void Model_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { if (e.PropertyName == "TraceStates") { switch (Model.TraceStates) { case TraceStates.Running: Running.Begin(cTraceState, true); Starting.Stop(cTraceState); Stopping.Stop(cTraceState); break; case TraceStates.Starting: Starting.Begin(cTraceState, true); Stopping.Stop(cTraceState); Running.Stop(cTraceState); break; case TraceStates.Stopping: Stopping.Begin(cTraceState, true); Running.Stop(cTraceState); Starting.Stop(cTraceState); break; case TraceStates.Stopped: default: Starting.Stop(cTraceState); Stopping.Stop(cTraceState); Running.Stop(cTraceState); break; } } }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,TypeOfTransportId,EndingStation,ControlRoom")] Stopping stopping) { if (id != stopping.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(stopping); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!StoppingExists(stopping.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["TypeOfTransportId"] = new SelectList(_context.TypeOfTransport, "Id", "Id", stopping.TypeOfTransportId); return(View(stopping)); }
public void Stop() { // If not scheduled, ignore if (!m_Scheduled) { return; } // Notify stopping Stopping?.Invoke(this); // Actually stop if (m_AsyncUpdateAction != null) { lock (m_AsyncUpdateAction) { // Suspend instead of unschedule to maintain registration sequence. // This is important in case the synchronous update order matters. m_Scheduler.Suspend(m_AsyncUpdateAction); } } else { lock (m_UpdateAction) { // Suspend instead of unschedule to maintain registration sequence. // This is important in case the synchronous update order matters. m_Scheduler.Suspend(m_UpdateAction); } } // Notify stopped m_IsStarted = false; Stopped?.Invoke(this); }
/// <summary> /// 停止监听 /// </summary> public void Stop() { if (!Running) { Log.Error(">未开始监听,无需停止"); return; } #if NETDNX AppDomain.CurrentDomain.ProcessExit -= CurrentDomain_ProcessExit; #else AppDomain.CurrentDomain.DomainUnload -= CurrentDomain_DomainUnload; #endif Log.Info(">准备停止监听"); Stopping?.Invoke(this, EventArgs.Empty); if (RunningV4) { if (Stop_IPv4()) { System.Threading.Interlocked.CompareExchange(ref _running_v4, 0, 1); } } if (RunningV6) { if (Stop_IPv6()) { System.Threading.Interlocked.CompareExchange(ref _running_v6, 0, 1); } } Log.Info(">停止监听完成"); Stoped?.Invoke(this, EventArgs.Empty); _endTime = System.DateTime.Now; }
public bool Select(int shift, string date) { try { string SelectCommand = "SELECT MachineNumber, Reason, StoppingTime FROM Stoping WHERE StDate = #" + date.Replace('.', '/') + "# AND Shift = " + shift.ToString(); dbcon.Open(); byte andrey = 228; var command = new OleDbCommand(SelectCommand, dbcon); var reader = command.ExecuteReader(); List <Stopping> st = new List <Stopping>(); while (reader.Read()) { Stopping stopping = new Stopping(); stopping.MachineNumber = int.Parse(reader[0].ToString()); stopping.Reason = int.Parse(reader[1].ToString()); stopping.StoppingTime = int.Parse(reader[2].ToString()); st.Add(stopping); } dbcon.Close(); StaticClass.StoppingsList = GenerateStatisticsRowStaticList(st); return(true); } catch { dbcon.Close(); return(false); } }
public void Stop() { lock (_locker) { Stopping?.Invoke(this, new EventArgs()); SimulationSession.Dispose(); _graphicsManager.Dispose(); } }
public void StopServer() { if (IsRunning) { Debug.Log("stopping server"); // stop the server Stopping?.Invoke(); } ResetSO(); }
private void OnStopping() { try { Stopping?.Invoke(); } catch (Exception e) { _logger.Error("Stopping event handler error", e); } }
// FIXME this needs some work, to be completely in-tune with needs. public void MediaEventLoop(Action <double> UpdateProgress) { mediaEvent.CancelDefaultHandling(EventCode.StateChange); //mediaEvent.CancelDefaultHandling(EventCode.Starvation); while (stopMediaEventLoop == false) { try { EventCode ev; IntPtr p1, p2; if (mediaEvent.GetEvent(out ev, out p1, out p2, 0) == 0) { switch (ev) { case EventCode.Complete: Stopping.Fire(this, null); if (UpdateProgress != null) { UpdateProgress(source.PercentageCompleted); } return; case EventCode.StateChange: FilterState state = (FilterState)p1.ToInt32(); if (state == FilterState.Stopped || state == FilterState.Paused) { Stopping.Fire(this, null); } else if (state == FilterState.Running) { Starting.Fire(this, null); } break; // FIXME add abort and stuff, and propagate this. } // Trace.WriteLine(ev.ToString() + " " + p1.ToInt32()); mediaEvent.FreeEventParams(ev, p1, p2); } else { if (UpdateProgress != null) { UpdateProgress(source.PercentageCompleted); } // FiXME use AutoResetEvent Thread.Sleep(100); } } catch (Exception e) { Trace.WriteLine("MediaEventLoop: " + e); } } }
public void Stop() { if (!Started) { return; } Stopping?.Invoke(); thread.Abort(); }
public async Task <IActionResult> Create([Bind("Id,Name,TypeOfTransportId,EndingStation,ControlRoom")] Stopping stopping) { if (ModelState.IsValid) { _context.Add(stopping); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["TypeOfTransportId"] = new SelectList(_context.TypeOfTransport, "Id", "Id", stopping.TypeOfTransportId); return(View(stopping)); }
public bool Select(int shift, string date, int shift2, string date2) { try { string SelectCommand = "SELECT MachineNumber, Reason, StoppingTime, StDate, Shift FROM Stoping WHERE StDate BETWEEN #" + date.Replace('.', '/') + "# AND #" + date2.Replace('.', '/') + "#"; dbcon.Open(); byte andrey = 228; var command = new OleDbCommand(SelectCommand, dbcon); var reader = command.ExecuteReader(); List <Stopping> st = new List <Stopping>(); while (reader.Read()) { Stopping stopping = new Stopping(); stopping.MachineNumber = int.Parse(reader[0].ToString()); stopping.Reason = int.Parse(reader[1].ToString()); stopping.StoppingTime = int.Parse(reader[2].ToString()); stopping.Shift = int.Parse(reader[4].ToString()); stopping.Date = ReplaceDayAndMonth((Convert.ToDateTime(reader[3])).ToShortDateString().ToString()); st.Add(stopping); } dbcon.Close(); if (shift == 1) { List <Stopping> k = st.Where(p => p.Date == date && p.Shift == 2).ToList(); foreach (var item in k) { st.Remove(item); } } if (shift2 == 2) { List <Stopping> k = st.Where(p => p.Date == date2 && p.Shift == 1).ToList(); foreach (var item in k) { st.Remove(item); } } StaticClass.StoppingsList = GenerateStatisticsRowStaticList(st); return(true); } catch { dbcon.Close(); return(false); } }
private void StopButton_Click(object sender, RoutedEventArgs e) { Stopping?.Invoke(sender, e); this._mpp.Stop(); PlayButton.IsEnabled = true; PauseButton.IsEnabled = false; StopButton.IsEnabled = false; this.IsPaused = false; }
private void ExitInternal() { Stopping.Fire(); using (var snapshot = Bitmap.CreateSnapshot()) { Bitmap.CreateWiper().Wipe(); Bitmap.Console.ForegroundColor = ConsoleString.DefaultForegroundColor; Bitmap.Console.BackgroundColor = ConsoleString.DefaultBackgroundColor; } _current = null; Stopped.Fire(); Dispose(); }
public virtual void Stop() { if (!isAlive) { return; } UpdateDriver.Remove(this); isAlive = false; Stopping?.Invoke(); StoppingOneShot?.Invoke(); StoppingOneShot = null; }
internal async Task Stop() { if (!_running) { return; } Stopping?.Invoke(); Log.Debug("Stopping log readers"); _stop = true; while (_running) { await Task.Delay(50); } await Task.WhenAll(_watchers.Select(x => x.Stop())); }
public void Stop(TimeSpan?waitTime = null) { Logger.Info("AppHost: stopping"); Stopping?.Invoke(this, EventArgs.Empty); lock (_stateLock) { InternalStop(waitTime); State = HostState.Initialized; } Stopped?.Invoke(this, EventArgs.Empty); Logger.Info("AppHost: stopped"); }
private void ExitInternal() { Stopping.Fire(); Recorder?.WriteFrame(Bitmap, true); Recorder?.Dispose(); using (var snapshot = Bitmap.CreateSnapshot()) { Bitmap.CreateWiper().Wipe(); Bitmap.Console.ForegroundColor = ConsoleString.DefaultForegroundColor; Bitmap.Console.BackgroundColor = ConsoleString.DefaultBackgroundColor; } _current = null; LayoutRoot.Dispose(); Stopped.Fire(); Dispose(); }
protected override void OnStop() { // Notify stopping Stopping.Raise(this); base.Positions.Closed -= HandlePositionClosed; base.Positions.Opened -= HandlePositionOpened; Util.DisposeAll(PositionManagers); Debugging = null; Broker = null; TradeStats = null; Instrument = null; Util.Dispose(ref m_sym_cache); base.OnStop(); }
private void ExitInternal() { Stopping.Fire(); Recorder?.WriteFrame(Bitmap, true); Recorder?.Finish(); if (ClearOnExit) { ConsoleProvider.Current.Clear(); } Bitmap.Console.ForegroundColor = ConsoleString.DefaultForegroundColor; Bitmap.Console.BackgroundColor = ConsoleString.DefaultBackgroundColor; LayoutRoot.Dispose(); Stopped.Fire(); Dispose(); _current = null; }
/// <summary> /// Stop the background task. Might not stop instantly. Does nothing if the task is not running. /// </summary> public void StopBackgroundTask() { bool stopped = false; if (taskCancellation != null) { if (!taskCancellation.IsCancellationRequested) { taskCancellation.Cancel(); stopped = true; } } if (stopped) { Stopping?.Invoke(this, EventArgs.Empty); } }
public async Task ReceiveAsync(IContext context) { var task = context.Message switch { RegisterMember cmd => Register(cmd, context), CheckStatus cmd => NotifyStatuses(cmd.Index, context.Self), DeregisterMember _ => UnregisterService(context), UpdateStatusValue cmd => RegisterService(cmd.StatusValue, context), ReregisterMember _ => RegisterService(_statusValue, context), Stopping _ => Stop(), _ => Task.CompletedTask }; await task.ConfigureAwait(false); Task Stop() { Logger.LogDebug("Stopping monitoring for {Service}", _id); return(_registered ? UnregisterService(context) : Actor.Done); } }
public void AcceptConnection() { try { while (!Stopping.WaitOne(0)) { Socket handler = SocketListener.Accept(); lock (Connections) { Connections.Add(new BridgeConnection(handler)); Connections[Connections.Count - 1].Name = Connections.Count.ToString(); } } } catch (Exception e) { Console.WriteLine(e.ToString()); } }
void OnDisable() { // OnDisable can get called before OnEnable when starting simulation, so we have to make sure not to // reset state that is set right before this behavior runs. if (Director == null || !IsPlaying) { return; } m_ShouldResume = false; IsPlaying = false; IsSyncing = false; Stopping?.Invoke(); Director.played -= OnResumed; Director.paused -= OnPaused; Director.stopped -= OnStopped; Director.Stop(); SetTime(0d); }
public sealed override void Stop() { lock (_stateLock) if (_state == StreamerState.Started) { Stopping?.Invoke(this, EventArgs.Empty); if (_tProducer.IsAlive) { _tProducer.Interrupt(); _state = StreamerState.Stopping; } else { _state = StreamerState.Stopped; } } else { throw new Exception($"Illegal State: {_state}"); } }
/// <summary> /// Stops listening for connections. /// </summary> public void Stop() { if (!IsRunning) { return; } Log.WriteLine("Server stopping"); stop = true; listener?.Stop(); Stopping?.Invoke(this, e: null); try { JoinListener(); } catch (MemberAccessException) { } catch (NotImplementedException) { } Log.WriteLine("Server stopped"); Stopped?.Invoke(this, e: null); }
private void rpCopyGrid_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { if (Convert.ToInt32(activity.EditValue) == 0) { Stopping.OptionsSelection.MultiSelect = true; Stopping.SelectAll(); Stopping.CopyToClipboard(); Stopping.OptionsSelection.MultiSelect = false; } if (Convert.ToInt32(activity.EditValue) == 1) { Development.OptionsSelection.MultiSelect = true; Development.SelectAll(); Development.CopyToClipboard(); Development.OptionsSelection.MultiSelect = true; } if (Convert.ToInt32(activity.EditValue) == 2) { Sundry.OptionsSelection.MultiSelect = true; Sundry.SelectAll(); Sundry.CopyToClipboard(); Sundry.OptionsSelection.MultiSelect = true; } }
private void Stopping_CellValueChanging(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e) { if (e.Column.Name.ToString() == "gcLocked") { DataRow dr = Stopping.GetFocusedDataRow(); dr["locked"] = e.Value; if (Convert.ToBoolean(e.Value)) { dr["Lkg"] = dr["Pkg"]; dr["Diffkg"] = 0; dr["LCubics"] = dr["PCubics"]; dr["DiffCubics"] = 0; dr["Lcmgt"] = dr["Pcmgt"]; dr["LSQM"] = dr["PSQM"]; dr["LOnSQM"] = dr["POnSQM"]; dr["LOffSQM"] = dr["POffSQM"]; dr["DiffSQM"] = 0; dr["LUkg"] = dr["PUkg"]; dr["DiffUkg"] = 0; } else { dr["Lkg"] = 0; dr["Diffkg"] = Convert.ToDecimal(dr["Pkg"].ToString()) - Convert.ToDecimal(dr["Lkg"].ToString()); dr["LCubics"] = 0; dr["DiffCubics"] = Convert.ToDecimal(dr["PCubics"].ToString()) - Convert.ToDecimal(dr["LCubics"].ToString()); dr["Lcmgt"] = 0; dr["LSQM"] = 0; dr["LOnSQM"] = 0; dr["LOffSQM"] = 0; dr["DiffSQM"] = Convert.ToDecimal(dr["PSQM"].ToString()) - Convert.ToDecimal(dr["LSQM"].ToString()); dr["LUkg"] = 0; dr["DiffUkg"] = Convert.ToDecimal(dr["PUkg"].ToString()) - Convert.ToDecimal(dr["LUkg"].ToString()); } } }
public override string ToString() { string str = ""; str += Signals.ToString() + ","; str += LookingAtMirrors.ToString() + ","; str += Parking.ToString() + ","; str += ParkingInReverse.ToString() + ","; str += KeepDistance.ToString() + ","; str += Speed.ToString() + ","; str += Bypassing.ToString() + ","; str += DriveInTheRightLane.ToString() + ","; str += PreemptiveRight.ToString() + ","; str += Stopping.ToString() + ","; str += ObedienceToTrafficSigns.ToString() + ","; str += AddressingPedestrians.ToString() + ","; str += ALeapInTheRise.ToString() + ","; str += ChangeGears.ToString() + ","; str += EngineShutdown.ToString() + ","; str += IntegrationIntoMovement.ToString() + ","; str += SkillForVehicleOperation.ToString() + ","; str += AeactionTime.ToString() + ","; return(str); }
protected override void OnStop() { base.OnStop(); Stopping?.Invoke(this, EventArgs.Empty); }
/// <summary> /// Sets up a control scheme for moving a given object. /// </summary> /// <param name="controlObject">The object that is controlled.</param> /// <param name="controlMode">The type of control available to the control object.</param> /// <param name="movementType">How acceleration or velocity should be handled as the object moves.</param> /// <param name="stoppingType">How acceleration or velocity should be handled as the object stops.</param> /// <param name="playerIndex">The index number of the player controlling the object.</param> public GenControl(GenObject controlObject, ControlType controlMode = ControlType.TopDown, Movement movementType = Movement.Instant, Stopping stoppingType = Stopping.Instant, PlayerIndex playerIndex = PlayerIndex.One) { ControlMode = controlMode; ControlObject = controlObject; MovementType = movementType; StoppingType = stoppingType; PlayerIndex = playerIndex; _keyboardControls = new Keys[5]; _gamePadControls = new Buttons[5]; ButtonsSpecial = GenGamePad.ButtonsSpecial.None; UseInput = true; #if WINDOWS UseKeyboard = true; #endif UseGamePad = true; MovementSpeedX = 0; MovementSpeedY = 0; JumpSpeed = 0; JumpInheritVelocity = false; JumpCount = 1; // Start the jump counter at 1, since the control object spawns in the air initially. _jumpCounter = 1; Gravity = Vector2.Zero; _inAir = true;_state = State.Idle; MoveState = GenObject.Direction.None; IdleAnimation = null; MoveAnimation = null; JumpAnimation = null; FallAnimation = null; UseSpeedAnimation = false; MinAnimationFps = 0f; MaxAnimationFps = 12f; JumpCallback = null; LandCallback = null; // Set the default movement direction keyboard controls. SetDirectionControls(Keys.Left, Keys.Right, Keys.Up, Keys.Down); // Set the default jumping keyboard control. SetJumpControl(Keys.Space); // Set the default movement direction game pad controls. SetDirectionControls(Buttons.LeftThumbstickLeft, Buttons.LeftThumbstickRight, Buttons.LeftThumbstickUp, Buttons.LeftThumbstickDown); // Set the default jumping game pad control. SetJumpControl(Buttons.A); }