Esempio n. 1
0
        private void CreateNewSPESProject_Click(object sender, RibbonControlEventArgs e)
        {
            try
            {
                //Zum Starten der Modellierung werden die folgenden Methoden aufgerufen.
                FolderBrowserDialog folder = new FolderBrowserDialog();
                folder.Description = "Please select an empty folder.";
                folder.ShowDialog();

                //check if folder is empty
                if (new System.IO.DirectoryInfo(folder.SelectedPath).GetFiles().Any())
                {
                    throw new Exception("Selected folder is not empty.");
                }

                //Ruft Dialogbox auf, in der der Benutzer den Namen das Systems angibt
                string systemname = Microsoft.VisualBasic.Interaction.InputBox("Type in the name of the system", "Get System name", "System_Name");

                //pressing abort returns empty string
                if (String.IsNullOrWhiteSpace(systemname))
                {
                    return;
                }

                documentReferencer = new SPES_DocumentReferencer();

                string path = folder.SelectedPath;
                //pressing abort returns empty string
                if (String.IsNullOrWhiteSpace(path))
                {
                    return;
                }

                this.application.ActiveDocument.SaveAs(System.IO.Path.Combine(path, systemname + "_Overview.vsdx"));
                this.spesapp.CreateRectangle(systemname);
                this.spesapp.CreateSystem(documentReferencer);
                this.spesapp.SetHyperlink();

                //create config file
                documentReferencer.SaveConfigToFile(documentReferencerFile);

                //this._spesapp.deleteModels();
            }
            //Fange mögliche Fehler ab und informiere Benutzer, dass die Generierung unvollständig ist
            catch (Exception exc)
            {
                if (exc.InnerException != null)
                {
                    System.Windows.Forms.MessageBox.Show("Not all elements could created through Modeling: " + exc.InnerException.Message);
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("Not all elements could created through Modeling: " + exc.Message);
                }
            }
        }
Esempio n. 2
0
        private void CreateNewEngineeringPath_Click(object sender, RibbonControlEventArgs e)
        {
            try
            {
                //this._application.ActiveDocument.Save();

                this.spesapp.CreateSubsystems(documentReferencer);
                documentReferencer.SaveConfigToFile(documentReferencerFile);
                System.Windows.Forms.MessageBox.Show("Creation successfully!");
            }
            //Fange mögliche Fehler ab und informiere Benutzer, dass die Generierung unvollständig ist
            catch (Exception exc)
            {
                if (exc.InnerException != null)
                {
                    System.Windows.Forms.MessageBox.Show("Not all elements could created through Modeling: " + exc.InnerException.Message);
                }
                else
                {
                    System.Windows.Forms.MessageBox.Show("Not all elements could created through Modeling: " + exc.Message);
                }
            }
        }