public BackWindow(Koala koala) { InitializeComponent(); this.koala = koala; this.DataContext = koala; this.Loaded += BackWindow_Loaded; }
public MainWindow(Koala koala) { InitializeComponent(); this.koala = koala; this.DataContext = koala; this.Loaded += MainWindow_Loaded; this.Left = 0; this.Top = 0; }
protected override void OnStartup(StartupEventArgs e) { var bnew = false; var appname = System.Windows.Forms.Application.ProductName; var mutex = new Mutex(true, appname, out bnew); if (bnew) { base.OnStartup(e); ConfigProfile.Current.ReadConfig(); var screens = System.Windows.Forms.Screen.AllScreens; koalaIn = new Koala(ConfigProfile.Current.WelcomeIn); koalaIn.OnRecognized += KoalaIn_OnRecognized; koalaIn.OnGone += KoalaIn_OnGone; Application.Current.MainWindow = new MainWindow(koalaIn); Application.Current.MainWindow.Show(); if (screens.Length >= 1) { koalaOut = new Koala(ConfigProfile.Current.WelcomeOut); koalaOut.OnRecognized += KoalaOut_OnRecognized; koalaOut.OnGone += KoalaOut_OnGone; var s2 = screens[0].WorkingArea; BackWindow back = new BackWindow(koalaOut); back.Left = 384; back.Top = 0; back.Show(); } mutex.WaitOne(); } else { CustomDialog.Show("系统已运行!"); Application.Current.Shutdown(); } }