private void InitializeTimer() { //timer = new DispatcherTimer(); _timer = new BackgroundTimer { Interval = TimeSpan.FromSeconds(1.00) }; _timer.Tick += OneSecondPassed; DataContext = new { Dashboard = 0 }; }
private void BackgroundTimer_Tick(object sender, EventArgs e) { //Always read the RFID Tag if not calling the Main Menu if (!IsCallingMainMenu) { BackgroundTimer.Stop(); VerifyAssetProc(); LoopVerification(); } }
public MessagePageViewModel(long uid, string screenName) { UserName = screenName; _uid = uid.ToString(); _timer = new BackgroundTimer() { Interval = TimeSpan.FromSeconds(10) }; _timer.Tick += Timer_Tick; _timer.Start(); #pragma warning disable CS4014 // 由于此调用不会等待,因此在调用完成前将继续执行当前方法 Refresh(); #pragma warning restore CS4014 // 由于此调用不会等待,因此在调用完成前将继续执行当前方法 }
public Main2() { InitializeComponent(); TranslateUI(); aTabControl.MouseClick += new MouseEventHandler(TabControl_MouseClick); aTabControl.DoubleClick += new EventHandler(TabControl_MouseDoubleClick); ribbon1.Resize += new EventHandler(Ribbon_Resize); ribbon1.MouseDown += new MouseEventHandler(OnMouseDown); // Helper.Instance.SetMainWindow(this); this.WindowState = FormWindowState.Maximized; this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.Main2_FormClosing); BackgroundTimer.Start(); }
public BackgroundTimerTestPage() { this.InitializeComponent(); _bt = new BackgroundTimer { Interval = TimeSpan.FromSeconds(.1), AdjustDelays = false }; _bt.Tick += _bt_Tick; _abt = new BackgroundTimer { Interval = TimeSpan.FromSeconds(.1) }; _abt.Tick += _abt_Tick; _dt = new DispatcherTimer { Interval = TimeSpan.FromSeconds(.1) }; _dt.Tick += _dt_Tick; }
private void LoopVerification() { //while (IsPortError == false) //{ // //btnVerifyAsset.PerformClick(); // VerifyAssetProc(); //} if (!IsCallingMainMenu) { //RFID Reader Loop //if (IsPortError == false) //{ BackgroundTimer.Stop(); BackgroundTimer.Start(); //} //else //(IsPortError) //{ // CallMainMenu(); //} } }
internal void Initialization() { if (Settings.NotifyDuration != NotifyDuration.Never) { var time = 1; switch (Settings.NotifyDuration) { case NotifyDuration.ThreeMin: time = 3; break; case NotifyDuration.FiveMin: time = 5; break; case NotifyDuration.TenMin: time = 10; break; case NotifyDuration.HalfHour: time = 30; break; default: break; } if (_timer == null) { _timer = new BackgroundTimer() { Interval = TimeSpan.FromMinutes(time) }; _timer.Tick += Timer_Tick; _timer.Start(); } } InitHeader(); InitUser(); InitAllList(); }
public ConfigController(BackgroundTimer backgroundTimer) { this.backgroundTimer = backgroundTimer; }
public PrimeNumbersApp() { InitializeComponent(); this.ActiveControl = NumberText; this.KeyPreview = true; NumberText.Focus(); BackgroundTimer.Interval = 1500; this.BackColor = Color.FromArgb(255, 102, 102, 102); VerifyText.BackColor = Color.FromArgb(255, 102, 102, 102); VerifyText.Text = String.Empty; NumberText.MaxLength = 9; VerifyTextTick.Checked = false; VerifyText.Visible = false; NumberText.TextChanged += (sender, e) => //! { BackgroundTimer.Stop(); CharNumber = ((TextBox)sender).Text; int CharNumberIndex = 0; bool NonNumbersFound = false; int NonNumbersIndex = 0; while ((CharNumber.Length > CharNumberIndex) && (NonNumbersFound == false)) { if (!(CharNumber[CharNumberIndex] >= '0' && CharNumber[CharNumberIndex] <= '9')) { NonNumbersFound = true; NonNumbersIndex = CharNumberIndex; } CharNumberIndex++; } if (NonNumbersFound == true) { if (((TextBox)sender).Text.Length <= NonNumbersIndex) { NonNumbersFound = false; NonNumbersIndex = 0; } this.BackColor = Color.FromArgb(255, 255, 255, 102); VerifyText.BackColor = Color.FromArgb(255, 255, 255, 102); VerifyText.Text = PrimeStatus("WeirdExist"); } else { if (!String.IsNullOrEmpty(((TextBox)sender).Text)) { IntegerNumber = Convert.ToUInt32(CharNumber); NumberCheck = true; } this.BackColor = Color.FromArgb(255, 102, 102, 102); VerifyText.BackColor = Color.FromArgb(255, 102, 102, 102); VerifyText.Text = String.Empty; } }; //! VerifyButton.Click += (sender, e) => //! { if (String.IsNullOrEmpty(NumberText.Text)) { this.BackColor = Color.FromArgb(255, 102, 102, 255); VerifyText.BackColor = Color.FromArgb(255, 102, 102, 255); VerifyText.Text = PrimeStatus("Empty"); BackgroundTimer.Start(); } else { if (NumberCheck == true) { if (IntegerNumber <= 1) { this.BackColor = Color.FromArgb(255, 255, 102, 102); VerifyText.BackColor = Color.FromArgb(255, 255, 102, 102); VerifyText.Text = PrimeStatus("False"); } else { VerifyText.Text = PrimeStatus(Convert.ToString(PrimeAlgorithm(IntegerNumber))); } BackgroundTimer.Start(); } } }; //! }
internal void CleanUp() { _timer.Stop(); _timer.Dispose(); _timer = null; }