예제 #1
0
        ///--------------------------------------------------------------------------------
        /// <summary>This method processes the new propertyreference command.</summary>
        ///--------------------------------------------------------------------------------
        public void ProcessNewPropertyReferenceCommand()
        {
            PropertyReferenceEventArgs message = new PropertyReferenceEventArgs();

            message.PropertyReference            = new PropertyReference();
            message.PropertyReference.PropertyID = Guid.NewGuid();
            message.PropertyReference.EntityID   = Entity.EntityID;
            message.PropertyReference.Entity     = Entity;
            message.EntityID = Entity.EntityID;
            message.PropertyReference.Solution = Solution;
            message.Solution = Solution;
            if (message.PropertyReference.Entity != null)
            {
                message.PropertyReference.Order = message.PropertyReference.Entity.PropertyReferenceList.Count + 1;
            }
            message.WorkspaceID = WorkspaceID;
            Mediator.NotifyColleagues <PropertyReferenceEventArgs>(MediatorMessages.Command_EditPropertyReferenceRequested, message);
        }
예제 #2
0
        ///--------------------------------------------------------------------------------
        /// <summary>This method applies propertyreference deletes.</summary>
        ///--------------------------------------------------------------------------------
        public void ProcessDeletePropertyReferencePerformed(PropertyReferenceEventArgs data)
        {
            try
            {
                bool isItemMatch = false;
                if (data != null && data.PropertyReference != null)
                {
                    foreach (PropertyReferenceViewModel item in PropertyReferences.ToList <PropertyReferenceViewModel>())
                    {
                        if (item.PropertyReference.PropertyID == data.PropertyReference.PropertyID)
                        {
                            // remove item from tabs, if present
                            WorkspaceEventArgs message = new WorkspaceEventArgs();
                            message.ItemID = item.PropertyReference.PropertyID;
                            Mediator.NotifyColleagues <WorkspaceEventArgs>(MediatorMessages.Command_CloseItemRequested, message);

                            // delete children
                            for (int i = item.Items.Count - 1; i >= 0; i--)
                            {
                            }

                            // delete item
                            isItemMatch = true;
                            PropertyReferences.Remove(item);
                            Entity.PropertyReferenceList.Remove(item.PropertyReference);
                            Items.Remove(item);
                            Entity.ResetModified(true);
                            OnUpdated(this, null);
                            break;
                        }
                    }
                    if (isItemMatch == false)
                    {
                        ShowIssue(DisplayValues.Issue_DeleteItemNotFound);
                    }
                }
            }
            catch (Exception ex)
            {
                ShowIssue(ex.Message + ex.StackTrace);
            }
        }
예제 #3
0
 ///--------------------------------------------------------------------------------
 /// <summary>This method applies propertyreference updates.</summary>
 ///--------------------------------------------------------------------------------
 public void ProcessEditPropertyReferencePerformed(PropertyReferenceEventArgs data)
 {
     try
     {
         bool isItemMatch = false;
         if (data != null && data.PropertyReference != null)
         {
             foreach (PropertyReferenceViewModel item in PropertyReferences)
             {
                 if (item.PropertyReference.PropertyID == data.PropertyReference.PropertyID)
                 {
                     isItemMatch = true;
                     item.PropertyReference.TransformDataFromObject(data.PropertyReference, null, false);
                     item.OnUpdated(item, null);
                     item.ShowInTreeView();
                     break;
                 }
             }
             if (isItemMatch == false)
             {
                 // add new PropertyReference
                 data.PropertyReference.Entity = Entity;
                 PropertyReferenceViewModel newItem = new PropertyReferenceViewModel(data.PropertyReference, Solution);
                 newItem.Updated += new EventHandler(Children_Updated);
                 PropertyReferences.Add(newItem);
                 Entity.PropertyReferenceList.Add(newItem.PropertyReference);
                 Solution.PropertyReferenceList.Add(newItem.PropertyReference);
                 Items.Add(newItem);
                 OnUpdated(this, null);
                 newItem.ShowInTreeView();
             }
         }
     }
     catch (Exception ex)
     {
         ShowIssue(ex.Message + ex.StackTrace);
     }
 }