internal void Start() { if (!Settings.UserSettings.Keys.Contains(_enableClientLogFileMonitoringConfigName)) { return; } var enabled = Convert.ToBoolean(Settings.UserSettings[_enableClientLogFileMonitoringConfigName]); if (!enabled) { return; } if (FileWatcher == null) { Initialize(); } FileWatcher.EnableRaisingEvents = true; if (!PollingTimer.Enabled) { PollingTimer.Start(); } }
protected bool StartArchiving() { try { periods = getArchivePeriods(); if (periods != null) { archiveTimers = new List <PollingTimer>(); foreach (ArchivePeriod period in periods) { PollingTimer timer = new PollingTimer(); timer.PeriodID = period.ID; timer.Interval = period.Period * 1000; timer.AutoReset = true; timer.Enabled = true; timer.Elapsed += timer_Archive; timer.Start(); archiveTimers.Add(timer); } } return(true); } catch (Exception ex) { Log.Instance.Error("{0}: Archiving sürücü hatası. Sürücü başlatılamıyor => {1}", this.GetType().Name, ex.Message); return(false); } }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var mainForm = new MainForm(); LineReceived += Program_LineReceived; SerialPort.DataReceived += SerialPort_DataReceived; SerialPort.Open(); TGitWndStatusChanged += Program_TGitWndStatusChanged; PollingTimer.Elapsed += PollingTimer_Elapsed; PollingTimer.Start(); Application.Run(mainForm); TGitWndStatusChanged -= Program_TGitWndStatusChanged; PollingTimer.Elapsed -= PollingTimer_Elapsed; PollingTimer.Dispose(); SerialPort.DataReceived -= SerialPort_DataReceived; LineReceived -= Program_LineReceived; SerialPort.Dispose(); SoundPlayer.Dispose(); PollingTimer.Dispose(); }
public MainPage () { //PUT UI CODE HERE Content = layout; //Instantiate Polling timer to call handleaction every 5 seconds timer = new PollingTimer(TimeSpan.FromSeconds(5), HandleAction); }
internal void Stop() { if (FileWatcher != null) { FileWatcher.EnableRaisingEvents = false; } PollingTimer.Stop(); }
private void InitializePollingTimer() { pollingTimer = new PollingTimer(pollingTime); pollingTimer.hostAddress = ipAddress; pollingTimer.Elapsed += PollingTimer_Elapsed; pollingTimer.AutoReset = true; pollingTimer.Enabled = true; pollingTimer.Start(); }
private void OnFormClosingEvent(Object sender, FormClosingEventArgs e) { PollingTimer?.Stop(); if (Iow != null) { Iow.I2C.WriteBytes(BH1750_ADDRESS, BH1750_RESET); Iow.I2C.WriteBytes(BH1750_ADDRESS, BH1750_POWER_DOWN); Iow.I2C.Disable(); } FastIOW.CloseConnection(); }