private void IncrementProgress(int index) { _animationProgresses[index] += Increment; if (_animationProgresses[index] > MAX_VALUE) { _animationProgresses[index] = MAX_VALUE; for (int i = 0; i < GetAnimationCount(); i++) { if (_animationDirections[i] == AnimationDirection.InOutIn) { return; } if (_animationDirections[i] == AnimationDirection.InOutRepeatingIn) { return; } if (_animationDirections[i] == AnimationDirection.InOutRepeatingOut) { return; } if (_animationDirections[i] == AnimationDirection.InOutOut && _animationProgresses[i] != MAX_VALUE) { return; } if (_animationDirections[i] == AnimationDirection.In && _animationProgresses[i] != MAX_VALUE) { return; } } _animationTimer.Stop(); OnAnimationFinished?.Invoke(this); } }
//Serial Port private void ReceiveSerialPortEvent(object sender, SerialDataReceivedEventArgs e) { try { string msgRcv = ""; string aux = "\r\n"; // \r = CR; \n = LF //Stop timeout timer tmrTimout.Stop(); msgRcv = SerialPort.ReadExisting(); sb.Append(msgRcv); msgRcv = sb.ToString(); if ((msgRcv.Substring(msgRcv.Length - 2, 2) == "\r\n".ToString()) || (msgRcv.Substring(msgRcv.Length - 1, 1) == "\r".ToString())) { string[] array = msgRcv.Split('\r'); //devido ao buffer do leitor que pode enviar varios codigos seguidos msgRcv = array[0].Replace(aux, ""); sb.Remove(0, sb.Length); newDataReceived?.Invoke(Name, msgRcv); _DataReceived = msgRcv; _ReadComplete = true; } } catch (Exception ex) { _ErrorMsg = "Error while receive from Scanner " + ex.Message; } }
public RefreshUtilities_old() { goToURLTimer.Enabled = true; goToURLTimer.Tick += Timer_Tick;; goToURLTimer.Interval = 1000;//one second goToURLTimer.Stop(); }
void MouseTimerTick(object sender, EventArgs e) { _mouseTimer.Stop(); if (_parentForm != null && _parentForm.ContainsFocus && IsLeftMouseButtonDown()) { var p = _ownerControl.PointToClient(System.Windows.Forms.Control.MousePosition); if (p.X > 0 && p.X < _ownerControl.Width && p.Y > 0 && p.Y < _ownerControl.Height) { if (IsPlaying) { Pause(); } else { Play(); } int i = 0; while (IsLeftMouseButtonDown() && i < 200) { System.Threading.Thread.Sleep(2); System.Windows.Forms.Application.DoEvents(); i++; } } } _mouseTimer.Start(); }
private void StartDinnerButton_Click(object sender, RoutedEventArgs e) { _ttc.StartDinner(); ChangeWorkingDayGrid(); _workinDayTimeTimer.Stop(); }
/// <summary> /// 登录 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnLogin_Click(object sender, RoutedEventArgs e) { try { if (ValidateLogin()) { ChangeUserNameReadOnly(true); Process(); Dispatcher.Invoke(() => { this.btnLogin.Content = "登 录"; }); } } catch (Exception ex) { _timer.Stop(); MessageBoxResult dialog = MessageBox.Show("下载验证码失败!\r\n" + ex.Message + "\r\n确定重试 ?", "信息提示", MessageBoxButton.OKCancel, MessageBoxImage.Error); LogHelper.Log(new System.Diagnostics.StackTrace().GetFrame(0).GetMethod().Name, ex.Message); if (dialog == MessageBoxResult.OK) { Process(); } else { Environment.Exit(0);//退出应用程序 } } }
/// timerAllowedToPrint #region timerAllowedToPrint /// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void timerAllowedToPrint_Tick(object sender, EventArgs e) { timerAllowedToPrint.Stop(); if (!ConfigData.Config_DontCheckUserBalance) { AllowedToPrintResponse res = APIWrapper.CheckIfCanPrint(Environment.MachineName, Environment.UserName, PrintWithColor, NumberOfPrints, ChosenPrinter.Name); if (res == null) { WPFNotifier.Warning(string.Format("No response from server but still printing.")); Print(PDFFileName, PostScriptMetaData.Title, ChosenPrinter.Settings, PostScriptMetaData); } else { if (res.AllowedToPrint) { Print(PDFFileName, PostScriptMetaData.Title, ChosenPrinter.Settings, PostScriptMetaData); } else { timerAllowedToPrint.Start(); } } } timerAllowedToPrint.Start(); }
void timer_Tick(object sender, EventArgs e) { // variable properties _mplayer.StandardInput.WriteLine("pausing_keep_force get_property time_pos"); _mplayer.StandardInput.WriteLine("pausing_keep_force get_property pause"); if (!_ended && OnVideoEnded != null && _lengthInSeconds.TotalSeconds == Duration) { // _ended = true; // OnVideoEnded.Invoke(this, null); } else if (_lengthInSeconds.TotalSeconds < Duration) { _ended = false; } if (OnVideoLoaded != null && _loaded == true) { timer.Stop(); _loaded = false; OnVideoLoaded.Invoke(this, null); timer.Interval = 100; timer.Start(); } if (_lengthInSeconds != _lastLengthInSeconds) { _paused = false; } _lastLengthInSeconds = _lengthInSeconds; }
private void OnResumeCmdExecute(object o) { togglePanel(); sw.Start(); dt.Start(); timer.Stop(); timer.Dispose(); currentTimeRest = rest_time_label.Content.ToString(); if (DateTime.TryParseExact(currentTimeRest, "HH:mm:ss", null, DateTimeStyles.None, out _)) { TimeSpan ts2 = TimeSpan.FromMinutes(maxUnitTime); ///<summary> Получить разницу между максимальным временем перерыва (15 или 60) и оставшемся ///Пример: Сотрудник отошёл на 7 минут и 30 секунд, затем продолжил работу => (00:15:00 - 00:12:30) = 00:07:30 </summary> TimeSpan currentTime = -(ts - ts2); // Прибавить к накопителю зафиксированное время timeRestCollector += currentTime; } else { return; } rest_time_label.Content = "00:00:00"; toggleWorkingElements(); continue_button.IsEnabled = false; }
void timer_Tick(object sender, EventArgs e) { timer.Enabled = false; if (org == null || org.OrgInfo.OnLine == false) { MessageBox.Show("当前现场端不在线,远程监控关闭!"); timer.Stop(); this.Close(); begin = false; return; } try { new Thread(new ThreadStart(() => { byte[] b = GetImage(); img.Dispatcher.BeginInvoke(new Action(() => { var imageSource = ClientHelper.LoadImageFromBytes(b as byte[]); this.img.Source = imageSource; timer.Enabled = true; })); })).Start(); } catch { timer.Enabled = true; } //this.img.Source = new BitmapImage(new Uri(imageUrl)); }
private async void ScrollOneUnit(object sender, EventArgs e) { // Jump one unit scrollTop -= unit; pdfRenderer.SetDisplayRectLocation(new Point(1, (int)Math.Round(scrollTop))); // Check if end of document is reached var currentPos = pdfRenderer.DisplayRectangle.Top; var documentHeight = pdfRenderer.DisplayRectangle.Height - pdfRenderer.Height; if (Math.Abs(currentPos) != documentHeight) { return; } // Sleep and load next PDF scrollTimer.Stop(); // Make sure that each document is at least for 'minDisplayTime' on the screen, but wait for a minimum of pauseTime // This code is overflow-safe, at least if a single document is not reloaded for more than around 25 days, which should never happen. int timeElapsed = Environment.TickCount - startTimestamp; int delay = Math.Max(pauseTime, minDisplayTime - timeElapsed); await Task.Delay(delay); OnFileEndReached(); }
public void GetInBoxRefer(int pFolderCode) { Timer.Stop(); JReferFolder tmpJReferFolder = new JReferFolder(); tmpJReferFolder.InsertReferFolder(JAFolderTypeEnum.Inbox); CurrentKartable = JAFolderTypeEnum.Inbox; Nodes.ObjectBase = new ClassLibrary.JAction("GetReferNode", "Automation.JKartable.GetNode", null, null); JRowStyles p = new JRowStyles(); JRowStyle R = new JRowStyle(); R.Expression = "[خوانده شده]='False'"; Janus.Windows.GridEX.GridEXFormatStyle JanusRowStyle = new Janus.Windows.GridEX.GridEXFormatStyle(); JanusRowStyle.BackColor = System.Drawing.Color.Silver; R.JanusRowStyle = JanusRowStyle; p.Add(R); Nodes.RowStyles = p; Nodes.DataTable = JARefers.GetReferInInbox(ClassLibrary.JMainFrame.CurrentPostCode, pFolderCode); if (pFolderCode == 0) { Nodes.Name = "JKartableInBOX"; } else { Nodes.Name = "FolderInBOX_" + pFolderCode.ToString(); } Nodes.hidColumns = "View_date_Time,externalcode,ObjectType,Receiver_Full_Title,action,Code,ClassName,ObjectCode ,DynamicClassCode"; Timer.Start(); }
protected void InitTimer() { checkTimer.Interval = 10; checkTimer.Tick += new EventHandler(checkTimer_TickHandler); checkTimer.Enabled = false; checkTimer.Stop(); }
void TmCheckForACKTick(object sender, System.EventArgs e) { OpsMMEventLog opsEventLog = new OpsMMEventLog(); if (opsEventLog.gotAckEvent()) { setStatusMessage("Server is in maintenance mode!\nYou may close this window.", STATUS_OK); updateProgressBar(MM_TIMEOUT, MM_TIMEOUT, Color.Green); btnCancel.Text = "&Close"; btnCancel.Focus(); tmCheckForACK.Stop(); btStartMaintenance.Enabled = true; btStopMaintenance.Enabled = true; } else { setMMTimeout = setMMTimeout - tmCheckForACK.Interval; if (setMMTimeout > 60000) { updateProgressBar(MM_TIMEOUT - setMMTimeout, MM_TIMEOUT, ATEA_GREEN); } else if (setMMTimeout > 0) { updateProgressBar(MM_TIMEOUT - setMMTimeout, MM_TIMEOUT, Color.Gold); } else { setStatusMessage("Timed out waiting for maintenance mode.\nPlease contact monitoring support for assistance.", STATUS_ERROR); updateProgressBar(MM_TIMEOUT - setMMTimeout, MM_TIMEOUT, Color.Red); tmCheckForACK.Stop(); setMMTimeout = MM_TIMEOUT; } } }
public void Aligned_Timer_PushMessages(object sender, EventArgs e) { if (uiTimer_aligned.Enabled && count_trigger < 30) { //same as mysql_cmd2_btn click event //selected record with confidence (40, 90], show as UnsureMessages //string myConnection = "SERVER=localhost;DATABASE=mixed_initiative_exp1;UID=Christine;PASSWORD=20150330;"; //MySqlConnection myConn = new MySqlConnection(myConnection); //myConn.Open(); current_selection_range = generate_selection_range(); generate_from_table_range(); string cmd_string = "INSERT INTO unsure_messages(from_table_id, from_table, time, content, confidence, is_about_delivery) SELECT id_all, table_name, time, content, confidence, is_about_delivery FROM all_messages WHERE confidence > 40 and confidence <= 90 and is_processed = 0 and " + current_selection_range; MySqlCommand cmd = new MySqlCommand(cmd_string, myConn); MySqlDataAdapter adp = new MySqlDataAdapter(cmd); cmd.ExecuteNonQuery(); // string cmd1_string = "UPDATE unsure_messages SET from_table='all_messages' WHERE " + from_table_range_string; // MySqlCommand cmd1 = new MySqlCommand(cmd1_string, myConn); // cmd1.ExecuteNonQuery(); string cmd2_string = "UPDATE all_messages SET is_processed='1' WHERE confidence > 40 and confidence <= 90 and " + current_selection_range; MySqlCommand cmd2 = new MySqlCommand(cmd2_string, myConn); cmd2.ExecuteNonQuery(); MySqlCommand cmd3 = new MySqlCommand("SELECT id_unsure_messages, time, content, note, confidence, is_about_delivery FROM unsure_messages", myConn); MySqlDataAdapter adp3 = new MySqlDataAdapter(cmd3); DataSet ds = new DataSet(); adp3.Fill(ds, "LoadDataBinding_Unsure"); Unsure_Messages.DG1.Items.Refresh(); Unsure_Messages.DG1.DataContext = ds; //myConn.Close(); write_subtasktime(System.DateTime.Now, current_task_type, count_trigger, "System", "Push_messages", Unsure_Messages.DG1.Items.Count); uiTimer_aligned.Interval = interval_ms[count_user_click]; update_count_trigger_and_messages(); system_push[count_trigger] = System.DateTime.Now; //Console.Beep(4200, 50); // BackgroundBeep.Beep(); } else if (count_trigger == 30) { uiTimer_aligned.Tick -= Aligned_Timer_PushMessages; uiTimer_aligned.Stop(); Aligned_timer_flag = 0; //count_trigger = 0; count_user_click = 0; } }
public void StopTimer() { if (_timer.Enabled) { _timer.Stop(); onStop(EventArgs.Empty); } }
protected override void OnSelectedIndexChanged(EventArgs e) { base.OnSelectedIndexChanged(e); // restart delay timer m_timer.Stop(); m_timer.Start(); }
/// <summary> /// Recognizes when the mouse leaves the screen or starts drawing, stops timer, and removes selection /// </summary> private void outOfHoverPosition(object sender, StylusEventArgs e) { hoverTimer.Stop(); removeSelectionHandles(); allowSelection = false; sketchPanel.InkCanvas.GetSelectedStrokes().Clear(); //selectionTool.RemoveMenu(); }
/// <summary> /// Clear delay call /// </summary> public void ClearTimeout() { if (myTimer != null) { myTimer.Stop(); } strTimeoutMethod = null; }
void showError(string error) { errorTb.Text = string.Format("{0}", error); errorRect.Fill = errorColor; errorBox.Visibility = Visibility.Visible; errorTimer.Stop(); errorTimer.Start(); }
/// <summary> /// Stops the animation. /// If no animation is running nothing happens. /// </summary> public void Stop() { if (_timer.Enabled) { _timer.Stop(); OnAnimationStopped(EventArgs.Empty); } }
private void Tmr_Tick(object sender, EventArgs e) { tmr.Stop(); if (this.StableTextChanged != null) { this.StableTextChanged(this, new EventArgs()); } }
protected void OnButtonUpMouseUp(MouseWithKeysEventArgs e) { if (ButtonUpPressed) { ButtonUpPressed = false; ButtonPushTimer.Stop(); } }
/// <summary> /// clear interval call /// </summary> public void ClearInterval() { if (myIntervalTimer != null) { myIntervalTimer.Stop(); } strTimerIntervalMethod = null; }
/// <summary> /// Stops the recording or the Pre-Start countdown. /// </summary> private void Stop() { try { FrameCount = 0; _capture.Stop(); FrameRate.Stop(); if (Stage != Stage.Stopped && Stage != Stage.PreStarting && Project.Any) { #region Stop ExitArg = ExitAction.Recorded; if (IsDialog) { DialogResult = false; } else { Close(); } #endregion } else if ((Stage == Stage.PreStarting || Stage == Stage.Snapping) && !Project.Any) { #region if Pre-Starting or in Snapmode and no Frames, Stops Stage = Stage.Stopped; //Enables the controls that are disabled while recording; FpsNumericUpDown.IsEnabled = true; HeightIntegerBox.IsEnabled = true; WidthIntegerBox.IsEnabled = true; IsRecording = false; Topmost = true; Title = FindResource("Board.Title") as string + " ■"; AutoFitButtons(); #endregion } } catch (NullReferenceException nll) { ErrorDialog.Ok(FindResource("Board.Title") as string, "Error while stopping", nll.Message, nll); LogWriter.Log(nll, "NullPointer on the Stop function"); } catch (Exception ex) { ErrorDialog.Ok(FindResource("Board.Title") as string, "Error while stopping", ex.Message, ex); LogWriter.Log(ex, "Error on the Stop function"); } }
public void StopWatching() { if (_checkProcess.IsBusy) { _checkProcess.CancelAsync(); } _checkTimer.Stop(); WinAPIHelper.UnhookWinEvent(_hook); }
public LiveCamIndicator() { watchdog.Interval = 1000; watchdog.Tick += (obj, args) => { curLiveState = false; watchdog.Stop(); ErrorStateDetected?.Invoke(this, new EventArgs()); }; }
public void StopSending() { timer.Stop(); if (mousekeyTimer != null) { mousekeyTimer.Stop(); } rtpClient.Dispose(); }
private void StartErrorRecovTimer() { timer.Stop(); timer.Interval = 200; timer.Tick -= FireTimer; timer.Tick += FireTimer; timer.Start(); }
private void submit_Click(object sender, RoutedEventArgs e) { uiTimer0_1.Tick -= BeepTimer0_1; uiTimer0_1.Stop(); this.Visibility = System.Windows.Visibility.Hidden; write_preferredrhythm(t); var main = App.Current.MainWindow as MainWindow; main.Task1Btn.Visibility = main.Task2Btn.Visibility = main.Task3Btn.Visibility = main.Task4Btn.Visibility = System.Windows.Visibility.Visible; }
public TvNotifyManager() { using (Settings xmlreader = new MPSettings()) { _enableRecNotification = xmlreader.GetValueAsBool("mytv", "enableRecNotifier", false); _preNotifyConfig = xmlreader.GetValueAsInt("mytv", "notifyTVBefore", 300); } _busy = false; _timer = new Timer(); _timer.Stop(); // check every 15 seconds for notifies _dummyuser = new User(); _dummyuser.IsAdmin = false; _dummyuser.Name = "Free channel checker"; _timer.Interval = 15000; _timer.Enabled = true; // Execute TvNotifyManager in a separate thread, so that it doesn't block the Main UI Render thread when Tvservice connection died new Thread(() => { _timer.Tick += new EventHandler(_timer_Tick); } ) {Name = "TvNotifyManager"}.Start(); _notifiedRecordings = new ArrayList(); }
public void Flash(TimeSpan duration) { if (Timer != null) { Timer.Stop(); } Enabled = true; Scanner.UpdateLedState(); Timer = new System.Windows.Forms.Timer(); Timer.Interval = (int)duration.TotalMilliseconds; Timer.Start(); Timer.Tick += new EventHandler(delegate(Object sender, EventArgs args) { Timer.Stop(); Enabled = false; Scanner.UpdateLedState(); }); }
public TimerMessageBox() { this.InitializeComponent(); // Insert code required on object creation below this point. int nSeconds=10; string sMessage=Application.Current.FindResource("MessageID325") as string; MsgContent.Text = string.Format(sMessage, nSeconds.ToString()); var timerLogoff = new System.Windows.Forms.Timer { Interval = 1000, Enabled = true }; timerLogoff.Tick += (object sender, EventArgs e) => { MsgContent.Text = string.Format(sMessage, nSeconds.ToString()); if (nSeconds == 0) { _DialogResult = "NO"; timerLogoff.Stop(); Hide(); } nSeconds--; }; }
internal static void LaunchGame() { string GameDirectory = Location; var p = new Process { StartInfo = { WorkingDirectory = GameDirectory, FileName = Path.Combine(GameDirectory, "League of Legends.exe") } }; p.Exited += p_Exited; p.StartInfo.Arguments = "\"8394\" \"" + RootLocation + "LoLLauncher.exe" + "\" \"" + "\" \"" + CurrentGame.ServerIp + " " + CurrentGame.ServerPort + " " + CurrentGame.EncryptionKey + " " + CurrentGame.SummonerId + "\""; p.Start(); var t = new Timer { Interval = 5000, }; t.Tick += (o, m) => { if (Region.Garena) return; GameScouter scouter = new GameScouter(); scouter.LoadScouter(LoginPacket.AllSummonerData.Summoner.Name); scouter.Show(); scouter.Activate(); t.Stop(); }; t.Start(); }
void XmppConnection_OnPresence(object sender, Presence pres) { if (jid.Bare.Contains(pres.From.User)) return; if (Client.InstaCall) { Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { var tr = new TextRange(ChatText.Document.ContentEnd, ChatText.Document.ContentEnd) { Text = Client.LoginPacket.AllSummonerData.Summoner.Name + ": " }; tr.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.OrangeRed); tr = new TextRange(ChatText.Document.ContentEnd, ChatText.Document.ContentEnd); if (Client.Filter) tr.Text = Client.CallString.Filter() + Environment.NewLine; else tr.Text = Client.CallString + Environment.NewLine; tr.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.White); Client.XmppConnection.Send(new Message(jid, Client.CallString)); ChatText.ScrollToEnd(); var t = new Timer { Interval = 10000 }; t.Start(); t.Tick += (o, e) => { Client.InstaCall = false; t.Stop(); }; })); } Dispatcher.BeginInvoke(DispatcherPriority.Input, new ThreadStart(() => { //Solve multipile joins if (firstPlayer == null) firstPlayer = pres.From.User; else { if (firstPlayer == pres.From.User) { Client.XmppConnection.MessageGrabber.Remove(jid); Client.XmppConnection.OnPresence -= XmppConnection_OnPresence; } } if (PreviousPlayers.Any(previousPlayer => previousPlayer == pres.From.User)) { return; } var tr = new TextRange(ChatText.Document.ContentEnd, ChatText.Document.ContentEnd) { Text = pres.From.Resource + " joined the room." + Environment.NewLine }; PreviousPlayers.Add(pres.From.User); tr.ApplyPropertyValue(TextElement.ForegroundProperty, Brushes.Yellow); ChatText.ScrollToEnd(); })); }
/// <summary> /// Method that starts or pauses the recording /// </summary> private void RecordPause() { Extras.CreateTemp(_pathTemp); switch (Stage) { case Stage.Stopped: #region To Record _capture = new Timer { Interval = 1000 / FpsNumericUpDown.Value }; _snapDelay = null; ListFrames = new List<FrameInfo>(); #region If Fullscreen if (Settings.Default.FullScreen) { _bt = new Bitmap((int)_sizeScreen.X, (int)_sizeScreen.Y); HideWindowAndShowTrayIcon(); } else { _bt = new Bitmap((int)((Width - 18) * _dpi), (int)((Height - 69) * _dpi)); } #endregion _gr = Graphics.FromImage(_bt); HeightTextBox.IsEnabled = false; WidthTextBox.IsEnabled = false; FpsNumericUpDown.IsEnabled = false; IsRecording(true); Topmost = true; _size = new System.Drawing.Size(_bt.Size.Width, _bt.Size.Height); FrameRate.Start(_capture.Interval); #region Start if (Settings.Default.PreStart) { Title = "Screen To Gif (2 " + Properties.Resources.TitleSecondsToGo; RecordPauseButton.IsEnabled = false; Stage = Stage.PreStarting; _preStartCount = 1; //Reset timer to 2 seconds, 1 second to trigger the timer so 1 + 1 = 2 _preStartTimer.Start(); } else { if (Settings.Default.ShowCursor) { #region If Show Cursor if (!Settings.Default.Snapshot) { #region Normal Recording if (!Settings.Default.FullScreen) { //To start recording right away, I call the tick before starting the timer, //because the first tick will only occur after the delay. _capture.Tick += Cursor_Elapsed; //Cursor_Elapsed(null, null); _capture.Start(); } else { _capture.Tick += FullCursor_Elapsed; //FullCursor_Elapsed(null, null); _capture.Start(); } Stage = Stage.Recording; RecordPauseButton.Text = Properties.Resources.Pause; RecordPauseButton.Content = (Canvas)FindResource("Vector.Pause"); RecordPauseButton.HorizontalContentAlignment = HorizontalAlignment.Left; AutoFitButtons(); #endregion } else { #region SnapShot Recording //Set to Snapshot Mode, change the text of the record button to "Snap" and //every press of the button, takes a screenshot Stage = Stage.Snapping; RecordPauseButton.Content = (Canvas)FindResource("Vector.Camera.Old"); RecordPauseButton.Text = Properties.Resources.btnSnap; RecordPauseButton.HorizontalContentAlignment = HorizontalAlignment.Left; Title = "Screen To Gif - " + Properties.Resources.Con_SnapshotMode; AutoFitButtons(); #endregion } #endregion } else { #region If Not if (!Settings.Default.Snapshot) { #region Normal Recording _actHook.OnMouseActivity += MouseHookTarget; if (!Settings.Default.FullScreen) { _capture.Tick += Normal_Elapsed; //Normal_Elapsed(null, null); _capture.Start(); } else { _capture.Tick += Full_Elapsed; //Full_Elapsed(null, null); _capture.Start(); } Stage = Stage.Recording; RecordPauseButton.Text = Properties.Resources.Pause; RecordPauseButton.Content = (Canvas)FindResource("Vector.Pause"); RecordPauseButton.HorizontalContentAlignment = HorizontalAlignment.Left; AutoFitButtons(); #endregion } else { #region SnapShot Recording Stage = Stage.Snapping; RecordPauseButton.Content = (Canvas)FindResource("Vector.Camera.Old"); RecordPauseButton.Text = Properties.Resources.btnSnap; RecordPauseButton.HorizontalContentAlignment = HorizontalAlignment.Left; Title = "Screen To Gif - " + Properties.Resources.Con_SnapshotMode; AutoFitButtons(); #endregion } #endregion } } break; #endregion #endregion case Stage.Recording: #region To Pause Stage = Stage.Paused; RecordPauseButton.Text = Properties.Resources.btnRecordPause_Continue; RecordPauseButton.Content = (Canvas)FindResource("Vector.Record.Dark"); RecordPauseButton.HorizontalContentAlignment = HorizontalAlignment.Left; Title = Properties.Resources.TitlePaused; AutoFitButtons(); _capture.Stop(); //ModifyCaptureTimerAndChangeTrayIconVisibility(false); FrameRate.Stop(); break; #endregion case Stage.Paused: #region To Record Again Stage = Stage.Recording; RecordPauseButton.Text = Properties.Resources.Pause; RecordPauseButton.Content = (Canvas)FindResource("Vector.Pause"); RecordPauseButton.HorizontalContentAlignment = HorizontalAlignment.Left; Title = Properties.Resources.TitleRecording; AutoFitButtons(); FrameRate.Start(_capture.Interval); _capture.Start(); break; //ModifyCaptureTimerAndChangeTrayIconVisibility(true); #endregion case Stage.Snapping: #region Take Screenshot (All possibles types) _snapDelay = Settings.Default.SnapshotDefaultDelay; if (Settings.Default.ShowCursor) { if (Settings.Default.FullScreen) { FullCursor_Elapsed(null, null); } else { Cursor_Elapsed(null, null); } } else { if (Settings.Default.FullScreen) { Full_Elapsed(null, null); } else { Normal_Elapsed(null, null); } } break; #endregion } }
public SettingsMenu(MainMenu MenuParent) { Parent = MenuParent.ParentWindow; ParentMenu = MenuParent; soundStatus = Properties.Settings.Default.SoundStatus; musicStatus = Properties.Settings.Default.MusicStatus; mainTimer = new Timer(); mainTimer.Interval = 10; titleLabel = new Label(); titleLabel.Text = "Settings"; titleLabel.Location = new Vector(100, -250.5f); toggleSoundLabel = new Label(); toggleSoundLabel.Location = new Vector(130, -220.5f); toggleSoundLabel.Text = "Sound: " + (soundStatus ? "On " : "Off"); toggleSound = new Button(); toggleSound.Location = new Vector(270, -220.5f); toggleSound.ApplyStylishEffect(); toggleSound.Size = new Vector(70, 20); toggleSound.Image = "data/img/bck.bmp"; toggleSound.Text = "Toggle"; toggleSound.MouseClick += (pos) => { soundStatus = soundStatus ? false : true; toggleSoundLabel.Text = "Sound: " + (soundStatus ? "On " : "Off"); }; saveButton = new Button(); saveButton.Location = new Vector(200, -30); saveButton.Image = "data/img/bck.bmp"; saveButton.ApplyStylishEffect(); saveButton.Text = "Save"; saveButton.MouseClick += (pos) => SaveAndHide(); toggleMusicLabel = new Label(); toggleMusicLabel.Location = new Vector(130, -180.5f); toggleMusicLabel.Text = "Music: " + (musicStatus ? "On " : "Off"); toggleMusic = new Button(); toggleMusic.Location = new Vector(270, -180.5f); toggleMusic.ApplyStylishEffect(); toggleMusic.Size = new Vector(70, 20); toggleMusic.Image = "data/img/bck.bmp"; toggleMusic.Text = "Toggle"; toggleMusic.MouseClick += (pos) => { musicStatus = musicStatus ? false : true; toggleMusicLabel.Text = "Music: " + (musicStatus ? "On " : "Off"); }; deleteSaveGames = new Button(); deleteSaveGames.Location = new Vector(150, -120.5f); deleteSaveGames.ApplyStylishEffect(); deleteSaveGames.Image = "data/img/bck.bmp"; deleteSaveGames.Text = "Delete saved games"; deleteSaveGames.MouseClick += (pos) => { Game.Game.DeleteProgress(false); Game.Game.LoadGame(); SaveAndHide(); }; deleteSaveGames.Size = new Vector(160, 25); Parent.AddChildren(toggleSound, saveButton, toggleMusicLabel, toggleMusic, deleteSaveGames); mainTimer.Tick += (o, e) => { //lazy delay implementation //TODO: maybe fix elapsed++; if (elapsed < 10) return; if (curShift < destShift) { curShift += shiftIncr; titleLabel.Location.Y -= curShift; toggleSoundLabel.Location.Y -= curShift; toggleSound.Location.Y -= curShift; saveButton.Location.Y -= curShift; toggleMusicLabel.Location.Y -= curShift; toggleMusic.Location.Y -= curShift; deleteSaveGames.Location.Y -= curShift; return; } mainTimer.Stop(); }; }
public PlayGameMenu(MainMenu menuParent) { MenuParent = menuParent; Parent = menuParent.ParentWindow; resumeGameButton = new Button(); resumeGameButton.Text = "Resume Game"; resumeGameButton.Location = new Vector(255, 0); resumeGameButton.ApplyStylishEffect(); resumeGameButton.Size.X -= 10; resumeGameButton.Image = "data/img/bck.bmp"; resumeGameButton.MouseClick += (pos) => { Game.Game.ResumeGame(); Hide(); MenuParent.HideMenu(); }; newGameButton = new Button(); newGameButton.Text = "New Game"; newGameButton.Location = new Vector(250, 0); newGameButton.ApplyStylishEffect(); newGameButton.Image = "data/img/bck.bmp"; newGameButton.MouseClick += (pos) => { Game.Game.NewGame(); Hide(); MenuParent.HideMenu(); }; backButton = new Button(); backButton.Text = "Back"; backButton.Location = new Vector(265, 0); backButton.ApplyStylishEffect(); backButton.Image = "data/img/bck.bmp"; backButton.Size.X -= 30; backButton.MouseClick += (pos) => Hide(); mainTimer = new Timer(); mainTimer.Interval = 10; mainTimer.Tick += (o, e) => { if (curShift < destShift) { curShift += shiftIncr; resumeGameButton.Location.Y -= curShift; newGameButton.Location.Y -= curShift; backButton.Location.Y -= curShift; return; } mainTimer.Stop(); }; resumeGameButton.Location.Y = -250.5f; newGameButton.Location.Y = -220.5f; backButton.Location.Y = -1900.5f; Parent.AddChildren(resumeGameButton, newGameButton, backButton); canResume = Game.Game.CheckProgress(); if (!canResume) { Parent.Children.Remove(resumeGameButton); Parent.Children.Add(this); } }
/// <summary> /// Adjust the scrollbar of the panel on html element by the given id.<br/> /// The top of the html element rectangle will be at the top of the panel, if there /// is not enough height to scroll to the top the scroll will be at maximum.<br/> /// </summary> /// <param name="elementId">the id of the element to scroll to</param> public virtual void ScrollToElement(string elementId, out string result, out List<string> availableIds) { availableIds = new List<string>(); result = "_htmlContainer is null"; ArgChecker.AssertArgNotNullOrEmpty(elementId, "elementId"); if (_htmlContainer != null) { result = "id not found"; CssBox box = null; var rect = _htmlContainer.GetElementRectangle(elementId, out availableIds, out box); if (rect.HasValue) { result = "";//Scrolled to " + rect.Value.Location.X + ":" + rect.Value.Location.Y; Dispatcher.Invoke(new Action(() => { ScrollToPoint(rect.Value.Location.X, Math.Max(rect.Value.Location.Y - 50, 0)); box.BorderLeftColor = "red"; box.BorderLeftStyle = "solid"; box.BorderLeftWidth = "2px"; box.PaddingLeft = "3px"; System.Windows.Forms.Timer t = new System.Windows.Forms.Timer(); t.Interval = 300; this.InvalidateVisual(); int counter = 0; t.Tick += (sen, ev) => { if (counter == 6) { t.Stop(); box.BorderLeftColor = "black"; box.BorderLeftStyle = "none"; box.BorderLeftWidth = "0"; box.PaddingLeft = "0"; } if (counter % 2 == 0) box.BorderLeftWidth = "2px"; else box.BorderLeftWidth = "0px"; this.InvalidateVisual(); counter++; }; t.Start(); _htmlContainer.HandleMouseMove(this, Mouse.GetPosition(this)); })); } } }
/// <summary> /// Method that starts or pauses the recording /// </summary> private void RecordPause() { Extras.CreateTemp(_pathTemp); switch (Stage) { case Stage.Stopped: #region To Record _capture = new Timer {Interval = 1000/(int) FpsNumericUpDown.Value}; _snapDelay = null; ListFrames = new List<FrameInfo>(); HeightTextBox.IsEnabled = false; WidthTextBox.IsEnabled = false; FpsNumericUpDown.IsEnabled = false; IsRecording(true); Topmost = true; FrameRate.Start(_capture.Interval); #region Start if (!Settings.Default.Snapshot) { #region Normal Recording _capture.Tick += Normal_Elapsed; //Normal_Elapsed(null, null); _capture.Start(); Stage = Stage.Recording; AutoFitButtons(); #endregion } else { #region SnapShot Recording Stage = Stage.Snapping; Title = "Board Recorder - " + Properties.Resources.Con_SnapshotMode; AutoFitButtons(); #endregion } break; #endregion #endregion case Stage.Recording: #region To Pause Stage = Stage.Paused; Title = FindResource("Recorder.Paused").ToString(); AutoFitButtons(); _capture.Stop(); FrameRate.Stop(); break; #endregion case Stage.Paused: #region To Record Again Stage = Stage.Recording; Title = "Board Recorder"; AutoFitButtons(); FrameRate.Start(_capture.Interval); _capture.Start(); break; #endregion case Stage.Snapping: #region Take Screenshot (All possibles types) _snapDelay = Settings.Default.SnapshotDefaultDelay; Normal_Elapsed(null, null); break; #endregion } }
private void accountButton_Click(object sender, RoutedEventArgs e) { this.userNamestackPanel.Visibility = System.Windows.Visibility.Collapsed; this.currentUser.name = this.Username.Text; int count = 4; System.Windows.Forms.Timer myTimer = new System.Windows.Forms.Timer(); System.Windows.Point center = new System.Windows.Point(RenderWidth/2, RenderHeight/2); myTimer.Interval = 1000; myTimer.Start(); myTimer.Tick += (_, a) => { if (count-- == 1) { myTimer.Stop(); if (this.isUserNew) { this.myImageBox.Visibility = Visibility.Collapsed; this.scanpanel.Visibility = System.Windows.Visibility.Visible; } else { this.progressBar1.Width = 170; this.myImageBox.Visibility = Visibility.Collapsed; this.scanpanel.Visibility = System.Windows.Visibility.Visible; this.progressBar2.Visibility = System.Windows.Visibility.Collapsed; this.progressBar3.Visibility = System.Windows.Visibility.Collapsed; } this.isfaceTrackerOn = true; faceTrackingViewer.setSensor(this.sensor); CurrentObjectBag.SCurrentFaceClassifier.OnUserReceived += new GiveUser(GiveUser); } else { this.myImageBox.Visibility = Visibility.Visible; using (DrawingContext dc = this.liveFeedbackGroup.Open()) { //dc.DrawEllipse(Brushes.Red, inferredBonePen,center,20, 20); this.myImageBox.Source = handSource; dc.DrawText( new FormattedText(count.ToString(), System.Globalization.CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, new Typeface("Verdana"), 40, System.Windows.Media.Brushes.Black), new System.Windows.Point(RenderWidth / 3, RenderHeight/ 3)); } } }; }
//-------------------------------------------------------------------------------------------- private void InitUIUpdates() { var timer = new System.Windows.Forms.Timer { Interval = 100 }; timer.Tick += delegate { List<string> duplicated_group = null; while ((duplicated_group = getNextDuplicatedGroupOfFiles()) != null) { OnDuplocatedGroupFound(duplicated_group); if (IsRunning()) break; } if (!IsRunning()) { timer.Stop(); if (OnProcessingFinished != null) OnProcessingFinished(); } if (OnProgressStarted != null && m_should_notify_progress_type_changed) { OnProgressStarted(m_current_progress_type); m_should_notify_progress_type_changed = false; } if (OnProgressChanged != null && m_current_progress_type == ProgressType.Determinate) OnProgressChanged(m_progress); }; timer.Start(); }