private void InitializeStatus()
 {
     //List<string> status = Constants.STATUS_LIST;
     //BindingSource bs = new BindingSource();
     //bs.DataSource = status;
     //cboStatus.DataSource = bs;
     Control.Status stat = Control.Status.Okay;
     SetStatusText(stat);
     //txtStatus.Text = Control.Status.Okay.ToString();
 }
Esempio n. 2
0
 public override void UpdateBeforeSimulation10()
 {
     if (Entity as IMyCubeBlock != null && Entity as Sandbox.ModAPI.Ingame.IMyTerminalBlock != null)
     {
         IMyCubeBlock block = Entity as IMyCubeBlock;
         Sandbox.ModAPI.Ingame.IMyGridTerminalSystem gridTerminal = getGridTerminal(Entity);
         if (block.BlockDefinition.SubtypeName.Contains("AirlockRKR") && gridTerminal != null && (Entity as IMyCubeBlock).IsWorking)
         {
             String   name      = (Entity as IMyTerminalBlock).CustomName;
             String[] nameSplit = name.Split('#');
             if (nameSplit.Length == 2 && nameSplit[1] != null)
             {
                 String configLCDName = nameSplit[1];
                 Config config        = new ConfigReader(gridTerminal, Entity as Sandbox.ModAPI.Ingame.IMyTerminalBlock, configLCDName).readConfig();
                 if (config.isStatusPanelValid() && !Debugging)
                 {
                     LOG = new Logger(config.statusPanel);
                 }
                 //MyAPIGateway.Utilities.ShowNotification(config.isStatusPanelValid() ? "status Panel gefunden" : "kein status Panel", 10000, MyFontEnum.Red);
                 if (LOG != null && !Debugging && config.isStatusPanelValid())
                 {
                     LOG.Clear(config.statusPanel);
                     LOG.log(config.statusPanel, "Uhrzeit: " + DateTime.Now.ToLongTimeString(), ErrorSeverity.Notice);
                     LOG.log(config.statusPanel, "Konfigurationspanel: " + configLCDName, ErrorSeverity.Notice);
                 }
                 else if (LOG != null && Debugging && gridTerminal != null)
                 {
                     LOG.Clear(gridTerminal);
                     LOG.log(gridTerminal, "Uhrzeit: " + DateTime.Now.ToLongTimeString(), ErrorSeverity.Notice);
                     LOG.log(gridTerminal, "Konfigurationspanel: " + configLCDName, ErrorSeverity.Notice);
                     LOG.log(gridTerminal, "Progress: " + this.progress.ToString() + "(" + this.progress.Equals(Control.Status.Standby) + ")", ErrorSeverity.Notice);
                 }
                 if (config.isValid())
                 {
                     if (LOG != null && config.isStatusPanelValid())
                     {
                         LOG.log(config.statusPanel, "Schleusendruck: " + Utils.getPressure(config.sluiceVents[0]) + "%", ErrorSeverity.Notice);
                     }
                     List <Control.Event> currentEvents = new List <Control.Event>();
                     if (this.abortStartTimeStamp != 0L && DateTime.Now.Ticks >= new DateTime(this.abortStartTimeStamp).AddMilliseconds(config.abortMilliseconds).Ticks)
                     {
                         currentEvents.Add(Control.Event.AbortTimerDown);
                     }
                     currentEvents.AddList(Utils.getSensorStatusChanges(this.sensorStatus, config));
                     if (LOG != null && Debugging && gridTerminal != null)
                     {
                         foreach (Control.Event currentEvent in currentEvents)
                         {
                             LOG.log(gridTerminal, currentEvent.ToString(), ErrorSeverity.Error);
                         }
                         LOG.log(gridTerminal, "Doors1 " + Utils.isOneDoorOpen(config.doors1), ErrorSeverity.Notice);
                         LOG.log(gridTerminal, "Doors2 " + Utils.isOneDoorOpen(config.doors2), ErrorSeverity.Notice);
                     }
                     this.progress = Control.run(currentEvents, this.progress, config);
                     if ((this.abortStartTimeStamp == 0L) && (this.progress.Equals(Control.Status.leaveProgress) || this.progress.Equals(Control.Status.leaveSchleuse) || this.progress.Equals(Control.Status.enterProgress) || this.progress.Equals(Control.Status.enterSchleuse)))
                     {
                         this.abortStartTimeStamp = DateTime.Now.Ticks;
                     }
                     else if (this.progress.Equals(Control.Status.leavePressurize) || this.progress.Equals(Control.Status.Standby) || this.progress.Equals(Control.Status.enterPressurize))
                     {
                         this.abortStartTimeStamp = 0L;
                     }
                 }
                 else
                 {
                     if (LOG != null && config.isStatusPanelValid())
                     {
                         LOG.log(config.statusPanel, "Konfiguration ist " + (config.isValid() ? "" : "nicht ") + "valide", ErrorSeverity.Notice);
                         LOG.log(config.statusPanel, "Doors1 " + (config.isDoors1Valid() ? "ok" : "nicht gefunden"), ErrorSeverity.Notice);
                         LOG.log(config.statusPanel, "Sensors1 " + (config.isSensors1Valid() ? "ok" : "nicht gefunden"), ErrorSeverity.Notice);
                         LOG.log(config.statusPanel, "SluiceVents " + (config.isSluiceVentsValid() ? "ok" : "nicht gefunden"), ErrorSeverity.Notice);
                         LOG.log(config.statusPanel, "SluiceSensors " + (config.isSluiceSensorsValid() ? "ok" : "nicht gefunden"), ErrorSeverity.Notice);
                         LOG.log(config.statusPanel, "Doors2 " + (config.isDoors2Valid() ? "ok" : "nicht gefunden"), ErrorSeverity.Notice);
                         LOG.log(config.statusPanel, "Sensors2 " + (config.isSensors2Valid() ? "ok" : "nicht gefunden"), ErrorSeverity.Notice);
                         LOG.log(config.statusPanel, "Vents " + (config.isVentsValid() ? "ok" : "nicht gefunden"), ErrorSeverity.Notice);
                         LOG.log(config.statusPanel, "Lights " + (config.lightsFound() ? "ok" : "nicht gefunden"), ErrorSeverity.Notice);
                     }
                     else if (LOG != null && Debugging && gridTerminal != null)
                     {
                         LOG.log(gridTerminal, "Konfiguration ist " + (config.isValid() ? "" : "nicht ") + "valide", ErrorSeverity.Notice);
                         LOG.log(gridTerminal, "Doors1 " + (config.isDoors1Valid() ? "ok" : "nicht gefunden"), ErrorSeverity.Notice);
                         LOG.log(gridTerminal, "Doors2 " + (config.isDoors2Valid() ? "ok" : "nicht gefunden"), ErrorSeverity.Notice);
                         LOG.log(gridTerminal, "Vents " + (config.isVentsValid() ? "ok" : "nicht gefunden"), ErrorSeverity.Notice);
                         LOG.log(gridTerminal, "SluiceVents  " + (config.isSluiceVentsValid() ? "ok" : "nicht gefunden"), ErrorSeverity.Notice);
                         LOG.log(gridTerminal, "Sensors1  " + (config.isSensors1Valid() ? "ok" : "nicht gefunden"), ErrorSeverity.Notice);
                         LOG.log(gridTerminal, "SluiceSensors  " + (config.isSluiceSensorsValid() ? "ok" : "nicht gefunden"), ErrorSeverity.Notice);
                         LOG.log(gridTerminal, "Sensors2  " + (config.isSensors2Valid() ? "ok" : "nicht gefunden"), ErrorSeverity.Notice);
                     }
                     this.progress            = Control.Status.Standby;
                     this.abortStartTimeStamp = 0L;
                     this.sensorStatus.Clear();
                 }
             }
         }
         else
         {
             this.progress            = Control.Status.Standby;
             this.abortStartTimeStamp = 0L;
             this.sensorStatus.Clear();
         }
     }
 }
 // Try to ensure that what goes into the disabled txtStatus text box is a Control.Status value.
 // This is a controlled input for the work order.
 private void SetStatusText(Control.Status status)
 {
     txtStatus.Text = status.ToString();;
 }