Esempio n. 1
0
 /// <summary>
 /// Возобновить работу модуля.
 /// </summary>
 public async ValueTask <Nothing> ResumeModule()
 {
     if (Interlocked.Exchange(ref _isSuspended, 0) != 0)
     {
         List <ValueTask <Nothing> > tasks = new List <ValueTask <Nothing> >();
         foreach (var pt in _providers.Values)
         {
             foreach (var p in pt.Select(p => p.QueryView <IModuleLifetime>()).Where(p => p != null && p.IsSuspendAware))
             {
                 tasks.Add(p.ResumeModule());
             }
         }
         foreach (var task in tasks)
         {
             await task;
         }
         Resumed?.Invoke(null);
         var parent = Interlocked.CompareExchange(ref _parent, null, null);
         if (parent == null)
         {
             await AllModulesResumed();
         }
     }
     return(Nothing.Value);
 }
 public void OnResumed()
 {
     if (Resumed != null)
     {
         Resumed.Invoke(this, EventArgs.Empty);
     }
 }
Esempio n. 3
0
 public virtual void Unsuspend()
 {
     if (State == SceneState.SUSPENDED)
     {
         State = SceneState.ACTIVE;
     }
     Unsuspended?.Invoke(this, new EventArgs());
     Resumed?.Invoke(this, new EventArgs());
 }
Esempio n. 4
0
        /// <summary>
        /// Raises the <see cref="Resumed"/> event.
        /// </summary>
        private void OnResumed()
        {
            foreach (var subscriber in subscribers)
            {
                subscriber.ClockResumed();
            }

            Resumed?.Invoke(this);
        }
Esempio n. 5
0
File: App.cs Progetto: hdir/ga10
        protected override void OnResume()
        {
            IsForeground = true;
            CrossServiceContainer.UpdateService?.SetUpdateMode(UpdateMode.Foreground);
            Resumed?.Invoke();
            base.OnResume();

            BulletinService.Instance.ShowBulletins();
        }
Esempio n. 6
0
 public virtual void Resume()
 {
     if (IsRunning && _isPaused)
     {
         _pauseSignal.Set();
         _isPaused = false;
         Resumed?.Invoke(this, null);
     }
 }
Esempio n. 7
0
 public virtual void Unpause()
 {
     if (State == SceneState.PAUSED)
     {
         State = SceneState.ACTIVE;
     }
     Unpaused?.Invoke(this, new EventArgs());
     Resumed?.Invoke(this, new EventArgs());
 }
Esempio n. 8
0
 public void Resume()
 {
     if (!IsPaused)
     {
         return;
     }
     IsPaused = false;
     Resumed?.Invoke(this, EventArgs.Empty);
     popup.WindowState = WindowState.Maximized;
 }
Esempio n. 9
0
        public void Resume()
        {
            if (Running || !Active)
            {
                return;
            }

            Running = true;
            Resumed?.Invoke(this);
        }
Esempio n. 10
0
        public void Resume()
        {
            if (PlayState != PlayState.Paused)
            {
                return;
            }

            _soundOut.Play();
            this.PlayState = PlayState.Playing;
            Resumed?.Invoke();
        }
Esempio n. 11
0
        /// <summary>
        /// Resumes emulation.
        /// </summary>
        public void Resume()
        {
            if (ROMIsLoaded == false)
            {
                return;
            }

            IsPaused = false;
            Resumed?.Invoke();

            LateResumed?.Invoke();
        }
Esempio n. 12
0
 /// <summary>
 /// Возобновить работу модуля.
 /// </summary>
 public async ValueTask <Nothing> ResumeModule()
 {
     if (_suspendedAware && Interlocked.Exchange(ref _isSuspended, 0) != 0)
     {
         if (_suspendAwareCallbacks != null)
         {
             await _suspendAwareCallbacks.OnResumeLifetimeCallback();
         }
         Resumed?.Invoke(null);
     }
     return(Nothing.Value);
 }
        /// <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();
        }
Esempio n. 14
0
        public async Task ResumeAsync()
        {
            this.LogInfo();

            Resuming?.Invoke(this, EventArgs.Empty);

            // restore the navigation state
            await FrameLogic.LoadNavigationState(Id, _frame);

            // call the view-models OnResuming
            await SuspensionLogic.CallResumeAsync(CurrentViewModel as ISuspensionAware);

            Resumed?.Invoke(this, EventArgs.Empty);
        }
Esempio n. 15
0
        protected void OnPause()
        {
            Assert(State == State_t.Running);

            Pausing?.Invoke(this);

            using (m_evPause = new AutoResetEvent(false))
            {
                State = State_t.Paused;
                m_evPause.WaitOne();
            }

            State = State_t.Running;
            Resumed?.Invoke(this);
        }
Esempio n. 16
0
        /// <summary>
        /// Resumes timing.
        /// </summary>
        /// <exception cref="ObjectDisposedException"><c>UniSharper.Timers.Timer</c> is disposed.</exception>
        public void Resume()
        {
            if (disposed)
            {
                throw new ObjectDisposedException(GetType().FullName);
            }

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

            TimerState = TimerState.Running;
            Resumed?.Invoke(this, EventArgs.Empty);
        }
Esempio n. 17
0
        public override void Update(bool[] pressed)
        {
            select.Update();
            select.Position = new Vector2(selects[(int)pausetype].Position.X - 4, selects[(int)pausetype].Position.Y - 4);

            if (pressed[(int)ButtonType.Up])
            {
                ChangePauseType(-1);
                Sound.Play(soundfilenames[0], -1000);
            }
            else if (pressed[(int)ButtonType.Down])
            {
                ChangePauseType(1);
                Sound.Play(soundfilenames[0], -1000);
            }
            else if (pressed[(int)ButtonType.Cross] || pressed[(int)ButtonType.Start])
            {
                if (Resumed != null)
                {
                    Resumed.Invoke(this, EventArgs.Empty);
                }
            }
            else if (pressed[(int)ButtonType.Circle])
            {
                if (pausetype == PauseType.Resume)
                {
                    if (Resumed != null)
                    {
                        Resumed.Invoke(this, EventArgs.Empty);
                    }
                }
                else if (pausetype == PauseType.Retry)
                {
                    if (Retryed != null)
                    {
                        Retryed.Invoke(this, EventArgs.Empty);
                    }
                }
                else if (pausetype == PauseType.Return)
                {
                    if (Returned != null)
                    {
                        Returned.Invoke(this, EventArgs.Empty);
                    }
                }
            }
        }
Esempio n. 18
0
        /// <summary>
        /// Resumes timing.
        /// </summary>
        /// <exception cref="ObjectDisposedException"><c>UniSharper.Timers.Timer</c> is disposed.</exception>
        public void Resume()
        {
            if (disposed)
            {
                throw new ObjectDisposedException(GetType().FullName);
            }

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

                if (Resumed != null)
                {
                    Resumed.Invoke(this, EventArgs.Empty);
                }
            }
        }
Esempio n. 19
0
 public override void Update(InputInfoBase inputInfo)
 {
     if (Disposed)
     {
         return;
     }
     if (inputInfo.IsPressed(ButtonType.Up))
     {
         ChangePauseType(-1);
         Sound.Play(PPDSetting.DefaultSounds[0], -1000);
     }
     else if (inputInfo.IsPressed(ButtonType.Down))
     {
         ChangePauseType(1);
         Sound.Play(PPDSetting.DefaultSounds[0], -1000);
     }
     else if (inputInfo.IsPressed(ButtonType.Cross) || inputInfo.IsPressed(ButtonType.Start))
     {
         // 再開
         if (Resumed != null)
         {
             Resumed.Invoke(this, EventArgs.Empty);
         }
     }
     else if (inputInfo.IsPressed(ButtonType.Circle))
     {
         // 再開
         if (pausetype == PauseType.Resume)
         {
             if (Resumed != null)
             {
                 Resumed.Invoke(this, EventArgs.Empty);
             }
         }
         // リターン
         else if (pausetype == PauseType.Return)
         {
             if (Returned != null)
             {
                 Returned.Invoke(this, EventArgs.Empty);
             }
         }
     }
     base.Update();
 }
Esempio n. 20
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);
            };
        }
Esempio n. 21
0
        /// <summary>
        ///     Read a key while processing window resizes and process resumption.
        /// </summary>
        /// <param name="intercept">If true, pressed key will not be displayed in console</param>
        /// <returns>
        ///     <see cref="ConsoleKeyInfo" />
        /// </returns>
        public static ConsoleKeyInfo ReadKey(bool intercept)
        {
            var key = Console.ReadKey(intercept);

            switch (key.Key)
            {
            case (ConsoleKey)0x1200:
                // "SizeChanged" key indication.
                SizeChanged?.Invoke(null, EventArgs.Empty);
                break;

            case (ConsoleKey)0x1201:
                // "Resumed" key indication.
                Resumed?.Invoke(null, EventArgs.Empty);
                break;
            }
            return(key);
        }
Esempio n. 22
0
 public void Resume()
 {
     while (true)
     {
         var tcs = m_paused;
         if (tcs == null)
         {
             return;
         }
         if (Interlocked.CompareExchange(ref m_paused, null, tcs) == tcs)
         {
             tcs.SetResult(true);
             Resumed?.Invoke();
             PauseStatusChanged?.Invoke(false);
             break;
         }
     }
 }
Esempio n. 23
0
        protected override void OnResume()
        {
            base.OnResume();
            Resumed?.Invoke(this);

            if (Game != null)
            {
                var deviceManager = Game.Services.GetService <IGraphicsDeviceManager>();
                if (deviceManager == null)
                {
                    return;
                }

                ((GraphicsDeviceManager)deviceManager).ForceSetFullScreen();
                ((AndroidGameWindow)Game.Window).GameView.RequestFocus();
                if (_orientationListener.CanDetectOrientation())
                {
                    _orientationListener.Enable();
                }
            }
        }
Esempio n. 24
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);
                });
            }
        }
Esempio n. 25
0
 /// <summary>
 /// Overrides this method if you want to handle behavior.
 /// </summary>
 /// <since_tizen> 3 </since_tizen>
 protected virtual void OnResume()
 {
     Resumed?.Invoke(this, EventArgs.Empty);
 }
Esempio n. 26
0
 /// <summary>
 /// Overrides this method if you want to handle behavior.
 /// </summary>
 protected virtual void OnResume()
 {
     Log.Debug("NUI", "OnResume() is called!");
     Resumed?.Invoke(this, EventArgs.Empty);
 }
        private static void OnActivityResumed(object sender, ActivityEventArgs e)
        {
            _currentActivity.SetTarget(e.Activity);

            Resumed?.Invoke(null, EventArgs.Empty);
        }
Esempio n. 28
0
        protected override void OnResume()
        {
            base.OnResume();

            Resumed?.Invoke(this);
        }
Esempio n. 29
0
 /// <summary>
 ///     Invokes the resumed delegate.
 /// </summary>
 /// <param name="sender">The sender.</param>
 private void OnResumed(ITransport sender)
 => Resumed?.Invoke(sender);
Esempio n. 30
0
 protected void RaiseResumed()
 {
     Resumed?.Invoke(this, EventArgs.Empty);
 }