Exemplo n.º 1
0
 public static void UpdateComponentSelected(int eX, int eY, NumericUpDown numericUpDown1, NumericUpDown numericUpDown2)
 {
     if (PipeLineSystem.Updated == 0)
     {
         foreach (var c in PipeLineSystem.Network.GetListOfComponents())
         {
             if (c.ContainsPoint(eX, eY))
             {
                 if (c is Pump)
                 {
                     DialogResult dialogResult = MessageBox.Show("You want to change your current flow? Put the new input and double click on this pump again to update it ", "Update your pump's current flow?", MessageBoxButtons.YesNo);
                     if (dialogResult == DialogResult.Yes)
                     {
                         numericUpDown2.Enabled    = true;
                         numericUpDown1.Enabled    = false;
                         PipeLineSystem.UpdatePump = (Pump)c;
                         numericUpDown1.Value      = (decimal)PipeLineSystem.UpdatePump.GetCapacity();
                     }
                     else
                     {
                         PipeLineSystem.Updated = 0;
                     }
                 }
                 if (c is AdjustableSpliter)
                 {
                     DialogResult dialogResult = MessageBox.Show("You want to change your splitter setting? Put the new input and click on this spliter again to update it ", "Update your adjustable spliter?", MessageBoxButtons.YesNo);
                     if (dialogResult == DialogResult.Yes)
                     {
                         PipeLineSystem.UpdateSpliter = (AdjustableSpliter)c;
                     }
                     else
                     {
                         PipeLineSystem.Updated = 0;
                     }
                 }
             }
         }
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Update Pipelines of Comps depending type of com
 /// </summary>
 /// <param name="c"></param>
 private void UpdatePipelinesOfComps(Component c)
 {
     if (c is Pump)
     {
         Pump p = (Pump)c;
         if (p.getOutPipeLine() != null)
         {
             PipeLine outPipeLine = GetPipeline(p.getOutPipeLine().getId());
             p.addOutPipeLine(outPipeLine);
         }
         else
         {
             p.addOutPipeLine(null);
         }
     }
     if (c is Spliter || c is AdjustableSpliter)
     {
         Spliter sp = null;
         sp = (Spliter)c;
         if (c is AdjustableSpliter)
         {
             sp = (AdjustableSpliter)c;
         }
         if (sp.getInPipeLine() != null)
         {
             PipeLine inPipeLine = GetPipeline(sp.getInPipeLine().getId());
             sp.addInPipeLine(inPipeLine);
         }
         else
         {
             sp.addInPipeLine(null);
         }
         if (sp.getOutPipeLine1() != null)
         {
             PipeLine outPipeLine1 = GetPipeline(sp.getOutPipeLine1().getId());
             sp.addOutPipeLine1(outPipeLine1);
         }
         else
         {
             sp.addOutPipeLine1(null);
         }
         if (sp.getOutPipeLine2() != null)
         {
             PipeLine outPipeLine2 = GetPipeline(sp.getOutPipeLine2().getId());
             sp.addOutPipeLine2(outPipeLine2);
         }
         else
         {
             sp.addOutPipeLine2(null);
         }
     }
     if (c is Merger)
     {
         Merger mg = (Merger)c;
         if (mg.getOutPipeLine() != null)
         {
             PipeLine outPipeline = GetPipeline(mg.getOutPipeLine().getId());
             mg.addOutPipeLine(outPipeline);
         }
         else
         {
             mg.addOutPipeLine(null);
         }
         if (mg.getInPipeLine1() != null)
         {
             PipeLine inPipeline1 = GetPipeline(mg.getInPipeLine1().getId());
             mg.addInPipeLine1(inPipeline1);
         }
         else
         {
             mg.addInPipeLine1(null);
         }
         if (mg.getInPipeLine2() != null)
         {
             PipeLine intPipeline2 = GetPipeline(mg.getInPipeLine2().getId());
             mg.addInPipeLine2(intPipeline2);
         }
         else
         {
             mg.addInPipeLine2(null);
         }
     }
     if (c is Sink)
     {
         Sink sk = (Sink)c;
         if (sk.getInPipeLine() != null)
         {
             PipeLine inPipeline = GetPipeline(sk.getInPipeLine().getId());
             sk.addInPipeLine(inPipeline);
         }
         else
         {
             sk.addInPipeLine(null);
         }
     }
 }