private void btnUpdateFlow_Click(object sender, EventArgs e)
 {
     if (selectedComponent != null)
     {
         if (selectedComponent is Pump)
         {
             Pump   p = (Pump)selectedComponent;
             double capacity;
             double flow;
             if (double.TryParse(tbCapacity.Text, out capacity) &&
                 double.TryParse(tbCurrentFlow.Text, out flow))
             {
                 p.SetFlow(capacity, flow);
             }
             else
             {
                 MessageBox.Show("Invalid values!");
             }
         }
         selectedComponent       = null;
         this.tbCurrentFlow.Text = "";
         this.tbCapacity.Text    = "";
         panel1.Invalidate();
     }
     else if (selectedPipeline != null)
     {
         double maxFlow;
         if (double.TryParse(tbCapacity.Text, out maxFlow))
         {
             selectedPipeline.ChangeMaxFlow(maxFlow);
         }
         else
         {
             MessageBox.Show("Invalid max value!");
         }
         selectedPipeline        = null;
         this.tbCurrentFlow.Text = "";
         this.tbCapacity.Text    = "";
         panel1.Invalidate();
     }
 }