コード例 #1
0
        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;
                }
            }
        }
コード例 #2
0
        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));
        }
コード例 #3
0
ファイル: ScheduledUpdater.cs プロジェクト: shrekjxf/Rpi
        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);
        }
コード例 #4
0
        /// <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;
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
 public void Stop()
 {
     lock (_locker)
     {
         Stopping?.Invoke(this, new EventArgs());
         SimulationSession.Dispose();
         _graphicsManager.Dispose();
     }
 }
コード例 #7
0
 public void StopServer()
 {
     if (IsRunning)
     {
         Debug.Log("stopping server");
         // stop the server
         Stopping?.Invoke();
     }
     ResetSO();
 }
コード例 #8
0
 private void OnStopping()
 {
     try
     {
         Stopping?.Invoke();
     }
     catch (Exception e)
     {
         _logger.Error("Stopping event handler error", e);
     }
 }
コード例 #9
0
    // 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);
            }
        }
    }
コード例 #10
0
        public void Stop()
        {
            if (!Started)
            {
                return;
            }

            Stopping?.Invoke();

            thread.Abort();
        }
コード例 #11
0
        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));
        }
コード例 #12
0
        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);
            }
        }
コード例 #13
0
ファイル: TZPlayback.xaml.cs プロジェクト: zkg642/JXXZ
        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;
        }
コード例 #14
0
ファイル: ConsoleApp.cs プロジェクト: kentcb/PowerArgs
 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();
 }
コード例 #15
0
ファイル: NormalUpdater.cs プロジェクト: GF47/GRT
        public virtual void Stop()
        {
            if (!isAlive)
            {
                return;
            }

            UpdateDriver.Remove(this);
            isAlive = false;

            Stopping?.Invoke();
            StoppingOneShot?.Invoke();
            StoppingOneShot = null;
        }
コード例 #16
0
ファイル: LogReader.cs プロジェクト: riQQ/HearthSim.Common
 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()));
 }
コード例 #17
0
        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");
        }
コード例 #18
0
ファイル: ConsoleApp.cs プロジェクト: jiaw37/PowerArgs
 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();
 }
コード例 #19
0
        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();
        }
コード例 #20
0
        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;
        }
コード例 #21
0
ファイル: BackgroundProcessor.cs プロジェクト: itsmefox/evtc
        /// <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);
            }
        }
コード例 #22
0
        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);
            }
        }
コード例 #23
0
ファイル: ProxyServer.cs プロジェクト: nvnamsss/ProxyServer
        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());
            }
        }
コード例 #24
0
        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);
        }
コード例 #25
0
ファイル: Streamer.cs プロジェクト: DaleLin93/SharpBCI
 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}");
         }
 }
コード例 #26
0
ファイル: HttpServer.cs プロジェクト: Element18592/fsd4ever
        /// <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);
        }
コード例 #27
0
 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;
     }
 }
コード例 #28
0
 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());
         }
     }
 }
コード例 #29
0
        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);
        }
コード例 #30
0
        protected override void OnStop()
        {
            base.OnStop();

            Stopping?.Invoke(this, EventArgs.Empty);
        }
コード例 #31
0
ファイル: GenControl.cs プロジェクト: GeneticSpartan/Genetic
        /// <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);
        }