Exemple #1
0
        public override void get(string what, Msg message)
        {
            Console.WriteLine("...SimInstr.get(" + what + ")");
            switch (what)
            {
            case "location":
                //get this through the instrument interface
                replyTo(message, location);
                break;

            case "location.now":
                //get this through the instrument interface
                ack(message);
                replyTo(message, location);
                break;

            case "name":
                //get this through the instrument interface
                replyTo(message, name);
                break;

            case "runstate":
                replyTo(message, RunState.ToString());
                break;

            default:
                //not handled
                base.get(what, message);
                break;
            }
        }
 private bool SetState(RunState value) {
     lock (_runStateLock) {
         if (_runState >= value)
             return false;
         _runState = value;
         if (value == RunState.Starting) {
             Status = string.Format("Starting on scheduler {0}", _schedId);
         } else {
             Status = value.ToString();
             if (value == RunState.Stopped) {
                 _cts.Cancel();
                 if (OnStopped != null) {
                     if (StarcounterEnvironment.IsOnScheduler())
                         OnStopped.Invoke();
                     else
                         ScheduleTask(OnStopped);
                 }
             }
         }
         return true;
     }
 }