/// <summary> /// Logic for mouse enter mainwindow event /// </summary> /// <param name="sender"></param> /// <param name="e"></param> internal static void Interface_MouseEnter(object sender, MouseEventArgs e) { if (!ActivityTimer.Enabled || Scroll.IsAutoScrolling) { ActivityTimer.Start(); } }
async void OnTakeABreak(object sender, EventArgs args) { ActivityTimer.Stop(); OnSwitchingPages(); await App.Navigation.PushAsync(new TakingBreakPage(this, CurrentActivity)); }
/// <summary> /// Create a span record for the given span type. Must have a corresponding Leave. /// </summary> /// <param name="spanType"></param> public static void Enter(string spanType) { if (comm == null) { return; } var time = DateTime.UtcNow; ActivityTimer timer; if (!activityTimers.TryGetValue(spanType, out timer)) { timer = new ActivityTimer(); activityTimers.TryAdd(spanType, timer); } timer.Enter(time); if (records != null) { var spanRecord = new SpanRecord(comm.Rank, spanType, time.Ticks, isStart: true); lock (recordLock) { records.Add(spanRecord); } } Logging?.Invoke(comm.Rank, spanType, time, true); }
/// <summary> /// Unsubscribe to activity polling. /// </summary> public static void UnsubscribeToActivity() { if (ActivityTimer != null) { ActivityTimer.Change(Timeout.InfiniteTimeSpan, Timeout.InfiniteTimeSpan); ActivityTimer.Dispose(); ActivityTimer = null; } }
//on client form load private void ClientForm_Load(object sender, EventArgs e) { //set up activity timer ActivityTimer.Tick += new System.EventHandler(ActivityTimer_Tick); ActivityTimer.Start(); //defaults message recipient to all privateMessageBox.SelectedIndex = 0; }
public RegisterActivityViewModel(INavigation nav, Xamarin.Forms.Maps.Map map) { _nav = nav; viewMap = map; dialogs = UserDialogs.Instance; Model = new RecordActivityModel(); locator = CrossGeolocator.Current; Activity = new ActivityTimer(OnTimerTick, TimeSpan.FromSeconds(0), TimeSpan.FromSeconds(1)); LoadCommands(); }
/// <summary> /// Subscribe to activity polling. /// </summary> public static void SubscribeToActivity() { if (ActivityTimer == null) { ActivityTimer = new Timer(new TimerCallback(ActivityTimerCallback)); } RepositoryActivityTask = null; ActivityTimer.Change(DefaultActivityPollingTime, DefaultActivityPollingTime); }
public async Task SetActivity(Activity newActivity) { CurrentActivity = newActivity; if (CurrentActivity == null) { ActivityTimer.Reset(); } else { CurrentActivity.StartTime = DateTime.Now; } }
private void StartTimingActivity() { LytCurrentActivity.Children.Clear(); ActivityView aView = new ActivityView(CurrentActivity); aView.AsTimerView(); LytCurrentActivity.Children.Add(aView); LytIndicator.IsVisible = false; LytTimer.IsVisible = true; ActivityTimer.Start(); }
internal static void ShowMinimalInterface() { ShowTopandBottom(false); ShowNavigation(true); ShowShortcuts(true); Properties.Settings.Default.ShowInterface = false; if (ActivityTimer != null) { ActivityTimer.Start(); } }
internal static void ShowStandardInterface() { Properties.Settings.Default.ShowInterface = true; ShowTopandBottom(true); ShowNavigation(false); ShowShortcuts(false); if (ActivityTimer != null) { ActivityTimer.Stop(); } }
private async void OpenStopActivityPage() { CurrentActivity.EndTime = DateTime.Now; ActivityTimer.Stop(); OnSwitchingPages(); bool next = false; if (HasStoppedActivity || IsStopWorkday) { next = true; } await App.Navigation.PushAsync(new StopActivityPage(this, CurrentActivity, next)); }
/// <summary> /// Dispose the control /// </summary> /// <param name="disposing">If a disposing is already processing</param> private void Dispose(bool disposing) { if (_disposed) { return; } Loaded -= OnLoaded; MediaPlayerTimer.Tick -= MediaPlayerTimerTick; MediaPlayerTimer.Stop(); ActivityTimer.Tick -= OnInactivity; ActivityTimer.Stop(); InputManager.Current.PreProcessInput -= OnActivity; Player.VlcMediaPlayer.EndReached -= MediaPlayerEndReached; MediaPlayerIsPlaying = false; Player.Stop(); Player.Dispose(); var window = System.Windows.Window.GetWindow(this); if (window != null) { window.Cursor = Cursors.Arrow; } var vm = DataContext as MediaPlayerViewModel; if (vm != null) { vm.StoppedPlayingMedia -= OnStoppedPlayingMedia; } _disposed = true; if (disposing) { GC.SuppressFinalize(this); } }
/// <summary> /// Dispose the control /// </summary> /// <param name="disposing">If a disposing is already processing</param> private void Dispose(bool disposing) { if (Disposed) { return; } Loaded -= OnLoaded; MediaPlayerTimer.Tick -= MediaPlayerTimerTick; MediaPlayerTimer.Stop(); ActivityTimer.Tick -= OnInactivity; ActivityTimer.Stop(); InputManager.Current.PreProcessInput -= OnActivity; Player.VlcMediaPlayer.EndReached -= MediaPlayerEndReached; MediaPlayerIsPlaying = false; Task.Run(() => { Player.Stop(); //Player.Dispose(); DispatcherHelper.CheckBeginInvokeOnUI(() => { var vm = DataContext as MoviePlayerViewModel; if (vm != null) { vm.StoppedPlayingMedia -= OnStoppedPlayingMedia; } Disposed = true; if (disposing) { GC.SuppressFinalize(this); } }); }); }
//submit button clicked private void SubmitButtonClick(object sender, EventArgs e) { //if message is set to send to all then send username and message to all clients if (privateMessageBox.SelectedIndex == 0) { mClient.SendChatMessage(InputField.Text, UsernameInput.Text); } //send message and username to the user ID selected else { mClient.SendPrivateMessage(InputField.Text, UsernameInput.Text, privateMessageBox.SelectedIndex - 1); } //clear input text InputField.Clear(); //reset activity timer ActivityTimer.Stop(); ActivityTimer.Start(); }
/// <summary> /// Dispose the control /// </summary> /// <param name="disposing">If a disposing is already processing</param> private void Dispose(bool disposing) { if (Disposed) { return; } Loaded -= OnLoaded; MediaPlayerTimer.Tick -= MediaPlayerTimerTick; MediaPlayerTimer.Stop(); ActivityTimer.Tick -= OnInactivity; ActivityTimer.Stop(); InputManager.Current.PreProcessInput -= OnActivity; Player.MediaEnded -= MediaPlayerEndReached; MediaPlayerIsPlaying = false; Player.Stop(); Player.Close(); Player.Dispose(); var vm = DataContext as MoviePlayerViewModel; if (vm != null) { vm.StoppedPlayingMedia -= OnStoppedPlayingMedia; } Disposed = true; if (disposing) { GC.SuppressFinalize(this); } }
private void RestartTimer() { MyActivityCounter = 0; ActivityTimer.Start(); ShowTimeLeft(); }
/// <summary> /// Stops the timer that controls the stepping of activities. /// </summary> protected virtual void StopActivityTimer() { ActivityTimer.Stop(); }
/// <summary> /// Starts the timer that controls the stepping of activities. /// </summary> protected virtual void StartActivityTimer() { ActivityTimer.Start(); }