Exemplo n.º 1
0
 /// <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();
     }
 }
Exemplo n.º 2
0
        async void OnTakeABreak(object sender, EventArgs args)
        {
            ActivityTimer.Stop();

            OnSwitchingPages();
            await App.Navigation.PushAsync(new TakingBreakPage(this, CurrentActivity));
        }
Exemplo n.º 3
0
        /// <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);
        }
Exemplo n.º 4
0
 /// <summary>
 /// Unsubscribe to activity polling.
 /// </summary>
 public static void UnsubscribeToActivity()
 {
     if (ActivityTimer != null)
     {
         ActivityTimer.Change(Timeout.InfiniteTimeSpan, Timeout.InfiniteTimeSpan);
         ActivityTimer.Dispose();
         ActivityTimer = null;
     }
 }
Exemplo n.º 5
0
        //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();
 }
Exemplo n.º 7
0
        /// <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);
        }
Exemplo n.º 8
0
        public async Task SetActivity(Activity newActivity)
        {
            CurrentActivity = newActivity;

            if (CurrentActivity == null)
            {
                ActivityTimer.Reset();
            }
            else
            {
                CurrentActivity.StartTime = DateTime.Now;
            }
        }
Exemplo n.º 9
0
        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();
        }
Exemplo n.º 10
0
        internal static void ShowMinimalInterface()
        {
            ShowTopandBottom(false);
            ShowNavigation(true);
            ShowShortcuts(true);

            Properties.Settings.Default.ShowInterface = false;

            if (ActivityTimer != null)
            {
                ActivityTimer.Start();
            }
        }
Exemplo n.º 11
0
        internal static void ShowStandardInterface()
        {
            Properties.Settings.Default.ShowInterface = true;

            ShowTopandBottom(true);
            ShowNavigation(false);
            ShowShortcuts(false);

            if (ActivityTimer != null)
            {
                ActivityTimer.Stop();
            }
        }
Exemplo n.º 12
0
        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));
        }
Exemplo n.º 13
0
        /// <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);
            }
        }
Exemplo n.º 14
0
        /// <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);
                    }
                });
            });
        }
Exemplo n.º 15
0
        //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();
        }
Exemplo n.º 16
0
        /// <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);
            }
        }
Exemplo n.º 17
0
 private void RestartTimer()
 {
     MyActivityCounter = 0;
     ActivityTimer.Start();
     ShowTimeLeft();
 }
Exemplo n.º 18
0
 /// <summary>
 /// Stops the timer that controls the stepping of activities.
 /// </summary>
 protected virtual void StopActivityTimer()
 {
     ActivityTimer.Stop();
 }
Exemplo n.º 19
0
 /// <summary>
 /// Starts the timer that controls the stepping of activities.
 /// </summary>
 protected virtual void StartActivityTimer()
 {
     ActivityTimer.Start();
 }