/// <summary> /// Dibuja todos los elementos de la pantalla. /// </summary> /// <param name="gameTime">Valor temporal interno.</param> public void Draw(GameTime gameTime) { Game.SpriteBatch.Begin(); BtnBack.draw(Game); Game.SpriteBatch.DrawString(Font, Room + " " + NumberRoom, new Vector2(ScreenWidth / 2 - Font.MeasureString(Room + " " + NumberRoom).X / 2, ScreenHeight / 8), Color.Black); int row = 1; for (int i = 0; i < Players.Count; i++) { Game.SpriteBatch.DrawString(Font, Players[i], new Vector2( (i % 2) == 0 ? (float)ScreenWidth / 4 - Font.MeasureString(Players[i]).X / 2 : (float)ScreenWidth * 3 / 4 - Font.MeasureString(Players[i]).X / 2, (float)ScreenHeight * 2 / 5 + ScreenWidth * row / 15), Color.Black); if ((i + 1) % 2 == 0) { row++; } } if (Host) { BtnStart.draw(Game); } Game.SpriteBatch.End(); }
/// <summary> /// Gestiona los clicks del ratón del usuario. /// </summary> /// <returns>Devuelve un objeto tipo Screen según las acciones del usuario.</returns> public Screen Click() { if (BtnBack.isHover(Mouse.GetState().X, Mouse.GetState().Y)) { Game.effects[MainGame.eSounds.click].Play(); return(new StartScreen(Game)); } if (BtnStart.isHover(Mouse.GetState().X, Mouse.GetState().Y) && !ClickJoin) { ClickJoin = true; return(goNext()); } if (TxtInputName.isHover(Mouse.GetState().X, Mouse.GetState().Y)) { changeFocus(TxtInputName); } if (TxtInputRoom.isHover(Mouse.GetState().X, Mouse.GetState().Y)) { changeFocus(TxtInputRoom); } foreach (TextBox input in inputs) { if (input.Focus) { Focused = input; } } return(this); }
private void SetStart(bool enabled) { BtnStart.Invoke((MethodInvoker) delegate() { BtnStart.Enabled = enabled; }); }
private void button1_Click(object sender, EventArgs e) //START SERVER { TcpListener listener = new TcpListener(IPAddress.Any, 2133); listener.Start(); client = listener.AcceptTcpClient(); STR = new StreamReader(client.GetStream()); STW = new StreamWriter(client.GetStream()); STW.AutoFlush = true; backgroundWorker1.RunWorkerAsync(); //start receiving data in background backgroundWorker2.WorkerSupportsCancellation = true; //ability to cancel this thread /////// BoardInitialization(); MyBoard[1, 1].PopulateGrid(panel1, MyButton); CreateClickEvents(); PlayerBlack = new Player("Black", MyBoard, MyButton); PlayerWhite = new Player("White", MyBoard, MyButton); Player = PlayerWhite; WhiteMove = true; panel1.BackgroundImage = null; MyTurn = true; BtnStart.Hide(); button1.Hide(); button2.Hide(); textBox1.Hide(); textBox2.Hide(); }
public void OpenDrawWindow() { _start = true; BtnStart.SetValue(Button.ContentProperty, "Close"); _drawWindow = new DrawWindow(this); _drawWindow.Show(); }
/// <summary> /// Dibuja todos los elementos de la pantalla. /// </summary> /// <param name="gameTime">Valor temporal interno.</param> public void Draw(GameTime gameTime) { Game.SpriteBatch.Begin(); BtnBack.draw(Game); Game.SpriteBatch.DrawString( DefaultFont, RoomMessage, new Vector2(ScreenWidth / 2 - DefaultFont.MeasureString(RoomMessage).X / 2, ScreenHeight / 10), Color.Black ); TxtInputRoom.draw(Game); Game.SpriteBatch.DrawString( DefaultFont, NameMessage, new Vector2(ScreenWidth / 2 - DefaultFont.MeasureString(NameMessage).X / 2, ScreenHeight / 2 - DefaultFont.MeasureString(NameMessage).Y), Color.Black ); if (NameError) { Game.SpriteBatch.DrawString(ErrorFont, ErrorNameMsg, new Vector2(ScreenWidth / 2 - ErrorFont.MeasureString(ErrorNameMsg).X / 2, ScreenHeight * 15 / 20), Color.Red); } if (RoomError) { Game.SpriteBatch.DrawString(ErrorFont, ErrorRoomMsg, new Vector2(ScreenWidth / 2 - ErrorFont.MeasureString(ErrorRoomMsg).X / 2, ScreenHeight * 7 / 20), Color.Red); } TxtInputName.draw(Game); BtnStart.draw(Game); Game.SpriteBatch.End(); }
public FrmInitial() { InitializeComponent(); ReadInfo(); notBusy = true; BtnStop.Hide(); BtnStart.Show(); }
private void BtnStart_Click(object sender, EventArgs e) { txtTranscript.Text = string.Empty; BtnSaveStop.Enabled = true; BtnStart.Hide(); BtnSaveStop.Show(); StartCapture(_FileName); lblDisplayTime.Visible = true; }
private void MainForm_Load(object sender, EventArgs e) { BtnStop.Enabled = false; if (Cfg.Autostart) { BtnStart.PerformClick(); WindowState = FormWindowState.Minimized; ShowInTaskbar = false; } }
public void UpdateUIStartButton(bool isStart = true) { if (isStart) { BtnStart.SetText(Controller.GetLanguage()["StartButton"]); } else { BtnStart.SetText(Controller.GetLanguage()["StopButton"]); } }
protected override void OnInit(QFramework.IUIData uiData) { mData = uiData as UIHomePanelData ?? new UIHomePanelData(); // please add init code here BtnStart.OnClickAsObservable().Subscribe(_ => { StartHide(); UIMgr.OpenPanel <UIGamePanel>(); }); }
/// <summary> /// Se encarga del refresco de pantalla. Se realiza 60 veces por segundo. /// </summary> /// <param name="gameTime">Valor temporal interno.</param> /// <returns></returns> public Screen Update(GameTime gameTime) { if (BtnStart.isHover(Mouse.GetState().X, Mouse.GetState().Y)) { BtnStart.Img = BtnSelected; } else if (BtnStart.Img != BtnDefault) { BtnStart.Img = BtnDefault; } return(this); }
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; } }
/// <summary> /// Gestiona los clicks del ratón del usuario. /// </summary> /// <returns>Devuelve un objeto tipo Screen según las acciones del usuario.</returns> public Screen Click() { if (BtnBack.isHover(Mouse.GetState().X, Mouse.GetState().Y)) { Game.effects[MainGame.eSounds.click].Play(); return(new StartScreen(Game)); } if (BtnStart.isHover(Mouse.GetState().X, Mouse.GetState().Y) && !ClickCreate) { ClickCreate = true; return(goNext()); } return(this); }
private void ToggleDrawWindow() { _start = !_start; if (_start) { BtnStart.SetValue(ContentProperty, "Stop"); _drawWindow = new DrawWindow(); _drawWindow.Show(); } else { BtnStart.SetValue(ContentProperty, "Start"); _drawWindow.Close(); } }
public MainWindow(ILogContainer logContainer) { this.logContainer = logContainer; this.logContainer.Updated += LoggingUpdated; InitializeComponent(); MenuMru.MenuClick += (s, e) => FileOpenCore(e.Filepath); ITest selectedTest = null; var testFactory = new TestFactory(); foreach (var test in testFactory.GetList()) { tests.Add(test); if (test.Name.Equals(Settings.Default.SelectedTest)) { selectedTest = test; } } CmbTests.DataContext = tests; if (selectedTest != null) { CmbTests.SelectedItem = selectedTest; BtnStart.Focus(); } else { CmbTests.Focus(); CmbTests.IsDropDownOpen = true; BtnStart.IsEnabled = false; } var lineSerie = new StairStepSeries() { Smooth = true, MarkerType = MarkerType.Diamond }; lineSerie.Points.Add(new DataPoint(0.4, 4)); lineSerie.Points.Add(new DataPoint(10, 13)); lineSerie.Points.Add(new DataPoint(20, 15)); lineSerie.Points.Add(new DataPoint(30, 16)); lineSerie.Points.Add(new DataPoint(40, 12)); lineSerie.Points.Add(new DataPoint(50, 12)); var model = new PlotModel(); model.Series.Add(lineSerie); Plot.Model = model; }
private void BtnSaveStop_Click(object sender, EventArgs e) { lblWait.Visible = true; Application.DoEvents(); BtnSaveStop.Hide(); StopCapture(); objStopWatch.Reset(); lblDisplayTime.Visible = false; // Process.Start(_FileName); AudioToText audioToText = new AudioToText(); string message = "Processing is Done!"; txtTranscript.Text = audioToText.GetTextBy16BitPCMAudio(_FileName, cmbLanguageCode.SelectedValue.ToString(), ref message); lblWait.Visible = false; BtnStart.Show(); MessageBox.Show(message); }
private void StartGame(object sender, EventArgs e) { BoardInitialization(); MyBoard[1, 1].PopulateGrid(panel1, MyButton); CreateClickEvents(); PlayerBlack = new Player("Black", MyBoard, MyButton); PlayerWhite = new Player("White", MyBoard, MyButton); panel1.BackgroundImage = null; BtnStart.Hide(); button1.Hide(); button2.Hide(); textBox1.Hide(); textBox2.Hide(); }
protected override void RegisterUIEvent() { BtnClose.OnClickAsObservable().Subscribe(_ => { CloseSelf(); }); Background.OnClickAsObservable().Subscribe(_ => { CloseSelf(); }); BtnStart.OnClickAsObservable().Subscribe(_ => { CloseSelf(); UIMgr.ClosePanel <UIMapStagesPanel>(); UIMgr.OpenPanel <UIGamePanel>(); }); }
/// <summary> /// Gestiona los clicks del ratón del usuario. /// </summary> /// <returns>Devuelve un objeto tipo Screen según las acciones del usuario.</returns> public Screen Click() { if (BtnBack.isHover(Mouse.GetState().X, Mouse.GetState().Y)) { Game.effects[MainGame.eSounds.click].Play(); Server.closeServer(); getNewPlayersThread.Join(); return(new StartScreen(Game)); } if (!ClickStart && Host && BtnStart.isHover(Mouse.GetState().X, Mouse.GetState().Y) && Players.Count >= 2) { ClickStart = true; Game.effects[MainGame.eSounds.click].Play(); Server.sendData("empezar"); } return(this); }
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; } } }
protected override void RegisterUIEvent() { BtnIntpuSet.AddCallback(new UnityEngine.Events.UnityAction(() => { UIMgr.OpenPanel <InputSetList>(); })); BtnStart.AddCallback(new UnityEngine.Events.UnityAction(() => { GlobalManager.Instance.InitMainScene(1); })); BtnAudioSet.AddCallback(() => { UIMgr.OpenPanel <AudioSettingPanel>(); }); BtnLoad.AddCallback(() => { UIMgr.OpenPanel <LevelPanel>(); }); }
/// <summary> /// Se encarga del refresco de pantalla. Se realiza 60 veces por segundo. /// </summary> /// <param name="gameTime">Valor temporal interno.</param> /// <returns></returns> public Screen Update(GameTime gameTime) { if (BtnStart.isHover(Mouse.GetState().X, Mouse.GetState().Y)) { BtnStart.Img = BtnSelected; } else if (BtnStart.Img != BtnDefault) { BtnStart.Img = BtnDefault; } if (!WaitingRoomActive) { getNewPlayersThread.Join(); return(new Match(Game, Server, Name, Players.Count)); } if (ServerError) { getNewPlayersThread.Join(); return(new StartScreen(Game, "Server's connection lost")); } return(this); }
/// <summary> /// Dibuja todos los elementos de la pantalla. /// </summary> /// <param name="gameTime">Valor temporal interno.</param> public void Draw(GameTime gameTime) { Game.SpriteBatch.Begin(); BtnBack.draw(Game); Game.SpriteBatch.DrawString( Font, Intro, new Vector2(ScreenWidth / 2 - Font.MeasureString(Intro).X / 2, ScreenHeight / 4), Color.Black ); BtnInput.draw(Game); BtnStart.draw(Game); if (ErrorOcurrered) { Game.SpriteBatch.DrawString( ErrorFont, ErrorMsg, new Vector2(ScreenWidth / 2 - ErrorFont.MeasureString(ErrorMsg).X / 2, ScreenHeight * 7 / 10), Color.Red ); } Game.SpriteBatch.End(); }
/// <summary> /// Increase button size via animation. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnStart_MouseEnter(object sender, MouseEventArgs e) { // Increase btn size +5px var startDa = new DoubleAnimation { From = 100, To = 105, Duration = new Duration(TimeSpan.FromMilliseconds(250)) }; BtnStart.BeginAnimation(Button.HeightProperty, startDa); BtnStart.BeginAnimation(Button.WidthProperty, startDa); // Increase tic size + 5px var ticDa = new DoubleAnimation { From = 60, To = 65, Duration = new Duration(TimeSpan.FromMilliseconds(250)) }; TicArrow.BeginAnimation(Button.HeightProperty, ticDa); TicArrow.BeginAnimation(Button.WidthProperty, ticDa); }
private void button2_Click(object sender, EventArgs e) //START CLIENT { client = new TcpClient(); IPEndPoint IP_End = new IPEndPoint(IPAddress.Parse(textBox2.Text), 2133); try { client.Connect(IP_End); if (client.Connected) { STW = new StreamWriter(client.GetStream()); STR = new StreamReader(client.GetStream()); STW.AutoFlush = true; backgroundWorker1.RunWorkerAsync(); //start receiving data in background backgroundWorker2.WorkerSupportsCancellation = true; //ability to cancel this thread ///// BoardInitialization(); MyBoard[1, 1].PopulateGrid(panel1, MyButton); CreateClickEvents(); PlayerBlack = new Player("Black", MyBoard, MyButton); PlayerWhite = new Player("White", MyBoard, MyButton); Player = PlayerBlack; WhiteMove = true; panel1.BackgroundImage = null; MyTurn = false; BtnStart.Hide(); button1.Hide(); button2.Hide(); textBox1.Hide(); textBox2.Hide(); } } catch (Exception x) { MessageBox.Show(x.Message.ToString()); } }
public void CloseDrawWindow() { _start = false; BtnStart.SetValue(Button.ContentProperty, "Start"); _drawWindow?.Close(); }
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; } } } }
private void BtnStop_KeyPress(object sender, KeyPressEventArgs e) { BtnStart.BackColor = Color.CornflowerBlue; BtnStop.BackColor = Color.PaleVioletRed; //Stop timer timer.Stop(); //Return the text to the default value set from Tag from Properties of this label labelNoSolves.Text = labelNoSolves.Tag.ToString(); labelNoSolves.Text += NoOfSolves; //"GOOD! BUT CAN YOU DO BETTER" stop button's message labelDoYourBest.Text = labelDoYourBest.Tag.ToString(); //Set focus back to the start button BtnStart.Focus(); //Reset the Solves array index as the array limit is 12 if (i == 12) { i = 0; } //Reset the SolvesOfFive array index as the array limit is 5 if (j == 5) { j = 0; } Solves[i] = labelTimer.Text; SolvesOfFive[j] = Solves[i]; records = Solves[0].TrimStart('0').TrimStart(':') + " "; if (Solves[1] != null) { records += Solves[1].TrimStart('0').TrimStart(':') + " "; } if (Solves[2] != null) { records += Solves[2].TrimStart('0').TrimStart(':') + " "; } if (Solves[3] != null) { records += Solves[3].TrimStart('0').TrimStart(':') + " "; } if (Solves[4] != null) { records += Solves[4].TrimStart('0').TrimStart(':') + " "; } if (Solves[5] != null) { records += Solves[5].TrimStart('0').TrimStart(':') + " "; } if (Solves[6] != null) { records += Solves[6].TrimStart('0').TrimStart(':') + " "; } if (Solves[7] != null) { records += Solves[7].TrimStart('0').TrimStart(':') + " "; } if (Solves[8] != null) { records += Solves[8].TrimStart('0').TrimStart(':') + " "; } if (Solves[9] != null) { records += Solves[9].TrimStart('0').TrimStart(':') + " "; } if (Solves[10] != null) { records += Solves[10].TrimStart('0').TrimStart(':') + " "; } if (Solves[11] != null) { records += Solves[11].TrimStart('0').TrimStart(':') + " "; } labelSessionSolves.Text = labelSessionSolves.Tag.ToString() + records; //Average of last 5 //The following executes only if the 5 elements of SolvesOfFive aren't null if (SolvesOfFive[0] != null && SolvesOfFive[1] != null && SolvesOfFive[2] != null && SolvesOfFive[2] != null && SolvesOfFive[3] != null && SolvesOfFive[4] != null) { DateTime d1 = DateTime.ParseExact(SolvesOfFive[0].ToString(), "m:s.ff", CultureInfo.InvariantCulture); DateTime d2 = DateTime.ParseExact(SolvesOfFive[1].ToString(), "m:s.ff", CultureInfo.InvariantCulture); DateTime ds1 = d1.Add(d2.TimeOfDay); DateTime d3 = DateTime.ParseExact(SolvesOfFive[2].ToString(), "m:s.ff", CultureInfo.InvariantCulture); DateTime ds2 = ds1.Add(d3.TimeOfDay); DateTime d4 = DateTime.ParseExact(SolvesOfFive[3].ToString(), "m:s.ff", CultureInfo.InvariantCulture); DateTime ds3 = ds2.Add(d4.TimeOfDay); DateTime d5 = DateTime.ParseExact(SolvesOfFive[4].ToString(), "m:s.ff", CultureInfo.InvariantCulture); DateTime ds4 = ds3.Add(d5.TimeOfDay); //Convert time to milliseconds var TotalMS = ds4.TimeOfDay.TotalMilliseconds; //Average of the last 5 elements from the array Solves var AverageOfFiveMS = TotalMS / 5; //Convert the average of milliseconds to this format mm:ss:ff TimeSpan TimeFromDateTimeToMS = TimeSpan.FromMilliseconds(AverageOfFiveMS); string TimeFromMStoDateTime = TimeFromDateTimeToMS.ToString(@"m\:s\.ff"); labelAverageOfFive.Text = labelAverageOfFive.Tag.ToString() + TimeFromMStoDateTime.TrimStart('0').TrimStart(':'); } //Average of the last 12 solves //The following executes only if the 12 elements of Solves aren't null if (Solves[0] != null && Solves[1] != null && Solves[2] != null && Solves[2] != null && Solves[3] != null && Solves[4] != null && Solves[5] != null && Solves[6] != null && Solves[7] != null && Solves[8] != null && Solves[9] != null && Solves[10] != null && Solves[11] != null) { DateTime d1 = DateTime.ParseExact(Solves[0].ToString(), "m:s.ff", CultureInfo.InvariantCulture); DateTime d2 = DateTime.ParseExact(Solves[1].ToString(), "m:s.ff", CultureInfo.InvariantCulture); DateTime ds1 = d1.Add(d2.TimeOfDay); DateTime d3 = DateTime.ParseExact(Solves[2].ToString(), "m:s.ff", CultureInfo.InvariantCulture); DateTime ds2 = ds1.Add(d3.TimeOfDay); DateTime d4 = DateTime.ParseExact(Solves[3].ToString(), "m:s.ff", CultureInfo.InvariantCulture); DateTime ds3 = ds2.Add(d4.TimeOfDay); DateTime d5 = DateTime.ParseExact(Solves[4].ToString(), "m:s.ff", CultureInfo.InvariantCulture); DateTime ds4 = ds3.Add(d5.TimeOfDay); DateTime d6 = DateTime.ParseExact(Solves[5].ToString(), "m:s.ff", CultureInfo.InvariantCulture); DateTime ds5 = ds4.Add(d6.TimeOfDay); DateTime d7 = DateTime.ParseExact(Solves[6].ToString(), "m:s.ff", CultureInfo.InvariantCulture); DateTime ds6 = ds5.Add(d7.TimeOfDay); DateTime d8 = DateTime.ParseExact(Solves[7].ToString(), "m:s.ff", CultureInfo.InvariantCulture); DateTime ds7 = ds6.Add(d8.TimeOfDay); DateTime d9 = DateTime.ParseExact(Solves[8].ToString(), "m:s.ff", CultureInfo.InvariantCulture); DateTime ds8 = ds7.Add(d9.TimeOfDay); DateTime d10 = DateTime.ParseExact(Solves[9].ToString(), "m:s.ff", CultureInfo.InvariantCulture); DateTime ds9 = ds8.Add(d10.TimeOfDay); DateTime d11 = DateTime.ParseExact(Solves[10].ToString(), "m:s.ff", CultureInfo.InvariantCulture); DateTime ds10 = ds9.Add(d11.TimeOfDay); DateTime d12 = DateTime.ParseExact(Solves[11].ToString(), "m:s.ff", CultureInfo.InvariantCulture); DateTime ds11 = ds10.Add(d12.TimeOfDay); //Convert time to milliseconds var TotalMS2 = ds11.TimeOfDay.TotalMilliseconds; //Average of the last 5 elements from the array Solves var AverageOfFiveMS2 = TotalMS2 / 12; //Convert the average of milliseconds to this format mm:ss:ff TimeSpan TimeFromDateTimeToMS2 = TimeSpan.FromMilliseconds(AverageOfFiveMS2); string TimeFromMStoDateTime2 = TimeFromDateTimeToMS2.ToString(@"m\:s\.ff"); labelAverageOfTwelve.Text = labelAverageOfTwelve.Tag.ToString() + TimeFromMStoDateTime2.TrimStart('0').TrimStart(':'); } i++; j++; }