示例#1
0
        private void SetItemToInProgress(TreeViewItem item)
        {
            var itemTag = item.Tag as ItemTag;
            var img     = Finder.FindFirstResult <Img>(item, "image");

            itemTag.Color = "yellow";
            img.Source    =
                ItemCreator.Bitmap2BitmapSource(
                    (Bitmap)Properties.Resources.ResourceManager.GetObject(itemTag.MicrosoftItem + "_yellow"));
        }
示例#2
0
        private void SetItemToSuccess(TreeViewItem item)
        {
            var itemTag = item.Tag as ItemTag;
            var img     = Finder.FindFirstResult <Img>(item, "image");

            itemTag.Color = "green";
            img.Source    =
                ItemCreator.Bitmap2BitmapSource(
                    (Bitmap)Properties.Resources.ResourceManager.GetObject(itemTag.MicrosoftItem + "_green"));

            if (!(item.Parent is TreeView))
            {
                SetParentItemState((TreeViewItem)item.Parent);
            }
        }
示例#3
0
        private void SetItemToError(TreeViewItem item, string message)
        {
            if (!IsFileDirectory(item))
            {
                item.ToolTip = $"Error: {message}";
            }

            var itemTag = item.Tag as ItemTag;
            var img     = Finder.FindFirstResult <Img>(item, "image");

            itemTag.Color = "red";
            img.Source    =
                ItemCreator.Bitmap2BitmapSource(
                    (Bitmap)Properties.Resources.ResourceManager.GetObject(itemTag.MicrosoftItem + "_red"));

            if (!(item.Parent is TreeView))
            {
                SetParentItemState((TreeViewItem)item.Parent);
            }
        }
示例#4
0
        private static void ChangeGraphicAfterSelection(TreeViewItem selectedItem)
        {
            var itemTag = (ItemTag)selectedItem.Tag;

            if (itemTag.Selected)
            {
                var border = Finder.FindFirstResult <Border>(selectedItem, "SelectionBorder");

                var fadeIn = new DoubleAnimationUsingKeyFrames();
                fadeIn.BeginTime = TimeSpan.FromSeconds(0);
                fadeIn.KeyFrames.Add(new SplineDoubleKeyFrame(1,
                                                              new TimeSpan(0, 0, 0, 0, 100)
                                                              ));

                var sb = new Storyboard();
                Storyboard.SetTarget(fadeIn, border);
                Storyboard.SetTargetProperty(fadeIn, new PropertyPath("(Opacity)"));
                sb.Children.Add(fadeIn);
                selectedItem.Resources.Clear();
                selectedItem.Resources.Add("MyEffect", sb);

                sb.Begin();

                var lab = Finder.FindFirstResult <Label>(selectedItem, "label");
                lab.Foreground = Brushes.Black;

                if (itemTag.Color == "white")
                {
                    itemTag.Color = "black";
                    var img = Finder.FindFirstResult <Image>(selectedItem, "image");
                    img.Source =
                        ItemCreator.Bitmap2BitmapSource(
                            (Bitmap)Resources.ResourceManager.GetObject(itemTag.MicrosoftItem + "_black"));
                }
            }
            else
            {
                var border = Finder.FindFirstResult <Border>(selectedItem, "SelectionBorder");

                var fadeIn = new DoubleAnimationUsingKeyFrames();
                fadeIn.BeginTime = TimeSpan.FromSeconds(0);
                fadeIn.KeyFrames.Add(new SplineDoubleKeyFrame(0,
                                                              new TimeSpan(0, 0, 0, 0, 200)
                                                              ));

                var sb = new Storyboard();
                Storyboard.SetTarget(fadeIn, border);
                Storyboard.SetTargetProperty(fadeIn, new PropertyPath("(Opacity)"));
                sb.Children.Add(fadeIn);
                selectedItem.Resources.Clear();
                selectedItem.Resources.Add("MyEffect", sb);

                sb.Begin();

                var lab = Finder.FindFirstResult <Label>(selectedItem, "label");
                lab.Foreground = Brushes.White;

                if (itemTag.Color == "black")
                {
                    itemTag.Color = "white";
                    var img = Finder.FindFirstResult <Image>(selectedItem, "image");
                    img.Source =
                        ItemCreator.Bitmap2BitmapSource(
                            (Bitmap)Resources.ResourceManager.GetObject(itemTag.MicrosoftItem + "_white"));
                }
            }
        }
示例#5
0
 private void Window_ContentRendered(object sender, EventArgs e)
 {
     Finder.FindFirstResult <Img>(this, "RefreshImage").Source =
         ItemCreator.Bitmap2BitmapSource(Properties.Resources.refresh);
 }