void ReleaseDesignerOutlets() { if (BtnPlayPause != null) { BtnPlayPause.Dispose(); BtnPlayPause = null; } if (BtnStop != null) { BtnStop.Dispose(); BtnStop = null; } if (PlayerView != null) { PlayerView.Dispose(); PlayerView = null; } if (TblVideos != null) { TblVideos.Dispose(); TblVideos = null; } }
public FrmInitial() { InitializeComponent(); ReadInfo(); notBusy = true; BtnStop.Hide(); BtnStart.Show(); }
public void BtnStopPerformClick() //enable Button Stop event form other thread { if (BtnStop != null) { if (InvokeRequired) { this.Invoke(new Action(BtnStopPerformClick), new object[] { }); return; } BtnStop.PerformClick(); } Application.DoEvents(); }
private void Timer_Tick(object sender, EventArgs e) { if (BtnStart.Background == Brushes.Red) { BtnStart.ClearValue(Button.BackgroundProperty); BtnStop.Background = Brushes.Green; } else { BtnStop.ClearValue(Button.BackgroundProperty); BtnStart.Background = Brushes.Red; } }
private async void BtnStop_Click(object sender, EventArgs e) { notBusy = false; BtnStart.Show(); BtnStop.Hide(); await PutTaskDelay(); dynamic doc = webBrowser1.Document; dynamic button = doc.GetElementsByTagName("input"); foreach (dynamic element in button) { if (element.GetAttribute("type").Equals("submit")) { element.InvokeMember("click"); break; } } }
private void BtnStart_KeyPress(object sender, KeyPressEventArgs e) { BtnStop.BackColor = Color.Crimson; BtnStart.BackColor = Color.LightSteelBlue; //Start timer timer.SetTime(00, 0); timer.Start(); NoOfSolves++; //NOTE: the timer class is for a count down timer that's changed for a counter timer.TimeChanged += () => labelTimer.Text = timer.TimeLeftMsStr; timer.StepMs = 33; //"DO YOUR BEST" signaling message labelDoYourBest.Text = "DO YOUR BEST!"; //Set focus to the stop button BtnStop.Focus(); }
private void BtnStart_Click(object sender, EventArgs e) { BtnStart.Enabled = false; BtnStop.Enabled = true; PanelUrl.Enabled = false; PanelWord.Enabled = false; PanelThread.Enabled = false; PanelDepth.Enabled = false; textBoxTimer.IsAccessible = true; textBoxMessageOut.Clear(); string _searchingUrl = textBoxUrl.Text; string _searchingWord = textBoxWord.Text; Int32.TryParse(comboBoxUrlDepth.SelectedItem.ToString(), out int _depthOfLinkDisplay); Int32.TryParse(comboBoxThreadCount.SelectedItem.ToString(), out int _treadCount); if (!_timerRunning) { _startTime = DateTime.Now; _totalElapsedTime = _currentElapsedTime; timer1.Start(); _timerRunning = true; } if (!ConnectionChecker.IsConnectedToInternet()) //check internet connection { textBoxMessageOut.AppendText(Resource.NoInternetConnectionMessage); BtnStop.PerformClick(); } try { Validator validator = new Validator(); if (!validator.ValidateUrl(_searchingUrl)) { textBoxMessageOut.AppendText(Resource.InvalidURLMessage); BtnStopPerformClick(); } else if (!validator.ValidateSearchWord(_searchingWord)) { textBoxMessageOut.AppendText(Resource.InvalidSearchWordMessage); BtnStopPerformClick(); } else { ThreadCreator tc = new ThreadCreator(_logger, _treadCount, _depthOfLinkDisplay, _searchingWord, _searchingUrl); tc.StartMultithreading(); Thread th1 = new Thread(() => //checks while working threads are Alive { while (ThreadCreator.ThreadList.Any(t => t.IsAlive)) { Thread.Sleep(1000); } LogScanningAccomplished(); }); th1.Start(); } } catch (Exception ex) { textBoxMessageOut.AppendText(ex.Message); BtnStopPerformClick(); } }
private async void BtnStart_Click(object sender, EventArgs e) { BtnStart.Hide(); BtnStop.Show(); if (!notBusy) { notBusy = true; } if (notBusy) { webBrowser1.Document.GetElementById("username").SetAttribute("value", usernameAndPassword[0]); webBrowser1.Document.GetElementById("password").SetAttribute("value", usernameAndPassword[1]); dynamic doc = webBrowser1.Document; dynamic button = doc.GetElementsByTagName("button"); foreach (dynamic element in button) { if (element.GetAttribute("type").Equals("submit")) { element.InvokeMember("click"); break; } } } await Task.Delay(5000); int count = 0; for (int j = 0; j < 8; j++) { if (!moodleLinks[j].Equals("")) { count++; } else { break; } } while (notBusy) { for (int i = 0; i < count; i++) { if (notBusy) { this.webBrowser1.Navigate(moodleLinks[i]); } else { this.webBrowser1.Navigate("https://learn.mandela.ac.za/login/index.php"); break; } if (notBusy) { await PutTaskDelay(); } else { this.webBrowser1.Navigate("https://learn.mandela.ac.za/login/index.php"); break; } } } }