Example #1
0
        private void NewClientConnected(IRemoteXTMF obj)
        {
            // Setup a new model system for them to execute
            var msCopy = ModelSystemToExecute.Clone();

            FixParameters(msCopy);
            Host.ExecuteModelSystemAsync(msCopy);
        }
Example #2
0
 private void Cut_Click(object sender, RoutedEventArgs e)
 {
     if (this.SelectedElement != null)
     {
         this.CopyBuffer    = SelectedElement.Clone();
         this.ExitedOnClick = true;
         if (this.RemovePressed != null)
         {
             this.RemovePressed();
         }
     }
 }
 private void ModuleContextMenu_InsertRequested(IModelSystemStructure toInsert)
 {
     this.FocusedSelectedModule = -1;
     this.SetModuleFocus();
     var parent = this.GetParent(this.ModelSystemDisplay.SelectedModule);
     var clone = toInsert.Clone();
     if(parent == null)
     {
         if(this.ModelSystem != null)
         {
             this.AddCommand(new SetModelSystemRootCommand(UpdateRootAction, this.ModelSystem, clone));
         }
         else
         {
             this.AddCommand(new SetProjectRootCommand(UpdateRootAction, this._Project, this.ProjectModelSystemNumber, clone));
         }
         this.ModelSystemDisplay.RootModule = toInsert;
         this.RefreshLinkedParameters();
         this.SetupParameters(clone);
         this.SetupModelSystem();
     }
     else
     {
         var selected = this.ModelSystemDisplay.SelectedModule;
         if(selected.IsCollection)
         {
             if(toInsert.IsCollection)
             {
                 if(clone.Children == null) return;
                 foreach(var child in clone.Children)
                 {
                     this.AddCommand(new AddToModuleListCommand(selected, child));
                 }
                 this.ModelSystemDisplay.SelectedModule = selected.Children[selected.Children.Count - 1];
             }
             else
             {
                 this.AddCommand(new AddToModuleListCommand(selected, toInsert.Clone()));
                 this.ModelSystemDisplay.SelectedModule = selected.Children[selected.Children.Count - 1];
             }
             this.SetupModelSystem();
         }
         else
         {
             // process being inserted into a non list where the parent is a list
             if(parent.IsCollection)
             {
                 var collection = parent.Children;
                 var collectionLength = collection.Count;
                 for(int i = 0; i < collectionLength; i++)
                 {
                     if(collection[i] == this.ModelSystemDisplay.SelectedModule)
                     {
                         this.AddCommand(new ModuleSwapCommand(this.GetLinkParameters(), parent, i, clone));
                         this.ModelSystemDisplay.SelectedModule = clone;
                         this.RefreshLinkedParameters();
                         this.SetupModelSystem();
                         break;
                     }
                 }
             }
             else
             {
                 // Process being inserted into a non list where the parent is also not a list.
                 var collection = parent.Children;
                 if(collection == null)
                 {
                     AddCommand(new SetModelSystemRootCommand(UpdateRootAction, ModelSystem, clone));
                 }
                 else
                 {
                     var collectionLength = collection.Count;
                     for(int i = 0; i < collectionLength; i++)
                     {
                         if(collection[i] == this.ModelSystemDisplay.SelectedModule)
                         {
                             this.AddCommand(new ModuleSwapCommand(this.GetLinkParameters(), parent, i, clone));
                             this.ModelSystemDisplay.SelectedModule = clone;
                             this.RefreshLinkedParameters();
                             break;
                         }
                     }
                 }
                 this.SetupParameters(clone);
                 this.SetupModelSystem();
             }
         }
     }
     this.Save();
 }
Example #4
0
        private void ModuleContextMenu_InsertRequested(IModelSystemStructure toInsert)
        {
            this.FocusedSelectedModule = -1;
            this.SetModuleFocus();
            var parent = this.GetParent(this.ModelSystemDisplay.SelectedModule);
            var clone  = toInsert.Clone();

            if (parent == null)
            {
                if (this.ModelSystem != null)
                {
                    this.AddCommand(new SetModelSystemRootCommand(UpdateRootAction, this.ModelSystem, clone));
                }
                else
                {
                    this.AddCommand(new SetProjectRootCommand(UpdateRootAction, this._Project, this.ProjectModelSystemNumber, clone));
                }
                this.ModelSystemDisplay.RootModule = toInsert;
                this.RefreshLinkedParameters();
                this.SetupParameters(clone);
                this.SetupModelSystem();
            }
            else
            {
                var selected = this.ModelSystemDisplay.SelectedModule;
                if (selected.IsCollection)
                {
                    if (toInsert.IsCollection)
                    {
                        if (clone.Children == null)
                        {
                            return;
                        }
                        foreach (var child in clone.Children)
                        {
                            this.AddCommand(new AddToModuleListCommand(selected, child));
                        }
                        this.ModelSystemDisplay.SelectedModule = selected.Children[selected.Children.Count - 1];
                    }
                    else
                    {
                        this.AddCommand(new AddToModuleListCommand(selected, toInsert.Clone()));
                        this.ModelSystemDisplay.SelectedModule = selected.Children[selected.Children.Count - 1];
                    }
                    this.SetupModelSystem();
                }
                else
                {
                    // process being inserted into a non list where the parent is a list
                    if (parent.IsCollection)
                    {
                        var collection       = parent.Children;
                        var collectionLength = collection.Count;
                        for (int i = 0; i < collectionLength; i++)
                        {
                            if (collection[i] == this.ModelSystemDisplay.SelectedModule)
                            {
                                this.AddCommand(new ModuleSwapCommand(this.GetLinkParameters(), parent, i, clone));
                                this.ModelSystemDisplay.SelectedModule = clone;
                                this.RefreshLinkedParameters();
                                this.SetupModelSystem();
                                break;
                            }
                        }
                    }
                    else
                    {
                        // Process being inserted into a non list where the parent is also not a list.
                        var collection = parent.Children;
                        if (collection == null)
                        {
                            AddCommand(new SetModelSystemRootCommand(UpdateRootAction, ModelSystem, clone));
                        }
                        else
                        {
                            var collectionLength = collection.Count;
                            for (int i = 0; i < collectionLength; i++)
                            {
                                if (collection[i] == this.ModelSystemDisplay.SelectedModule)
                                {
                                    this.AddCommand(new ModuleSwapCommand(this.GetLinkParameters(), parent, i, clone));
                                    this.ModelSystemDisplay.SelectedModule = clone;
                                    this.RefreshLinkedParameters();
                                    break;
                                }
                            }
                        }
                        this.SetupParameters(clone);
                        this.SetupModelSystem();
                    }
                }
            }
            this.Save();
        }