示例#1
0
        public Win2DIcon(INodeIcon icon, ICanvasControl canvasControl)
        {
            Guard.NotNull(icon, nameof(icon));

            name = icon.Name;

            LoadFile(icon, canvasControl.Device).ContinueWith(task => AttachBitmap(canvasControl, task));
        }
示例#2
0
        protected override void Execute(bool isRedo)
        {
            oldIcon = Node.Icon;

            Node.ChangeIcon(newIcon);

            if (isRedo)
            {
                Node.Select();
            }
        }
示例#3
0
        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);
            }
        }
示例#4
0
        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));
                });
            }
        }
示例#5
0
 internal void ChangeIcon(INodeIcon newIcon)
 {
     Icon = newIcon;
 }
示例#6
0
 public ChangeIconCommand(NodeBase nodeId, INodeIcon newIcon)
     : base(nodeId)
 {
     this.newIcon = newIcon;
 }
示例#7
0
 public ChangeIconCommand(PropertiesBag properties, Document document)
     : base(properties, document)
 {
     newIcon = KeyIcon.TryParse(properties) ?? AttachmentIcon.TryParse(properties);
 }
示例#8
0
 public bool Equals(INodeIcon other)
 {
     return(Equals(other as AttachmentIcon));
 }
示例#9
0
 public bool Equals(INodeIcon other)
 {
     return(Equals(other as KeyIcon));
 }