Exemplo n.º 1
0
        public void LoadTreeFolder()
        {
            List <TreeNode> treeList = new List <TreeNode>();

            treeList.Add(Favourite.GetFavourite());

            TreeNode computer = new TreeNode();

            computer.Name   = "MyComputer";
            computer.Icon   = wExp.Icon.GetIconFromExtension(".Computer");
            computer.Path   = null;
            computer.Childs = new List <TreeNode>();

            DriveInfo[] myDrivers = DriveInfo.GetDrives();
            foreach (var driver in myDrivers)
            {
                computer.Childs.Add(new TreeNode
                {
                    Path = driver.Name,
                    Name = driver.Name,
                    Icon = wExp.Icon.GetIconFromExtension(".volume")
                });
            }

            treeList.Add(computer);

            treeFolder.ItemsSource = treeList;
        }
Exemplo n.º 2
0
        //private void ShowProperties()

        private void buttonFavourite_Click(object sender, RoutedEventArgs e)
        {
            var displayInfo = (DisplayInfo)stackPanelInfo.DataContext;

            if (displayInfo == null)
            {
                return;
            }
            if (System.IO.Path.GetExtension(displayInfo.Path) == "")
            {
                if (Favourite.IsFavouriteFolder(displayInfo.Path))
                {
                    Favourite.DeleteFavourite(displayInfo.Path);
                    MessageBox.Show(
                        "Đã xóa " + displayInfo.Path + "khỏi favourite",
                        "Hoàn tất",
                        MessageBoxButton.OK,
                        MessageBoxImage.Asterisk);
                }
                else
                {
                    Favourite.AddFavourite(displayInfo.Path);
                    MessageBox.Show(
                        "Đã thêm " + displayInfo.Path + "vào favourite",
                        "Hoàn tất",
                        MessageBoxButton.OK,
                        MessageBoxImage.Asterisk);
                }
                LoadTreeFolder();
                Display(displayInfo.Path, null);
            }
        }
Exemplo n.º 3
0
        private void RefreshStackPanelInfo(string filePath)
        {
            if (filePath == null)
            {
                return;
            }
            FileInfo    fileInfo    = new FileInfo(filePath);
            DisplayInfo displayInfo = new DisplayInfo();

            displayInfo.Icon           = wExp.Icon.GetIconFromExtension((fileInfo.Extension != "") ? fileInfo.Extension : ".folder");
            displayInfo.Name           = Truncate(fileInfo.Name, 28);
            displayInfo.Extension      = (fileInfo.Extension != "") ? fileInfo.Extension : "folder";
            displayInfo.DateModified   = "DateModifies " + fileInfo.CreationTime.ToShortDateString();
            displayInfo.Path           = filePath;
            stackPanelInfo.DataContext = displayInfo;
            if (Favourite.IsFavouriteFolder(displayInfo.Path))
            {
                favouriteText.Text = "Unfavourite this!";
            }
            else
            {
                favouriteText.Text = "Favourite this!";
            }
            if (displayInfo.Extension != "folder")
            {
                buttonFavourite.Visibility = Visibility.Hidden;
            }
            else
            {
                buttonFavourite.Visibility = Visibility.Visible;
            }
        }