Beispiel #1
0
 private Association CreateNewAssociation(Class.TopApplication selectedApplication)
 {
     Class.Association a = new Association();
     a.Setup(EditedItem.Name, selectedApplication.Name);
     return a;
 }
Beispiel #2
0
        public void OkButton_Clicked()
        {
            if (EditContextMenuVisibility == Visibility.Visible)
            {
                if (SelectedContextMenu.Name == null)
                {
                    EditedItem.ContextMenuCollection.Remove(SelectedContextMenu);
                }

                SetViewVisibility(true);
            }
            else if (EditAssociatedVisibility == Visibility.Visible)
            {
                if (!EditedItem.Associations.Contains(SelectedAssociation))
                {
                    // Add new association to the EditedItem's association collection
                    EditedItem.Associations.Add(SelectedAssociation);
                }

                SetViewVisibility(true);
            }
            else if (SelectExistingAssociationVisibility == Visibility.Visible)
            {
                if (SelectedExistingAssociation != null)
                {
                    SelectedAssociation = new Association();
                    SelectedAssociation.Setup(EditedItem.Name, SelectedExistingAssociation.Name);

                    foreach (var parameter in SelectedExistingAssociation.Parameters)
                    {
                        Parameter newParameter = new Parameter();
                        newParameter.Setup(parameter.Type, parameter.Value, parameter.Path);
                        SelectedAssociation.Parameters.Add(newParameter);
                    }

                    foreach (var cm in SelectedExistingAssociation.ContextMenuCollection)
                    {
                        Class.ContextMenu newContextMenu = new Class.ContextMenu();
                        newContextMenu.Setup(cm.Type, cm.Value, cm.Name);
                        SelectedAssociation.AddContextMenu(cm);
                    }
                }

                SetViewVisibility(showEditAssociation:true);
            }
            else
            {
                SelectedItem.Name = EditedItem.Name;
                SelectedItem.ContextMenuCollection = EditedItem.ContextMenuCollection;
                SelectedItem.Applications = editedItem.Applications;
                SelectedItem.Associations = EditedItem.Associations;
                SelectedItem.MiscText = EditedItem.MiscText;
                Messenger.Default.Send<Message.M_EditTile>(new Message.M_EditTile(SelectedItem, this));
            }

            //proj.Execute(EditedItem);
            //Messenger.Default.Send<Message.M_SimpleAction>(new Message.M_SimpleAction(Message.M_SimpleAction.Action.RefreshViews));
        }