public Monitor() { try { InitializeComponent(); Factory objFactory = new Factory(); _exceptionHandler = objFactory.GetExceptionHandler(); _saveData = objFactory.GetSaveData(); _dataStore = objFactory.GetDataStore(); _materialSkinManager = MaterialSkinManager.Instance; _materialSkinManager.AddFormToManage(this); _materialSkinManager.Theme = MaterialSkinManager.Themes.LIGHT; _csLight = _materialSkinManager.ColorScheme; _csDark = new ColorScheme(Primary.BlueGrey800, Primary.BlueGrey900, Primary.BlueGrey500, Accent.LightBlue200, TextShade.WHITE); notifyIcon.ContextMenuStrip = cmMenu; _objfgHook = new FGHook(_dataStore); _dataStore.PropertyChanged += _objDataStore_PropertyChanged; _3SecTimer.Interval = 3000; _3SecTimer.AutoReset = false; _3SecTimer.Elapsed += ClearMessageTimer_Elapsed; AppStatus = Constants.Running; } catch (Exception ex) { DisposeHook(); _exceptionHandler.HandleException(ex); } }
private void DisposeHook() { if (_objfgHook != null) { _objfgHook.Dispose(); _objfgHook = null; } AppStatus = Constants.Stopped; }
private void StartMonitoring() { try { _trackingStartedOn = DateTime.Now; if (AppStatus != Constants.Running) { AppStatus = Constants.Running; _objfgHook = new FGHook(_dataStore); } } catch (Exception ex) { DisposeHook(); _exceptionHandler.HandleException(ex); } }