コード例 #1
0
 // Inserts a new group after the last selected group
 public void InsertAfterInstructionGroup(IInstructionGroupItem groupFactory)
 {
     if (runtimeService.DisconnectDialog(this))
     {
         IInstructionGroupItem foundIG = null;
         foreach (var instructionGroupIterator in Items)
         {
             IInstructionGroupItem instructionGroup = null;
             instructionGroup = instructionGroupIterator as IInstructionGroupItem;
             if (instructionGroup != null && instructionGroup.IsSelected)
             {
                 foundIG = instructionGroup;
             }
         }
         if (foundIG != null)
         {
             var      newItem = groupFactory.Create(this, null);
             NodePage newPage = WorkingCopy.NodeInstructionGroupChildren.InsertAfter(foundIG.InstructionGroup, newItem.InstructionGroup);
             insertNewGroup(newItem, newPage);
         }
         else
         {
             PageEditorParent.messagingService.ShowMessage(
                 Resources.Strings.PageEditor_GroupCommand_NoneSelected,
                 Resources.Strings.PageEditor_GroupCommand_NoneSelected_Title);
         }
     }
 }
コード例 #2
0
 public void AppendInstructionGroup(IInstructionGroupItem groupFactory)
 {
     if (runtimeService.DisconnectDialog(this))
     {
         var      newItem = groupFactory.Create(this, null);
         NodePage newPage = WorkingCopy.NodeInstructionGroupChildren.Append(newItem.InstructionGroup);
         insertNewGroup(newItem, newPage);
     }
 }
コード例 #3
0
 public void MoveSelectedAfter(IInstructionGroupItem instructionGroup)
 {
     if (runtimeService.DisconnectDialog(this))
     {
         var      nodesToMove = new ReadOnlyCollection <NodeInstructionGroup>(getSelectedNodes());
         NodePage newPage     = WorkingCopy;
         newPage = newPage.NodeInstructionGroupChildren.Remove(nodesToMove);
         newPage = newPage.NodeInstructionGroupChildren.InsertAfter(instructionGroup.InstructionGroup, nodesToMove);
         simplePageEdit(newPage, Resources.Strings.PageEditor_UndoDescription_MoveGroups);
     }
 }
コード例 #4
0
 /// <summary>
 /// Helper method
 /// </summary>
 /// <param name="newItem">Item created by factory</param>
 /// <param name="newPage">NodePage with node already inserted at the desired position</param>
 private void insertNewGroup(IInstructionGroupItem newItem, NodePage newPage)
 {
     if (runtimeService.DisconnectDialog(this))
     {
         NodePage origPage    = WorkingCopy;
         var      undoActions = new List <Action>();
         var      doActions   = new List <Action>();
         doActions.Add(() => Items.Add(newItem));
         doActions.Add(() => WorkingCopy   = newPage);
         undoActions.Add(() => WorkingCopy = origPage);
         Do(new UndoMemento(this, ActionType.ADD,
                            Resources.Strings.PageEditor_UndoDescription_InsertGroup, undoActions, doActions));
     }
 }
コード例 #5
0
 void HookupHandlers(IInstructionGroupItem groupItem)
 {
     groupItem.Parent   = this;
     groupItem.Edited  += new EditedHandler(InstructionGroupItem_Edited);
     groupItem.Deleted += new DeletedHandler(InstructionGroupItem_Deleted);
 }