Beispiel #1
0
 protected virtual void OnPaused(EventArgs e)
 {
     if (Paused != null)
     {
         Paused.Invoke(this, e);
     }
 }
Beispiel #2
0
        public void Start()
        {
            TimeSpan endTime = new TimeSpan(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second).Add(TimeLeft);

            if (!isRunning) //if it is already running ther's no meaning for starting again
            {
                Device.StartTimer(TimeSpan.FromMilliseconds(SpreedControl()), () =>
                {
                    isRunning = true;

                    TimeSpan nowTime = new TimeSpan(DateTime.Now.Hour, DateTime.Now.Minute, DateTime.Now.Second);

                    TimeLeft = endTime - nowTime;

                    var ticked = TimeLeft.TotalSeconds > 0;

                    if (isPause)
                    {
                        Paused?.Invoke();
                        ticked    = false;
                        isRunning = false;
                    }
                    else if (ticked)
                    {
                        Ticked?.Invoke();
                    }
                    else
                    {
                        Completed?.Invoke();
                    }

                    return(ticked);
                });
            }
        }
        public void ResumeGame()
        {
            Cursor.lockState = CursorLockMode.Locked;
            Cursor.visible   = false;

            Paused?.Invoke(false);
        }
        public void PauseGame()
        {
            Cursor.lockState = CursorLockMode.Confined;
            Cursor.visible   = true;

            Paused?.Invoke(true);
        }
        void OnPayloadReceived(object sender, Misc.PayloadReceivedEventArgs e)
        {
            var msg = e.Payload;

            if (msg.EventType == "TIMER")
            {
                if (msg.Event == "CALL_START")
                {
                    Started?.Invoke(this, new EventArgs());
                }
                if (msg.Event == "CALL_START_PAUSE")
                {
                    Paused?.Invoke(this, new EventArgs());
                }
                if (msg.Event == "CALL_END_PAUSE")
                {
                    Unpaused?.Invoke(this, new EventArgs());
                }
                if (msg.Event == "CALL_END")
                {
                    Stopped?.Invoke(this, new EventArgs());
                }
                if (msg.Event == "CALL_CANCEL")
                {
                    Canceled?.Invoke(this, new EventArgs());
                }
            }
        }
Beispiel #6
0
 protected void OnPaused()
 {
     if (Paused != null)
     {
         Paused.Invoke(this);
     }
 }
Beispiel #7
0
 public void Pause()
 {
     // Keep the gun from shooting
     isPaused = true;
     canShoot = false;
     Paused.Invoke();
 }
        public void Pause()
        {
            _soundOut.Pause();

            this.PlayState = PlayState.Paused;
            Paused?.Invoke();
        }
Beispiel #9
0
 public void Stop()
 {
     if (Running)
     {
         _gameTime.Stop();
         Paused?.Invoke(this, EventArgs.Empty);
     }
 }
Beispiel #10
0
        public override void OnPause(Action baseOnPause)
        {
            var service = Get <INavigationService>();

            service.OnPauseActivity(Target, NavigationContext);
            Paused?.Invoke(Target, EventArgs.Empty);
            base.OnPause(baseOnPause);
        }
Beispiel #11
0
 public void Pause()
 {
     if (Interlocked.CompareExchange(ref m_paused, new TaskCompletionSource <bool>(), null) == null)
     {
         Paused?.Invoke();
         PauseStatusChanged?.Invoke(true);
     }
 }
Beispiel #12
0
    public virtual void Pause()
    {
        isPaused = true;
        Paused.Invoke();

        // Stop registering collisions
        rigidbody.Sleep();
    }
Beispiel #13
0
 public void Pause()
 {
     if (this.IsRunning && !this.IsPaused)
     {
         this.IsPaused = true;
         OnPaused();
         Paused?.Invoke(this);
     }
 }
Beispiel #14
0
        public void Pause(PausedBy playbackPausedBy = PausedBy.User)
        {
            if (_output != null)
            {
                _output.Pause();

                Paused?.Invoke(new Paused(playbackPausedBy));
            }
        }
Beispiel #15
0
 public virtual void Pause()
 {
     if (IsRunning && !_isPaused)
     {
         _pauseSignal.Reset();
         _isPaused = true;
         Paused?.Invoke(this, null);
     }
 }
Beispiel #16
0
        /// <summary>
        /// Raises the <see cref="Paused"/> event.
        /// </summary>
        private void OnPaused()
        {
            foreach (var subscriber in subscribers)
            {
                subscriber.ClockPaused();
            }

            Paused?.Invoke(this);
        }
Beispiel #17
0
        public Task NotifyPause()
        {
            if (Paused != null)
            {
                return(Paused.Invoke());
            }

            return(Task.CompletedTask);
        }
Beispiel #18
0
    public void Pause()
    {
        // Keep this from moving or registering collisions
        velocity = Vector3.zero;
        rigidbody.Sleep();

        isPaused = true;
        Paused.Invoke();
    }
    public void PauseGame()
    {
        gamePaused = true;
        Paused.Invoke();

        if (pauseMenu != null && pauseMenu.activeSelf == false)
        {
            pauseMenu.SetActive(true);
        }
    }
Beispiel #20
0
        protected override void OnPause()
        {
            base.OnPause();
            Paused?.Invoke(this);

            if (_orientationListener.CanDetectOrientation())
            {
                _orientationListener.Disable();
            }
        }
Beispiel #21
0
        /// <summary>
        /// Pauses emulation.
        /// </summary>
        public void Pause()
        {
            if (ROMIsLoaded == false)
            {
                return;
            }

            IsPaused = true;
            Paused?.Invoke();
        }
Beispiel #22
0
 public void Pause()
 {
     if (IsPaused)
     {
         return;
     }
     IsPaused = true;
     Paused?.Invoke(this, EventArgs.Empty);
     popup.WindowState = WindowState.Minimized;
 }
        void OnPaused(PlayableDirector director)
        {
            m_Paused  = true;
            IsSyncing = false;
            if (m_ControlsMarsLifecycle)
            {
                MarsTime.Pause();
            }

            Paused?.Invoke();
        }
        /// <summary>
        /// Connects to SignalR
        /// </summary>
        public async Task ConnectAsync()
        {
            connection = new HubConnectionBuilder()
                         .WithUrl(_hubUrl)
                         .Build();

            connection.On <CurrentlyPlaying>("SongChanged", (song) => SongChanged?.Invoke(song));
            connection.On <PlaylistItem>("PlaylistChanged", (playlist) => PlaylistChanged?.Invoke(playlist));
            connection.On <int>("VolumeChanged", (volume) => VolumeChanged?.Invoke(volume));
            connection.On("Paused", () => Paused?.Invoke());
            connection.On("Resumed", () => Resumed?.Invoke());

            await connection.StartAsync();
        }
Beispiel #25
0
        /// <summary>
        /// Pauses timing.
        /// </summary>
        /// <exception cref="ObjectDisposedException"><c>UniSharper.Timers.Timer</c> is disposed.</exception>
        public void Pause()
        {
            if (disposed)
            {
                throw new ObjectDisposedException(GetType().FullName);
            }

            if (TimerState != TimerState.Pause)
            {
                TimerState = TimerState.Pause;

                if (Paused != null)
                {
                    Paused.Invoke(this, EventArgs.Empty);
                }
            }
        }
Beispiel #26
0
        /// <summary>
        /// Creates and initializes a new instance of the AnimationView class.
        /// </summary>
        /// <param name="parent">The parent is a given container, which will be attached by AnimationView as a child. It's <see cref="EvasObject"/> type.</param>
        /// <since_tizen> preview </since_tizen>
        public AnimationView(EvasObject parent) : base(parent)
        {
            _started  = new SmartEvent(this, this.Handle, "play,start");
            _repeated = new SmartEvent(this, this.Handle, "play,repeat");
            _finished = new SmartEvent(this, this.Handle, "play,done");
            _paused   = new SmartEvent(this, this.Handle, "play,pause");
            _resumed  = new SmartEvent(this, this.Handle, "play,resume");
            _stopped  = new SmartEvent(this, this.Handle, "play,stop");
            _updated  = new SmartEvent(this, this.Handle, "play,update");

            _started.On += (sender, e) =>
            {
                Started?.Invoke(this, EventArgs.Empty);
            };

            _repeated.On += (sender, e) =>
            {
                Repeated?.Invoke(this, EventArgs.Empty);
            };

            _finished.On += (sender, e) =>
            {
                Finished?.Invoke(this, EventArgs.Empty);
            };

            _paused.On += (sender, e) =>
            {
                Paused?.Invoke(this, EventArgs.Empty);
            };

            _resumed.On += (sender, e) =>
            {
                Resumed?.Invoke(this, EventArgs.Empty);
            };

            _stopped.On += (sender, e) =>
            {
                Stopped?.Invoke(this, EventArgs.Empty);
            };

            _updated.On += (sender, e) =>
            {
                Updated?.Invoke(this, EventArgs.Empty);
            };
        }
Beispiel #27
0
 private void Worker_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     if (e.Cancelled && !IsOneTime)
     {
         if (IsPaused)
         {
             Paused?.Invoke();
         }
         else
         {
             if (!IsFinished)
             {
                 manager.StopFinalize();
                 Stopped?.Invoke();
             }
         }
     }
     IsOneTime = false;
     IsWorking = false;
 }
Beispiel #28
0
        /// <summary>
        /// Pauses timing.
        /// </summary>
        /// <param name="causedByApplicationPaused">
        /// if set to <c>true</c> invoke this method caused by application paused; otherwise, set <c>false</c>.
        /// </param>
        /// <exception cref="System.ObjectDisposedException"></exception>
        /// <exception cref="ObjectDisposedException"><c>UniSharper.Timers.Timer</c> is disposed.</exception>
        public void Pause(bool causedByApplicationPaused = false)
        {
            if (disposed)
            {
                throw new ObjectDisposedException(GetType().FullName);
            }

            if (!CanAcceptApplicationPause && causedByApplicationPaused)
            {
                return;
            }

            if (TimerState != TimerState.Running)
            {
                return;
            }

            TimerState = TimerState.Pause;
            Paused?.Invoke(this, EventArgs.Empty);
        }
        public void PlayCycle(System.Timers.Timer countdown2)
        {
            this.elapsed2 += 200;
            if (this.elapsed2 == 200)
            {
                Paused.Invoke(new MethodInvoker(delegate { Paused.Hide(); }));
                gettingPaused4.Invoke(new MethodInvoker(delegate { gettingPaused4.Show(); }));
            }
            if (this.elapsed2 == 400)
            {
                gettingPaused4.Invoke(new MethodInvoker(delegate { gettingPaused4.Hide(); }));
                gettingPaused3.Invoke(new MethodInvoker(delegate { gettingPaused3.Show(); }));
            }
            if (this.elapsed2 == 600)
            {
                gettingPaused3.Invoke(new MethodInvoker(delegate { gettingPaused3.Hide(); }));
                gettingPaused2.Invoke(new MethodInvoker(delegate { gettingPaused2.Show(); }));
            }
            if (this.elapsed2 == 800)
            {
                gettingPaused2.Invoke(new MethodInvoker(delegate { gettingPaused2.Hide(); }));
                gettingPaused1.Invoke(new MethodInvoker(delegate { gettingPaused1.Show(); }));
            }
            if (this.elapsed2 == 1000)
            {
                gettingPaused1.Invoke(new MethodInvoker(delegate { gettingPaused1.Hide(); }));
                PauseStatus.Invoke(new MethodInvoker(delegate { PauseStatus.Text = ""; }));
                countdown2.Stop();

                Paused.Invoke(new MethodInvoker(delegate { Paused.Hide(); }));
                gettingPaused4.Invoke(new MethodInvoker(delegate { gettingPaused4.Hide(); }));
                gettingPaused3.Invoke(new MethodInvoker(delegate { gettingPaused3.Hide(); }));
                gettingPaused2.Invoke(new MethodInvoker(delegate { gettingPaused2.Hide(); }));
                gettingPaused1.Invoke(new MethodInvoker(delegate { gettingPaused1.Hide(); }));
                this.elapsed2 = 0;
            }
        }
Beispiel #30
0
        public async void Start()
        {
            if (CancellationSource == null)
            {
                CancellationSource = new CancellationTokenSource();

                await Task.Run(() =>
                {
                    DateTime prev = DateTime.Now;
                    Resumed?.Invoke();

                    while (CancellationSource.IsCancellationRequested == false)
                    {
                        if (IsPaused)
                        {
                            Paused?.Invoke();
                            PauseHandle.WaitOne();
                            Resumed?.Invoke();
                        }
                        else
                        {
                            if (BackgroundAction() == false)
                            {
                                Pause();
                            }
                            else if (SingleStep)
                            {
                                SingleStep = false;
                                Pause();
                            }
                        }
                    }

                    CompletionSource.SetResult(null);
                });
            }
        }