示例#1
0
 /// <summary>Initialise new subprogram.</summary>
 public void ISP(InitSubP p)
 {
     if (!InitSP.Contains(p))
     {
         InitSP.Add(p);
     }
 }
示例#2
0
 /// <summary>Run new subprogram.</summary>
 public SdSubP RSP(InitSubP p)
 {
     unchecked
     {
         while (SP.ContainsKey(K))
         {
             K++;
         }
         var t = p.Start();
         if (t != null)
         {
             if (string.IsNullOrEmpty(t.TerminateMsg))
             {
                 if (t.ID != K)
                 {
                     // todo добавить скобки
                     EchoCtrl.CShow($"Subprogram {F.Brckt(t.I.Name)} can not start due to having invalid id."); /// #ERROR
                     return(null);
                 }
                 if (CSP(t))
                 {
                     // todo срабатывает ошибочно, добавить скобки и ниже
                     EchoCtrl.CShow($"Subprogram {F.Brckt(t.I.Name)} already running."); /// #ERROR
                     return(null);
                 }
                 SP.Add(K++, t);
                 return(t);
             }
             else
             {
                 EchoCtrl.CShow($"Subprogram {F.Brckt(t.I.Name)} can not start due by:\n{t.TerminateMsg}"); /// #ERROR
             }
         }
         return(null);
     }
 }