Exemple #1
0
 //Global variables
 private void btnSaveAs_Click(object sender, EventArgs e)
 {
     if (PipeLineSystem.SaveAsDrawing(saveFileDialog1))
     {
         btnSaveAs.Enabled = false;
         MessageBox.Show("Your drawing is saved successfully");
     }
 }
Exemple #2
0
 /// <summary>
 /// Add new network
 /// </summary>
 /// <param name="saveFileDialog1"></param>
 /// <param name="btnSave"></param>
 /// <param name="btnSaveAs"></param>
 public static void AddNewNetwork(SaveFileDialog saveFileDialog1, Button btnSave, Button btnSaveAs)
 {
     if (PipeLineSystem.Network.GetListOfComponents().Count != 0 && PipeLineSystem.Saved == false)
     {
         DialogResult dialogResult = MessageBox.Show("The current drawing has not saved yet? Would you like to save it  ", "Save your network?", MessageBoxButtons.YesNoCancel);
         if (dialogResult == DialogResult.Yes)
         {
             if (PipeLineSystem.SavedAs == false)
             {
                 if (PipeLineSystem.SaveAsDrawing(saveFileDialog1))
                 {
                     btnSaveAs.Enabled = false;
                     MessageBox.Show("Your drawing is saved successfully");
                 }
             }
             else
             {
                 if (PipeLineSystem.SaveDrawing())
                 {
                     btnSave.Enabled   = false;
                     btnSaveAs.Enabled = false;
                     MessageBox.Show("Your drawing is saved successfully");
                 }
             }
         }
         if (dialogResult == DialogResult.No)
         {
             PipeLineSystem.Network.RemoveAll();
             btnSaveAs.Enabled      = true;
             PipeLineSystem.SavedAs = false;
             btnSave.Enabled        = false;
         }
     }
     else
     {
         PipeLineSystem.Network.RemoveAll();
         btnSaveAs.Enabled      = true;
         PipeLineSystem.SavedAs = false;
         btnSave.Enabled        = false;
     }
 }