Example #1
0
        public override void InvokeHandler(CommandSetState state)
        {
            var dlg   = new SetBaseClassAndInterfacesForm();
            var store = state.CurrentDocView.CurrentDiagram.Store;

            dlg.Initialize(store.ElementDirectory.FindElements <ModelClass>());
            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var origCursor = Cursor.Current;
                try
                {
                    Cursor.Current = Cursors.WaitCursor;
                    using (Transaction tx = store.TransactionManager.BeginTransaction())
                    {
                        dlg.SelectedClasses.ForEach(c => c.DerivesOrImplements = dlg.InheritsOrImplements);

                        if (tx.HasPendingChanges)
                        {
                            tx.Commit();
                        }
                    }
                }
                finally
                {
                    Cursor.Current = origCursor;
                }
            }
        }
Example #2
0
 CommandSetState GetDiagramState()
 {
     var state = new CommandSetState();
     state.CurrentSelection = this.CurrentSelection;
     state.CurrentDocView = this.CurrentDocView;
     return state;
 }
        public override void InvokeHandler(CommandSetState state)
        {
            var store = state.CurrentDocView.CurrentDiagram.Store;
            var btPage = (SelectedPage.ModelElement as CloudcoreUser);

            SubProcessFiles.OpenController(store, btPage.VisioId, btPage.SubProcess.VisioId);
        }
Example #4
0
        CommandSetState GetDiagramState()
        {
            var state = new CommandSetState();

            state.CurrentSelection = this.CurrentSelection;
            state.CurrentDocView   = this.CurrentDocView;
            return(state);
        }
Example #5
0
        public override void InvokeHandler(CommandSetState state)
        {
            var store = state.CurrentDocView.CurrentDiagram.Store;

            var addEntityForm = new AddEntityForm(store);

            addEntityForm.ShowDialog();
        }
Example #6
0
 public override void InvokeHandler(CommandSetState state)
 {
     ModelerTransaction.Enter(() =>
         {
             var diagram = state.CurrentDocView.CurrentDiagram;
             var sync = new Utilities.DbSchemaImporter(diagram);
             sync.ImportModels();
         });
 }
Example #7
0
 public override void InvokeHandler(CommandSetState state)
 {
     ModelerTransaction.Enter(() =>
     {
         var diagram = state.CurrentDocView.CurrentDiagram;
         var sync    = new Utilities.DbSchemaImporter(diagram);
         sync.ImportModels();
     });
 }
Example #8
0
        public override void InvokeHandler(CommandSetState state)
        {
            var store = state.CurrentDocView.CurrentDiagram.Store;

            var addInheritanceForm = new AddInheritanceForm(store);

            if (addInheritanceForm.ShowDialog() == DialogResult.OK)
            {
                InheritanceUtil.AddInheritance(store, addInheritanceForm.baseClassComboBox.SelectedItem as string, addInheritanceForm.derivedClassComboBox.SelectedItem as string);
            }
        }
Example #9
0
        public override void InvokeHandler(CommandSetState state)
        {
            var store = state.CurrentDocView.CurrentDiagram.Store;

            ModelerTransaction.Enter(() =>
            {
                using (Transaction tx = store.TransactionManager.BeginTransaction())
                {
                    var addAssociationForm = new AddAssociationForm(state.CurrentDocView.CurrentDiagram.Store);
                    if (state.CurrentSelection.Count == 1)
                    {
                        var selection = state.CurrentSelection.Cast<object>().First();
                        if (selection is ClassShape)
                        {
                            var modelClass = ((ClassShape)selection).ModelElement as ModelClass;
                            addAssociationForm.SetSelectedClasses(modelClass);
                        }
                    }
                    addAssociationForm.ShowDialog();

                    tx.Commit();
                }
            });

            /*
            MenuCommand command = sender as MenuCommand;

            StringBuilder sb = new StringBuilder();
            sb.Append("Command: " + Commands.Values.First(x => x.CommandGuid == command.CommandID.Guid).Type.ToString() + "\n");
            foreach (object selectedObject in this.CurrentSelection)
            {
                sb.AppendLine("Selected Shape: " + selectedObject.ToString());

                if (selectedObject is ClassShape)
                {
                    ModelClass modelClass = (ModelClass)(selectedObject as ClassShape).ModelElement;
                    sb.AppendLine("*** Related Domain Class: " + modelClass.ToString());
                }

                if (selectedObject is ClassDiagram)
                {
                }
            }


            */
        }
Example #10
0
        public override void InvokeHandler(CommandSetState state)
        {
            var store = state.CurrentDocView.CurrentDiagram.Store;

            ModelerTransaction.Enter(() =>
            {
                using (Transaction tx = store.TransactionManager.BeginTransaction())
                {
                    var addAssociationForm = new AddAssociationForm(state.CurrentDocView.CurrentDiagram.Store);
                    if (state.CurrentSelection.Count == 1)
                    {
                        var selection = state.CurrentSelection.Cast <object>().First();
                        if (selection is ClassShape)
                        {
                            var modelClass = ((ClassShape)selection).ModelElement as ModelClass;
                            addAssociationForm.SetSelectedClasses(modelClass);
                        }
                    }
                    addAssociationForm.ShowDialog();

                    tx.Commit();
                }
            });

            /*
             * MenuCommand command = sender as MenuCommand;
             *
             * StringBuilder sb = new StringBuilder();
             * sb.Append("Command: " + Commands.Values.First(x => x.CommandGuid == command.CommandID.Guid).Type.ToString() + "\n");
             * foreach (object selectedObject in this.CurrentSelection)
             * {
             *  sb.AppendLine("Selected Shape: " + selectedObject.ToString());
             *
             *  if (selectedObject is ClassShape)
             *  {
             *      ModelClass modelClass = (ModelClass)(selectedObject as ClassShape).ModelElement;
             *      sb.AppendLine("*** Related Domain Class: " + modelClass.ToString());
             *  }
             *
             *  if (selectedObject is ClassDiagram)
             *  {
             *  }
             * }
             *
             *
             */
        }
Example #11
0
        public override void InvokeHandler(CommandSetState state)
        {
            var diagram          = state.CurrentDocView.CurrentDiagram;
            var modelRoot        = diagram.Store.ElementDirectory.FindElements <ModelRoot>().Single();
            var connectionString = modelRoot.ConnectionString;

            var dlg = new GenerateSQLForm();

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var sqlGenerator = new DbSchemaGenerator(diagram)
                {
                    CleanUpDbSchema = dlg.CleanupDbSchema,
                    UseNavigationPropertyNameForFKeys = dlg.UseNavigationPropertyNameForFKeys,
                };
                var sb = sqlGenerator.GenerateScripts();
                System.IO.File.WriteAllText(dlg.Filename, sb.ToString());

                if (dlg.OverwriteDatabase)
                {
                    //Creating a connection to the given database
                    using (SqlConnection sqlConnection = new SqlConnection(connectionString))
                    {
                        var originalDatabase = sqlConnection.Database;
                        sqlConnection.Open();

                        //Switching to master database
                        sqlConnection.ChangeDatabase("master");
                        ServerConnection svrConnection = new ServerConnection(sqlConnection);

                        //Recreating database and executing the query file
                        DropAndRecreateDatabase(originalDatabase, svrConnection);
                        svrConnection.ExecuteNonQuery(System.IO.File.ReadAllText(dlg.Filename));
                    }

                    ModelerTransaction.Enter(() =>
                    {
                        //Importing the new schema from database
                        var sync = new Utilities.DbSchemaImporter(diagram);
                        sync.FullDatabaseReload = true;
                        sync.ImportModels();
                    });
                }
                System.Windows.Forms.MessageBox.Show("Sql script generation completed.");
            }
        }
Example #12
0
        public override void InvokeHandler(CommandSetState state)
        {
            CleanLists();

            ConnectionStringBuilderPopup form = new ConnectionStringBuilderPopup();
            form.MyConnectionString = "Data Source=localhost; Integrated Security=True; Initial Catalog=CloudCoreDB;";
            form.ShowDialog();

            if (form.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                CloudCoreDB db = new CloudCoreDB(form.MyConnectionString);
                var store = state.CurrentDocView.CurrentDiagram.Store;
                var showscript = true;

                Architect.CustomCode.Helpers.ArchitectDte.Instance.Store = store;
                var dte = Architect.CustomCode.Helpers.ArchitectDte.Dte;
                var project = dte.ActiveWindow.Project;

                string AssemblyName = project.Properties.Item("AssemblyName").Value.ToString();
                string SystemModuleGuid = project.Properties.Item("AssemblyGuid").Value.ToString();

                Architect.ProcessOverview.Process process = store.ElementDirectory.AllElements.OfType<Architect.ProcessOverview.Process>().First();

                getDiagramSubProcess(store, process, project);
                getDatabaseSubProcesses(db, new Guid(process.VisioId));

                // Do List Comparison
                myActivities.FindAll(a => !(a.activity is FromProcessConnector) && !(a.activity is ToProcessConnector)).ForEach(act => act.DoCreate = !dbActivities.Any(a => a.activity.ActivityGuid == new Guid(act.activity.VisioId)));
                dbActivities.ForEach(act => act.DoDelete = !myActivities.FindAll(a => !(a.activity is FromProcessConnector) && !(a.activity is ToProcessConnector)).Any(a => new Guid(a.activity.VisioId) == act.activity.ActivityGuid));

                if (dbActivities.Any(a => a.DoDelete))
                {
                    showscript = getReplacementIds();
                }

                string script = GenerateScript(AssemblyName, SystemModuleGuid, new Guid(process.VisioId), process.ProcessName, db, migrateItemList, mySubProcesses, myActivities, myFlows);

                CleanLists();

                if (showscript)
                {
                    ViewScriptForm scriptform = new ViewScriptForm(script);
                    scriptform.ShowDialog();
                }
            }
        }
Example #13
0
        public override void InvokeHandler(CommandSetState state)
        {
            var diagram = state.CurrentDocView.CurrentDiagram;
            var modelRoot = diagram.Store.ElementDirectory.FindElements<ModelRoot>().Single();
            var connectionString = modelRoot.ConnectionString;

            var dlg = new GenerateSQLForm();
            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var sqlGenerator = new DbSchemaGenerator(diagram)
                {
                    CleanUpDbSchema = dlg.CleanupDbSchema,
                    UseNavigationPropertyNameForFKeys = dlg.UseNavigationPropertyNameForFKeys,
                };
                var sb = sqlGenerator.GenerateScripts();
                System.IO.File.WriteAllText(dlg.Filename, sb.ToString());

                if (dlg.OverwriteDatabase)
                {
                    //Creating a connection to the given database
                    using (SqlConnection sqlConnection = new SqlConnection(connectionString))
                    {
                        var originalDatabase = sqlConnection.Database;
                        sqlConnection.Open();

                        //Switching to master database
                        sqlConnection.ChangeDatabase("master");
                        ServerConnection svrConnection = new ServerConnection(sqlConnection);

                        //Recreating database and executing the query file
                        DropAndRecreateDatabase(originalDatabase, svrConnection);
                        svrConnection.ExecuteNonQuery(System.IO.File.ReadAllText(dlg.Filename));
                    }

                    ModelerTransaction.Enter(() =>
                        {

                            //Importing the new schema from database
                            var sync = new Utilities.DbSchemaImporter(diagram);
                            sync.FullDatabaseReload = true;
                            sync.ImportModels();
                        });
                }
                System.Windows.Forms.MessageBox.Show("Sql script generation completed.");
            }
        }
Example #14
0
 public override void StatusHandler(CommandSetState state)
 {
     foreach (object selectedObject in state.CurrentSelection)
     {
         if (selectedObject is ClassDiagram)
         {
             MenuCommand.Visible = MenuCommand.Enabled = true;
             MenuCommand.Enabled = true;
             return;
         }
         else
         {
             MenuCommand.Visible = false;
             MenuCommand.Enabled = false;
         }
     }
 }
Example #15
0
 public override void StatusHandler(CommandSetState state)
 {
     foreach (object selectedObject in state.CurrentSelection)
     {
         if (selectedObject is ClassDiagram)
         {
             MenuCommand.Visible = MenuCommand.Enabled = true;
             MenuCommand.Enabled = true;
             return;
         }
         else
         {
             MenuCommand.Visible = false;
             MenuCommand.Enabled = false;
         }
     }
 }
Example #16
0
 public override void StatusHandler(CommandSetState state)
 {
     foreach (object selectedObject in state.CurrentSelection)
     {
         if (selectedObject is ClassShape)
         {
             MenuCommand.Visible = true;
             var store = state.CurrentDocView.CurrentDiagram.Store;
             MenuCommand.Enabled = (store.ElementDirectory.FindElements <ModelClass>().Count > 1);
             return;
         }
         else
         {
             MenuCommand.Visible = false;
             MenuCommand.Enabled = false;
         }
     }
 }
Example #17
0
 public override void StatusHandler(CommandSetState state)
 {
     foreach (object selectedObject in state.CurrentSelection)
     {
         if (selectedObject is PageShape)
         {
             SelectedPage = (PageShape)selectedObject;
             MenuCommand.Visible = true;
             var store = state.CurrentDocView.CurrentDiagram.Store;
             MenuCommand.Enabled = true;
             return;
         }
         else
         {
             MenuCommand.Visible = false;
             MenuCommand.Enabled = false;
         }
     }
 }
Example #18
0
        public override void InvokeHandler(CommandSetState state)
        {
            var dlg = new System.Windows.Forms.SaveFileDialog();

            dlg.DefaultExt       = "png";
            dlg.Filter           = "Portable Network Graphics (*.png)|*.png|Windows 24-bit bitmap (*.bmp)|*.bmp|JPEG Interchange format (*.jpg)|*.jpg|Graphic Interchange Format (*.gif)|*.gif|Tagged Image File Format (*.tif)|*.tif";
            dlg.AddExtension     = true;
            dlg.RestoreDirectory = true;
            dlg.FileName         = "AgileModelerDiagram";
            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var         diagram = state.CurrentDocView.CurrentDiagram;
                var         bitmap  = diagram.CreateBitmap(diagram.NestedChildShapes, Microsoft.VisualStudio.Modeling.Diagrams.Diagram.CreateBitmapPreference.FavorClarityOverSmallSize);
                ImageFormat format  = ImageFormat.Png;

                switch (Path.GetExtension(dlg.FileName).ToLower())
                {
                case ".bmp":
                    format = ImageFormat.Bmp;
                    break;

                case ".jpg":
                    format = ImageFormat.Jpeg;
                    break;

                case ".gif":
                    format = ImageFormat.Gif;
                    break;

                case ".tif":
                    format = ImageFormat.Tiff;
                    break;

                case ".png":
                default:
                    format = ImageFormat.Png;
                    break;
                }
                bitmap.Save(dlg.FileName, format);
            }
        }
Example #19
0
        public override void InvokeHandler(CommandSetState state)
        {
            CleanLists();
            var store = state.CurrentDocView.CurrentDiagram.Store;
            var showscript = true;

            ConnectionStringBuilderPopup form = new ConnectionStringBuilderPopup();
            form.MyConnectionString = "Data Source=localhost; Integrated Security=True; Initial Catalog=CloudCoreDB;";
            form.ShowDialog();

            if (form.DialogResult == System.Windows.Forms.DialogResult.OK)
            {
                CloudCoreDB db = new CloudCoreDB(form.MyConnectionString);
                EnvDTE._DTE dte = new ScheduledTasks.VsEnvironment.ScheduledTaskDte(store).Dte;
                var project = dte.ActiveWindow.Project;

                Group group = getDiagramTasks(store, project);
                getDatabaseTasks(db, group.Id);

                string AssemblyName = project.Properties.Item("AssemblyName").Value.ToString();
                string AssemblyGuid = project.Properties.Item("AssemblyGuid").Value.ToString();

                // Do List Comparison
                scheduledtasks.ForEach(task => task.DoCreate = !dbscheduledtasks.Any(a => a.ScheduledTask.ScheduledTaskGuid == task.ScheduledTask.Id));
                dbscheduledtasks.ForEach(task => task.DoDelete = !scheduledtasks.Any(a => a.ScheduledTask.Id == task.ScheduledTask.ScheduledTaskGuid));

                string script = GenerateScript(AssemblyName, AssemblyGuid, group.Id, group.GroupName, scheduledtasks, dbscheduledtasks);

                CleanLists();

                if (showscript)
                {
                    ViewScriptForm scriptform = new ViewScriptForm(script);
                    scriptform.ShowDialog();
                }
            }
        }
        public override void InvokeHandler(CommandSetState state)
        {
            var dlg = new SetBaseClassAndInterfacesForm();
            var store = state.CurrentDocView.CurrentDiagram.Store;
            dlg.Initialize(store.ElementDirectory.FindElements<ModelClass>());
            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var origCursor = Cursor.Current;
                try
                {
                    Cursor.Current = Cursors.WaitCursor;
                    using (Transaction tx = store.TransactionManager.BeginTransaction())
                    {
                        dlg.SelectedClasses.ForEach(c => c.DerivesOrImplements = dlg.InheritsOrImplements);

                        if (tx.HasPendingChanges) tx.Commit();
                    }
                }
                finally
                {
                    Cursor.Current = origCursor;
                }
            }
        }
Example #21
0
 public override void InvokeHandler(CommandSetState state)
 {
     DiagramUtil.AutoLayout(state.CurrentDocView.CurrentDiagram.NestedChildShapes, state.CurrentDocView.CurrentDiagram);
     new DiagramUtil().GetDiagramClientView(state.CurrentDocView.CurrentDiagram).ZoomToFit();
 }
Example #22
0
 public override void InvokeHandler(CommandSetState state)
 {
     new DiagramUtil().GetDiagramClientView(state.CurrentDocView.CurrentDiagram).ZoomToFit();
 }
Example #23
0
 public override void InvokeHandler(CommandSetState state)
 {
     new DiagramUtil().GetDiagramClientView(state.CurrentDocView.CurrentDiagram)
     .SetZoomFactor(zoomFactor, state.CurrentDocView.CurrentDiagram.Center, true);
 }
Example #24
0
 public override void StatusHandler(CommandSetState state)
 {
     MenuCommand.Visible = true;
     MenuCommand.Enabled = true;
     return;
 }
Example #25
0
        public override void InvokeHandler(CommandSetState state)
        {
            var store = state.CurrentDocView.CurrentDiagram.Store;

            MessageBox.Show("This feature will be available in the next version of AgileFx.");
        }
Example #26
0
 public override void InvokeHandler(CommandSetState state)
 {
     var store = state.CurrentDocView.CurrentDiagram.Store;
     MessageBox.Show("This feature will be available in the next version of AgileFx.");
 }
Example #27
0
 public abstract void StatusHandler(CommandSetState state);
Example #28
0
 public abstract void InvokeHandler(CommandSetState state);
Example #29
0
 public override void StatusHandler(CommandSetState state)
 {
     MenuCommand.Visible = true;
     MenuCommand.Enabled = true;
 }