sc 2 years ago
parent
commit
7ff192068a
  1. 49
      App.xaml.cs
  2. 3
      Windows/Sql.xaml
  3. 10
      Windows/Sql.xaml.cs

49
App.xaml.cs

@ -13,5 +13,54 @@ namespace formula_manage
/// </summary> /// </summary>
public partial class App : Application public partial class App : Application
{ {
public App()
{
this.Startup += new StartupEventHandler(App_Startup);
this.DispatcherUnhandledException += new System.Windows.Threading.DispatcherUnhandledExceptionEventHandler(App_DispatcherUnhandledException);
}
System.Threading.Mutex mutex;
void App_Startup(object sender, StartupEventArgs e) //程序只允许启动一次
{
bool ret;
mutex = new System.Threading.Mutex(true, "ElectronicNeedleTherapySystem", out ret);
if (!ret)
{
MessageBox.Show("SUNLIGHT:单据管理已启动");
Environment.Exit(0);
}
}
protected override void OnStartup(StartupEventArgs e) //跟踪报错信息
{
base.OnStartup(e);
//UI线程的异常捕捉
this.DispatcherUnhandledException += App_DispatcherUnhandledException;
}
private void App_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
{
e.Handled = true;
if (e.Exception.InnerException == null)
{
MessageBox.Show("发生了一个无法处理的错误!请联系SUNLIGHT处理!" + Environment.NewLine
// + "(2)错误源:" + e.Exception.Source + Environment.NewLine
+ "详细信息:" + e.Exception.Message + Environment.NewLine
// + "(4)报错区域:" + e.Exception.StackTrace
);
}
else
{
MessageBox.Show("发生了一个无法处理的错误!请联系SUNLIGHT处理!" + Environment.NewLine
// + "(2)错误源:" + e.Exception.InnerException.Source + Environment.NewLine
+ "错误信息:" + e.Exception.Message + Environment.NewLine
// + "(4)详细信息:" + e.Exception.InnerException.Message + Environment.NewLine
// + "(5)报错区域:" + e.Exception.InnerException.StackTrace
);
}
}
} }
} }

3
Windows/Sql.xaml

@ -24,6 +24,7 @@
<ComboBoxItem Content="Windows 身份认证"></ComboBoxItem> <ComboBoxItem Content="Windows 身份认证"></ComboBoxItem>
<ComboBoxItem Content="SQL SERVER 身份认证"></ComboBoxItem> <ComboBoxItem Content="SQL SERVER 身份认证"></ComboBoxItem>
</ComboBox> </ComboBox>
<Button Content="保存" HorizontalAlignment="Center" Height="34" Margin="0,362,0,0" VerticalAlignment="Top" Width="81" BorderBrush="White"/> <Button Content="保存" HorizontalAlignment="Right" Height="24" Margin="0,362,20,0" VerticalAlignment="Top" Width="80" BorderBrush="White" Click="Button_Click"/>
<Button Content="测试" HorizontalAlignment="Left" Height="24" Margin="20,362,0,0" VerticalAlignment="Top" Width="80" BorderBrush="White" Click="Button_Click_1"/>
</Grid> </Grid>
</Window> </Window>

10
Windows/Sql.xaml.cs

@ -30,5 +30,15 @@ namespace formula_manage.Windows
{ {
} }
private void Button_Click(object sender, RoutedEventArgs e)
{
}
private void Button_Click_1(object sender, RoutedEventArgs e)
{
}
} }
} }

Loading…
Cancel
Save