private void SystemParameters_StaticPropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == "WorkArea") { Tool.MoveWindowBackToWorkArea(mainWindow, mainWindow.windowPadding); } }
private void InitViewAndNeedCloseResourcees() { mainWindow = new MainWindow(); detailWindow = new DetailWindow(mainWindow); mainWindow.SetDetailWindow(detailWindow); detailWindow.IsVisibleChanged += DetailWindow_IsVisibleChanged; if (Settings.Default.MainWindowLeft > -200000 && Settings.Default.MainWindowTop > -200000) { mainWindow.Left = Settings.Default.MainWindowLeft; mainWindow.Top = Settings.Default.MainWindowTop; Dispatcher.InvokeAsync(new Action(() => { Tool.MoveWindowBackToWorkArea(mainWindow, mainWindow.windowPadding); mainWindow.isEdgeHide = true; mainWindow.TryToEdgeShow(); mainWindow.TryToEdgeHide(); })); } else { Dispatcher.InvokeAsync(new Action(() => { mainWindow.isEdgeHide = true; mainWindow.TryToEdgeShow(); mainWindow.TryToEdgeHide(); })); } InitializeTray(); mainWindow.Show(); CheckScreenCount(); Microsoft.Win32.SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged; SystemParameters.StaticPropertyChanged += SystemParameters_StaticPropertyChanged; timer.Elapsed += Timer_Elapsed; timer.Enabled = true; }
private void Window_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { if (oldLeft == Left && oldTop == Top) { if (DateTime.Now.Subtract(leftPressTime).TotalMilliseconds < 500) { TryToEdgeShow(); detailWindow.OthersWantShow(true); } } else { detailWindow.OthersWantShow(false); Tool.MoveWindowBackToWorkArea(this, windowPadding); } }
private void InitViewAndNeedClosedResourcees() { mainWindow = new MainWindow(); if (Settings.Default.MainWindowLeft > -200000 && Settings.Default.MainWindowTop > -200000) { mainWindow.Left = Settings.Default.MainWindowLeft; mainWindow.Top = Settings.Default.MainWindowTop; Dispatcher.InvokeAsync(new Action(() => { Tool.MoveWindowBackToWorkArea(mainWindow, mainWindow.windowPadding); mainWindow.isEdgeHide = true; mainWindow.TryToEdgeShow(); mainWindow.TryToEdgeHide(); })); } else { Dispatcher.InvokeAsync(new Action(() => { mainWindow.isEdgeHide = true; mainWindow.TryToEdgeShow(); mainWindow.TryToEdgeHide(); })); } InitializeTray(); mainWindow.Show(); CheckScreenCount(); Microsoft.Win32.SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged; SystemParameters.StaticPropertyChanged += SystemParameters_StaticPropertyChanged; timer.Elapsed += Timer_Elapsed; timer.Enabled = true; if (Settings.Default.AutoUpdate) { System.Timers.Timer myTimer = new System.Timers.Timer { AutoReset = false, Interval = 20000 }; myTimer.Elapsed += MyTimer_Elapsed_AutoCheckUpdate; myTimer.Enabled = true; } }