Exemplo n.º 1
0
        private void exportBrowsePNG_Click(object sender, EventArgs e)
        {
            using (VistaFolderBrowserDialog browser = new VistaFolderBrowserDialog())
            {
                browser.ShowDialog();

                if (browser.SelectedPath == "")
                {
                    return;
                }

                exportPathPNG.Text = browser.SelectedPath;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets the user selected folder
        /// </summary>
        public static String GetOpenDir()
        {
            VistaFolderBrowserDialog fbd = new VistaFolderBrowserDialog();

            fbd.RootFolder = Environment.SpecialFolder.MyComputer;
            if (fbd.ShowDialog(Globals.MainForm) == DialogResult.OK)
            {
                return(fbd.SelectedPath);
            }
            else
            {
                return(String.Empty);
            }
        }
Exemplo n.º 3
0
        private void AddFolderBtn_OnClick(object sender, RoutedEventArgs e)
        {
            var dialog = new VistaFolderBrowserDialog();
            var res    = dialog.ShowDialog(this);

            if (res ?? false)
            {
                _vm.Config.Paths.Add(new FileProfile {
                    Path = dialog.SelectedPath, LastSynced = DateTime.MinValue
                });
            }

            RefreshListBinding();
        }
Exemplo n.º 4
0
        private void FindPathClick(object sender, RoutedEventArgs e)
        {
            var dlg = new VistaFolderBrowserDialog();

            if (!Path.Text.IsEmpty())
            {
                dlg.SelectedPath = Path.Text;
            }

            if (dlg.ShowDialog(this) == true)
            {
                Path.Text = dlg.SelectedPath;
            }
        }
Exemplo n.º 5
0
        protected override void Initialize()
        {
            RegisterImportHandler <Texture>(filePath =>
            {
                var texture = TextureEncoder.Encode(filePath);
                {
                    texture.Id   = Data.Textures.Max(x => x.Id) + 1;
                    texture.Name = Path.GetFileNameWithoutExtension(filePath);
                }
                Data.Textures.Add(texture);
            });
            RegisterImportHandler <Bitmap>(filePath =>
            {
                var texture = TextureEncoder.Encode(filePath);
                {
                    texture.Id   = Data.Textures.Max(x => x.Id) + 1;
                    texture.Name = Path.GetFileNameWithoutExtension(filePath);
                }
                Data.Textures.Add(texture);
            });
            RegisterExportHandler <TextureSet>(filePath => Data.Save(filePath));
            RegisterReplaceHandler <TextureSet>(BinaryFile.Load <TextureSet>);
            RegisterCustomHandler("Export All", () =>
            {
                using (var folderBrowseDialog = new VistaFolderBrowserDialog())
                {
                    folderBrowseDialog.Description            = "Select a folder to save textures to.";
                    folderBrowseDialog.UseDescriptionForTitle = true;

                    if (folderBrowseDialog.ShowDialog() != DialogResult.OK)
                    {
                        return;
                    }

                    foreach (var texture in Data.Textures)
                    {
                        if (!TextureFormatUtilities.IsCompressed(texture.Format) || texture.IsYCbCr)
                        {
                            TextureDecoder.DecodeToPNG(texture, Path.Combine(folderBrowseDialog.SelectedPath, $"{texture.Name}.png"));
                        }
                        else
                        {
                            TextureDecoder.DecodeToDDS(texture, Path.Combine(folderBrowseDialog.SelectedPath, $"{texture.Name}.dds"));
                        }
                    }
                }
            }, Keys.Control | Keys.Shift | Keys.E);

            base.Initialize();
        }
Exemplo n.º 6
0
        private void OnInputClick(object sender, RoutedEventArgs e)
        {
            VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog
            {
                ShowNewFolderButton    = false,
                Description            = Properties.Resources.SelectFolder,
                UseDescriptionForTitle = true
            };

            if ((bool)dialog.ShowDialog(this))
            {
                Properties.Settings.Default.PakPath = dialog.SelectedPath;
            }
        }
Exemplo n.º 7
0
        private void SelectOutputFolder_Click(object sender, RoutedEventArgs e)
        {
            var selectFolderDialog = new VistaFolderBrowserDialog
            {
                SelectedPath = Constants.DefaultOutputFolder
            };
            var result = selectFolderDialog.ShowDialog();

            if (result.HasValue && result.Value == true)
            {
                txtOutputPath.Text = selectFolderDialog.SelectedPath;
            }
            LogInfo($"Output folder is {txtOutputPath.Text}");
        }
Exemplo n.º 8
0
        private void changeServerProfiles_button_Click(object sender, EventArgs e)
        {
            VistaFolderBrowserDialog chosenFolder = new VistaFolderBrowserDialog();

            chosenFolder.Description  = "Select profiles folder.";
            chosenFolder.SelectedPath = Path.GetDirectoryName(pathToArma3_textBox.Text) + @"\";

            if (chosenFolder.ShowDialog().Value)
            {
                serverProfiles_textBox.Text = chosenFolder.SelectedPath;

                refreshServer_button_Click(null, null);
            }
        }
Exemplo n.º 9
0
        public void ShareDatabase()
        {
            var dialog = new VistaFolderBrowserDialog();

            dialog.Description            = "Select directory to copy user database";
            dialog.UseDescriptionForTitle = true;
            var ans = dialog.ShowDialog();

            if (ans != true)
            {
                return;
            }
            ShareDatabase(dialog.SelectedPath);
        }
 private void OnBrowseButtonClicked(object sender, RoutedEventArgs e)
 {
     //This call is blocking. Will have to use a thread to change that.
     if ((bool)openModDialog.ShowDialog())
     {
         SelectedModPath            = openModDialog.SelectedPath;
         this.directoryTextBox.Text = SelectedModPath;
         Console.WriteLine(SelectedModPath);
     }
     else
     {
         Console.WriteLine("Folder Selection Cancelled!");
     }
 }
Exemplo n.º 11
0
        public void Browse()
        {
            var dialog = new VistaFolderBrowserDialog
            {
                SelectedPath           = _location,
                Description            = "Select Project Path",
                UseDescriptionForTitle = true
            };

            if (dialog.ShowDialog() == true)
            {
                Location = dialog.SelectedPath;
            }
        }
Exemplo n.º 12
0
        private void SelectDestinationDirectory_Click(object sender, System.Windows.RoutedEventArgs e)
        {
            VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog();

            dialog.Description            = WPFLocalizeExtensionHelpers.GetUIString("SelectFolderForDownloads");
            dialog.UseDescriptionForTitle = true;             // This applies to the Vista style dialog only, not the old dialog.
            if ((bool)dialog.ShowDialog())
            {
                if (!String.IsNullOrEmpty(dialog.SelectedPath))
                {
                    DestinationDirectory.Text = dialog.SelectedPath;
                }
            }
        }
Exemplo n.º 13
0
        private void SetTrunkLocation()
        {
            var dialog = new VistaFolderBrowserDialog();

            dialog.SelectedPath = Settings.Default.TrunkLocation;

            var showDialog = dialog.ShowDialog();

            if (showDialog.HasValue && showDialog.Value)
            {
                Settings.Default.TrunkLocation = dialog.SelectedPath;
                Settings.Default.Save();
            }
        }
Exemplo n.º 14
0
        private void onAddFolder(object sender, EventArgs e)
        {
            VistaFolderBrowserDialog folderBrowserDialog = new VistaFolderBrowserDialog();

            folderBrowserDialog.RootFolder = Environment.SpecialFolder.System;

            if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                string folderPath = folderBrowserDialog.SelectedPath;

                FolderTreeNode newNode = BuildNodeTree(folderPath);
                folderTreeView.SelectedNode = newNode;
            }
        }
Exemplo n.º 15
0
        public void SetLocationSurfaces()
        {
            var dlg        = new VistaFolderBrowserDialog();
            var showDialog = dlg.ShowDialog();

            if (showDialog == null || !((bool)showDialog))
            {
                return;
            }
            SurfacesPath = dlg.SelectedPath;
            Properties.Settings.Default.surfaceFilePath = SurfacesPath;
            Properties.Settings.Default.Save();
            //SurfacesPath = @"B:\DEV\UIEdit\UIEdit\bin\Debug\surfaces.pck.files";
        }
Exemplo n.º 16
0
        private void changePathToArma3ServerMods_button_Click(object sender, EventArgs e)
        {
            VistaFolderBrowserDialog chosenFolder = new VistaFolderBrowserDialog();

            chosenFolder.Description  = "Select server mods folder.";
            chosenFolder.SelectedPath = pathToMods_textBox.Text;

            if (chosenFolder.ShowDialog().Value)
            {
                pathToMods_textBox.Text = chosenFolder.SelectedPath;

                refreshServer_button_Click(null, null);
            }
        }
Exemplo n.º 17
0
        private static string SelectFolderByDialog(string prompt)
        {
            var dialog = new VistaFolderBrowserDialog();

            dialog.SelectedPath        = "";
            dialog.ShowNewFolderButton = true;

            if (dialog.ShowDialog() == true)
            {
                return(dialog.SelectedPath);
            }

            return(null);
        }
Exemplo n.º 18
0
        private void addCustomServerMod_Click(object sender, EventArgs e)
        {
            VistaFolderBrowserDialog chosenFolder = new VistaFolderBrowserDialog();

            chosenFolder.Description            = "Select custom mod folder.";
            chosenFolder.UseDescriptionForTitle = true;

            if (chosenFolder.ShowDialog().Value)
            {
                customMods_listView.Items.Add(chosenFolder.SelectedPath);

                refreshServer_button_Click(null, null);
            }
        }
Exemplo n.º 19
0
        private void SelectDirectory()
        {
            var a = new VistaFolderBrowserDialog();

            if (DirectoryPathIsValid())
            {
                a.SelectedPath = GitPath;
            }

            if (a.ShowDialog() == true)
            {
                GitPath = a.SelectedPath;
            }
        }
Exemplo n.º 20
0
        private void AddDataSourceFromFolder()
        {
            var dlg = new VistaFolderBrowserDialog
            {
                Description            = "Select folder to open",
                UseDescriptionForTitle = true
            };

            if (dlg.ShowDialog() == true)
            {
                var folder = dlg.SelectedPath;
                GetOrAddFolder(folder);
            }
        }
Exemplo n.º 21
0
        private void FindPathClick(object sender, RoutedEventArgs e)
        {
            var dlg = new VistaFolderBrowserDialog();

            if (!HistoryPathTextBox.Text.IsEmpty())
            {
                dlg.SelectedPath = HistoryPathTextBox.Text;
            }

            if (dlg.ShowDialog(Application.Current.MainWindow) == true)
            {
                HistoryPathTextBox.Text = dlg.SelectedPath;
            }
        }
Exemplo n.º 22
0
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            AddPlugin.Command = new RelayCommand(() => {
                var ofd         = new VistaOpenFileDialog();
                ofd.Filter      = ".NET assemblies (*.exe, *.dll)|*.exe;*.dll|All Files (*.*)|*.*";
                ofd.Multiselect = true;
                if (ofd.ShowDialog() ?? false)
                {
                    foreach (string plugin in ofd.FileNames)
                    {
                        try {
                            ComponentDiscovery.LoadComponents(project.Protections, project.Packers, plugin);
                            project.Plugins.Add(new StringItem(plugin));
                        }
                        catch {
                            MessageBox.Show("Failed to load plugin '" + plugin + "'.");
                        }
                    }
                }
            });

            RemovePlugin.Command = new RelayCommand(() => {
                int selIndex = PluginPaths.SelectedIndex;
                Debug.Assert(selIndex != -1);

                string plugin = project.Plugins[selIndex].Item;
                ComponentDiscovery.RemoveComponents(project.Protections, project.Packers, plugin);
                project.Plugins.RemoveAt(selIndex);

                PluginPaths.SelectedIndex = selIndex >= project.Plugins.Count ? project.Plugins.Count - 1 : selIndex;
            }, () => PluginPaths.SelectedIndex != -1);


            AddProbe.Command = new RelayCommand(() => {
                var fbd = new VistaFolderBrowserDialog();
                if (fbd.ShowDialog() ?? false)
                {
                    project.ProbePaths.Add(new StringItem(fbd.SelectedPath));
                }
            });

            RemoveProbe.Command = new RelayCommand(() => {
                int selIndex = ProbePaths.SelectedIndex;
                Debug.Assert(selIndex != -1);
                project.ProbePaths.RemoveAt(selIndex);
                ProbePaths.SelectedIndex = selIndex >= project.ProbePaths.Count ? project.ProbePaths.Count - 1 : selIndex;
            }, () => ProbePaths.SelectedIndex != -1);
        }
Exemplo n.º 23
0
        private void AddDestinationPath(object parameter)
        {
            VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog();

            if (dialog.ShowDialog() == true)
            {
                Paths.Add(new PathElement()
                {
                    FullPath = dialog.SelectedPath
                });
                DestinationPath = dialog.SelectedPath;
                SettingsManager.UpdateSettingsDestinationPaths(Paths);
            }
        }
Exemplo n.º 24
0
        private void ListBoxItem_OnSelected_4(object sender, RoutedEventArgs e)
        {
            var dialog = new VistaFolderBrowserDialog()
            {
                Description         = "选择下载缓存文件夹",
                RootFolder          = Environment.SpecialFolder.Desktop,
                ShowNewFolderButton = true,
            };

            if (dialog.ShowDialog() ?? false)
            {
                download_CachePath_Input.Text = dialog.SelectedPath;
            }
        }
Exemplo n.º 25
0
        private void OpenFolder(object sender, RoutedEventArgs e)
        {
            var dialog = new VistaFolderBrowserDialog();

            dialog.SelectedPath = currentPath;
            var selected = dialog.ShowDialog(this);

            if (selected.GetValueOrDefault())
            {
                currentPath            = dialog.SelectedPath;
                appOptions.DefaultPath = currentPath;
                LoadFolder(currentPath);
            }
        }
Exemplo n.º 26
0
        private void Select_Click(object sender, RoutedEventArgs e)
        {
            mod_dir = new VistaFolderBrowserDialog();
            if ((bool)mod_dir.ShowDialog())
            {
                mod_folder_path   = mod_dir.SelectedPath;
                custom_title.Text = "S4-Pavir - \"" + mod_folder_path + "\"";

                if (mod_folder_path.Length != 0)
                {
                    Scan();
                }
            }
        }
Exemplo n.º 27
0
        private void ChooseExportPath()
        {
            Ookii.Dialogs.VistaFolderBrowserDialog dlg = new VistaFolderBrowserDialog();
            dlg.SelectedPath        = Properties.Settings.Default.LastExportDirectory;
            dlg.ShowNewFolderButton = false;

            dlg.OnFolderSelected += new VistaFolderBrowserDialog.FolderSelectedHandler(dlg_OnFolderSelected);

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                Properties.Settings.Default.LastExportDirectory = Path.GetFullPath(dlg.SelectedPath);
                Properties.Settings.Default.Save();
            }
        }
Exemplo n.º 28
0
        private void browseDirectorySVG_Click(object sender, EventArgs e)
        {
            using (VistaFolderBrowserDialog browser = new VistaFolderBrowserDialog())
            {
                browser.ShowDialog();

                if (browser.SelectedPath == "")
                {
                    return;
                }

                importPathDirectorySVG.Text = browser.SelectedPath;
            }
        }
Exemplo n.º 29
0
        public static void OpenBackupDirectory(string path)
        {
            Trace.WriteLine("Open Directory " + path);
            VistaFolderBrowserDialog fd = new VistaFolderBrowserDialog
            {
                SelectedPath = path
            };

            fd.ShowDialog();
            var selectedPath = fd.SelectedPath;

            Trace.WriteLine("Selected Path: " + selectedPath);
            ToscaConfigFilesViewModel.ToscaConfigFiles.BackupPath = selectedPath;
        }
Exemplo n.º 30
0
        private void ChooseTargetFolder(object sender, RoutedEventArgs routedEventArgs)
        {
            var dialog   = new VistaFolderBrowserDialog();
            var selected = dialog.ShowDialog(Owner);

            if (selected == false)
            {
                return;
            }

            TargetDirectoryLabel.Content = dialog.SelectedPath;
            Properties.Settings.Default.TargetDefaultPath = dialog.SelectedPath;
            Properties.Settings.Default.Save();
        }
Exemplo n.º 31
0
 private void ShowFolderBrowserDialog()
 {
     VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog();
     dialog.Description = "Please select a folder.";
     dialog.UseDescriptionForTitle = true; // This applies to the Vista style dialog only, not the old dialog.
     if( !VistaFolderBrowserDialog.IsVistaFolderDialogSupported )
         MessageBox.Show(this, "Because you are not using Windows Vista or later, the regular folder browser dialog will be used. Please use Windows Vista to see the new dialog.", "Sample folder browser dialog");
     if( (bool)dialog.ShowDialog(this) )
         MessageBox.Show(this, "The selected folder was: " + dialog.SelectedPath, "Sample folder browser dialog");            
 }