Esempio n. 1
0
        public void Add(DirVM node)
        {
            this.Children.Add(node);
            node.Parent = this;

            if (BackupPanelVM.curVM != null)
                BackupPanelVM.curVM.UpdateTrackTree();
        }
Esempio n. 2
0
 public bool Remove(DirVM node)
 {
     if (node.Parent == this)
     {
         if (BackupPanelVM.curVM != null)
             BackupPanelVM.curVM.UpdateTrackTree();
         return this.Children.Remove(node);
     }
     else
         return false;
 }
Esempio n. 3
0
        private void UpdateBackupView()
        {
            
            if (_selectedBackupIndex > -1 && _backupList.Count > 0)
            {
                //Update Log display
                XElement backup = XElement.Load(_backupList[_selectedBackupIndex].Path);
                Log = (string)backup.Attribute("Log");

                //Update Backup Tree View
                _backupTreeView.Clear();

                BackupVM backupTreeItem = new BackupVM(new Backup((string)backup.Attribute("Title")));
                _backupTreeView.Add(backupTreeItem);

                foreach (XElement dir in backup.Elements("Directory"))
                {
                    DirVM dirTreeItem = new DirVM(new BackupDir((string)dir.Attribute("Name")));
                    backupTreeItem.Add(dirTreeItem);
                    
                    foreach (XElement file in dir.Elements("File"))
                    {
                        FileVM fileTreeItem = new FileVM(new BackupFile((string)file.Attribute("Name"),""));
                        dirTreeItem.Add(fileTreeItem);
                    }
                }

            }
        }
Esempio n. 4
0
        private void LoadTrackTree()
        {
            if (!File.Exists(TRACKTREE_PATH))
            {
                XElement emptyTrackTree = new XElement("TrackTree", new XAttribute("Title", "Track Tree"));
                emptyTrackTree.Save(TRACKTREE_PATH);
            }

            _treeRoot = XElement.Load(TRACKTREE_PATH);
            _backupRoot.Children.Clear();
            _backupRoot.Title = (string)_treeRoot.Attribute("Title");

            foreach (XElement dir in _treeRoot.Elements("Directory"))
            {
                DirVM dirVM = new DirVM(new BackupDir((string)dir.Attribute("Name")));
                _backupRoot.Add(dirVM);

                foreach (XElement file in dir.Elements("File"))
                {
                    FileVM fileVM;
                    if (File.Exists((string)file.Attribute("Path")))
                    {
                        fileVM = new FileVM(new BackupFile((string)file.Attribute("Name"), (string)file.Attribute("Path")));
                        dirVM.Add(fileVM);
                    }
                    else
                    {
                        MessageBox.Show("Tracked file " + (string)file.Attribute("Path") + " can't be found!", "BackendGUI");
                    }
                }

            }
        }
Esempio n. 5
0
        public FileVM(BackupFile file, DirVM parent = null)
            : base(parent)
        {
            _file = file;

            deleteCommand = new DelegateCommand(Delete);
        }