protected override void OnConnectionStopped(ISourceConnection connection, StopReason reason)
 {
     if (reason != StopReason.UserReconnect)
     {
         Stop(reason);
     }
 }
        /// <summary>
        /// Event handler for when the Roomba stops
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Roomba_Stopped(object sender, RoombaStopArgs e)
        {
            var stopReason = Enum.GetName(typeof(StopReason), e.StopOrigin);

            Debug.WriteLine("Roomba_Stopped: " + stopReason);

            lastStopType = e.StopOrigin;

            switch (e.StopOrigin)
            {
            case StopReason.Collision:
                Debug.WriteLine("Stopped because of collision!");
                cts?.Cancel();
                break;

            case StopReason.Cancellation:
                Debug.WriteLine("Stopped because of class wide cancellation!");
                cts?.Cancel();
                break;

            case StopReason.Requested:
                Debug.WriteLine("Stopped because of a stop request!");
                break;

            case StopReason.Success:
                Debug.WriteLine("Stopped because success!");
                break;

            default:
                break;
            }
        }
        public StopReason GetLast(Machine machine)
        {
            string     connString = string.Format("server={0};user=root;database={1};port=3306;password=root;Connection Timeout=1", machine.Ip, _raspiDb);
            StopReason sr         = new StopReason();

            try
            {
                using (_conn = new MySqlConnection(connString))
                {
                    string query = string.Format("select * from {0} order by Id desc limit 1", _raspiStopReasonTable);
                    using (MySqlCommand cmd = new MySqlCommand(query, _conn))
                    {
                        _conn.Open();
                        using (MySqlDataReader reader = cmd.ExecuteReader())
                        {
                            while (reader.Read())
                            {
                                sr.Id     = reader.GetInt32(0);
                                sr.Start  = reader.GetDateTime(1);
                                sr.Finish = reader.GetDateTime(2);
                                sr.Time   = reader.GetTimeSpan(3);
                                sr.Reason = reader.GetInt32(4);
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("stopreasondal  getlast'de sıkıntı var\n" + e);
            }
            return(sr);
        }
        protected override void OnConnectionStopped(ISourceConnection connection, StopReason reason)
        {
            switch (reason)
            {
            case StopReason.UnavailableError:
                IgnoreNode(connection.SourceUri);
                Reconnect(SelectSourceHost());
                break;

            case StopReason.ConnectionError:
            case StopReason.OffAir:
                if (connection.SourceUri == this.SourceUri)
                {
                    Stop(reason);
                }
                else
                {
                    IgnoreNode(connection.SourceUri);
                    Reconnect(SelectSourceHost());
                }
                break;

            case StopReason.UserReconnect:
                break;

            case StopReason.UserShutdown:
            default:
                Stop(reason);
                break;
            }
        }
Example #5
0
 public override int GetHashCode()
 {
     return(PersonId.GetHashCode() ^
            ConceptId.GetHashCode() ^
            TypeConceptId.GetHashCode() ^
            (SourceValue != null ? SourceValue.GetHashCode() : 0) ^
            (StopReason != null ? StopReason.GetHashCode() : 0) ^
            Refills.GetHashCode() ^
            VisitOccurrenceId.GetHashCode() ^
            Quantity.GetHashCode() ^
            DaysSupply.GetHashCode() ^
            RouteConceptId.GetHashCode() ^
            EffectiveDrugDose.GetHashCode() ^
            DoseUnitConceptId.GetHashCode() ^
            SourceConceptId.GetHashCode() ^
            (Sig != null ? Sig.GetHashCode() : 0) ^
            (LotNumber != null ? LotNumber.GetHashCode() : 0) ^
            (RouteSourceValue != null ? RouteSourceValue.GetHashCode() : 0) ^
            (DoseUnitSourceValue != null ? DoseUnitSourceValue.GetHashCode() : 0) ^
            ProviderId.GetHashCode() ^
            (StartDate.GetHashCode()) ^
            (EndDate.GetHashCode()) ^
            (VerbatimEndDate.GetHashCode()) ^
            (StartTime != null ? StartTime.GetHashCode() : 0) ^
            (EndTime != null ? EndTime.GetHashCode() : 0));
 }
        public void Add(Machine machine, StopReason stopReason)
        {
            string connString = string.Format("server={0};user=root;database={1};port=3306;password=root;Connection Timeout=1", machine.Ip, _raspiDb);

            try
            {
                using (_conn = new MySqlConnection(connString))
                {
                    string query = "insert into StopReasons (Start,Finish,Time,Reason) values (@Start,@Finish,@,@Time,@Reason)";
                    using (MySqlCommand cmd = new MySqlCommand(query, _conn))
                    {
                        _conn.Open();
                        cmd.Parameters.AddWithValue("@Start", stopReason.Start);
                        cmd.Parameters.AddWithValue("@Finish", stopReason.Finish);
                        cmd.Parameters.AddWithValue("@Time", stopReason.Time);
                        cmd.Parameters.AddWithValue("@Reason", stopReason.Reason);
                        cmd.ExecuteNonQuery();
                    }
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("stopreasondal add sıkıntı var" + e);
            }
        }
 void MockThread(RemoteThread thread, StopReason stopReason, List <ulong> stopData)
 {
     thread.GetStopReason().Returns(stopReason);
     thread.GetStopReasonDataCount().Returns((uint)stopData.Count);
     thread.GetStopReasonDataAtIndex(Arg.Any <uint>())
     .Returns(i => stopData[Convert.ToInt32(i[0])]);
 }
Example #8
0
 public void OnStop(StopReason reason)
 {
     msgQueue.Enqueue(new ContentMessage {
         Type = ContentMessage.MessageType.Stop, StopReason = reason
     });
     processorTask.Wait();
 }
Example #9
0
        public void Stop(string requestId, StopReason reason)
        {
            try
            {
                string serviceUrl = Settings.GetAsString("ServiceURL", "");

                if (requestProperties == null || !requestProperties.ContainsKey(requestId) || !requestProperties[requestId].ContainsKey("RequestToken"))
                {
                    return;
                }

                string requestToken = requestProperties[requestId]["RequestToken"];

                using (var factory = new WebChannelFactory <IModelProcessorRestService>(new Uri(serviceUrl)))
                {
                    var channel = factory.CreateChannel();
                    //channel.Stop(requestId, (Lpp.Dns.DataMart.Model.Rest.StopReason)Enum.ToObject(typeof(StopReason), (int) reason));
                    channel.Stop(requestToken, (Lpp.Dns.DataMart.Model.Rest.StopReason)Enum.ToObject(typeof(StopReason), (int)reason));
                }
            }
            catch (Exception ex)
            {
                log.Debug(ex);
                throw new ModelProcessorError(ex.Message, ex);
            }
        }
Example #10
0
 public void OnStop(StopReason reason)
 {
     if (process != null)
     {
         pipePackets.Enqueue(null);
         try {
             if (!Task.WaitAll(new [] { stdInTask, stdOutTask, stdErrorTask }, 333))
             {
                 processCancellationToken.Cancel();
                 Task.WaitAll(new [] { stdInTask, stdOutTask, stdErrorTask }, 333);
             }
         }
         catch (AggregateException) {
         }
         try {
             if (!process.HasExited)
             {
                 if (!process.CloseMainWindow() ||
                     !process.WaitForExit(1000))
                 {
                     process.Kill();
                 }
             }
         }
         catch (System.ComponentModel.Win32Exception) {
         }
         catch (InvalidOperationException) {
         }
         process.Close();
         process = null;
         processCancellationToken = null;
     }
     Sink.OnStop(reason);
 }
Example #11
0
 protected void StopConnection(StopReason reason)
 {
     if (sourceConnection != null)
     {
         sourceConnection.Stop(reason);
         sourceConnectionThread.Join();
     }
 }
Example #12
0
 public PauseContext(IMemory memory, ICpu cpu, StopReason stopReason, IBreakPoint stopBreakPoint, string stopMessage)
 {
     Memory         = memory;
     Cpu            = cpu;
     StopReason     = stopReason;
     StopMessage    = stopMessage;
     StopBreakPoint = stopBreakPoint;
 }
Example #13
0
File: Logic.cs Project: wurunduk/SI
 internal virtual void Stop(StopReason reason)
 {
     if (_stopReason == StopReason.None)
     {
         _stopReason = reason;
         ExecuteImmediate();
     }
 }
        /// <summary>
        /// This function will move the robot while also stopping if there are obstacles and adjusting
        /// course if it's heading towards a wall
        /// </summary>
        /// <param name="speed">Speed robot will move</param>
        /// <param name="distMM">Distance in millimeters</param>
        /// <returns></returns>
        public async Task ContinuousMove(int speed, int distMM, CancellationToken token)
        {
            if (!Roomba.IsEnabled)
            {
                Debug.WriteLine("Roomba is not enabled!  Cancelling move...");
                return;
            }

            lastStopType = StopReason.Success;

            int distMoved = 0;

            do
            {
                // Cancel the entire move if we collided with something or canceled everything
                if (token != null && token.IsCancellationRequested)
                {
                    return;
                }

                if (lastStopType == StopReason.Collision || lastStopType == StopReason.Cancellation)
                {
                    return;
                }

                switch (Analysis.LastRecommendation)
                {
                case LidarRecommendation.Move:
                    Debug.WriteLine("ContinuousMove: Moving...");
                    // Calculate distance left to move
                    distMM -= distMoved;

                    // Move the robot
                    OnControllerMessageReceived($"Moving {distMM} mm...");
                    await Roomba.MoveDistanceEncoders(speed, distMM);

                    // Determine how far the robot moved
                    distMoved = (int)Roomba.AverageDistanceTraveled;
                    break;

                case LidarRecommendation.AdjustObstacle:
                    Debug.WriteLine("ContinuousMove: Adjusting...");
                    // It doesn't matter what the actual adjust angle is, since the robot will
                    // stop rotating once we get the recommendation to move
                    if (Analysis.LastAdjustAngle < 0)
                    {
                        Roomba.SetSpeed(DEFAULT_ROTATE_SPEED, 0);
                    }
                    else
                    {
                        Roomba.SetSpeed(0, DEFAULT_ROTATE_SPEED);
                    }
                    break;
                }

                await Task.Delay(100);
            }while (distMoved < distMM);
        }
 public void Stop(StopReason reason)
 {
     if (!IsStopped)
     {
         SyncContext.Post(dummy => {
             DoStop(reason);
         }, null);
     }
 }
 protected void Stop(StopReason reason)
 {
     if (!IsStopped)
     {
         PostAction(() => {
             DoStop(reason);
         });
     }
 }
 public void StopAndWait(StopReason reason)
 {
     if (IsCompleted)
     {
         return;
     }
     Connection.Stop(reason);
     Task.Wait();
 }
Example #18
0
        private void OnClosed(StopReason reason)
        {
            var sinks = contentSinks;

            foreach (var sink in sinks)
            {
                sink.OnStop(reason);
            }
        }
Example #19
0
        private void OnClosed(StopReason reason)
        {
            var events = ReadLock(() => Closed);

            if (events != null)
            {
                events(this, new StreamStoppedEventArgs(reason));
            }
        }
 protected void StopConnection(StopReason reason)
 {
     if (sourceConnection == null)
     {
         return;
     }
     sourceConnection.Stop(reason);
     sourceConnectionTask.Wait();
 }
Example #21
0
        private void OnClosed(StopReason reason)
        {
            var sinks = contentSinks;

            foreach (var sink in sinks)
            {
                sink.OnStop(reason);
            }
            DispatchMonitorEvent(mon => mon.OnStopped(reason));
        }
 public void StopTick(StopReason reason, string user)
 {
     if (!IsRunning)
     {
         return;
     }
     StopReason   = reason;
     StoppingUser = user;
     StopTick();
 }
 protected virtual void DoStop(StopReason reason)
 {
     if (reason == StopReason.None)
     {
         throw new ArgumentException("Invalid value", "reason");
     }
     if (!IsStopped)
     {
         StoppedReason = reason;
     }
 }
Example #24
0
        public void DbCheck()
        {
            Console.WriteLine("dbcheck fired");
            string date   = DateTime.Now.ToString("yyyy-MM-dd");
            string acik   = _logService.SpendTime(Machine.Ip, "Machine", "Logs", date, "open").ToString();
            string kapali = _logService.SpendTime(Machine.Ip, "Machine", "Logs", date, "close").ToString();

            lblAcik.Text   = string.Format("Açık : {0}", acik);
            lblKapali.Text = string.Format("Kapalı : {0}", kapali);

            Log lastLog = new Log();

            lastLog = _logService.GetLast(Machine.Ip, "Machine", "Logs");
            string lastState = lastLog.LastState;

            pbState.Image = (lastState == "open") ? Properties.Resources.green : Properties.Resources.red;
            lblDurum.Text = (lastState == "open") ? "Açık" : "Kapalı";
            lastState     = (lastState == "open") ? "'dir açık" : "'dir kapalı";
            var lastTime  = lastLog.LastDate;
            var gecenSure = DateTime.Now - lastTime;

            string calismaSuresi = string.Format("{0:%d}g {0:%h}s {0:%m}dk {0:%s}sn", gecenSure) + "\t" + lastState;

            lblTime.Text = calismaSuresi;


            Console.WriteLine("gecensure.minute : {0}", gecenSure.TotalMinutes);
            bool bl = gecenSure.TotalMinutes > 1;

            Console.WriteLine("bool : " + bl);
            if (gecenSure.TotalMinutes > 1 && lastLog.LastState == "close")
            {
                StopReason sr = new StopReason();
                sr = _stopReasonService.GetLast(Machine);
                TimeSpan time = DateTime.Now - sr.Finish;
                Console.WriteLine("time : " + time);
                int min = Convert.ToInt32(time.TotalMinutes);
                Console.WriteLine("min : " + min);
                if (min > 1)
                {
                    AnaSayfaWarning asw = new AnaSayfaWarning
                    {
                        Machine = Machine
                    };
                    timerDbCheck.Enabled = false;
                    timerDbCheck.Stop();
                    panelMain.Controls.Clear();
                    panelMain.Controls.Add(asw);
                    asw.Show();
                    asw.Dock = DockStyle.Fill;
                    asw.BringToFront();
                }
            }
        }
Example #25
0
 void OnFinishConversation(StopReason reason)
 {
     if (!CallInProgress)
     {
         return;
     }
     CallInProgress = false;
     //LogHelper.Call(GetType(), "send stop_reason: " + reason);
     RemoveTracksRenderers();
     ReleaseRoom();
     _listener?.OnRoomDisconnected(reason);
 }
Example #26
0
 public void Start()
 {
     lock (_settingsSync) {
         if (IsRunning)
         {
             throw new Exception("The watcher is already running.");
         }
         _isStopping        = false;
         _stopReason        = StopReason.Other;
         _hasRun            = true;
         _hasInitialized    = false;
         _nextCheckWorkItem = _workScheduler.AddItem(TickCount.Now, Check, PageHost);
     }
 }
Example #27
0
            public override int GetHashCode()
            {
                unchecked
                {
                    var hashCode = EqualityComparer <TS> .Default.GetHashCode(StateName);

                    hashCode = (hashCode * 397) ^ EqualityComparer <TD> .Default.GetHashCode(StateData);

                    hashCode = (hashCode * 397) ^ Timeout.GetHashCode();
                    hashCode = (hashCode * 397) ^ (StopReason != null ? StopReason.GetHashCode() : 0);
                    hashCode = (hashCode * 397) ^ (Replies != null ? Replies.GetHashCode() : 0);
                    return(hashCode);
                }
            }
Example #28
0
        private async Task SendQuit(Stream stream, StopReason code, CancellationToken cancellationToken)
        {
            switch (code)
            {
            case StopReason.None:
                break;

            case StopReason.Any:
                await stream.WriteAsync(new Atom(Atom.PCP_QUIT, Atom.PCP_ERROR_QUIT), cancellationToken).ConfigureAwait(false);

                break;

            case StopReason.SendTimeoutError:
                await stream.WriteAsync(new Atom(Atom.PCP_QUIT, Atom.PCP_ERROR_QUIT + Atom.PCP_ERROR_SKIP), cancellationToken).ConfigureAwait(false);

                break;

            case StopReason.BadAgentError:
                await stream.WriteAsync(new Atom(Atom.PCP_QUIT, Atom.PCP_ERROR_QUIT + Atom.PCP_ERROR_BADAGENT), cancellationToken).ConfigureAwait(false);

                break;

            case StopReason.ConnectionError:
                await stream.WriteAsync(new Atom(Atom.PCP_QUIT, Atom.PCP_ERROR_QUIT + Atom.PCP_ERROR_READ), cancellationToken).ConfigureAwait(false);

                break;

            case StopReason.NotIdentifiedError:
                await stream.WriteAsync(new Atom(Atom.PCP_QUIT, Atom.PCP_ERROR_QUIT + Atom.PCP_ERROR_NOTIDENTIFIED), cancellationToken).ConfigureAwait(false);

                break;

            case StopReason.UnavailableError:
                await stream.WriteAsync(new Atom(Atom.PCP_QUIT, Atom.PCP_ERROR_QUIT + Atom.PCP_ERROR_UNAVAILABLE), cancellationToken).ConfigureAwait(false);

                break;

            case StopReason.OffAir:
                await stream.WriteAsync(new Atom(Atom.PCP_QUIT, Atom.PCP_ERROR_QUIT + Atom.PCP_ERROR_OFFAIR), cancellationToken).ConfigureAwait(false);

                break;

            case StopReason.UserShutdown:
                await stream.WriteAsync(new Atom(Atom.PCP_QUIT, Atom.PCP_ERROR_QUIT + Atom.PCP_ERROR_SHUTDOWN), cancellationToken).ConfigureAwait(false);

                break;
            }
        }
        protected override void OnConnectionStopped(ISourceConnection connection, StopReason reason)
        {
            switch (reason)
            {
            case StopReason.UserReconnect:
                break;

            case StopReason.UserShutdown:
                Stop(reason);
                break;

            default:
                Task.Delay(3000).ContinueWith(prev => Reconnect());
                break;
            }
        }
Example #30
0
 public void Stop(StopReason stopReason = StopReason.ShutdownServer)
 {
     willStop = true;
     try
     {
         AdvancedStream.SendMessage(ref Writer, "L2KDB:Basic:Stop," + stopReason.ToString(), CustomedAES);
     }
     catch (Exception)
     {
     }
     try
     {
         Reader.Dispose();
     }
     catch (Exception)
     {
     }
     try
     {
         Writer.Dispose();
     }
     catch (Exception)
     {
     }
     try
     {
         OriginalStream.Dispose();
     }
     catch (Exception)
     {
     }
     try
     {
         Client.Dispose();
     }
     catch (Exception)
     {
     }
     try
     {
         ServerCore.SessionPool.Remove(this);
     }
     catch (Exception)
     {
     }
     System.GC.Collect();
 }
 public void Stop(StopReason reason)
 {
     log.InfoFormat("ServiceRunner stopping, reason: [{0}]{1}", reason.ToString(), Environment.NewLine);
 }
        private bool AddThread(string pageURL, string pageAuth, string imageAuth, int checkInterval, bool oneTime, string saveDir, string description, StopReason? stopReason, WatcherExtraData extraData)
        {
            ThreadWatcher watcher = null;
            ListViewItem newListViewItem = null;

            foreach (ThreadWatcher existingWatcher in ThreadWatchers) {
                if (String.Equals(existingWatcher.PageURL, pageURL, StringComparison.OrdinalIgnoreCase)) {
                    if (existingWatcher.IsRunning) return false;
                    watcher = existingWatcher;
                    break;
                }
            }

            if (watcher == null) {
                watcher = new ThreadWatcher(pageURL);
                watcher.ThreadDownloadDirectory = saveDir;
                watcher.Description = description;
                watcher.DownloadStatus += ThreadWatcher_DownloadStatus;
                watcher.WaitStatus += ThreadWatcher_WaitStatus;
                watcher.StopStatus += ThreadWatcher_StopStatus;
                watcher.ThreadDownloadDirectoryRename += ThreadWatcher_ThreadDownloadDirectoryRename;
                watcher.DownloadStart += ThreadWatcher_DownloadStart;
                watcher.DownloadProgress += ThreadWatcher_DownloadProgress;
                watcher.DownloadEnd += ThreadWatcher_DownloadEnd;

                newListViewItem = new ListViewItem(String.Empty);
                for (int i = 1; i < lvThreads.Columns.Count; i++) {
                    newListViewItem.SubItems.Add(String.Empty);
                }
                newListViewItem.Tag = watcher;
                lvThreads.Items.Add(newListViewItem);
            }

            watcher.PageAuth = pageAuth;
            watcher.ImageAuth = imageAuth;
            watcher.CheckIntervalSeconds = checkInterval;
            watcher.OneTimeDownload = oneTime;

            if (extraData == null) {
                extraData = watcher.Tag as WatcherExtraData;
                if (extraData == null) {
                    extraData = new WatcherExtraData {
                        AddedOn = DateTime.Now
                    };
                }
            }
            if (newListViewItem != null) {
                extraData.ListViewItem = newListViewItem;
            }
            watcher.Tag = extraData;

            DisplayDescription(watcher);
            DisplayAddedOn(watcher);
            DisplayLastImageOn(watcher);
            if (stopReason == null) {
                watcher.Start();
            }
            else {
                watcher.Stop(stopReason.Value);
            }

            return true;
        }
 protected void StopConnection(StopReason reason)
 {
     if (sourceConnection!=null) {
     sourceConnection.Stop(reason);
     sourceConnectionThread.Join();
       }
 }
 public StopEvent(StopReason reason)
     : base(SourceStreamEventType.Stop)
 {
     this.StopReason = reason;
 }
Example #35
0
 public StopEventArgs(StopReason Reason)
     : base()
 {
     this.Reason = Reason;
 }
Example #36
0
 protected void Stop(StopReason Reason)
 {
     if (!this.Initialized) { return; }
     this._Fade = new FinalFade(this, FinalFade.DefaultStopLength, FadeType.Stop);
 }
 protected override void OnConnectionStopped(ISourceConnection connection, StopReason reason)
 {
   switch (reason) {
   case StopReason.UserReconnect:
     break;
   case StopReason.UserShutdown:
     Stop(reason);
     break;
   case StopReason.NoHost:
     Stop(reason);
     break;
   default:
     Task.Delay(3000).ContinueWith(prev => Reconnect());
     break;
   }
 }
 protected virtual void DoStop(StopReason reason)
 {
     if (reason==StopReason.None) throw new ArgumentException("Invalid value", "reason");
       if (!IsStopped) {
     StoppedReason = reason;
       }
 }
        internal void Stop(StopReason reason, Action callback)
        {
            if (callback != null)
            {
                stopCallback = callback;
            }

            switch (this.CrawlStatus)
            {
                case CrawlStatus.Downloading:
                    //First stop attempt
                    UpdateSink(new UpdateData(EventType.ItemUpdate, "Stopping... '" + reason.ToString() + "' again to force stop without finishing current downloads."));
                    this.CrawlStatus = CrawlStatus.StopRequested;
                    break;
                case CrawlStatus.StopRequested:
                case CrawlStatus.StopPending:
                    //Second stop attempt. Stop now.
                    ForceStop();
                    break;
                default:
                    break;
            }
        }
 private void SetStopStatus(ThreadWatcher watcher, StopReason stopReason)
 {
     string status = "Stopped: ";
     switch (stopReason) {
         case StopReason.UserRequest:
             status += "User requested";
             break;
         case StopReason.Exiting:
             status += "Exiting";
             break;
         case StopReason.PageNotFound:
             status += "Page not found";
             break;
         case StopReason.DownloadComplete:
             status += "Download complete";
             break;
         case StopReason.IOError:
             status += "Error writing to disk";
             break;
         default:
             status += "Unknown error";
             break;
     }
     DisplayStatus(watcher, status);
 }
 protected override void OnConnectionStopped(ISourceConnection connection, StopReason reason)
 {
   switch (reason) {
   case StopReason.UserReconnect:
     break;
   case StopReason.UserShutdown:
     Stop(reason);
     break;
   case StopReason.NoHost:
     Stop(reason);
     break;
   default:
     Reconnect();
     break;
   }
 }
Example #42
0
 protected void StopFinal(StopReason Reason)
 {
     this.Finish();
     PlayStopped(this, new StopEventArgs(Reason));
 }
 protected override void DoStop(StopReason reason)
 {
     switch (reason) {
       case StopReason.None:
     break;
       case StopReason.Any:
     Send(new Atom(Atom.PCP_QUIT, Atom.PCP_ERROR_QUIT));
     break;
       case StopReason.SendTimeoutError:
     Send(new Atom(Atom.PCP_QUIT, Atom.PCP_ERROR_QUIT + Atom.PCP_ERROR_SKIP));
     break;
       case StopReason.BadAgentError:
     Send(new Atom(Atom.PCP_QUIT, Atom.PCP_ERROR_QUIT + Atom.PCP_ERROR_BADAGENT));
     break;
       case StopReason.ConnectionError:
     Send(new Atom(Atom.PCP_QUIT, Atom.PCP_ERROR_QUIT + Atom.PCP_ERROR_READ));
     break;
       case StopReason.NotIdentifiedError:
     Send(new Atom(Atom.PCP_QUIT, Atom.PCP_ERROR_QUIT + Atom.PCP_ERROR_NOTIDENTIFIED));
     break;
       case StopReason.UnavailableError:
     {
       //次に接続するホストを送ってQUIT
       foreach (var node in SelectSourceHosts((IPEndPoint)RemoteEndPoint)) {
     if (Downhost!=null && Downhost.SessionID==node.SessionID) continue;
     var host_atom = new AtomCollection(node.Extra);
     Atom ip = host_atom.FindByName(Atom.PCP_HOST_IP);
     while (ip!=null) {
       host_atom.Remove(ip);
       ip = host_atom.FindByName(Atom.PCP_HOST_IP);
     }
     Atom port = host_atom.FindByName(Atom.PCP_HOST_PORT);
     while (port!=null) {
       host_atom.Remove(port);
       port = host_atom.FindByName(Atom.PCP_HOST_PORT);
     }
     host_atom.SetHostSessionID(node.SessionID);
     var globalendpoint = node.GlobalEndPoint ?? new IPEndPoint(IPAddress.Any, 0);
     host_atom.AddHostIP(globalendpoint.Address);
     host_atom.AddHostPort(globalendpoint.Port);
     var localendpoint  = node.LocalEndPoint ?? new IPEndPoint(IPAddress.Any, 0);
     host_atom.AddHostIP(localendpoint.Address);
     host_atom.AddHostPort(localendpoint.Port);
     host_atom.SetHostNumRelays(node.RelayCount);
     host_atom.SetHostNumListeners(node.DirectCount);
     host_atom.SetHostChannelID(Channel.ChannelID);
     host_atom.SetHostFlags1(
       (node.IsFirewalled ? PCPHostFlags1.Firewalled : PCPHostFlags1.None) |
       (node.IsTracker ? PCPHostFlags1.Tracker : PCPHostFlags1.None) |
       (node.IsRelayFull ? PCPHostFlags1.None : PCPHostFlags1.Relay) |
       (node.IsDirectFull ? PCPHostFlags1.None : PCPHostFlags1.Direct) |
       (node.IsReceiving ? PCPHostFlags1.Receiving : PCPHostFlags1.None) |
       (node.IsControlFull ? PCPHostFlags1.None : PCPHostFlags1.ControlIn));
     Send(new Atom(Atom.PCP_HOST, host_atom));
     Logger.Debug("Sending Node: {0}({1})", globalendpoint, node.SessionID.ToString("N"));
       }
     }
     Send(new Atom(Atom.PCP_QUIT, Atom.PCP_ERROR_QUIT + Atom.PCP_ERROR_UNAVAILABLE));
     break;
       case StopReason.OffAir:
     Send(new Atom(Atom.PCP_QUIT, Atom.PCP_ERROR_QUIT + Atom.PCP_ERROR_OFFAIR));
     break;
       case StopReason.UserShutdown:
     Send(new Atom(Atom.PCP_QUIT, Atom.PCP_ERROR_QUIT + Atom.PCP_ERROR_SHUTDOWN));
     break;
       }
       base.DoStop(reason);
 }
 protected void Stop(StopReason reason)
 {
     EventQueue.Enqueue(new StopEvent(reason));
 }
Example #45
0
 /// <summary>
 /// Returns the text associated with the passed
 /// stop reason.
 /// </summary>
 /// <param name="stopReasonText">The rext of the stop reason.</param>
 /// <param name="stopReason">The stop reason to examine</param>
 /// <param name="stopReasonObject"></param>
 /// <returns></returns>
 private void GetStopReasonInfo(object stopReasonObject, out string stopReasonText, out StopReason stopReason)
 {
     if (stopReasonObject is BreakpointHitStopReason)
     {
         stopReasonText = "Breakpoint Hit";
         stopReason = StopReason.BreakpointHit;
     }
     else if (stopReasonObject is StepCompleteStopReason)
     {
         stopReasonText = "Step Complete";
         stopReason = StopReason.StepComplete;
     }
     else if (stopReasonObject is ExceptionThrownStopReason)
     {
         stopReasonText = "Exception Thrown!";
         stopReason = StopReason.ExceptionOccurred;
     }
     else if (stopReasonObject is ExceptionUnwindStopReason)
     {
         stopReasonText = "An Exception is being unwound";
         stopReason = StopReason.ExceptionOccurred;
     }
     else if (stopReasonObject is AttachCompleteStopReason)
     {
         stopReasonText = "Debugger successfully started";
         stopReason = StopReason.DebuggerStarted;
     }
     else
     {
         stopReasonText = "Unsupported Stop Reason";
         stopReason = StopReason.ExceptionOccurred;
     }
 }
 public ConnectionStoppedEvent(ISourceConnection connection, StopReason reason)
     : base(SourceStreamEventType.ConnectionStopped)
 {
     this.Connection = connection;
     this.StopReason = reason;
 }
		public void Stop(StopReason reason)
		{
			stopReason = reason;
			cancelSource.Cancel();
		}
Example #48
0
        public void StopMeasurements(StopReason reason)
        {
            m_StateMachine.VideoOperation.StopMeasurements((correctTrackingTool) =>
                {
                    m_CorrectTrackingTool = correctTrackingTool;
                    m_StoppedAtFrameNo = m_StateMachine.VideoOperation.m_CurrFrameNo;
                    m_StopReason = reason;

                    btnStop.Text = "Continue Measurements";

                    btnLightCurve.Visible = true;

                    if (m_CorrectTrackingTool.SupportsManualCorrections)
                    {
                        gbxCorrections.Visible = true;
                        ucCorrSelection.CorrectTrackingTool = m_CorrectTrackingTool;
                        ucCorrSelection.Reset();
                    }

                    m_VideoController.RefreshCurrentFrame();
                });
        }
 public virtual void Stop(StopReason reason)
 {
   if (reason==StopReason.None) throw new ArgumentException("Invalid value", "reason");
   if (IsStopped) return;
   StoppedReason = reason;
   isStopped.Cancel();
 }
Example #50
0
 void process(object sender, Level_2_Lib.MazeRobot.StopEventArgs args)
 {
     sr = args.stopReason;
     rd = args.runDistance;
 }
 public void Stop(StopReason reason)
 {
   StoppedReason = reason;
   isStopped.Cancel();
 }
 protected override void OnConnectionStopped(ISourceConnection connection, StopReason reason)
 {
   switch (reason) {
   case StopReason.UnavailableError:
     IgnoreNode(connection.SourceUri);
     Reconnect(SelectSourceHost());
     break;
   case StopReason.ConnectionError:
   case StopReason.OffAir:
     if (connection.SourceUri==this.SourceUri) {
       Stop(reason);
     }
     else {
       IgnoreNode(connection.SourceUri);
       Reconnect(SelectSourceHost());
     }
     break;
   case StopReason.UserReconnect:
     break;
   case StopReason.UserShutdown:
   default:
     Stop(reason);
     break;
   }
 }
 protected virtual void DoStop(StopReason reason)
 {
     IsStopped = true;
 }
Example #54
0
 public StreamStoppedEventArgs(StopReason reason)
 {
     this.StopReason = reason;
 }
 protected void Stop(StopReason reason)
 {
     if (!IsStopped) {
     PostAction(() => {
       DoStop(reason);
     });
       }
 }
 public void Stop(StopReason reason)
 {
     if (!IsStopped) {
     SyncContext.Post(dummy => {
       DoStop(reason);
     }, null);
       }
 }
 internal void Stop(StopReason reason)
 {
     Stop(reason, null);
 }