public void SetToSelection(ColumnDefinitionNode toSelectTo)
 {
     if (this.PrimarySelection == null)
     {
         this.SetSelection(toSelectTo);
     }
     else
     {
         GridElement gridElement = (GridElement)this.PrimarySelection.Parent;
         int         val1        = gridElement.ColumnDefinitions.IndexOf(this.PrimarySelection);
         int         val2        = gridElement.ColumnDefinitions.IndexOf(toSelectTo);
         int         num1        = Math.Min(val1, val2);
         int         num2        = Math.Max(val1, val2);
         MarkerBasedSceneNodeCollection <ColumnDefinitionNode> sceneNodeCollection = this.StorageProvider.NewList();
         for (int index = num1; index <= num2; ++index)
         {
             if (index != val1)
             {
                 sceneNodeCollection.Add(gridElement.ColumnDefinitions[index]);
             }
         }
         sceneNodeCollection.Add(this.PrimarySelection);
         this.SetSelection((ICollection <ColumnDefinitionNode>)sceneNodeCollection, this.PrimarySelection);
     }
 }
Exemple #2
0
        protected override void SetSelectionWithUndo(string description, MarkerBasedSceneNodeCollection <SceneElement> newSelection, SceneElement newPrimarySelection)
        {
            SceneNode           containerForSelection = this.ViewModel.GetEditingContainerForSelection <SceneElement>((ICollection <SceneElement>)newSelection);
            List <SceneElement> removedElements;

            newSelection = this.StorageProvider.CopyList((ICollection <SceneElement>) this.ViewModel.GetSelectionForEditingContainer <SceneElement>(containerForSelection, (ICollection <SceneElement>)newSelection, out removedElements));
            if (removedElements.Contains(newPrimarySelection))
            {
                newPrimarySelection = newSelection.Count > 0 ? newSelection[newSelection.Count - 1] : (SceneElement)null;
            }
            this.OnSelectionChanging((IList <SceneElement>)newSelection);
            if (this.EditTransactionFactory != null)
            {
                description = string.Format((IFormatProvider)CultureInfo.CurrentCulture, description, new object[1]
                {
                    (object)this.NamingHelper.Name
                });
                using (SceneEditTransaction editTransaction = this.EditTransactionFactory.CreateEditTransaction(description, true))
                {
                    this.SetSelectionWithUndo(description, newSelection, newPrimarySelection);
                    if (containerForSelection != null)
                    {
                        this.ViewModel.ActiveEditingContainerPath = containerForSelection.DocumentNodePath;
                    }
                    editTransaction.Commit();
                }
            }
            else
            {
                this.SetSelectionInternal(newSelection, newPrimarySelection);
            }
            this.OnSelectionChangedOutsideUndo();
        }
 public MarkerBasedSceneNodeCollection <T> CanonicalizeList(MarkerBasedSceneNodeCollection <T> list, SceneUpdateTypeFlags flags)
 {
     if (flags != SceneUpdateTypeFlags.UndoRedo)
     {
         return(list.FilterOutDeletedMarkers());
     }
     list.RestoreDeletedMarkers();
     return((MarkerBasedSceneNodeCollection <T>)null);
 }