public void DoPause(PauseReason pauseReason, int layerNumber = -1)
        {
            switch (pauseReason)
            {
            case PauseReason.UserRequested:
                // do nothing special
                break;

            case PauseReason.PauseLayerReached:
            case PauseReason.GCodeRequest:
                printer.Connection.OnPauseOnLayer(new PrintPauseEventArgs(printer.Connection.ActivePrintName, false, layerNumber));
                break;

            case PauseReason.FilamentRunout:
                printer.Connection.OnFilamentRunout(new PrintPauseEventArgs(printer.Connection.ActivePrintName, true, layerNumber));
                break;
            }

            // Add the pause_gcode to the loadedGCode.GCodeCommandQueue
            string pauseGCode = printer.Settings.GetValue(SettingsKey.pause_gcode);

            // put in the gcode for pausing (if any)
            InjectPauseGCode(pauseGCode);

            // get the position after any pause gcode executes
            InjectPauseGCode("M114");

            // inject a marker to tell when we are done with the inserted pause code
            InjectPauseGCode("MH_PAUSE");
        }
Example #2
0
        public void Update(TimeSpan ts)
        {
            //check pause key
            if (IsKeyDown(GameKeys.Space))
            {
                if (Reason == PauseReason.Paused)
                {
                    Paused = !Paused;
                }
            }
            //update all game objects
            if (!Paused)
            {
                Module.Update(ts);
            }
            //check for collisions
            for (int i = 0; i < terrain.points.Count - 1; i++)
            {
                if (Module.IntersectsWithLine(terrain.points[i], terrain.points[i + 1]))
                {
                    //check if we crashed
                    Paused = true;
                    Reason = PauseReason.Crashed;

                    if (terrain.points[i].Y == terrain.points[i + 1].Y)
                    {
                        if ((Module.sY < Module.MaxLandingSpeed) && (Module.IsRotatedForLanding))
                        {
                            Reason = PauseReason.Landed;
                        }
                    }
                }
            }
        }
Example #3
0
 public DebuggerPauseEventArgs(RuntimeAppDomain domain, RuntimeThread thread, PauseReason reason)
     : base(domain, false)
 {
     AppDomain = domain;
     Thread    = thread;
     Reason    = reason;
 }
        public void DoPause(PauseReason pauseReason, string layerNumber = "")
        {
            switch (pauseReason)
            {
            case PauseReason.UserRequested:
                // do nothing special
                break;

            case PauseReason.PauseLayerReached:
            case PauseReason.GCodeRequest:
                printer.Connection.PauseOnLayer.CallEvents(printer.Connection, new NamedItemEventArgs(printer.Bed.EditContext?.SourceItem?.Name ?? "Unknown"));
                UiThread.RunOnIdle(() => StyledMessageBox.ShowMessageBox(ResumePrint, layerPauseMessage.FormatWith(layerNumber), pauseCaption, StyledMessageBox.MessageType.YES_NO, "Ok".Localize(), "Resume".Localize()));
                break;

            case PauseReason.FilamentRunout:
                printer.Connection.FilamentRunout.CallEvents(printer.Connection, new NamedItemEventArgs(printer.Bed.EditContext?.SourceItem?.Name ?? "Unknown"));
                UiThread.RunOnIdle(() => StyledMessageBox.ShowMessageBox(ResumePrint, filamentPauseMessage, pauseCaption, StyledMessageBox.MessageType.YES_NO, "Ok".Localize(), "Resume".Localize()));
                break;
            }

            // Add the pause_gcode to the loadedGCode.GCodeCommandQueue
            string pauseGCode = printer.Settings.GetValue(SettingsKey.pause_gcode);

            // put in the gcode for pausing (if any)
            InjectPauseGCode(pauseGCode);

            // inject a marker to tell when we are done with the inserted pause code
            InjectPauseGCode("M114");

            InjectPauseGCode("MH_PAUSE");
        }
Example #5
0
        private void PausePlayback()
        {
            _pauseReason = PauseReason.Requested;

            player.Pause();
            // Don't pass buffering events in paused state.
            UnsubscribeBufferingEvent();
            _dataClock.Stop();
            StopTransfer();

            SetState(PlayerState.Paused, activeTaskCts.Token);

            logger.Info("End");
        }
Example #6
0
 private void duktape_Status(object sender, EventArgs e)
 {
     PluginManager.Core.Invoke(new Action(async() =>
     {
         bool wantPause  = !Inferior.Running;
         bool wantResume = !Running && Inferior.Running;
         Running         = Inferior.Running;
         if (wantPause)
         {
             focusTimer.Change(Timeout.Infinite, Timeout.Infinite);
             FileName   = ResolvePath(Inferior.FileName);
             LineNumber = Inferior.LineNumber;
             if (!File.Exists(FileName))
             {
                 // filename reported by Duktape doesn't exist; walk callstack for a
                 // JavaScript call as a fallback
                 var callStack = await Inferior.GetCallStack();
                 var topCall   = callStack.First(entry => entry.Item3 != 0);
                 var callIndex = Array.IndexOf(callStack, topCall);
                 FileName      = ResolvePath(topCall.Item2);
                 LineNumber    = topCall.Item3;
                 await Panes.Inspector.SetCallStack(callStack, callIndex);
                 Panes.Inspector.Enabled = true;
             }
             else
             {
                 updateTimer.Change(500, Timeout.Infinite);
             }
         }
         if (wantResume && Inferior.Running)
         {
             focusTimer.Change(250, Timeout.Infinite);
             updateTimer.Change(Timeout.Infinite, Timeout.Infinite);
             Panes.Errors.ClearHighlight();
         }
         if (wantPause && Paused != null)
         {
             PauseReason reason = haveError ? PauseReason.Exception : PauseReason.Breakpoint;
             haveError          = false;
             Paused(this, new PausedEventArgs(reason));
         }
         if (wantResume && Resumed != null)
         {
             Resumed(this, EventArgs.Empty);
         }
     }), null);
 }
        private void StartPausing(PauseReason reason)
        {
            if (CurrentState == State.Pausing)
            {
                TimeSyncUI.TargetTime = _serverTime;
                return;
            }

            DebugLog.DebugWrite($"START PAUSING (Target:{_serverTime} Current:{Time.timeSinceLevelLoad})", MessageType.Info);
            Locator.GetActiveCamera().enabled = false;

            //OWInput.ChangeInputMode(InputMode.None);
            QSBInputManager.Instance.SetInputsEnabled(false);

            OWTime.SetTimeScale(0f);
            CurrentState  = State.Pausing;
            CurrentReason = reason;
            SpinnerUI.Show();
            TimeSyncUI.TargetTime = _serverTime;
            TimeSyncUI.Start(TimeSyncType.Pausing, reason);
        }
Example #8
0
 public PauseEventArgs(PauseReason reason)
 {
     Reason = reason;
 }
Example #9
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="reason">Reason</param>
 public DebuggerPauseState(PauseReason reason)
 {
     this.reason = reason;
 }
Example #10
0
		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="reason">Reason</param>
		public DebuggerPauseState(PauseReason reason) {
			Reason = reason;
		}
 internal CountDownTicker(int tickCountRemaining,
                          PauseReason pauseReason) {
   this.pauseReason = pauseReason;
   this.remainingTickCounts = tickCountRemaining;
 }
 void OnPause(PauseReason pauseReason) {
   Debug.Assert(this.modelState == ModelState.Uploading);
   try {
     GoogleEmailUploaderTrace.EnteringMethod(
         "GoogleEmailUploaderModel.OnPause(PauseReason)");
     this.mailUploader.PauseUpload();
     if (this.UploadPausedEvent != null) {
       this.UploadPausedEvent(pauseReason);
     }
     this.modelState = ModelState.UploadingPause;
   } finally {
     GoogleEmailUploaderTrace.ExitingMethod(
         "GoogleEmailUploaderModel.OnPause(PauseReason)");
   }
 }
Example #13
0
 public ControllerPauseEventArgs(IDebuggerController controller, IThread thread, PauseReason reason)
     : base(reason)
 {
     Controller = controller;
     Thread     = thread;
 }
Example #14
0
        public double pause(PauseReason pr)
        {
            this._currentMediaElement.Pause();
            double currentPosition = this._currentMediaElement.Position.Seconds;
            this._currentMedia.CurrentTime = currentPosition;
            this._centerIcon.Source = this.generateImage(ScreenController.PAUSE_FILE);
            this._centerIcon.Opacity = 1.0;
            double startOpacity = this._currentContainer.Opacity;

            this._currentContainer.BeginAnimation(Canvas.OpacityProperty, this.generateDoubleAnimation(startOpacity, 0.3, ScreenController.PAUSE_FADE_OUT_DURATION));
            this._centerIcon.BeginAnimation(Canvas.OpacityProperty, this.generateDoubleAnimation(1, 0, ScreenController.PAUSE_FADE_OUT_DURATION));

            this._cornerIcon.Opacity = 1.0;
            this._cornerIcon.Source = this.generateImage(this.getIconPathForPauseReason(pr));
            return currentPosition;
        }
 static string GetProperPauseMessage(PauseReason pauseReason,
                                     int remainingCount) {
   string pauseReasonText;
   switch (pauseReason) {
     case PauseReason.UserAction:
       pauseReasonText = Resources.PauseUserActionText;
       break;
     case PauseReason.ConnectionFailures:
       pauseReasonText =
           string.Format(Resources.PauseConnectionFailuresTemplateText,
                         remainingCount);
       break;
     case PauseReason.ServiceUnavailable:
       pauseReasonText =
           string.Format(Resources.ServiceUnavailableTemplateText,
                         remainingCount);
       break;
     case PauseReason.ServerInternalError:
       pauseReasonText =
           string.Format(Resources.ServerInternalErrorTemplateText,
                         remainingCount);
       break;
     case PauseReason.Resuming:
       pauseReasonText = string.Empty;
       break;
     default:
       Debug.Fail("What kind of reason is this?");
       pauseReasonText = string.Empty;
       break;
   }
   return pauseReasonText;
 }
 void googleEmailUploaderModel_PauseCountDownEvent(PauseReason pauseReason,
                                         int remainingCount) {
   if (this.IsHandleCreated && !this.IsDisposed) {
     string pauseReasonText =
         UploadView.GetProperPauseMessage(pauseReason, remainingCount);
     this.Invoke(new StringDelegate(this.UpdateMessageLabel),
                 new object[] { pauseReasonText });
   }
 }
 void googleEmailUploaderModel_UploadPausedEvent(PauseReason pauseReason) {
   if (this.IsHandleCreated && !this.IsDisposed) {
     string pauseResumeButtonText = Resources.PauseText;
     string pauseReasonText = string.Empty;
     bool enabled = true;
     if (pauseReason != PauseReason.Resuming) {
       pauseReasonText = UploadView.GetProperPauseMessage(pauseReason, 0);
       pauseResumeButtonText = Resources.ResumeText;
       enabled = (pauseReason == PauseReason.UserAction);
     }
     this.Invoke(new StringDelegate(this.UpdateMessageLabel),
                 new object[] { pauseReasonText });
     this.Invoke(
         new StringBoolDelegate(this.SetPauseResumeButtonText),
         new object[] { pauseResumeButtonText, enabled });
   }
 }
 public ControllerPauseEventArgs(IDebuggerController controller, IThread thread, PauseReason reason)
     : base(reason)
 {
     Controller = controller;
     Thread = thread;
 }
Example #19
0
 private String getIconPathForPauseReason(PauseReason pr)
 {
     if (pr.Equals(PauseReason.STANDUP))
     {
         return ScreenController.STANDUP_FILE;
     }
     else if (pr.Equals(PauseReason.PHONE))
     {
         return ScreenController.PHONE_FILE;
     }
     else if (pr.Equals(PauseReason.SPEECH))
     {
         return ScreenController.SPEECH_FILE;
     }
     else if (pr.Equals(PauseReason.LEAVE))
     {
         return ScreenController.LEAVE_FILE;
     }
     else
     {
         return ScreenController.PAUSE_FILE;
     }
 }
Example #20
0
        /// <summary>
        /// Starts playback on all initialized streams. Streams do have to be
        /// configured in order for the call to start playback.
        /// </summary>
        public void Play()
        {
            if (!AllStreamsHaveConfiguration)
            {
                logger.Info($"Needed config: Video {esStreams[(int)StreamType.Video].Configuration == null} Audio {esStreams[(int)StreamType.Audio].Configuration == null}");
                return;
            }

            try
            {
                var token = activeTaskCts.Token;
                token.ThrowIfCancellationRequested();

                var state = player.GetState();
                logger.Info($"Player State: {state}");

                switch (state)
                {
                case ESPlayer.ESPlayerState.Playing:
                    return;

                case ESPlayer.ESPlayerState.Ready:
                    player.Start();

                    try
                    {
                        using (asyncOpSerializer.Lock(new CancellationToken(true)))
                        {
                            StartClockGenerator();
                            SubscribeBufferingEvent();
                        }
                    }
                    catch (OperationCanceledException)
                    {
                        logger.Info("Async operation in progress.");
                    }

                    break;

                case ESPlayer.ESPlayerState.Paused:

                    _pauseReason = PauseReason.NotPaused;

                    if (_pendingRepresentation != null)
                    {
                        logger.Info("Pending ChangeRepresentation()");
                        _ = ChangeRepresentationInternal(_pendingRepresentation, true, token);
                    }
                    else
                    {
                        ResumeTransfer(token);
                        player.Resume();
                        _dataClock.Start();
                        SubscribeBufferingEvent();
                    }

                    break;

                default:
                    throw new InvalidOperationException($"Play called in invalid state: {state}");
                }

                SetState(PlayerState.Playing, token);
                logger.Info("End");
            }
            catch (InvalidOperationException ioe)
            {
                logger.Error(ioe);
            }
            catch (OperationCanceledException)
            {
                logger.Info("Operation canceled");
            }
        }
Example #21
0
 /// <summary>
 /// Constructs data for a Paused debugger event.
 /// </summary>
 /// <param name="reason"></param>
 public PausedEventArgs(PauseReason reason)
 {
     Reason = reason;
 }
 void TimedPauseUpload(PauseReason pauseReason) {
   Debug.Assert(this.modelState == ModelState.Uploading);
   this.OnPause(pauseReason);
   Debug.Assert(this.pauseTimer == null);
   // Kill previous timer if it exists.
   if (this.pauseTimer != null) {
     this.pauseTimer.Dispose();
     this.pauseTimer = null;
   }
   // Create a timer that calls PauseTimerCallback ever second.
   this.pauseTimer =
       new Timer(new TimerCallback(this.PauseTimerCallback),
                 new CountDownTicker(this.pauseTime,
                                     pauseReason),
                 0,
                 1000);
 }