static void OnPrepareStampForSerialization(SerializedItem stamp, IItemProperties properties) { SerializedStampEventArgs serializedStampEventArgs = new SerializedStampEventArgs(); serializedStampEventArgs.Item = stamp; serializedStampEventArgs.Properties = properties; PrepareItemForSerialization?.Invoke(null, serializedStampEventArgs); }
public void InsertStamp(int startIndex, IItemProperties item) { if (item.HasNoZOrder()) { item.ZOrder = startIndex; } Items.Insert(startIndex, item); }
public void AddItem(IItemProperties item) { if (item.HasNoZOrder()) { item.ZOrder = Items.Count; } Items.Add(item); }
public static SerializedItem From(IItemProperties itemProperties) { SerializedItem serializedItem = new SerializedItem(); serializedItem.GetValuesFrom(itemProperties); OnPrepareStampForSerialization(serializedItem, itemProperties); return(serializedItem); }
public override void GetPropertiesFrom(IItemProperties itemProperties, bool transferGuid = true) { base.GetPropertiesFrom(itemProperties, transferGuid); if (itemProperties is MapCharacter mapCharacter) { this.GetPropertiesFrom <MapCharacter>(mapCharacter); } }
public void InsertStamps(int startIndex, List <IItemProperties> items) { for (int i = 0; i < items.Count; i++) { IItemProperties item = items[i]; item.ResetZOrder(); InsertStamp(startIndex + i, item); } }
public ItemProperties(IItemProperties other) { Path = other.Path; Name = other.Name; Type = other.Type; Sha1 = other.Sha1; Size = other.Size; LastModified = other.LastModified; }
protected double GetSavedValue(IItemProperties itemProperties) { if (!undoValues.ContainsKey(itemProperties.Guid)) { System.Diagnostics.Debugger.Break(); return(0); } return(undoValues[itemProperties.Guid]); }
protected override void ActivateUndo(Map map) { IItemProperties stampFromGuid = map.GetItemFromGuid(stampGuid); if (stampFromGuid != null) { map.RemoveItem(stampFromGuid); map.ClearStampSelection(); } }
protected int GetSavedInt(IItemProperties stampProperties) { if (!undoValues.ContainsKey(stampProperties.Guid)) { System.Diagnostics.Debugger.Break(); return(0); } return((int)Math.Round(undoValues[stampProperties.Guid])); }
protected void SaveValue(IItemProperties itemProperties, double value) { if (undoValues.ContainsKey(itemProperties.Guid)) { undoValues[itemProperties.Guid] = value; } else { undoValues.Add(itemProperties.Guid, value); } }
public static IItemProperties Clone(this IItemProperties item, double x = 0, double y = 0) { if (item is IStampProperties stamp) { return(stamp.Copy(x, y)); } else { return(item.Copy(x, y)); } }
protected void SaveValue(IItemProperties stampProperties, T value) { if (undoValues.ContainsKey(stampProperties.Guid)) { undoValues[stampProperties.Guid] = value; } else { undoValues.Add(stampProperties.Guid, value); } }
public IItemProperties GetItemAt(double x, double y) { for (int i = Items.Count - 1; i >= 0; i--) { IItemProperties item = Items[i]; if (item.ContainsPoint(x, y)) { return(item); } } return(null); }
public List <IItemProperties> GetItems(List <Guid> itemGuids) { List <IItemProperties> result = new List <IItemProperties>(); foreach (Guid guid in itemGuids) { IItemProperties foundItem = GetItemFromGuid(guid); if (foundItem != null) { result.Add(foundItem); } } return(result); }
public static void Ungroup(IGroup group, List <IItemProperties> ungroupedStamps) { if (group.Locked) { return; } for (int i = 0; i < group.Children.Count; i++) { IItemProperties stamp = group.Children[i]; stamp.Move(group.X, group.Y); stamp.ZOrder = group.ZOrder + i; ungroupedStamps.Add(stamp); } }
public virtual void GetPropertiesFrom(IItemProperties itemProperties, bool transferGuid = true) { if (transferGuid) { Guid = itemProperties.Guid; } X = itemProperties.X; Y = itemProperties.Y; Locked = itemProperties.Locked; ZOrder = itemProperties.ZOrder; Visible = itemProperties.Visible; FileName = itemProperties.FileName; Height = itemProperties.Height; Width = itemProperties.Width; TypeName = itemProperties.TypeName; }
void Copy(Map map, double deltaX, double deltaY) { List <IItemProperties> copiedStamps = new List <IItemProperties>(); List <IItemProperties> zOrderedSelection = map.SelectedItems.OrderBy(x => x.ZOrder).ToList(); foreach (IItemProperties item in zOrderedSelection) { IItemProperties newStamp = item.Clone(deltaX, deltaY); if (newStamp != null) { map.AddItem(newStamp); copiedStamps.Add(newStamp); } } originalStampSelection.AddRange(map.SelectedItems.Select(stampProperties => stampProperties.Guid)); SetSelectedItems(map, copiedStamps); }
public UngroupedStamps(IItemProperties stampGroup) { StampGroup = stampGroup; }
/// <summary> /// Initializes a new instance of the <see cref="SolutionItem"/> class. /// </summary> /// <param name="path">The item path.</param> /// <param name="parent">The item parent.</param> /// <param name="properties">The item properties.</param> public SolutionItem(IItemPath path, ISolutionFolder parent, IItemProperties properties) : base(parent, path, properties) { }
public virtual void NotifyCompletedAsync(Dispatcher dispatcher, IItemPath newItemPath, IItemProperties newItemProperties) { IDocumentCreatedCompletionArgs CompletionArgs = new DocumentCreatedCompletionArgs(newItemPath, newItemProperties); NotifyEventCompletedAsync(dispatcher, CompletionArgs); }
protected T GetSavedValue(IItemProperties stampProperties) { if (!undoValues.ContainsKey(stampProperties.Guid)) { System.Diagnostics.Debugger.Break(); return(default);
protected void AddSelectedItem(Map map, IItemProperties item) { map.SelectedItems.Add(item); SelectedItems.Add(item); UpdateSelectedStampGuids(); }
public AddItemOperation(ISolutionRoot root, IFolderPath destinationFolderPath, IItemPath newPath, IItemProperties newProperties) : base(root, destinationFolderPath, newPath, newProperties) { }
protected virtual void Add(IReadOnlyDictionary <ITreeNodePath, IPathConnection> pathTable) { Assert.ValidateReference(pathTable); ClearExpandedFolders(); List <ISolutionTreeNodeCollection> ModifiedCollectionList = new List <ISolutionTreeNodeCollection>(); List <ITreeNodePath> PathList = new List <ITreeNodePath>(); foreach (KeyValuePair <ITreeNodePath, IPathConnection> Entry in pathTable) { PathList.Add(Entry.Key); } while (PathList.Count > 0) { IReadOnlyDictionary <IFolderPath, ISolutionFolder> FlatFolderTable = Root.FlatFolderChildren; int i = 0; while (i < PathList.Count) { ITreeNodePath Path = PathList[i]; IPathConnection Connection = pathTable[Path]; IFolderPath ParentPath = Connection.ParentPath; if (FlatFolderTable.ContainsKey(ParentPath)) { PathList.RemoveAt(i); ISolutionFolder ParentFolder = FlatFolderTable[ParentPath]; ISolutionTreeNodeCollection ChildrenCollection = (ISolutionTreeNodeCollection)ParentFolder.Children; IFolderPath AsFolderPath; IItemPath AsItemPath; if ((AsFolderPath = Path as IFolderPath) != null) { IFolderProperties Properties = (IFolderProperties)Connection.Properties; ISolutionFolder NewFolder = CreateSolutionFolder(ParentFolder, AsFolderPath, Properties); ChildrenCollection.Add(NewFolder); if (Connection.IsExpanded) { AddExpandedFolder(NewFolder); } } else if ((AsItemPath = Path as IItemPath) != null) { IItemProperties Properties = (IItemProperties)Connection.Properties; ISolutionItem NewItem = CreateSolutionItem(ParentFolder, AsItemPath, Properties); ChildrenCollection.Add(NewItem); } else { Assert.InvalidExecutionPath(); } if (!ModifiedCollectionList.Contains(ChildrenCollection)) { ModifiedCollectionList.Add(ChildrenCollection); } } else { i++; } } } foreach (ISolutionTreeNodeCollection ChildrenCollection in ModifiedCollectionList) { ChildrenCollection.Sort(); } }
protected virtual ISolutionItem CreateSolutionItem(ISolutionFolder parentFolder, IItemPath path, IItemProperties properties) { Assert.ValidateReference(parentFolder); Assert.ValidateReference(path); Assert.ValidateReference(properties); return(new SolutionItem(path, parentFolder, properties)); }
protected void RemoveSelectedItem(Map map, IItemProperties item) { map.SelectedItems.Remove(item); SelectedItems.Remove(item); UpdateSelectedStampGuids(); }
/// <summary> /// Initializes a new instance of the <see cref="DocumentCreatedCompletionArgs"/> class. /// </summary> /// <param name="newItemPath">The path to the created document item.</param> /// <param name="newItemProperties">The path to the created document properties.</param> public DocumentCreatedCompletionArgs(IItemPath newItemPath, IItemProperties newItemProperties) { NewItemPath = newItemPath; NewItemProperties = newItemProperties; }
public DocumentCreatedCompletionArgs(IItemPath NewItemPath, IItemProperties NewItemProperties) { this.NewItemPath = NewItemPath; this.NewItemProperties = NewItemProperties; }
/// <summary> /// Helper method which generates columns for a given IItemProperties and adds /// them either to a datagrid or to a collection of columns as specified by the flag. /// </summary> /// <param name="dataGrid"></param> /// <param name="iItemProperties"></param> /// <param name="columnCollection"></param> private static void GenerateColumns( IItemProperties iItemProperties, DataGrid dataGrid, Collection<DataGridColumn> columnCollection) { Debug.Assert(iItemProperties != null, "iItemProperties should not be null"); Debug.Assert(dataGrid != null || columnCollection != null, "Both dataGrid and columnCollection cannot not be null at the same time"); ReadOnlyCollection<ItemPropertyInfo> itemProperties = iItemProperties.ItemProperties; if (itemProperties != null && itemProperties.Count > 0) { foreach (ItemPropertyInfo itemProperty in itemProperties) { DataGridColumn dataGridColumn = DataGridColumn.CreateDefaultColumn(itemProperty); if (dataGrid != null) { // AutoGeneratingColumn event is raised before generating and adding column to datagrid // and the column returned by the event handler is used instead of the original column. DataGridAutoGeneratingColumnEventArgs eventArgs = new DataGridAutoGeneratingColumnEventArgs(dataGridColumn, itemProperty); dataGrid.OnAutoGeneratingColumn(eventArgs); if (!eventArgs.Cancel && eventArgs.Column != null) { eventArgs.Column.IsAutoGenerated = true; dataGrid.Columns.Add(eventArgs.Column); } } else { columnCollection.Add(dataGridColumn); } } } }
/// <summary> /// Helper method which generates columns for a given IItemProperties /// </summary> /// <param name="iItemProperties"></param> /// <returns></returns> public static Collection<DataGridColumn> GenerateColumns(IItemProperties itemProperties) { if (itemProperties == null) { throw new ArgumentNullException("itemProperties"); } Collection<DataGridColumn> columnCollection = new Collection<DataGridColumn>(); DataGrid.GenerateColumns( itemProperties.ItemProperties, null, columnCollection); return columnCollection; }
public ResizeTracker(IItemProperties item) { Item = item; }