///-------------------------------------------------------------------------------- /// <summary>This method processes the delete IndexProperty command.</summary> ///-------------------------------------------------------------------------------- public void ProcessDeleteIndexPropertyCommand() { IndexPropertyEventArgs message = new IndexPropertyEventArgs(); message.IndexProperty = IndexProperty; message.IndexID = IndexID; message.Solution = Solution; message.WorkspaceID = WorkspaceID; Mediator.NotifyColleagues <IndexPropertyEventArgs>(MediatorMessages.Command_DeleteIndexPropertyRequested, message); }
///-------------------------------------------------------------------------------- /// <summary>This method sends the edit item performed message to have the /// update applied.</summary> ///-------------------------------------------------------------------------------- public void SendEditIndexPropertyPerformed() { IndexPropertyEventArgs message = new IndexPropertyEventArgs(); message.IndexProperty = IndexProperty; message.IndexID = IndexID; message.Solution = Solution; message.WorkspaceID = WorkspaceID; Mediator.NotifyColleagues <IndexPropertyEventArgs>(MediatorMessages.Command_EditIndexPropertyPerformed, message); }
///-------------------------------------------------------------------------------- /// <summary>This method applies index deletes.</summary> ///-------------------------------------------------------------------------------- public void ProcessDeleteIndexPerformed(IndexEventArgs data) { try { bool isItemMatch = false; if (data != null && data.Index != null) { foreach (IndexViewModel item in Indexes.ToList <IndexViewModel>()) { if (item.Index.IndexID == data.Index.IndexID) { // remove item from tabs, if present WorkspaceEventArgs message = new WorkspaceEventArgs(); message.ItemID = item.Index.IndexID; Mediator.NotifyColleagues <WorkspaceEventArgs>(MediatorMessages.Command_CloseItemRequested, message); // delete children for (int i = item.Items.Count - 1; i >= 0; i--) { if (item.Items[i] is IndexPropertyViewModel) { IndexPropertyViewModel child = item.Items[i] as IndexPropertyViewModel; IndexPropertyEventArgs childMessage = new IndexPropertyEventArgs(); childMessage.IndexProperty = child.IndexProperty; childMessage.IndexID = item.Index.IndexID; childMessage.Solution = Solution; childMessage.WorkspaceID = child.WorkspaceID; item.ProcessDeleteIndexPropertyPerformed(childMessage); } } // delete item isItemMatch = true; Indexes.Remove(item); Entity.IndexList.Remove(item.Index); 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); } }
///-------------------------------------------------------------------------------- /// <summary>This method processes the new IndexProperty command.</summary> ///-------------------------------------------------------------------------------- public void ProcessNewIndexPropertyCommand() { IndexPropertyEventArgs message = new IndexPropertyEventArgs(); message.IndexProperty = new IndexProperty(); message.IndexProperty.IndexPropertyID = Guid.NewGuid(); message.IndexProperty.IndexID = IndexID; message.IndexProperty.Index = Solution.IndexList.FindByID((Guid)IndexID); if (message.IndexProperty.Index != null) { message.IndexProperty.Order = message.IndexProperty.Index.IndexPropertyList.Count + 1; } message.IndexProperty.Solution = Solution; message.IndexID = IndexID; message.Solution = Solution; message.WorkspaceID = WorkspaceID; Mediator.NotifyColleagues <IndexPropertyEventArgs>(MediatorMessages.Command_EditIndexPropertyRequested, message); }