public void SetSettings(AppSettings settings, IEmailAlertService eMalertService) { _settings = settings; _eMalertService = eMalertService; CreateGrid(); FillWithSources(); View.WatchDogTimerEnabled = true; }
public StockObserver(INotificationService notificationService, IEmailAlertService emailAlertService) { if (notificationService == null) { throw new ArgumentNullException(nameof(notificationService)); } _emailAlertService = emailAlertService; notificationService.Register(this); }
public AlertSetupPresenter(IApplicationController controller, IAlertSetupView view, IEmailAlertService eMalertService) : base(controller, view) { // View localization View.ThisText = Locale.Instance.Get("AlertSetup/this"); View.EmailPageText = Locale.Instance.Get("AlertSetup/emailPageText"); View.EmLostCheckBoxText = Locale.Instance.Get("AlertSetup/emLostCheckBoxText"); View.EmRecoverCheckBoxText = Locale.Instance.Get("AlertSetup/emRecoverCheckBoxText"); View.EmToLabelText = Locale.Instance.Get("AlertSetup/emToLabelText"); View.EmFromLabelText = Locale.Instance.Get("AlertSetup/emFromLabelText"); View.EmServerGroupBoxText = Locale.Instance.Get("AlertSetup/emServerGroupBoxText"); View.EmNameLabelText = Locale.Instance.Get("AlertSetup/emNameLabelText"); View.EmPortLabelText = Locale.Instance.Get("AlertSetup/emPortLabelText"); View.EmTestLinkLabelText = Locale.Instance.Get("AlertSetup/emTestLinkLabelText"); View.EmUsernameLabelText = Locale.Instance.Get("AlertSetup/emUsernameLabelText"); View.EmPasswordLabelText = Locale.Instance.Get("AlertSetup/emPasswordLabelText"); View.OkButtonText = Locale.Instance.Get("AlertSetup/okButtonText"); View.CancelButtonText = Locale.Instance.Get("AlertSetup/cancelButtonText"); // View actions View.OkClick += OkClick; View.CancelClick += CancelClick; View.EmTestClick += TestClick; _eMalertService = eMalertService; }
public MainPresenter(IApplicationController controller, IMainView view, ISettingsService settingsService, IEmailAlertService eMalertService) : base(controller, view) { // View localization View.SourcesPageText = Locale.Instance.Get("Main/sourcesPage"); View.SettingsPageText = Locale.Instance.Get("Main/settingsPage"); View.AskAddSamplesText = Locale.Instance.Get("Main/AskAddSamples"); View.CreateGridCommonErrorText = Locale.Instance.Get("Main/CreateGridCommonError"); View.CreateGridNoLibErrorText = Locale.Instance.Get("Main/CreateGridNoLibError"); View.CreateGridBadVerErrorText = Locale.Instance.Get("Main/CreateGridBadVerError"); View.CreateGridEndErrorText = Locale.Instance.Get("Main/CreateGridEndError"); View.SettingsSaveErrorText = Locale.Instance.Get("Main/SettingsSaveError"); View.SettingsLoadErrorText = Locale.Instance.Get("Main/SettingsLoadError"); View.SettingsAccesErrorText = Locale.Instance.Get("Main/SettingsAccesError"); View.HintOpenCtrlText = Locale.Instance.Get("Main/hintOpenCtrl"); View.HintAddCameraText = Locale.Instance.Get("Main/hintAddCamera"); View.HintDropCameraText = Locale.Instance.Get("Main/hintDropCamera"); View.HintRTSP1Text = Locale.Instance.Get("Main/hintRTSP1"); View.HintRTSP2Text = Locale.Instance.Get("Main/hintRTSP2"); View.FullScreenMenuItemText = Locale.Instance.Get("Main/fullScreenMenuItem"); View.ExitFullScreenMenuItemText = Locale.Instance.Get("Main/exitFullScreenMenuItem"); // View actions View.OpenClosePanelClick += OpenClosePanelClick; View.SourcesPageSelected += SourcesPageSelected; View.SettingsPageSelected += SettingsPageSelected; View.SplitterMoved += SplitterMoved; // Settings _settingsService = settingsService; try { _appSettings = settingsService.GetSettings(); } catch (UnauthorizedAccessException e) { View.ErrorAccessSettings(e.Message); } catch (Exception e) { View.ErrorOnLoadSettings(e.Message); } if (_appSettings == null) { _appSettings = settingsService.GetSettings(); } if (_appSettings.cams.Length == 0) { if (View.AskIfAddSamples()) { settingsService.AddSampleCameras(); } } View.CtrlPanelWidth = _appSettings.controlPanelWidth; // Alerts _eMalertService = eMalertService; _eMalertService.SetSettings(_appSettings.alert); // Sources grid try { CreateGrid(); } catch (System.IO.FileNotFoundException e) { View.ErrorOnCreateGridNoLib(e.Message); } //no VLC or ActiveX lib catch (System.NotSupportedException e) { View.ErrorOnCreateGridBadVer(e.Message); } //bad VLC version catch (System.InvalidCastException e) { View.ErrorOnCreateGridBadVer(e.Message); } //bad VLC version catch (Exception e) { View.ErrorOnCreateGridOther(e.Message); } foreach (Camera m in _appSettings.cams) { m.Edit += () => EditSrcClick(m); } // Process command line arguments ProcessCommandLine(Environment.GetCommandLineArgs()); // Prepare hints engine _appSettings.hint.onShow += ShowHintWithWait; _appSettings.hint.onHide += HideHint; View.HideHintTimer += () => _appSettings.hint.Hide(); View.ShowHintTimer += ShowHint; // Hint if empty grid and control is not shown if (!View.PanelState) { bool camPosFound = false; foreach (Camera c in _appSettings.cams) { if (c.position >= 0) { camPosFound = true; } } if (!camPosFound) { _appSettings.hint.Show(HintType.OpenCtrl); } } }