private void TimerTick() { if (FlashlightRadius < -4) { Game.Player.ReceiveDamage(100); } if (Game.GameOver || !Game.Player.Alive) { MainTimer.Stop(); Close(); } Game.Bullets.ForEach(x => x.Move()); Game.Monsters.ForEach(x => x.Move()); if (Game.Bullets.Count > 0) { Game.BulletCollision(); } Game.CheckCollisionWithItems(); Game.KillMonstersInDoor(); if (Controls.Count > 0) { Controls[0].Text = $"{Game.Player.Magazine} / {Game.Player.Ammunition}"; } Invalidate(); }
// СТАРТ.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; } }
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(); } }
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); } }
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; } }
private void StartFlow() { MainTimer.Interval = 60000 / wpm; MainTimer.Start(); PauseButton.Text = "Stop"; isRunning = true; }
// Update is called once per frame void Update() { if (!flowContinue) { return; } DateTime time1 = DateTime.Now; if (Mathf.Abs(TimeDetect - time1.Second) >= 1) { TimeDetect = time1.Second; MainTimer = MainTimer - 1; } if (MainTimer < 0) { playAndReplayButton.gameObject.SetActive(true); flowContinue = false; Timer.text = "Time Over"; playText.text = "Replay"; Ship.GetComponent <MeshRenderer>().enabled = false; } if (MainTimer == 10) { changeColor(colorCode.RED); } if (MainTimer >= 0) { Timer.text = "Time:" + MainTimer.ToString(); } }
// Use this for initialization void Start() { ship = GetComponentInChildren <StarshipController>(); gui = GetComponent <GUIController>(); frontMessage = GetComponentInChildren <FrontMessage>(); mainTimer = GetComponentInChildren <MainTimer>(); bar = GetComponentInChildren <Bar>(); speedCounter = GetComponentInChildren <SpeedCounter>(); oobAudio = GetComponentInChildren <OutOfBoundsAudio>(); fuelAlarm = GetComponentInChildren <FuelAlarm>(); lowFuelText = GetComponentInChildren <LowFuelText>(); timeLeft = 10f; //!!!! currentSpeed = minimumSpeed; fuel = 100f; theLevel = GetComponent <TheLevel>(); foreach (Transform child in transform) { if (child.name == "StarsNear") { starsNear = child.GetComponent <Stars>(); } else if (child.name == "StarsMedium") { starsMedium = child.GetComponent <Stars>(); } else if (child.name == "StarsFar") { starsFar = child.GetComponent <Stars>(); } } }
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(); }
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); } }
private void GameEnd(string wintype) { string modifier = ""; //Increment the appropriate stats switch (wintype) { case "DRAW": Stats.Draws++; break; case "HARE WIN": Stats.HareWins++; modifier = ", YUCK"; break; case "TURTLE WIN": Stats.TurtleWins++; modifier = ", HOORAY!"; break; default: break; } MainTimer.Stop(); MessageBox.Show(wintype + modifier); txtHareWins.Text = Stats.Display()["HARE WIN"].ToString(); txtTortoiseWins.Text = Stats.Display()["TURTLE WIN"].ToString(); txtDraw.Text = Stats.Display()["DRAWS"].ToString(); Stats.SaveStatistics(); btnReset.PerformClick(); btnStartPause.PerformClick(); }
private void MainView_Paint(object sender, PaintEventArgs e) { // Draw the packets foreach (var packet in packets) { packet.Draw(e.Graphics, this.Width, this.Height); if (packet.ShouldMove) { packet.Y = packet.Y + (int)Math.Round(Math.Sin(packet.X / 4)); packet.X++; if (packet.X > rtbSql.Left) { packetsToRemove.Add(packet); // Change the text of the SQL output this.rtbSql.WriteToSql(packet.Username, packet.Password); } } } // Start the timer if there's no packets if (packets.Count <= 0) { MainTimer.Stop(); } // Remove packets foreach (var packet in packetsToRemove) { packets.Remove(packet); } }
public TimeTrackerForm() { InitializeComponent(); timer = new MainTimer(facade.GetMyId()); projects = facade.GetParticiapedProjects(); foreach (Project p in projects) { comboBoxProjets.Items.Add(p); } if (comboBoxProjets.Items.Count > 0) { int index = Properties.Settings.Default.SelectedProjectIndex; comboBoxProjets.SelectedIndex = index < comboBoxProjets.Items.Count ? Properties.Settings.Default.SelectedProjectIndex : 0; checkBoxTasks.Checked = Properties.Settings.Default.OnlyAcceptedTask; labelTask.Text = checkBoxTasks.Checked ? "All tasks" : "My open tasks"; updateTasksComboBox(); } buttonTime.Enabled = false; checkBoxSeconds.Checked = Properties.Settings.Default.ShowSeconds; Portal = Properties.Settings.Default.Portal + ".teamlab.com"; labelPortal.Text = Portal; timer.State = MainTimer.STATE.Ready; int MainTaskId = Properties.Settings.Default.MainTaskTaskId; try { if (MainTaskId != -1) labelMainTask.Text = facade.GetTask(MainTaskId).title; else clearMainTask(); } catch (TeamLabExpception) { clearMainTask(); } }
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 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 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 void MainTimer_Tick(object sender, EventArgs e) { // если текущее время >= времени события DateTime DT_Now = DateTime.Now; if (DT_Now >= NextSignaltime) { // остановить таймер MainTimer.Stop(); // получить структуру события ReadWriteFile RWF = new ReadWriteFile(WorkDir + "\\" + EventListFile, vers); EventStruct ES = RWF.GetEvent(NextEventIndex); SignalText = ES.Caption; SignalType = ES.IsEarly; EventDay = ES.Date; NeedSignalize = true; // сигализировать //Signalize(ES.Caption, ES.IsEarly, ES.Date); needBell = true; Signalize(); // изменить статус события ES.Informed = true; RWF.EditEvent(NextEventIndex, ES); // перезапустить таймер ReloadTimer(); } }
// 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 MainTimer_Tick(object sender, EventArgs e) { try { StatusToolStripProgressBar.Maximum = WData.TotalSteps; StatusToolStripProgressBar.Value = WData.CurrentStep; StatusToolStripLabel.Text = WData.CurrentStep.ToString() + "/" + WData.TotalSteps.ToString(); } catch (Exception) { } if (WData.AllDone) { MainTimer.Stop(); if (!ProxyChecks) { //Вывод даных если это одиночный запрос if (WData.AskType == 0) { FillDataTable(); } ProxyCheckStartStopButton.Enabled = true; StartButton.Enabled = true; StopButton.Enabled = false; } else { //Вывод результата UpdateProxyList(); } } }
/// <summary> /// Is called upon end of a game /// </summary> /// <param name="condition">True - player wins, false - player loses</param> private void RequestGameOver(bool condition) { MainTimer.Stop(); timerToLoss.Stop(); showtimeToLoss.Text = "0,000"; holes[soosliqCurrentHole].Image = noraImage; if (condition == true) { MessageBox.Show("You win!"); } else { if (score > maxscore) { maxscore = score; MessageBox.Show("Новый рекорд!"); scoreLabel.Text = maxscore.ToString(); } else { MessageBox.Show("Игра закончена"); } startGame.Enabled = true; RecordSaver saver = new RecordSaver(score); saver.ShowDialog(); } }
private async void button1_Click(object sender, EventArgs e) { MainTimer.Start(); Log.Information("Turned on Timer"); OnTimedEvent(null, null); ToggleTimerActivationButtons(); }
/// <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(); }
public MainForm() { InitializeComponent(); pcsxCon.Enabled = false; readBytesToolStripMenuItem.Enabled = false; MainTimer.Start(); }
private void ExitBtn_Click(object sender, EventArgs e) { if (MainTimer.Enabled) { MainTimer.Stop(); } this.Close(); }
private void button1_Click(object sender, EventArgs e) { //Делаем таймер доступным MainTimer.Enabled = true; //Запускаем таймер MainTimer.Start(); StatusLbl.Text = "ПИШЕМ!!!"; DLurl(); //вызываем сработку однократно на старте }
private void ProgressBarComplete() { if (MainProgressBar.Value == MainProgressBar.Maximum) { MainTimer.Stop(); WinText.Enabled = true; WinText.Visible = true; } }
// переопределение и перезапуск таймера 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(); } }
private void button2_Click(object sender, EventArgs e) { //Останавливаем таймер MainTimer.Stop(); //Снова делаем таймер недоступным MainTimer.Enabled = false; //"Сбрасываем" текст надписи в исходное состояние StatusLbl.Text = "ПАУЗА"; }
public Form1(IGame source) { InitializeComponent(); _pictures = new PictureBox[13]; _game = source; MainTimer.Start(); }
private void ResetButton_Click(object sender, EventArgs e) { MainTimer.Stop(); dsec = 0; sec = 0; min = 0; hou = 0; UpdateClockDisplay(); StartButton.Text = "Start"; this.BackColor = Color.Black; }