private void _taskTrayMenu_OnObserveStateChanged(object sender, TaskTrayMenu.ObserveStateChangedEventArgs e) { AppSettingData.GetInstance().Observered = e.Observerd; AppSettingData.GetInstance().Save(); if (e.Observerd) { KeymappingHandler.Start(); } else { KeymappingHandler.Stop(); } }
/// <summary> /// application startup event /// </summary> /// <param name="e"></param> protected override void OnStartup(StartupEventArgs e) { base.OnStartup(e); ShutdownMode = ShutdownMode.OnExplicitShutdown; _taskTrayMenu = new TaskTrayMenu(AppSettingData.GetInstance().ClickCount); _taskTrayMenu.SetObserveChecked(AppSettingData.GetInstance().Observered); _taskTrayMenu.OnObserveStateChanged += _taskTrayMenu_OnObserveStateChanged; _taskTrayMenu.OnClickCountChanged += _taskTrayMenu_OnClickCountChanged; _taskTrayMenu.OnExitClicked += _taskTrayMenu_OnExitClicked; KeymappingHandler.SetUp(); KeymappingHandler.ClickCount = AppSettingData.GetInstance().ClickCount; if (AppSettingData.GetInstance().Observered) { KeymappingHandler.Start(); } }