Esempio n. 1
0
 /** <summary> Opens the water object. </summary> */
 private void Open(object sender, EventArgs e)
 {
     if (fileName == "")
     {
         openFileDialog.InitialDirectory = "";
         openFileDialog.FileName         = "";
     }
     else
     {
         openFileDialog.InitialDirectory = Path.GetDirectoryName(fileName);
         openFileDialog.FileName         = Path.GetFileNameWithoutExtension(fileName);
     }
     if (!changed || WarningMessageBox.Show(this, "Scenery group has been changed.", "Are you sure you want to continue?") == DialogResult.Yes)
     {
         if (openFileDialog.ShowDialog(this) == DialogResult.OK)
         {
             fileName = openFileDialog.FileName;
             ObjectData obj     = ObjectData.FromFile(fileName);
             bool       invalid = false;
             if (obj is SceneryGroup && (obj as SceneryGroup).GraphicsData.NumImages == 2)
             {
                 this.sceneryGroup = (SceneryGroup)obj;
                 LoadSceneryGroup();
             }
             else
             {
                 invalid = true;
             }
             if (invalid)
             {
                 ErrorMessageBox.Show(this, "Failed to load scenery group.", "Object may be invalid.");
             }
         }
     }
 }
Esempio n. 2
0
 /** <summary> Creates a new water object. </summary> */
 private void New(object sender, EventArgs e)
 {
     if (!changed || WarningMessageBox.Show(this, "Scenery group has been changed.", "Are you sure you want to continue?") == DialogResult.Yes)
     {
         sceneryGroup = (SceneryGroup)ObjectData.FromBuffer(Resources.SCGCUST);
         sceneryGroup.ObjectHeader.Flags = 0x7;
         LoadSceneryGroup();
         fileName = "";
     }
 }
Esempio n. 3
0
 public static DialogResult Show(Form parent, string text1, string text2)
 {
     using (var form = new WarningMessageBox(text1, text2)) {
         return(form.ShowDialog(parent));
     }
 }