public Win2DIcon(INodeIcon icon, ICanvasControl canvasControl) { Guard.NotNull(icon, nameof(icon)); name = icon.Name; LoadFile(icon, canvasControl.Device).ContinueWith(task => AttachBitmap(canvasControl, task)); }
protected override void Execute(bool isRedo) { oldIcon = Node.Icon; Node.ChangeIcon(newIcon); if (isRedo) { Node.Select(); } }
private static async Task <CanvasBitmap> LoadFile(INodeIcon icon, ICanvasResourceCreator device) { using (var stream = await icon.OpenAsStreamAsync()) { if (stream != null) { return(await CanvasBitmap.LoadAsync(device, stream.AsRandomAccessStream()).AsTask()); } return(null); } }
public static void ChangeIconTransactional(this NodeBase node, INodeIcon icon) { if (node.Document != null && !Equals(node.Icon, icon)) { var transactionName = LocalizationManager.GetString("TransactionName_ChangeIcon"); node.Document.MakeTransaction(transactionName, commands => { commands.Apply(new ChangeIconCommand(node, icon)); }); } }
internal void ChangeIcon(INodeIcon newIcon) { Icon = newIcon; }
public ChangeIconCommand(NodeBase nodeId, INodeIcon newIcon) : base(nodeId) { this.newIcon = newIcon; }
public ChangeIconCommand(PropertiesBag properties, Document document) : base(properties, document) { newIcon = KeyIcon.TryParse(properties) ?? AttachmentIcon.TryParse(properties); }
public bool Equals(INodeIcon other) { return(Equals(other as AttachmentIcon)); }
public bool Equals(INodeIcon other) { return(Equals(other as KeyIcon)); }