/// <summary> /// get instance /// </summary> /// <returns>instance</returns> public static AppSettingData GetInstance() { if (null == _settingData) { _settingData = (AppSettingData)LoadFromXml(_settingFile, typeof(AppSettingData)); if (null == _settingData) { _settingData = new AppSettingData(); _settingData.Observered = false; _settingData.ClickCount = 10; } } return(_settingData); }
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(); } }
private void _taskTrayMenu_OnClickCountChanged(object sender, TaskTrayMenu.ClickCountChangedEventArgs e) { AppSettingData.GetInstance().ClickCount = e.ClickCount; AppSettingData.GetInstance().Save(); KeymappingHandler.ClickCount = e.ClickCount; }