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; }
protected override void OnDeactivated() { if (t != null) { t.Stop(); t.Dispose(); } // Unsubscribe from previously subscribed events and release other references and resources. base.OnDeactivated(); }
//timer tick event private void Timer_Tick(object sender, EventArgs e) { if (!(numTicks < 600)) { whir.Open(whirsound); whir.Play(); } if ((numTicks > (totalTicks / 4)) && (numTicks % (totalTicks / 3) == 0)) { sound.Open(slothitsound); sound.Play(); } if (numTicks <= (totalTicks / 3)) { slots.Shuffle(); Slot1.Content = slots.First(); Slot1.Background = HandleData.GetClassColor(slots.First()); slots.Shuffle(); Slot2.Content = slots.First(); Slot2.Background = HandleData.GetClassColor(slots.First()); slots.Shuffle(); Slot3.Content = slots.First(); Slot3.Background = HandleData.GetClassColor(slots.First()); } else if (numTicks <= (2 * (totalTicks / 3))) { slots.Shuffle(); Slot2.Content = slots.First(); Slot2.Background = HandleData.GetClassColor(slots.First()); slots.Shuffle(); Slot3.Content = slots.First(); Slot3.Background = HandleData.GetClassColor(slots.First()); } else if (numTicks < totalTicks) { slots.Shuffle(); Slot3.Content = slots.First(); Slot3.Background = HandleData.GetClassColor(slots.First()); } numTicks += 100; if (numTicks >= totalTicks) { sound.Open(slothitsound); sound.Play(); timer.Stop(); timer.Dispose(); DisplayResult(); numTicks = 0; timer = null; } }
private static void StartTimedColourSession(int milliseconds) { if (timer != null) { timer.Dispose(); } timer = new System.Windows.Forms.Timer(); timer.Interval = milliseconds; timer.Tick += new EventHandler(BackToGrayscaleWhenTimedModeEnds); timer.Start(); AppState.GoColour(); }
public void AutoFlash(int interleave) { if (_timer != null) { _timer.Stop(); _timer.Dispose(); } _timer = new System.Windows.Forms.Timer(); _timer.Interval = interleave; _timer.Tick += new EventHandler(_timer_Tick); _timer.Start(); }
public override void Dispose() { if (fs != null) fs.Dispose(); timer.Dispose(); }
//private void WidgetControlWPF_Loaded( object sender, RoutedEventArgs e ) //{ // //innerControl = new WidgetControlWinForms(); // //HostControl.Child = innerControl; //} //protected override void OnInitialized( EventArgs e ) //{ // base.OnInitialized( e ); // if( DesignerProperties.GetIsInDesignMode( this ) ) // return; //} private void InnerControl_DestroyEvent( EngineViewportControl sender ) { allInstances.Remove( this ); updateTimer?.Dispose(); updateTimer = null; }
public void Timeout(float time, System.Action action) { System.Windows.Forms.Timer t = new System.Windows.Forms.Timer(); t.Tick += new EventHandler((o, s) => { t.Dispose(); action(); }); t.Interval = (int)(time * 1000); t.Enabled = true; }
/// <summary> /// One "Turn" of the game. Decrements the count variable. If there are 2 or more hidden tiles, un-hide one. /// If count is '0' then hide a random tile then generate a new counter. /// </summary> public void gameTick(System.Windows.Forms.Timer time) //Ran each sec for the alloted time { --count; //decremete counter for hiding tile --timer; if (lives < 0) { time.Dispose(); } if (hiddenList.Count >= 2) //if there are 1 or more hidden tiles unhide one { //Would like to add a way to randomize the queue if we countine with this method in the future var temp = hiddenList.Dequeue(); board[int.Parse(temp.Item1.ToString()), int.Parse(temp.Item2.ToString())].tile.Show(); } if (count < 0) { //when the count is 0 its tile to hide a tile int aa = rand.Next(1, n); //Needs to be based on number of tiles on the board for (int x = 0; x < aa; ++x) { int i = rand.Next(n); int j = rand.Next(n); //Gather random i and j values hideTileImage(i, j); } } label_timer.Text = timer.ToString(); }
public void Dispose()//удаление тетриса { timer.Stop(); field = null; timer.Dispose(); figure = null; }
/// <summary> /// shutdown game engine. /// call it one time on application exit. /// </summary> public static void Shutdown() { foreach (var initializable in Globals.MEFContainer.GetExportedValues <XLEBridgeUtils.IShutdownWithEngine>()) { initializable.Shutdown(); } foreach (var keyValue in s_idToDomNode) { DestroyObject( keyValue.Key.Item1, keyValue.Key.Item2, keyValue.Value.TypeId); } s_idToDomNode.Clear(); s_foregroundUpdateTimer.Stop(); s_foregroundUpdateTimer.Dispose(); s_foregroundUpdateTimer = null; s_loggingRedirect.Dispose(); s_loggingRedirect = null; XLEBridgeUtils.Utils.DetachLibrary(); Util3D.Shutdown(); XLEBridgeUtils.Utils.GlobalSceneManager = null; s_entityInterface = null; s_underlyingScene.Dispose(); s_underlyingScene = null; s_retainedRenderResources.Dispose(); s_retainedRenderResources = null; s_engineDevice.Dispose(); s_engineDevice = null; GlobalSelection.Dispose(); GlobalSelection = null; CriticalError = s_notInitialized; }
public static void Dispose() { Core.ChatNameClicked -= HandleChatCommand; mHost = null; mCore = null; mFileService = null; mMainPluginThread = null; mQueuedActions.Clear(); mQueuedActions = null; mChatActions.Clear(); mChatActions = null; if (mActionQueueTimer != null) { mActionQueueTimer.Dispose(); mActionQueueTimer = null; } if (mDebugWriter != null) { mDebugWriter.Dispose(); mDebugWriter = null; } }
public ReactorContainer <T> Stop() { _timerRenderer.Stop(); _timerRenderer.Tick -= _timerRenderer_Tick; _timerRenderer.Dispose(); _timerRenderer = null; return(this); }
public void Dispose() { Stop(); Close(); _timer.Stop(); _timer.Dispose(); _timer = null; }
public void Deinit() { timer.Enabled = false; timer.Tick -= new EventHandler(timer_Tick); timer.Dispose(); timer = null; disposed = true; }
private void OnClosing(object sender, CancelEventArgs e) { if (_timer != null) { _timer.Stop(); _timer.Dispose(); } }
public override void Unload() { updateTimer.Stop(); base.Unload(); updateTimer.Dispose(); updateTimer = null; VisualizerImage = null; }
protected override void Dispose(bool disposing) { base.Dispose(disposing); if (disposing) { _timer.Dispose(); } }
public void ServerTerminate() { if (null != timer) { timer.Dispose(); timer = null; } }
/// <summary> /// Clean up the running timers /// </summary> public void Dispose() { if (tmrDoNotesUp != null) { tmrDoNotesUp.Stop(); tmrDoNotesUp.Dispose(); } }
protected sealed override void Dispose(bool disposible) { if (fs != null) { fs.Dispose(); } timer.Dispose(); base.Dispose(); }
/// <summary> /// Cleanup the <see cref="Timer"/> /// </summary> private void ClearTimer() { if (null != timer) { timer.Tick -= timerTick; timer.Dispose(); timer = null; } }
private void imageTimerTick(Object sender, EventArgs e) { --imageHideCounter; if (imageHideCounter < 1) { totalTileCount--; imageTime.Dispose(); } }
public void Dispose() { if (fs != null) { fs.Dispose(); } timer.Dispose(); }
/// <summary> /// 确认倒计时 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void confirmTimer_Tick(object sender, EventArgs e) { if (count > 1) { count--; this.okButton.Content = this.okContent + "(" + count.ToString() + ")"; } else { this.okButton.Content = this.okContent; IsOk = true; isAllowClose = true; isUseTimeOutTare = Convert.ToBoolean(this.TareTimeOutCheckBox.IsChecked);//设定是否选中使用 超期的皮重 confirmTimer.Stop(); confirmTimer.Dispose(); this.Close(); } }
protected override void OnClosed(EventArgs e) { if (t != null) { t.Dispose(); t = null; } base.OnClosed(e); }
private void ChangeVisiblePanelVersion(bool onLoad = false) { bool fadingIn = false; if (!onLoad) { fadingIn = GridListVersion.Opacity <= 0; System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer(); timer.Tick += (sender, e) => { if (fadingIn) { GridListVersion.Visibility = _openedGridListVersion ? Visibility.Visible : Visibility.Hidden; if ((GridListVersion.Opacity += 0.1d) >= 1) { timer.Stop(); timer.Dispose(); } } else { if ((GridListVersion.Opacity -= 0.1d) <= 0) { timer.Stop(); timer.Dispose(); } } }; timer.Disposed += (sender, e) => GridListVersion.Visibility = _openedGridListVersion ? Visibility.Visible : Visibility.Hidden; timer.Interval = 50; timer.Start(); } else { GridListVersion.Opacity = 0; } _openedGridListVersion = fadingIn; ButtonVersions.FontWeight = _openedGridListVersion ? FontWeights.Heavy : FontWeights.Normal; }
private void Timer_Tick(object sender, EventArgs e) { timer.Stop(); timer.Dispose(); //mw = new MainWindow(Mw_onSettingsLoaded); //mw.Visibility = Visibility.Collapsed; //mw.Show(); //mw.Visibility = Visibility.Collapsed; }
public override void Dispose() { if (flashTimer != null) { flashTimer.Stop(); flashTimer.Dispose(); } base.Dispose(); }
public override void Unload() { updateTimer.Stop(); base.Unload(); updateTimer.Dispose(); updateTimer = null; visualizerCache = null; VisualizerImage = null; activeObserver = null; }
/// <summary> /// 延迟执行 /// </summary> /// <param name="delayTime">延迟时间,毫秒</param> /// <param name="execute">执行函数</param> public static void DelayExecuteWin(int delayTime, Action execute) { var time = new System.Windows.Forms.Timer(); time.Interval = delayTime; time.Tick += (s, e) => { time.Enabled = false; if (execute != null) { execute(); } time.Dispose(); }; time.Enabled = true; }
/// <summary> /// Initializes WinForms and starts the message loop. Blocks until <see cref="Terminate"/> is called. /// </summary> public void Run() { _guiThread = Thread.CurrentThread; Application.CurrentUICultureChanged += Application_CurrentUICultureChanged; // this must be called before any GUI objects are created - otherwise we get problems with icons not showing up System.Windows.Forms.Application.EnableVisualStyles(); // create a timer to raise the Started event from the message pump System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer(); timer.Interval = 100; timer.Tick += delegate(object sender, EventArgs args) { // immediately disable the timer so we don't get a second Tick timer.Dispose(); EventsHelper.Fire(_started, this, EventArgs.Empty); }; timer.Enabled = true; // start the message pump System.Windows.Forms.Application.Run(); }