private void OnDisconnectItemClick(object sender, EventArgs e) { Connection?.Close(); Connection = null; _updateTimer?.Change(0, 0); _updateTimer = null; }
protected PointCapture() { _pointerInputTargetWindow = new PointerInputTargetWindow(); _inputProvider = new InputProvider(); _pointEventTranslator = new PointEventTranslator(_inputProvider); _pointEventTranslator.PointDown += (PointEventTranslator_PointDown); _pointEventTranslator.PointUp += (PointEventTranslator_PointUp); _pointEventTranslator.PointMove += (PointEventTranslator_PointMove); _winEventDele = WinEventProc; _hWinEventHook = SetWinEventHook(EVENT_SYSTEM_FOREGROUND, EVENT_SYSTEM_MINIMIZEEND, IntPtr.Zero, _winEventDele, 0, 0, WINEVENT_OUTOFCONTEXT | WINEVENT_SKIPOWNPROCESS); if (AppConfig.UiAccess) { _blockTouchDelayTimer = new System.Threading.Timer(UpdateBlockTouchInputThresholdCallback, null, Timeout.Infinite, Timeout.Infinite); ForegroundApplicationsChanged += PointCapture_ForegroundApplicationsChanged; } ModeChanged += (o, e) => { if (e.Mode == CaptureMode.UserDisabled) { _pointerInputTargetWindow.BlockTouchInputThreshold = 0; } }; _timeoutTimer.Tick += GestureRecognizedCallback; }
private void OpenSettingsDialog(Object state) { _timerForOpenSettingsDialog.Dispose(); _timerForOpenSettingsDialog = null; var tab = state as String; WorkspaceView.OpenSettingsDialog(tab); }
/// <summary> /// Handle showing the settings dialog, opening it to the desired tab. /// </summary> /// <remarks> /// This is here instead of CollectionSettingsApi because we have easier access to /// showing the dialog via the WorkspaceView object. But it's a bit tricky getting /// the dialog to display, and allowing the dialog to display help or to restart /// the program if the user changes the settings. Starting the dialog after a very /// brief delay, and being sure in WorkSpaceView to Invoke it on the UI thread, /// allows the full functionality without any crashes or annoying yellow dialog boxes. /// </remarks> private void HandleShowSettingsDialog(ApiRequest request) { lock (request) { var tab = request.Parameters["tab"]; _timerForOpenSettingsDialog = new System.Threading.Timer(OpenSettingsDialog, tab, 100, System.Threading.Timeout.Infinite); request.PostSucceeded(); } }
private void SetUpTimer(TimeSpan alertTime) { DateTime current = DateTime.Now; TimeSpan timeToGo = alertTime - current.TimeOfDay; if (timeToGo < TimeSpan.Zero) { return;//time already passed } this.timer = new System.Threading.Timer(x => { this.testtyping(); }, null, timeToGo, Timeout.InfiniteTimeSpan); }
public static void SetTaskAtFixedTime() { DateTime now = DateTime.Now; DateTime oneOClock = DateTime.Today.AddHours(0); if (now > oneOClock) { oneOClock = oneOClock.AddDays(1.0); } int msUntilFour = (int)((oneOClock - now).TotalMilliseconds); var t = new System.Threading.Timer(DoAt); t.Change(msUntilFour, Timeout.Infinite); }
private void SetUpTimer(TimeSpan alertTime) { try { Log("SetUpTimer"); DateTime current = DateTime.Now; TimeSpan timeToGo = alertTime - current.TimeOfDay; if (timeToGo < TimeSpan.Zero) { Log("time already pass - return"); return;//time already passed } this.scheduleTimer = new System.Threading.Timer(x => { Log("예약실행 - GotoClick"); this.GotoClick(); }, null, timeToGo, Timeout.InfiniteTimeSpan); } catch (Exception e) { Log($"exception : {e.Message}"); } }
private void OnConnectItemClick(object sender, EventArgs e) { _connectionForm.SetPassword(Environment.GetEnvironmentVariable("db_pass")); _connectionForm.Visible = true; _updateTimer = new System.Threading.Timer(TickTimer, null, 1000, 1000); }