Пример #1
0
 protected virtual void OnPaused(EventArgs e)
 {
     if (Paused != null)
     {
         Paused.Invoke(this, e);
     }
 }
Пример #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);
                });
            }
        }
Пример #3
0
        public void ResumeGame()
        {
            Cursor.lockState = CursorLockMode.Locked;
            Cursor.visible   = false;

            Paused?.Invoke(false);
        }
Пример #4
0
        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());
                }
            }
        }
Пример #6
0
 protected void OnPaused()
 {
     if (Paused != null)
     {
         Paused.Invoke(this);
     }
 }
Пример #7
0
 public void Pause()
 {
     // Keep the gun from shooting
     isPaused = true;
     canShoot = false;
     Paused.Invoke();
 }
Пример #8
0
        public void Pause()
        {
            _soundOut.Pause();

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

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

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

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

            Paused?.Invoke(this);
        }
Пример #17
0
        public Task NotifyPause()
        {
            if (Paused != null)
            {
                return(Paused.Invoke());
            }

            return(Task.CompletedTask);
        }
Пример #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);
        }
    }
Пример #20
0
        protected override void OnPause()
        {
            base.OnPause();
            Paused?.Invoke(this);

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

            IsPaused = true;
            Paused?.Invoke();
        }
Пример #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();
        }
Пример #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);
                }
            }
        }
Пример #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);
            };
        }
Пример #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;
 }
Пример #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);
        }
Пример #29
0
        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;
            }
        }
Пример #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);
                });
            }
        }