Exemple #1
0
        private void MetroButton1_Click_1(object sender, EventArgs e)
        {
            openDialog openFirstFile = new openDialog();

            FileLocationOne.Text       = openFirstFile.OpenFileDialogForm();
            CompareUserControl.IsReady = true;
            CompareUserControl.Instance.ViewFileOne.Enabled = true;
            CompareUserControl.Instance.ViewFileOne.Visible = true;
            SetFilePathOne = FileLocationOne.Text;
            Compare();
        }
Exemple #2
0
        private void FileTwoSelect_Click(object sender, EventArgs e)
        {
            openDialog openFirstFile = new openDialog();

            FileLocationTwo.Text = openFirstFile.OpenFileDialogForm();
            CompareUserControl.Instance.Compare.Enabled = true;
            CompareUserControl.IsReady = true;
            CompareUserControl.Instance.ViewFileTwo.Enabled = true;
            CompareUserControl.Instance.ViewFileTwo.Visible = true;
            SetFilePathTwo = FileLocationTwo.Text;
            Compare();
        }
Exemple #3
0
        /// <summary>
        /// This event calls some methods to validate an SCL file
        /// </summary>
        /// <param name="sender">
        /// Name of the object.
        /// </param>
        /// <param name="e">
        /// This class contains no event data; it is used by events that do not pass state information to an event
        /// handler when an event is raised. If the event handler requires state information, the application must
        /// derive a class from this class to hold the data.
        /// </param>
        private void ValidateFileClick(object sender, EventArgs e)
        {
            List <ErrorsManagement> list = new List <ErrorsManagement> ();
            string     f   = "";
            openDialog dlg = new openDialog();
            var        res = dlg.ShowDialog();

            if (res == DialogResult.OK)
            {
                f = dlg.FileName;
            }
            else
            {
                return;
            }
            try {
                ValidatingSCL val = new ValidatingSCL();
                list = val.ValidateFile(f, xSDFiles);
                if (list.Count > 0)
                {
                    string msg = "";
                    for (int i = 0; i < list.Count; i++)
                    {
                        msg += list[i].ErrorMessage + "\n";
                    }
                    MessageBox.Show("Validation has found issues in SCL file:\n\n"
                                    + msg,
                                    "Validation finished",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Warning);
                }
            }
            catch (Exception ex) {
                MessageBox.Show("Validation has thrown an Error:\n\n"
                                + ex.Message,
                                "Validation Stoped",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
Exemple #4
0
 /// <summary>
 /// This event calls some methods to import an IED to an SCL File.
 /// </summary>
 /// <param name="sender">
 /// Name of the object.
 /// </param>
 /// <param name="e">
 /// This class contains no event data; it is used by events that do not pass state information to an event
 /// handler when an event is raised. If the event handler requires state information, the application must
 /// derive a class from this class to hold the data.
 /// </param>
 void ImportIEDClick(object sender, EventArgs e)
 {
     if (this.sclviewertree.Nodes != null && this.sclviewertree.Nodes.Count > 0)
     {
         var        listError = new List <ErrorsManagement> ();
         openDialog dlg       = new openDialog();
         dlg.ImportIED = true;
         if (dlg.ShowDialog() == DialogResult.OK)
         {
             this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
             listError   = ImportIED(dlg.FileName, validate);
             this.Cursor = System.Windows.Forms.Cursors.Default;
         }
         if (listError.Capacity > 0)
         {
             EnablePanels(listError);
         }
     }
     else
     {
         MessageBox.Show("Can't import IED over un empty SCL");
     }
 }
Exemple #5
0
        public void OpenSCLFile(string filename, bool validate)
        {
            List <ErrorsManagement> list = new List <ErrorsManagement> ();

            if (modified && scl != null)
            {
                var res = MessageBox.Show("Do you want to save your work?",
                                          "Openning a new SCL",
                                          MessageBoxButtons.YesNoCancel,
                                          MessageBoxIcon.Exclamation);
                if (res == DialogResult.Yes)
                {
                    SaveSCLFile(true);
                }
                if (res == DialogResult.Cancel)
                {
                    return;
                }
            }

            string f = "";

            if (filename == null)
            {
                openDialog dlg = new openDialog();
                var        res = dlg.ShowDialog();
                if (res == DialogResult.OK)
                {
                    f = dlg.FileName;
                }
                else
                {
                    return;
                }
            }
            else
            {
                f = filename;
            }

            if (validate)
            {
                //System.Windows.Forms.MessageBox.Show ("OpenDialog: Validating");
                ValidatingSCL val = new ValidatingSCL();
                list = val.ValidateFile(f, xSDFiles);
            }
            this.PropertyGridAttributes.SelectedObject = null;
            this.Cursor = System.Windows.Forms.Cursors.WaitCursor;
            this.scl    = null;
            // Creating an SCL object
            System.Console.WriteLine("Deserializating file to SCLObject:...");
            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();
            sw.Start();
            this.scl = new OpenSCL.Object();
            this.scl.Deserialize(f);
            sw.Stop();
            System.Console.WriteLine("Enlapsed Time:" + sw.ElapsedMilliseconds + " ms");
            // Creating TreeView
            System.Console.WriteLine("Creating TreeView:...");
            System.Diagnostics.Stopwatch swt = new System.Diagnostics.Stopwatch();
            swt.Start();
            string t = GetSclTitle();

            this.sclviewertree.scl   = this.scl.Configuration;
            this.sclviewertree.title = t;
            swt.Stop();
            System.Console.WriteLine("Enlapsed Time:" + swt.ElapsedMilliseconds + " ms");
            modified  = false;
            this.Text = this.AppName + " - " + this.File;
            Console.WriteLine("File: " + scl.FileName + "Openend Modif = " + modified.ToString());
            this.Cursor = System.Windows.Forms.Cursors.Default;

            if (list.Count == 0)
            {
                EnablePanels(null);
            }
            else
            {
                EnablePanels(list);
            }
        }
Exemple #6
0
 private void Start()
 {
     buildingSelection.SetActive(false); //hide building selection bar on start so player can't place a building before the satellite
     oD        = FindObjectOfType <openDialog>();
     buildings = new List <GameObject>();
 }