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 EditAssociation(bool isNew, Class.Association existingAssociation)
        {
            IsAssociationNew = isNew;

            if (isNew)
            {
                SelectedAssociation = new Association();
                AvailableApplicationsCollection = new ObservableCollection<TopApplication>();

                if (EditedItem.Associations.Any())
                {
                    foreach (var app in ApplicationsCollection)
                    {
                        if (EditedItem.Associations.Any((a) => a.Name != app.Name))
                        {
                            AvailableApplicationsCollection.Add(app);
                        }
                    }
                }
                else
                {
                    foreach (var a in ApplicationsCollection)
                    {
                        AvailableApplicationsCollection.Add(a);
                    }
                }
            }
            else
            {
                SelectedAssociation = existingAssociation;
                AvailableApplicationsCollection = new ObservableCollection<TopApplication>();
                SelectedApplication = ApplicationsCollection.First((a) => a.Name == existingAssociation.Name);
                AvailableApplicationsCollection.Add(SelectedApplication);
            }

            SetViewVisibility(showEditAssociation: true);
        }
Beispiel #3
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));
        }
Beispiel #4
0
 public void GetAssociations(Project project, XElement xmlSettings)
 {
     Association association;
     foreach (XElement xmlAssociation in xmlSettings.Elements("ASSOCIATIONS").Elements("ASSOCIATION"))
     {
         if (xmlAssociation.Attribute("PROJECTNAME").Value == project.Name)
         {
             //association = new Association(xmlAssociation.Attribute("PROJECTNAME").Value, xmlAssociation.Attribute("APPLICATIONNAME").Value,
             //                                                xmlAssociation.Elements("PARAMETERS").Elements("PARAMETER"), xmlAssociation.Elements("CONTEXTMENUS").Elements("CONTEXTMENU"));
             association = new Association();
             //association.Setup(xmlAssociation.Attribute("PROJECTNAME").Value, xmlAssociation.Attribute("APPLICATIONNAME").Value,
                                                             //xmlAssociation.Elements("PARAMETERS").Elements("PARAMETER"), xmlAssociation.Elements("CONTEXTMENUS").Elements("CONTEXTMENU"));
             project.Associations.Add(association);
         }
     }
 }