private void ToggleRecord() { DateTime now = DateTime.UtcNow; record = !record; if (record) { currentRecordItem = new RecordItem(); StartRoundTime = now; StartTotalTime = now; lbTime.Text = "00:00:00.000"; MainTimer.Start(); testNumber.Enabled = false; btnStart.Text = "Stop Record"; btnStart.BackColor = Color.Red; record = true; btnEdit.Enabled = false; } else { currentRecordItem.End = GetTimeDuration(StartTotalTime, now); currentRecordItem.Duration = GetTimeDuration(currentRecordItem.Start, currentRecordItem.End); AddRecordItem(currentRecordItem); MainTimer.Stop(); testNumber.Enabled = true; btnStart.Text = "Start Record"; btnStart.BackColor = SystemColors.Control; record = false; btnEdit.Enabled = true; } }
public ModelsForm() { InitializeComponent(); crashServices[0] = new CrashService(); crashServices[1] = new CrashService(); typeof(Panel).InvokeMember("DoubleBuffered", BindingFlags.SetProperty | BindingFlags.Instance | BindingFlags.NonPublic, null, Panel1, new object[] { true }); typeof(Panel).InvokeMember("DoubleBuffered", BindingFlags.SetProperty | BindingFlags.Instance | BindingFlags.NonPublic, null, Panel2, new object[] { true }); typeof(Panel).InvokeMember("DoubleBuffered", BindingFlags.SetProperty | BindingFlags.Instance | BindingFlags.NonPublic, null, Panel3, new object[] { true }); typeof(Panel).InvokeMember("DoubleBuffered", BindingFlags.SetProperty | BindingFlags.Instance | BindingFlags.NonPublic, null, Panel4, new object[] { true }); MainTimer.Start(); }
// Catches click event private void ImageClick(object sender, EventArgs e) { int index = GetHoleIndex((PictureBox)sender); if (index != soosliqCurrentHole) // Player misses suslik { RequestGameOver(false); } else // Player catches suslik { score++; nowScore.Text = score.ToString(); timerInterval -= decrement; if (timerInterval < minInterval) { timerInterval = minInterval; } ChooseActiveHole(); MainTimer.Stop(); MainTimer.Interval = timerInterval; prevStartTime = DateTime.Now; MainTimer.Start(); timerToLoss.Stop(); timerToLoss.Start(); } }
private void StartFlow() { MainTimer.Interval = 60000 / wpm; MainTimer.Start(); PauseButton.Text = "Stop"; isRunning = true; }
/// <summary> /// Обработка выбора услуги /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BB_Click(object sender, EventArgs e) { Selection = $"{(sender as RoundButton).Tag}"; Controls.Clear(); RenewScreen(doc, 2); MainTimer.Start(); }
private void button1_Click(object sender, EventArgs e) { //serialPort1.PortName = if (RobertComPort_comboBox.SelectedItem != null) { RobertConnectItem.SerialPortName = RobertComPort_comboBox.SelectedItem.ToString(); if (RobertConnectItem.SerialPortName != null && RobertConnectItem.SerialPortName.Contains("COM")) { RobertConnectItem.SerialPortInit(); //textBox1.Text = RobertConnectItem.GetWriteAddress_M(0x1067); RobertConnectItem.TaskList.Add(7); RobertConnectItem.TaskList.Add(1); RobertConnectItem.TaskList.Add(2); RobertConnectItem.TaskList.Add(3); RobertConnectItem.TaskList.Add(4); RobertConnectItem.TaskList.Add(5); RobertConnectItem.TaskList.Add(6); RobertConnectItem.TaskList.Add(7); // RobertConnectItem.StartTaskServer(); } } else { MessageBox.Show("请选择串口号"); } #region 此处定义任务类型,1为泡咖啡任务,2为取咖啡任务,3为丢弃咖啡任务 #endregion if (TaskNow.CodeID != null) { step = 1; StopStep = 5; } /*else if (TaskNow.CodeID == "2") * { * if (step != 0) * { * oldstep = step; * } * step = 1; * StopStep = 5; * } * if (TaskNow.CodeID == "3") * { * step = 7; * StopStep = 7; * }*/ MainTimer.Interval = 1000; DB_CheckTimer.Interval = 1000; //if(timer1.is ) MainTimer.Start(); button1.BackColor = Color.Green; //timer2.Start(); //MessageBox.Show("开始"); }
private async void button1_Click(object sender, EventArgs e) { MainTimer.Start(); Log.Information("Turned on Timer"); OnTimedEvent(null, null); ToggleTimerActivationButtons(); }
private void Form1_Load(object sender, EventArgs e) { //Instantiate the race MainRace = new Race((int)nudSteps.Value, Speeds[speed], pbHare.Width, pbHare.Height); MainTimer.Interval = MainRace.GameSpeed; MainTimer.Start(); }
private void InitListener() { try { _serialPort = new SerialPort("COM3", BaudRate); _serialPort.Open(); _serialPort.DiscardInBuffer(); var serialReader = new AsyncSerialReader(_serialPort); FileStream logStream = new FileStream(LogFileName, FileMode.OpenOrCreate, FileAccess.Read); var logReader = new LogReader(null, logStream); _serialReader = new LoggedSerialReader(serialReader, logReader); //_serialReader = new FakeSerialReader(null); //_serialReader = new LogReader(null, _logStream); MainTimer.Start(); } catch (IOException ex) { PrintMessage(ex.Message, true); } }
// СТАРТ.Click private void btnStart_Click(object sender, EventArgs e) { if (IsRunning) { // если уже запущено - остановливаем StopTimer(); } else { // если не зпущено - запускаем //if (!proverka()) // return; DisableControlls(true); //VremyaOstalos = new TimeSpan((int)numHours.Value, (int)numMinutes.Value, (int)numSecond.Value); VremyaOstalos = new TimeSpan(dTPicker.Value.Hour, dTPicker.Value.Minute, dTPicker.Value.Second); VremSobitiya = DateTime.Now + VremyaOstalos; MainTimer.Start(); notifyIcon1.Visible = true; IconRed = true; IsRunning = true; //TimeStart.H = (byte)numHours.Value; //TimeStart.M = (byte)numMinutes.Value; //TimeStart.S = (byte)numSecond.Value; TimeStart.H = (byte)dTPicker.Value.Hour; TimeStart.M = (byte)dTPicker.Value.Minute; TimeStart.S = (byte)dTPicker.Value.Second; } }
private void offEthernetDownButton_Click(object sender, EventArgs e) { if (offEthernetDownButton.Text.Length == 0) { MessageBox.Show("Вы ничего не ввели в поле", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } else { MainTimer.Enabled = true; MainTimer.Start(); enableButton.Enabled = false; disableButton.Enabled = false; UpdateList.Enabled = false; exitButton.Enabled = false; onEthernetDownButton.Enabled = false; onEthernetDownTextBox.Enabled = false; offEthernetDownButton.Enabled = false; offEthernetDownTextBox.Enabled = false; for (int i = 0; i < count; i++) { Disable(offEthernetDownTextBox.Text); } } }
private void btnStart_Click(object sender, EventArgs e) { //Checks if Classic or challenger mode, and takes the responding array if (radioClassic.Checked) { stringArraySentence = new string[] { "Wenn_bei_Capri_die rote_Sonne_im Meer versinkt" }; } else { stringArraySentence = new string[] { "Wenn_bei_Capri_die rote_Sonne_im Meer versinkt", "bei_Wenn_die rote_Sonne_Capri_im Meer versinkt", "im Meer versinkt_Sonne_die rote_Capri_bei_Wenn", "Capri_bei_die rote_Wenn_im Meer versinkt_Sonne", "Wenn_im Meer versinkt_die rote_Capri_Sonne_bei", "Wenn_die rote_Capri_Sonne_im Meer versinkt_bei", "bei_Wenn_im Meer versinkt_Capri_die rote_Sonne", "bei_im Meer versinkt_Sonne_Capri_die rote_Wenn", "Wenn_bei_im Meer versinkt_die rote_Sonne_Capri" }; } //Giving the roaches the pictures picbRoachOne.Image = new Bitmap(@".\kakalakophon\kakalake1.bmp"); picbRoachTwo.Image = new Bitmap(@".\kakalakophon\kakalake2.bmp"); picbRoachThree.Image = new Bitmap(@".\kakalakophon\kakalake3.bmp"); picbRoachFour.Image = new Bitmap(@".\kakalakophon\kakalake4.bmp"); picbRoachFive.Image = new Bitmap(@".\kakalakophon\kakalake5.bmp"); picbRoachSix.Image = new Bitmap(@".\kakalakophon\kakalake6.bmp"); MainTimer.Start(); VoiceTimer.Start(); RoachPlacement(); foreach (PictureBox roaches in picbArray) { roaches.Visible = true; roaches.Enabled = true; } //taking care of buttons which should be visible / invisible for the game btnStart.Enabled = false; btnStart.Visible = false; panelRadio.Enabled = false; panelRadio.Visible = false; btnReplace.Enabled = true; btnReplace.Visible = true; //Generating random number to determine which sentence to use randomNumber = randomizer.Next(0, stringArraySentence.Length); //Choosing a sentence and putting it in its own array for further working currentArray = stringArraySentence[randomNumber].Split('_'); //Checking the order of words and give the right the roach the right sound file for (int i = 0; i < 6; i++) { labelArray[i].Text = currentArray[i]; labelVoiceArray[i].BackColor = Color.Transparent; labelVoiceArray[i].Parent = picbArray[i]; Sound_File_Distributor(i); } }
public Form1() { InitializeComponent(); this.WindowState = FormWindowState.Minimized; MainTimer.Interval = 1000; string mac = GetMac(); CurrentSession = new Session(mac); if (CurrentSession.ID == 0) { Process.Start("IExplore.exe", "-k http://SSServer/SessionSoftWebClient/default.aspx?mac=" + mac); } else if (CurrentSession.ID == -1) { if (Environment.Is64BitOperatingSystem) { Process.Start("IExplore.exe", @"C:\Program Files (x86)\SessionSoft\ServerNotFound.html"); } else { Process.Start("IExplore.exe", @"C:\Program Files\SessionSoft\ServerNotFound.html"); } } else { Processes = ClientSettings.GetProcesses(); Settings = new ClientSettings(); CurrentSession.Time = Settings.MainTimerCount; Settings.GetAutoRenew(CurrentSession.ID); Process.Start("IExplore.exe", "-k http://SSServer/SessionSoftWebClient/default.aspx?id=" + CurrentSession.ID); MainTimer.Start(); } }
public MainForm() { InitializeComponent(); pcsxCon.Enabled = false; readBytesToolStripMenuItem.Enabled = false; MainTimer.Start(); }
private void button1_Click(object sender, EventArgs e) { //Делаем таймер доступным MainTimer.Enabled = true; //Запускаем таймер MainTimer.Start(); StatusLbl.Text = "ПИШЕМ!!!"; DLurl(); //вызываем сработку однократно на старте }
// переопределение и перезапуск таймера private void ReloadTimer() { // определить время следующего сигнала if (DetectNextSignal() == true) { // запустить таймер MainTimer.Start(); } }
private void ProxyCheckStartStopButton_Click(object sender, EventArgs e) { if (!ProxyChecks) { ProxyChecks = true; //Скрытие кнопок StartButton.Enabled = false; StopButton.Enabled = false; //Заполнение данных WData = new WorkData(); string[] proxylist = ProxyTextBox.Text.Replace("\r\n", "ç").Split('ç'); WData.ProxyList = new string[proxylist.Length]; WData.ProxyCredentials = new string[proxylist.Length, 2]; for (int i = 0; i < proxylist.Length; i++) { string[] proxy = proxylist[i].Split(':'); if (proxy.Length == 2) { WData.ProxyList[i] = proxy[0] + ":" + proxy[1]; WData.ProxyCredentials[i, 0] = string.Empty; WData.ProxyCredentials[i, 1] = string.Empty; } else if (proxy.Length == 4) { WData.ProxyList[i] = proxy[0] + ":" + proxy[1]; WData.ProxyCredentials[i, 0] = proxy[2]; WData.ProxyCredentials[i, 1] = proxy[3]; } else { WData.ProxyList[i] = string.Empty; WData.ProxyCredentials[i, 0] = string.Empty; WData.ProxyCredentials[i, 1] = string.Empty; } } //Проверка прокси WData.WorkThread = new Thread(ProxyChecking); WData.WorkThread.Start(); MainTimer.Start(); } else { //Остановка проверки MainTimer.Stop(); try { WData.WorkThread.Abort(); } catch (Exception) { } //Отображение результата UpdateProxyList(); } }
public Form1(IGame source) { InitializeComponent(); _pictures = new PictureBox[13]; _game = source; MainTimer.Start(); }
public void Start() { MainTimer.Start(); playersrator = Players.GetEnumerator(); NextPlayer(); Processes.Next(); if (CurrentProcess != null) { CurrentProcess.Do(); } }
public Form1() { InitializeComponent(); new Params(); MainTimer.Interval = 1000 / Params.Speed; MainTimer.Tick += UpdateScreen; MainTimer.Start(); StartGame(); }
public ForkGenerator() { InitializeComponent(); Timer_Log.Start(); MainTimer.Start(); GUITimer.Start(); OutputConsole.Font = new Font("Consolas", 12, FontStyle.Regular); OutputConsole.AutoScroll = true; }
public IndexViewModel() { this.MainTimer = new DispatcherTimer(); MainTimer.Interval = TimeSpan.FromMinutes(10); MainTimer.Tick += MainTimer_Tick; if (!IsInDesignMode) { InitArea(); MainTimer.Start(); this.Refresh(); } }
private void startGame_Click(object sender, EventArgs e) { startGame.Enabled = false; score = 0; timerInterval = 3000; MainTimer.Interval = timerInterval; timerToLoss.Interval = timerLossinterval; prevStartTime = DateTime.Now; MainTimer.Start(); timerToLoss.Start(); ChooseActiveHole(); }
//Diffie Hellman //Thay đổi P sau 15' //P được gửi kèm 1 chuỗi random(chữ hoặc kí tự đặc biệt) //b sau khi nhận sẽ tách lấy số và gán vào P private void MainTimer_Tick(object sender, EventArgs e) { MainTimer.Stop(); BigInteger p = new BigInteger(rand.Next(1000 * 50, 9999 * 50)); P = p; string tmp = p.ToString(); string txt = tmp.Insert(rand.Next(0, tmp.Length + 1), Random(7)); client.Send(Encoding.ASCII.GetBytes("<>|" + txt + "|")); MessageBox.Show("Update !"); MainTimer.Start(); }
private void button8_Click(object sender, EventArgs e) { RobertConnectItem.SerialPortName = RobertComPort_comboBox.SelectedItem.ToString(); if (RobertConnectItem.SerialPortName != null && RobertConnectItem.SerialPortName.Contains("COM")) { RobertConnectItem.SerialPortInit(); } //step = 1; MainTimer.Start(); }
protected void SetState(bool e) { MainTimer.Enabled = e; if (e) { MainTimer.Start(); } else { MainTimer.Stop(); } }
private void Board_MouseUp(object sender, MouseEventArgs e) { int sizeUnit = (int)Math.Round(Board.Image.Width / 16.0); if (Picked.Occupant == Piece.NONE) { return; } if (e.X >= Board.Width || e.Y >= Board.Height || e.X < 0 || e.Y < 0) { Picked = new Square(0, 'z'); Board.Invalidate(); return; } int X = e.X / (2 * sizeUnit); int Y = e.Y / (2 * sizeUnit); bool Success = Game.Move(new Move(Picked.File - 'a', 8 - Picked.Rank, X, Y)); if (TimeFlag == false) { // Start Timer. MainTimer.Start(); TimeFlag = true; } if (Success) { Dropped = new Square(Game.Board[X][Y].Rank, Game.Board[X][Y].File, Game.Board[X][Y].Occupant); // If there is a Checkmate or Stalemate stop the time. if (Game.IsCheckmateFlag || Game.IsStalemateFlag) { MainTimer.Stop(); if (Game.IsCheckmateFlag) { MessageBox.Show("Game Have Finished: Checkmate"); } else if (Game.IsStalemateFlag) { MessageBox.Show("Game Have Finished: Stalemate"); } } // Data Binding - Updating the List When A Move Is Valid. listBox1.Items.Add(Game.Moves[Game.Moves.Count - 1]); } Picked.Occupant = Piece.NONE; Board.Invalidate(); }
//================ /// <summary> /// entry point of a application (точка входа приложения) /// </summary> static void Main() { void MainMethod() { MainTimer.Start(); view.MainInitialize(); view.StartSum(); Thread.Sleep(SleepTime); int currentTime; while (true) { currentTime = (int)MainTimer.ElapsedMilliseconds; view.UpdateSum(); SleepTime = (FixedTimeMs - ((int)MainTimer.ElapsedMilliseconds - currentTime)).Range(0, FixedTimeMs); DeltaTime = (float)Math.Max(FixedTimeMs, (int)MainTimer.ElapsedMilliseconds - currentTime) / 1000; Thread.Sleep(SleepTime); } } if (!DoExceptionView) { MainMethod(); } else { try { MainMethod(); } catch (Exception Ex) { string message = Ex.Source + " error! " + Ex.Message; try { ObjectSingle plane = new ObjectSingle(Preset.plane, ConsoleColor.White); while (true) { message.WriteTo(plane); } } catch { Console.WriteLine(message); Console.ReadKey(); } } } }
private void btnStartPause_Click(object sender, EventArgs e) { //Negate the running bool Running = !Running; if (Running) { MainTimer.Start(); btnStartPause.Text = "❚❚"; } if (!Running) { MainTimer.Stop(); btnStartPause.Text = "▶"; } }
private void StartButton_Click(object sender, EventArgs e) { StartButton.Enabled = false; StopButton.Enabled = true; if (int.TryParse(Interval.Text, out DefaultInterval)) { MainTimer.Interval = DefaultInterval * 1000; } ; MainTimer.Start(); if (Minimize.Checked) { this.WindowState = FormWindowState.Minimized; } }