private void decoderClient_MessageReceived_TETRACONTROL(MessageEventArgs e) { try { var _messageFields = e.Data.Split('\t'); if (_messageFields == null || _messageFields.Count() <= 0) { return; } switch (_messageFields[0]) { case "FMS": if (_messageFields.Count() != 3) { return; } fmsMessageReceived(_messageFields[1], _messageFields[2]); break; } } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } }
public void Stop() { try { Logger.WriteDebug(MethodBase.GetCurrentMethod(), "Stopping"); var stopWatch = new Stopwatch(); stopWatch.Start(); unregisterEvents(); stopRecording(); _einsatz = null; //Stop all running timer without elapsed event _timerStatusEnd?.Stop(); _timerAlarmEnd?.Stop(); _timerRecordEnd?.Stop(); stopWatch.Stop(); Logger.WriteDebug(MethodBase.GetCurrentMethod(), $"Stopped -> {stopWatch.Elapsed}"); } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } finally { IsRunning = false; } }
public void Stop() { try { Logger.WriteDebug(MethodBase.GetCurrentMethod(), "Stopping"); var stopWatch = new Stopwatch(); stopWatch.Start(); unregisterEvents(); stopWatch.Stop(); Logger.WriteDebug(MethodBase.GetCurrentMethod(), $"Stopped -> {stopWatch.Elapsed}"); } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } finally { IsRunning = false; } }
public void Start() { try { Logger.WriteDebug(MethodBase.GetCurrentMethod(), "Starting"); var _stopWatch = new Stopwatch(); _stopWatch.Start(); IsRunning = false; _oldPosition = Cursor.Position; _refreshTimer.Start(); IsRunning = true; _stopWatch.Stop(); Logger.WriteDebug(MethodBase.GetCurrentMethod(), $"Started -> {_stopWatch.Elapsed}"); } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } }
private void decoderService_PagerMessageReceived(object sender, PagerMessageEventArgs e) { if (e == null || _recordState == RecordState.RequestedStop) { return; } try { Logger.WriteDebug(MethodBase.GetCurrentMethod(), $"Pager-Message({e.Identifier})"); if (_einsatz == null) { _einsatz = new Einsatz(App.Path_Record); Logger.WriteDebug(MethodBase.GetCurrentMethod(), "Create new einsatz"); startRecording(); } _einsatz.AddPager(e); timerAlarmEnd_Reset(); } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } }
private void stopRecording() { try { Logger.WriteDebug(MethodBase.GetCurrentMethod(), "recordDevice -> StopRecording"); if (_recordWaveStream != null) { _recordState = RecordState.RequestedStop; _recordWaveStream.StopRecording(); } else { Logger.WriteDebug(MethodBase.GetCurrentMethod(), "recordDevice -> already disposed"); recordDevice_RecordingStopped(this, null); } } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); recordDevice_RecordingStopped(this, null); } }
public void Start() { try { IsRunning = false; Logger.WriteDebug(MethodBase.GetCurrentMethod(), "Starting"); var _stopWatch = new Stopwatch(); _stopWatch.Start(); StartReceiveMail(); registerEvents(); IsRunning = true; _stopWatch.Stop(); Logger.WriteDebug(MethodBase.GetCurrentMethod(), $"Started -> {_stopWatch.Elapsed}"); } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } }
public void Start() { try { Logger.WriteDebug(MethodBase.GetCurrentMethod(), "Starting"); var stopWatch = new Stopwatch(); stopWatch.Start(); IsRunning = false; _apiService = null; if (string.IsNullOrEmpty(Settings.Default.Alarmapp_ApiToken)) { Logger.WriteDebug(MethodBase.GetCurrentMethod(), "AuthToken not set"); return; } _apiService = new AlarmappApiService(Settings.Default.Alarmapp_ApiToken); timerAlarmEnd_Elapsed(this, null); // reset pagerlist & alarmId registerEvents(); IsRunning = true; stopWatch.Stop(); Logger.WriteDebug(MethodBase.GetCurrentMethod(), $"Started -> {stopWatch.Elapsed}"); } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } }
private void startRecording() { try { if (_einsatz == null) { return; } //Record Device _recordWaveStream = new WaveInEvent { DeviceNumber = 0, WaveFormat = new WaveFormat(44100, 16, 2) }; _recordWaveStream.DataAvailable += recordDevice_DataAvailable; _recordWaveStream.RecordingStopped += recordDevice_RecordingStopped; _recordWaveStream.StartRecording(); _recordMp3Writer = new LameMP3FileWriter(_einsatz.RecordPath, _recordWaveStream.WaveFormat, 32); _recordState = RecordState.Recording; Logger.WriteDebug(MethodBase.GetCurrentMethod(), $"recordDevice -> Started({_einsatz.RecordPath})"); } catch (Exception) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Message = "recordDevice -> error on start" }); } }
private void rebootTimer_Elapsed(object sender, ElapsedEventArgs e) { try { //Try to restart if (_monitorService.IsAlarmWindow() == false) { Logger.WriteDebug(MethodBase.GetCurrentMethod(), "Try to reboot system"); RebootSystem(); } else { Logger.WriteDebug(MethodBase.GetCurrentMethod(), "Reboot not possible -> alarmwindow open"); //Restart timer _rebootTimer.Interval = MsUntilMidnight(); _rebootTimer.Start(); Logger.WriteDebug(MethodBase.GetCurrentMethod(), string.Format("Time until reboot: " + TimeSpan.FromMilliseconds(_rebootTimer.Interval) .ToString(@"hh\:mm\:ss", null))); } } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } }
private void decoderClient_MessageReceived_OPERATOR2(MessageEventArgs e) { try { var _messageFields = e.Data.Split(';'); if (_messageFields == null || _messageFields.Count() <= 0) { return; } switch (_messageFields[0]) { case "!FMS": //!FMS;6703xxx;HEFW.xx#xx219MTW......1.;32772;02.08.2014 17:15:29 if (_messageFields.Count() != 5) { return; } fmsMessageReceived(_messageFields[1], convertTetraStatusToFms(_messageFields[3])); break; case "!SDS": //!SDS;6703xxx;HEFW.xx#xx219MTW......1.;S;Test;02.08.2014 17:15:29 if (_messageFields.Count() != 6) { } break; case "!ZVEI": //!ZVEI;20815;02.08.2014 17:15:29 if (_messageFields.Count() != 3) { return; } pagerMessageReceived(_messageFields[1], null); break; case "!POCSAG": //!POCSAG;1234567;1;Brand Wohnhaus;02.08.2014 17:15:29 if (_messageFields.Count() != 5) { return; } pagerMessageReceived(_messageFields[1] + _messageFields[2], _messageFields[3]); break; } } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } }
public void Stop() { try { Logger.WriteDebug(MethodBase.GetCurrentMethod(), "Stopping"); var _stopWatch = new Stopwatch(); _stopWatch.Start(); unregisterEvents(); _receiveMailTaskMonitorTimer?.Stop(); _receiveMailTaskTokenSource?.Cancel(); _stopWatch.Stop(); Logger.WriteDebug(MethodBase.GetCurrentMethod(), $"Stopped -> {_stopWatch.Elapsed}"); } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } finally { IsRunning = false; } }
private void decoderService_PagerMessageReceived(object sender, PagerMessageEventArgs e) { if (e == null || e.Pager == null) { return; } if (_apiService == null) { return; } Task.Factory.StartNew(() => { try { Logger.WriteDebug(MethodBase.GetCurrentMethod(), $"Pager-Message({e.Identifier})"); } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } }); }
private void faxService_EinsatzCreated(object sender, EinsatzCreatedEventArgs e) { if (e == null || e.Einsatz == null) { return; } if (_apiService == null) { return; } Task.Factory.StartNew(() => { try { Logger.WriteDebug(MethodBase.GetCurrentMethod(), "Fax-Message"); _apiService.CreateAlarm(e.Einsatz); } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } }); }
public void Start() { try { Logger.WriteDebug(MethodBase.GetCurrentMethod(), "Starting"); var stopWatch = new Stopwatch(); stopWatch.Start(); IsRunning = false; if (_business.GetAmsOverview().Count == 0) { Logger.WriteError(MethodBase.GetCurrentMethod(), "No AMS configurated"); return; } registerEvents(); IsRunning = true; stopWatch.Stop(); Logger.WriteDebug(MethodBase.GetCurrentMethod(), $"Started -> {stopWatch.Elapsed}"); } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } }
private void client_DownloadDataCompleted(object sender, DownloadStringCompletedEventArgs e) { try { if (e.Error != null) { Logger.WriteError(MethodBase.GetCurrentMethod(), e.Error.Message); return; } switch (Settings.Default.Riverlevel_Mode) { case RiverlevelMode.HndBayern: parseHndBayern(e.Result); break; } } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } }
public void Start() { try { if (string.IsNullOrEmpty(Settings.Default.Riverlevel_Messstelle)) { Logger.WriteDebug(MethodBase.GetCurrentMethod(), "Riverlevel disabled in settings"); return; } Logger.WriteDebug(MethodBase.GetCurrentMethod(), "Starting"); var _stopWatch = new Stopwatch(); _stopWatch.Start(); IsRunning = false; //Query first time updateTimer_Elapsed(this, null); IsRunning = true; _stopWatch.Stop(); Logger.WriteDebug(MethodBase.GetCurrentMethod(), $"Started -> {_stopWatch.Elapsed}"); } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } }
private void recordDevice_RecordingStopped(object sender, StoppedEventArgs e) { try { Logger.WriteDebug(MethodBase.GetCurrentMethod(), "recordDevice -> Stopped"); if (_einsatz != null) { //Raise Event EinsatzFinished.RaiseEvent(this, new EinsatzFinishedEventArgs(_einsatz)); //Reset Einsatz _einsatz = null; Logger.WriteDebug(MethodBase.GetCurrentMethod(), "Reset einsatz -> finish"); } _recordMp3Writer?.Dispose(); _recordWaveStream?.Dispose(); } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } finally { _recordState = RecordState.Stopped; _recordWaveStream = null; _recordMp3Writer = null; } }
private void updateTimer_Elapsed(object source, ElapsedEventArgs e) { try { var _imageUrl = Settings.Default.Warnweather_Url; if (!_imageUrl.Contains("WIDTH") && !_imageUrl.Contains("HEIGHT")) { _imageUrl += $"&WIDTH={Settings.Default.Warnweather_ImageSize.X}"; _imageUrl += $"&HEIGHT={Settings.Default.Warnweather_ImageSize.Y}"; } ServicePointManager.ServerCertificateValidationCallback = delegate { return(true); }; ServicePointManager.SecurityProtocol = SecurityProtocolType.Ssl3 | SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12; using (var _client = new WebClient()) { _client.DownloadDataCompleted += client_DownloadImageCompleted; _client.DownloadDataAsync(new Uri(_imageUrl)); } } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } finally { //Restart timer _updateTimer.Start(); } }
public void AddAlarmWindow(AlarmWindow _alarmWindow) { try { _alarmWindows.Add(_alarmWindow); } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } }
public string Geocode(string _address) { try { return(clientGeocode(_address).ToString()); } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); return(null); } }
public void Start() { try { Logger.WriteDebug(MethodBase.GetCurrentMethod(), "Starting"); var _stopWatch = new Stopwatch(); _stopWatch.Start(); IsRunning = false; //Load monitor weekplan _monitorSettings = Serializer.Deserialize <SettingsMonitor>(Settings.Default.Monitor_Weekplan); _alarmWindows = new List <AlarmWindow>(); _timeFmsElapsed = null; _timePagerElapsed = null; _timeWindowElapsed = null; _timeMouseElapsed = DateTime.Now.Add(new TimeSpan(0, 1, 0)); //Initialize Screen and Screensaver Screen.SwitchOn(); Screensaver.Enable(); //Timer to check _monitorTimer = new Timer { Interval = 1000, AutoReset = false, Enabled = true }; _monitorTimer.Elapsed += monitorTimer_Elapsed; _monitorTimer.Start(); registerEvents(); IsRunning = true; _stopWatch.Stop(); Logger.WriteDebug(MethodBase.GetCurrentMethod(), $"Started -> {_stopWatch.Elapsed}"); } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } }
public void Stop() { try { Logger.WriteDebug(MethodBase.GetCurrentMethod(), "Stopping"); var _stopWatch = new Stopwatch(); _stopWatch.Start(); unregisterEvents(); //Close all open alarmWindows foreach (var _alarmWindow in _alarmWindows) { DispatcherHelper.CheckBeginInvokeOnUI(() => { _alarmWindow.Close(); }); } _alarmWindows.Clear(); //Disable timer for Monitor on/off if (_monitorTimer != null) { _monitorTimer.Stop(); _monitorTimer = null; } //Switch Monitor on, Screen.SwitchOn(); Screensaver.Enable(); _stopWatch.Stop(); Logger.WriteDebug(MethodBase.GetCurrentMethod(), $"Stopped -> {_stopWatch.Elapsed}"); } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } finally { IsRunning = false; } }
public void Stop() { try { Logger.WriteDebug(MethodBase.GetCurrentMethod(), "Stopping"); var _stopWatch = new Stopwatch(); _stopWatch.Start(); //Stop decoderClient1 if enabled if (_decoderClient1 != null) { _decoderClient1.Stop(); _decoderClient1 = null; } //Stop decoderClient2 if enabled if (_decoderClient2 != null) { _decoderClient2.Stop(); _decoderClient2 = null; } //Stop delayTimer if enabled if (_delayTimer != null) { _delayTimer.Stop(); _delayTimer = null; } _stopWatch.Stop(); Logger.WriteDebug(MethodBase.GetCurrentMethod(), $"Stopped -> {_stopWatch.Elapsed}"); } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } finally { IsRunning = false; } }
public bool ClearAlarmgroups() { try { _business.DeleteAlarmappAll(); Logger.WriteDebug(MethodBase.GetCurrentMethod(), "Clear -> OK"); return(true); } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); return(false); } }
private void RebootSystem() { try { Logger.WriteDebug(MethodBase.GetCurrentMethod(), "Shutdown!"); Process.Start("shutdown.exe", "/r /f /t 5"); Application.Current.Shutdown(); } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } }
public void Start() { try { Logger.WriteDebug(MethodBase.GetCurrentMethod(), "Starting"); var stopWatch = new Stopwatch(); stopWatch.Start(); IsRunning = false; _apiService = null; if (!string.IsNullOrEmpty(Settings.Default.Fireboard_AuthKey)) { _apiService = new FireboardApiService(Settings.Default.Fireboard_AuthKey); if (!_apiService.IsAuthTokenValid()) { Logger.WriteDebug(MethodBase.GetCurrentMethod(), "AuthKey -> invalid"); MessageBox.Show( "Es ist ein Fehler bei der Verbindung zur Fireboard-API aufgetreten, bitte Überprüfen Sie Ihre Zugangsdaten!", MessageBoxButton.OK, MessageBoxImage.Error); } else { Logger.WriteDebug(MethodBase.GetCurrentMethod(), "AuthKey -> valid"); registerEvents(); } } IsRunning = true; stopWatch.Stop(); Logger.WriteDebug(MethodBase.GetCurrentMethod(), $"Started -> {stopWatch.Elapsed}"); } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } }
private void recordDevice_DataAvailable(object sender, WaveInEventArgs e) { try { if (_recordWaveStream == null || _recordMp3Writer == null) { return; } _recordMp3Writer.Write(e.Buffer, 0, e.BytesRecorded); } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } }
public void RemoveAlarmWindow(AlarmWindow _alarmWindow) { try { _alarmWindows.Remove(_alarmWindow); //Check if all alarmWindows closed to add delay time if (_alarmWindows.Count == 0 && Settings.Default.Monitor_AlarmDelayTime.TotalSeconds > 0) { _timeWindowElapsed = DateTime.Now.Add(Settings.Default.Monitor_AlarmDelayTime); } } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); } }
public bool IsAlarmWindow() { try { if (_alarmWindows == null) { return(false); } return(_alarmWindows.Count > 0); } catch (Exception ex) { ExceptionOccured.RaiseEvent(this, new ExceptionEventArgs { Methode = MethodBase.GetCurrentMethod(), Error = ex }); return(false); } }