Beispiel #1
0
        public static void addDesktop(Gat.Controls.OpenDialogViewModel dialogView)
        {
            ImageSource img    = new BitmapImage(new Uri("\\Icons\\desktop.ico", UriKind.RelativeOrAbsolute));
            ImageSource imgsub = new BitmapImage(new Uri("\\Icons\\folder.ico", UriKind.RelativeOrAbsolute));

            addPathOpenDialog(dialogView, Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "DeskTop", img, imgsub, true);
        }
Beispiel #2
0
        public static void addPathOpenDialog(Gat.Controls.OpenDialogViewModel dialogView, string path, string showName, string imgPath, string imgSubItemPath, bool showChilds = true)
        {
            ImageSource img    = new BitmapImage(new Uri(imgPath, UriKind.RelativeOrAbsolute));
            ImageSource imgsub = new BitmapImage(new Uri(imgSubItemPath, UriKind.RelativeOrAbsolute));

            addPathOpenDialog(dialogView, path, showName, img, imgsub, showChilds);
        }
Beispiel #3
0
 private void button_Copy_Click(object sender, RoutedEventArgs e)
 {
     Gat.Controls.OpenDialogView      openDialog = new Gat.Controls.OpenDialogView();
     Gat.Controls.OpenDialogViewModel vm         = (Gat.Controls.OpenDialogViewModel)openDialog.DataContext;
     vm.IsDirectoryChooser = true;
     vm.StartupLocation    = System.Windows.WindowStartupLocation.CenterScreen;
     vm.Show();
     txtFolderDestination.Text = vm.SelectedFilePath;
     ChangeCutButtomState();
 }
Beispiel #4
0
 private void button_Click(object sender, RoutedEventArgs e)
 {
     Gat.Controls.OpenDialogView      openDialog = new Gat.Controls.OpenDialogView();
     Gat.Controls.OpenDialogViewModel vm         = (Gat.Controls.OpenDialogViewModel)openDialog.DataContext;
     vm.IsDirectoryChooser = false;
     vm.StartupLocation    = System.Windows.WindowStartupLocation.CenterScreen;;
     vm.AddFileFilterExtension(".json");
     vm.Show();
     txtFileSource.Text = vm.SelectedFilePath;
     ChangeCutButtomState();
 }
Beispiel #5
0
 private void browse1_Click(object sender, RoutedEventArgs e)
 {
     Gat.Controls.OpenDialogView      openDialog = new Gat.Controls.OpenDialogView();
     Gat.Controls.OpenDialogViewModel vm         = (Gat.Controls.OpenDialogViewModel)openDialog.DataContext;
     vm.IsDirectoryChooser = true;
     vm.Show();
     if (vm.SelectedFilePath != null)
     {
         StorePathtextBox.Text = vm.SelectedFilePath.ToString();
     }
 }
Beispiel #6
0
        public string GetFolderBrowserResult()
        {
            Gat.Controls.OpenDialogView      openDialog = new Gat.Controls.OpenDialogView();
            Gat.Controls.OpenDialogViewModel vm         = (Gat.Controls.OpenDialogViewModel)openDialog.DataContext;

            vm.IsDirectoryChooser = true;
            vm.StartupLocation    = System.Windows.WindowStartupLocation.CenterScreen;
            bool?result = vm.Show();

            return(result == true ?
                   vm.SelectedFilePath :
                   null);
        }
        private void buttonGetDestinatinPath_Click(object sender, RoutedEventArgs e)
        {
            Gat.Controls.OpenDialogView      lOpenDialog   = new Gat.Controls.OpenDialogView();
            Gat.Controls.OpenDialogViewModel lOpenDialogVM = (Gat.Controls.OpenDialogViewModel)lOpenDialog.DataContext;

            lOpenDialogVM.IsDirectoryChooser = true;
            lOpenDialogVM.SelectedFilePath   = textBoxDestinationPath.Text;

            if (lOpenDialogVM.Show() == true)
            {
                textBoxDestinationPath.Text = lOpenDialogVM.SelectedFilePath;
            }
        }
        private void buttonGetSavesPathFile_Click(object sender, RoutedEventArgs e)
        {
            Gat.Controls.OpenDialogView      lOpenDialog   = new Gat.Controls.OpenDialogView();
            Gat.Controls.OpenDialogViewModel lOpenDialogVM = (Gat.Controls.OpenDialogViewModel)lOpenDialog.DataContext;

            lOpenDialogVM.IsDirectoryChooser = false;

            if (lOpenDialogVM.Show() == true)
            {
                textBoxSavesPath.Text             = lOpenDialogVM.SelectedFilePath;
                checkBoxAutomaticBackup.IsChecked = true;
            }
        }
Beispiel #9
0
        private string OpenDirectoryDialog()
        {
            Gat.Controls.OpenDialogView      openDialog = new Gat.Controls.OpenDialogView();
            Gat.Controls.OpenDialogViewModel vm         = (Gat.Controls.OpenDialogViewModel)openDialog.DataContext;

            vm.IsDirectoryChooser = true;
            vm.IsSaveDialog       = false;

            bool?result = vm.Show();

            if (result == true)
            {
                return(vm.SelectedFolder.Path);
            }

            return(string.Empty);
        }
Beispiel #10
0
        private void ChangePhoto()
        {
            Gat.Controls.OpenDialogView      openDialog = new Gat.Controls.OpenDialogView();
            Gat.Controls.OpenDialogViewModel vm         = (Gat.Controls.OpenDialogViewModel)openDialog.DataContext;

            // Adding file filter
            vm.AddFileFilterExtension(".jpg;.png");

            // Show dialog and take result into account
            bool?result = vm.Show();

            if (result == true)
            {
                // Get selected file path
                var txt = vm.SelectedFilePath;
                image1.Source = new BitmapImage(new Uri(txt));
            }
            else
            {
                var txt = string.Empty;
            }
        }
Beispiel #11
0
 public static void addPathOpenDialog(Gat.Controls.OpenDialogViewModel dialogView, string path, string showName, ImageSource img, ImageSource imgSubItem, bool showChilds = true)
 {
     #region 为对话框增加一个路径为Path的选择项,显示名称showName,主图标img;子图标imgSubItem,是否显示子项showChilds(默认显示)
     OpenFolderRoot folder = new OpenFolderRoot();
     folder.Image = img;
     folder.Name  = showName;
     folder.Path  = path;
     if (showChilds)
     {
         DirectoryInfo         root      = new DirectoryInfo(path);
         List <OpenFolderItem> openItems = new List <OpenFolderItem>();
         foreach (DirectoryInfo dir in root.GetDirectories())
         {
             OpenFolderItem item = new OpenFolderItem(dir.FullName);
             item.Name  = dir.FullName.Substring(dir.FullName.LastIndexOf(@"\") + 1);
             item.Image = imgSubItem;
             openItems.Add(item);
         }
         folder.Children = (ICollection <OpenFolderItem>)openItems;
     }
     dialogView.Items.Add(folder);
     #endregion
 }
        public void ChoosePath(object sender, RoutedEventArgs e)
        {
            Gat.Controls.OpenDialogView      openDialog = new Gat.Controls.OpenDialogView();
            Gat.Controls.OpenDialogViewModel vm         = (Gat.Controls.OpenDialogViewModel)openDialog.DataContext;
            vm.IsDirectoryChooser = true;

            bool?  result = vm.Show();
            string path;

            if (result == true)
            {
                // Get selected file path
                path = vm.SelectedFilePath;
                if (path == null)
                {
                    return;
                }
                path_text.Text = "生成文件夹:" + path;
                XmlNodeList lis = doc.GetElementsByTagName("savepath");
                lis[0].InnerText = path;
                doc.Save("./config.xml");
                save_path = path;
            }
        }