コード例 #1
0
        private TreeViewItemFat addItemInRevertList(TreeViewItemFat item)
        {
            TreeViewItemFat ret = null;

            if (item.item.GetType() == typeof(FBDirectory))
            {
                foreach (TreeViewItemFat i in item.Items)
                {
                    addItemInRevertList(i);
                }
            }
            else
            {
                TreeViewItemFat el = findItem(revertList.Items, item);
                if (el != null)
                {
                    UsefullMethods.setLabelAlert("danger", errorBox, "File is already in the revert list");
                    flashItem(el);
                }
                else
                {
                    ret = item.Duplicate();
                    revertList.Items.Add(ret);
                    item.Select = true;
                }
            }
            return(ret);
        }
コード例 #2
0
 public TreeViewItemFat Duplicate()
 {
     TreeViewItemFat newNode = new TreeViewItemFat() { Header = this.Header };
     newNode.item = this.item;
     newNode.version = this.version;
     newNode.relativePath = this.relativePath;
     return newNode;
 }
コード例 #3
0
        private async void flashItem(TreeViewItemFat item)
        {
            Brush pc = item.Background;
            Color c  = (Color)ColorConverter.ConvertFromString("#FFB13D14");

            item.Background = new SolidColorBrush(c);
            await Task.Delay(700);

            item.Background = pc;
        }
コード例 #4
0
            public TreeViewItemFat Duplicate()
            {
                TreeViewItemFat newNode = new TreeViewItemFat()
                {
                    Header = this.Header
                };

                newNode.item         = this.item;
                newNode.version      = this.version;
                newNode.relativePath = this.relativePath;
                return(newNode);
            }
コード例 #5
0
        private void VersionView_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            TreeViewItemFat selectedItem = (TreeViewItemFat)this.versionView.SelectedItem;

            if (selectedItem != null)
            {
                if (selectedItem.item.GetType() == typeof(FBDirectory))
                {
                    this.preview.IsEnabled = false;
                }
                else
                {
                    this.preview.IsEnabled = true;
                }
            }
        }
コード例 #6
0
        private void VersionView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
        {
            TreeViewItemFat selectedItem = (TreeViewItemFat)((TreeView)sender).SelectedItem;

            if (selectedItem != null && selectedItem.item != null)
            {
                if (sender == versionView)
                {
                    addItemInRevertList(selectedItem);
                }
                else
                {
                    revertList.Items.Remove(selectedItem);
                    TreeViewItemFat el = findItem(versionView.Items, selectedItem);
                    el.Select = false;
                }
            }
        }
コード例 #7
0
        private void preview_Click(object sender, RoutedEventArgs e)
        {
            TreeViewItemFat seletedItem = (TreeViewItemFat)versionView.SelectedItem;
            string          filePath    = null;

            try
            {
                filePath = se.getFile((FBFile)seletedItem.item);
                System.Diagnostics.Process.Start(filePath);
            }
            catch (System.ServiceModel.CommunicationException)
            {
                UsefullMethods.setLabelAlert("danger", errorBox, "Error with communication! Check your connection!");
            }
            catch
            {
                UsefullMethods.setLabelAlert("danger", errorBox, "No file selected!");
            }
        }
コード例 #8
0
        private TreeViewItem CreateDirectoryNode(FBDirectory root, string path)
        {
            TreeViewItemFat treeItem = new TreeViewItemFat();

            treeItem.version      = selectedVersion;
            treeItem.item         = root;
            treeItem.Header       = root.Name;
            treeItem.relativePath = path;

            foreach (String key in root.content.Keys)
            {
                if (root.content[key].GetType() == typeof(FBDirectory))
                {
                    FBDirectory child = (FBDirectory)root.content[key];
                    treeItem.Items.Add(CreateDirectoryNode(child, path + "\\" + child.Name));
                    treeItem.IsExpanded = true;
                }
                else
                {
                    TreeViewItemFat ti = new TreeViewItemFat()
                    {
                        Header = key
                    };
                    ti.version      = selectedVersion;
                    ti.item         = root.content[key];
                    ti.relativePath = path;
                    if (findItem(revertList.Items, ti) != null)
                    {
                        ti.Select = true;
                    }
                    treeItem.Items.Add(ti);
                }
            }
            if (root.content.Count == 0)
            {
                treeItem.Items.Add(new TreeViewItemFat()
                {
                    Header = ""
                });
            }

            return(treeItem);
        }
コード例 #9
0
        private TreeViewItemFat findItem(ItemCollection view, TreeViewItemFat item)
        {
            TreeViewItemFat ret = null;

            foreach (TreeViewItemFat el in view)
            {
                if (el.item != null)
                {
                    if (el.item.GetType() == typeof(FBDirectory))
                    {
                        ret = findItem(el.Items, item);
                        if (ret != null)
                        {
                            return(ret);
                        }
                    }
                    if (el.Equals(item))
                    {
                        return(el);
                    }
                }
            }
            return(null);
        }
コード例 #10
0
 public bool Equals(TreeViewItemFat other)
 {
     return (this.item.Name.Equals(other.item.Name) && this.relativePath.Equals(other.relativePath));
 }
コード例 #11
0
 private TreeViewItemFat addItemInRevertList(TreeViewItemFat item)
 {
     TreeViewItemFat ret = null;
     if (item.item.GetType() == typeof(FBDirectory))
     {
         foreach (TreeViewItemFat i in item.Items)
         {
             addItemInRevertList(i);
         }
     }
     else
     {
         TreeViewItemFat el = findItem(revertList.Items, item);
         if (el != null)
         {
             UsefullMethods.setLabelAlert("danger", errorBox, "File is already in the revert list");
             flashItem(el);
         }else
         {
             ret = item.Duplicate();
             revertList.Items.Add(ret);
             item.Select = true;
         }
     }
     return ret;
 }
コード例 #12
0
 private TreeViewItemFat findItem(ItemCollection view,TreeViewItemFat item)
 {
     TreeViewItemFat ret = null;
     
     foreach (TreeViewItemFat el in view)
     {
         if (el.item != null)
         {
             if (el.item.GetType() == typeof(FBDirectory))
             {
                 ret = findItem(el.Items, item);
                 if (ret != null)
                 {
                     return ret;
                 }
             }
             if (el.Equals(item))
             {
                 return el;
             }
         }
         
     }
     return null;
 }
コード例 #13
0
 private async void flashItem(TreeViewItemFat item)
 {
     Brush pc = item.Background;
     Color c = (Color)ColorConverter.ConvertFromString("#FFB13D14");
     item.Background = new SolidColorBrush(c);
     await Task.Delay(700);
     item.Background = pc;
 }
コード例 #14
0
        private TreeViewItem CreateDirectoryNode(FBDirectory root, string path)
        {
            TreeViewItemFat treeItem = new TreeViewItemFat();
            treeItem.version = selectedVersion;
            treeItem.item = root;
            treeItem.Header = root.Name;
            treeItem.relativePath = path;

            foreach (String key in root.content.Keys)
            {
                if (root.content[key].GetType() == typeof(FBDirectory))
                {
                    FBDirectory child = (FBDirectory)root.content[key];
                    treeItem.Items.Add(CreateDirectoryNode(child, path + "\\" + child.Name));
                    treeItem.IsExpanded = true;
                }
                else
                {
                    TreeViewItemFat ti = new TreeViewItemFat() { Header = key };
                    ti.version = selectedVersion;
                    ti.item = root.content[key];
                    ti.relativePath = path;
                    if (findItem(revertList.Items, ti)!=null)
                    {
                        ti.Select = true;
                    }
                    treeItem.Items.Add(ti);

                }
            }
            if (root.content.Count == 0)
            {
                treeItem.Items.Add(new TreeViewItemFat() { Header = "" });
            }

            return treeItem;
        }
コード例 #15
0
 public bool Equals(TreeViewItemFat other)
 {
     return(this.item.Name.Equals(other.item.Name) && this.relativePath.Equals(other.relativePath));
 }