Ejemplo n.º 1
0
        Control SelectFolder()
        {
            var button = new Button {
                Text = "Select Folder"
            };

            button.Click += delegate
            {
                var dialog = new SelectFolderDialog();
                if (!string.IsNullOrEmpty(Title))
                {
                    dialog.Title = Title;
                }

                if (SetInitialFolder)
                {
                    dialog.Directory = InitialFolder;
                }

                var result = SetDialogParent ? dialog.ShowDialog(ParentWindow) : dialog.ShowDialog(null);
                if (result == DialogResult.Ok)
                {
                    Log.Write(dialog, "Result: {0}, Folder: {1}", result, dialog.Directory);
                }
                else
                {
                    Log.Write(dialog, "Result: {0}", result);
                }
            };
            return(button);
        }
Ejemplo n.º 2
0
        private Control CreateXamarinStudioDirectory()
        {
            var layout = new TableLayout(2, 2);

            var home = new Label {
                Text = "Xamarin Studio Bin Directory"
            };
            var txt = new TextBox();
            var btn = new Button {
                Text = "Select"
            };

            txt.Bind(b => b.Text, _vm, b => b.XamarinStudioDirectory);

            btn.Click += (s, e) =>
            {
                var dialog = new SelectFolderDialog();
                var result = dialog.ShowDialog(Application.Instance.MainForm);

                if (result == DialogResult.Ok)
                {
                    _vm.XamarinStudioDirectory = dialog.Directory;
                }
            };

            layout.Spacing = new Size(5, 5);
            layout.Add(home, 0, 0, true, false);
            layout.Add(txt, 0, 1, true, false);
            layout.Add(btn, 1, 1, false, false);

            return(layout);
        }
Ejemplo n.º 3
0
        Control SelectFolderWithStartupPath()
        {
            var button = new Button {
                Text = "Select Folder With Initial Folder"
            };

            button.Click += delegate
            {
                var dialog = new SelectFolderDialog();
                                #if PCL
                dialog.Directory = EtoEnvironment.GetFolderPath(EtoSpecialFolder.Documents);
                                #else
                dialog.Directory = Directory.GetCurrentDirectory();
                                #endif

                var result = dialog.ShowDialog(ParentWindow);
                if (result == DialogResult.Ok)
                {
                    Log.Write(dialog, "Result: {0}, Folder: {1}", result, dialog.Directory);
                }
                else
                {
                    Log.Write(dialog, "Result: {0}", result);
                }
            };
            return(button);
        }
Ejemplo n.º 4
0
 private void SelectFolder()
 {
     if (folderDialog.ShowDialog(this) == DialogResult.Ok)
     {
         folderBox.Text = folderDialog.Directory;
     }
 }
Ejemplo n.º 5
0
        private void selectFolder_Click(object sender, EventArgs e)
        {
            SelectFolderDialog.ShowDialog();

            pathBox.Text = SelectFolderDialog.SelectedPath.ToString();
            AppSettings.Default.downlaodpath = SelectFolderDialog.SelectedPath.ToString();
            AppSettings.Default.Save();
        }
Ejemplo n.º 6
0
 private void OutputFolderBrowseButton_Click(object sender, EventArgs e)
 {
     SelectFolderDialog.Description = "Select where you want to save the resulting PDF doc.";
     if (SelectFolderDialog.ShowDialog() == DialogResult.OK)
     {
         OutputTextBox.Text = SelectFolderDialog.SelectedPath;
     }
 }
Ejemplo n.º 7
0
        private string SelectFolder(string selectedPath)
        {
            var sfd = new SelectFolderDialog
            {
                Directory = selectedPath
            };

            return(sfd.ShowDialog(this) != DialogResult.Ok ? string.Empty : sfd.Directory);
        }
Ejemplo n.º 8
0
 private void InputFolderBrowseButton_Click(object sender, EventArgs e)
 {
     SelectFolderDialog.Description = "Select the folder where your images are saved.";
     if (SelectFolderDialog.ShowDialog() == DialogResult.OK)
     {
         InputTextBox.Text = SelectFolderDialog.SelectedPath;
         ReloadImageList();
     }
 }
Ejemplo n.º 9
0
        /// <summary>
        /// Handles the Click event of the browseButton control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        void browseButton_Click(object sender, RoutedEventArgs e)
        {
            var folderOpenDialog = new SelectFolderDialog();

            if (folderOpenDialog.ShowDialog() == true)
            {
                Text = folderOpenDialog.SelectedFolderPath;
            }
        }
        private void OnSelectFolder()
        {
            var dialog = new SelectFolderDialog();

            dialog.Description = "Select some folder you like";
            if (dialog.ShowDialog() == true)
            {
                SelectedFolder = dialog.SelectedPath;
            }
        }
Ejemplo n.º 11
0
        /// <summary>
        /// This is the event handler for the "Open Folder" button on the actionbar.
        /// </summary>
        private void OnOpenFolderClicked()
        {
            var dialog = new SelectFolderDialog();
            var result = dialog.ShowDialog(Application.Instance.MainForm);

            if (result == DialogResult.Ok)
            {
                ShowProjectFolder(dialog.Directory);
            }
        }
Ejemplo n.º 12
0
        private void ButtonBrowse_Click(object sender, EventArgs e)
        {
            var dialog = new SelectFolderDialog();

            dialog.Directory = _controller.GetFullPath(textBox1.Text);

            if (dialog.ShowDialog(this) == DialogResult.Ok)
            {
                textBox1.Text = _controller.GetRelativePath(dialog.Directory);
            }
        }
Ejemplo n.º 13
0
        private void OnDirectoryButtonClicked(object sender, EventArgs e)
        {
            SelectFolderDialog dialog = new SelectFolderDialog();

            dialog.Directory = _directoryBox.Text;

            if (dialog.ShowDialog(this) == DialogResult.Ok)
            {
                _directoryBox.Text = dialog.Directory;
            }
        }
Ejemplo n.º 14
0
        ///<summary>
        ///Выбираем и сохраняем расположение папки с MSTS
        ///</summary>
        private void SelectFolderMenuItem_Click(object sender, EventArgs e)
        {
            DialogResult result = SelectFolderDialog.ShowDialog(); //Открываем диалоговое окно выбора директории

            if (result == DialogResult.OK)                         //Если пользователь выбрал директорию
            {
                var path = SelectFolderDialog.SelectedPath;        //Получаем путь к выбранной директории
                OptionsController.SetPath(path);                   //Пытаемся записать путь к MSTS в конфигурационный файл
                LoadPath();                                        // Пробуем получить путь к МСТС
            }
        }
Ejemplo n.º 15
0
 private void SelectTargetDir_Click(object sender, EventArgs e)
 {
     using (var sfd = new SelectFolderDialog())
     {
         sfd.Directory = pathTextBox.Text;
         if (sfd.ShowDialog(this) == DialogResult.Ok)
         {
             pathTextBox.Text = sfd.Directory;
         }
     }
 }
Ejemplo n.º 16
0
        public bool ChooseContentFolder(string initialDirectory, out string folder)
        {
            var dialog = new SelectFolderDialog();

            dialog.Directory = initialDirectory;
            var result = dialog.ShowDialog(this) == DialogResult.Ok;

            folder = dialog.Directory;

            return(result);
        }
Ejemplo n.º 17
0
        void OnButtonSelectPathClick(object sender, EventArgs e)
        {
            if (Filters != null)
            {
                // Handle file selection
                using (var dialog = new OpenFileDialog()) {
                    foreach (var filter in Filters)
                    {
                        dialog.Filters.Add(filter);
                    }

                    if (TextBoxPath.Text.Length != 0)
                    {
                        var fileInfo = new FileInfo(TextBoxPath.Text);
                        if (fileInfo.Exists)
                        {
                            Debug.Assert(fileInfo.DirectoryName != null, "fileInfo.DirectoryName != null");
                            dialog.Directory = new Uri(fileInfo.DirectoryName);
                        }
                        else
                        {
                            dialog.Directory = new Uri(Utilities.ApplicationBaseDirectory);
                        }
                    }

                    if (dialog.ShowDialog(this) == DialogResult.Ok)
                    {
                        TextBoxPath.Text = Utilities.GetRelativePath(dialog.FileName);
                    }
                }
            }
            else
            {
                // Handle directory selection
                using (var dialog = new SelectFolderDialog()) {
                    if (TextBoxPath.Text.Length != 0)
                    {
                        var directory = Utilities.GetAbsolutePath(TextBoxPath.Text);
                        if (Directory.Exists(directory))
                        {
                            dialog.Directory = directory;
                        }
                    }

                    if (dialog.ShowDialog(this) == DialogResult.Ok)
                    {
                        TextBoxPath.Text = Utilities.GetRelativePath(dialog.Directory);
                    }
                }
            }

            TextBoxPath.SelectAll();
            TextBoxPath.Focus();
        }
Ejemplo n.º 18
0
        private void ButtonSelect_Click(object sender, EventArgs e)
        {
            Clear();
            //Окно выбора директории
            DialogResult result = SelectFolderDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                selectedPath = SelectFolderDialog.SelectedPath;
                SelectDirsUpdate();
            }
        }
Ejemplo n.º 19
0
        protected void OnBtnRepositoryClicked(object sender, EventArgs e)
        {
            SelectFolderDialog dlgFolder =
                new SelectFolderDialog {
                Title = "Choose repository folder", Directory = Path.GetTempPath()
            };

            if (dlgFolder.ShowDialog(this) == DialogResult.Ok)
            {
                txtRepository.Text = dlgFolder.Directory;
            }
        }
Ejemplo n.º 20
0
        private void OnBinaryFolderSelectButtonClick(object sender, EventArgs e)
        {
            SelectFolderDialog selectFolderDialog = new SelectFolderDialog {
                Directory = AppData.BinaryFileFolderPath
            };

            if (selectFolderDialog.ShowDialog(settingAreaLayout) == DialogResult.Ok)
            {
                AppData.BinaryFileFolderPath = selectFolderDialog.Directory;
                binaryFileFolderLabel.Text   = AppData.BinaryFileFolderPath;
            }
        }
Ejemplo n.º 21
0
        private void OnSelectFbsDirectoryBtnClick(object sender, EventArgs e)
        {
            SelectFolderDialog selectFolderDialog = new SelectFolderDialog
            {
                Title = "选择.fbs文件夹", Directory = AppData.FbsDirectory
            };

            if (selectFolderDialog.ShowDialog(this) == DialogResult.Ok)
            {
                AppData.FbsDirectory = selectFolderDialog.Directory;
                ReConstructWindowLayout();
            }
        }
Ejemplo n.º 22
0
        protected void OnBtnTmpClicked(object sender, EventArgs e)
        {
            var dlgFolder = new SelectFolderDialog
            {
                Title     = "Choose temporary folder",
                Directory = Path.GetTempPath()
            };

            if (dlgFolder.ShowDialog(this) == DialogResult.Ok)
            {
                txtTmp.Text = dlgFolder.Directory;
            }
        }
Ejemplo n.º 23
0
        private void GetFilePathsInFolder(string FileType)
        {
            DialogResult result = SelectFolderDialog.ShowDialog();

            if (result == DialogResult.OK)
            {
                beforeFileSize = FolderSizeCalculation(SelectFolderDialog.SelectedPath);
                filePaths      = Directory.GetFiles(SelectFolderDialog.SelectedPath, FileType, SearchOption.AllDirectories);
            }
            else if (result == DialogResult.Cancel)
            {
            }
        }
Ejemplo n.º 24
0
        private void OnExcelFolderSelectButtonClick(object sender, EventArgs e)
        {
            SelectFolderDialog selectFolderDialog = new SelectFolderDialog {
                Directory = AppData.ExcelFolderPath
            };

            if (selectFolderDialog.ShowDialog(settingAreaLayout) == DialogResult.Ok)
            {
                AppData.ExcelFolderPath = selectFolderDialog.Directory;
                excelFolderLabel.Text   = AppData.ExcelFolderPath;

                onExcelPathChanged?.Invoke();
            }
        }
Ejemplo n.º 25
0
 private string getFolderPath()
 {
     using (var folderDialog = new SelectFolderDialog())
     {
         if (folderDialog.ShowDialog(this) == DialogResult.Ok)
         {
             return(folderDialog.Directory);
         }
         else
         {
             return(null);
         }
     }
 }
Ejemplo n.º 26
0
        /// <summary>
        /// Prompts the user to select a folder
        /// </summary>
        /// <param name="prompt">Text to use to prompt the user</param>
        /// <returns>Folder path selected, or null if nothing was selected</returns>
        private string PromptForFolder(string prompt)
        {
            SelectFolderDialog dialog = new SelectFolderDialog();

            dialog.Title = prompt;
            if (dialog.ShowDialog(this) == DialogResult.Ok)
            {
                return(dialog.Directory);
            }
            else
            {
                return(null);
            }
        }
Ejemplo n.º 27
0
 void FolderBrowse(object sender, EventArgs e)
 {
     using (var dlg = new SelectFolderDialog())
     {
         if (Directory.Exists(freelancerPath.Text))
         {
             dlg.Directory = freelancerPath.Text;
         }
         if (dlg.ShowDialog(this) == DialogResult.Ok)
         {
             freelancerPath.Text = dlg.Directory;
         }
     }
 }
Ejemplo n.º 28
0
        private void ButtonBrowse_Click(object sender, EventArgs e)
        {
            if (FileAction != FileAction.SelectFolder)
            {
                FileDialog dialog;
                if (FileAction == FileAction.OpenFile)
                {
                    dialog = new OpenFileDialog();
                }
                else
                {
                    dialog = new SaveFileDialog();
                }
                dialog.Title = Title;

                if (!string.IsNullOrEmpty(FilePath))
                {
                    dialog.FileName = FilePath;
                }

                if (filters.Count > 0)
                {
                    foreach (var filter in filters)
                    {
                        dialog.Filters.Add(filter);
                    }
                    dialog.CurrentFilterIndex = CurrentFilterIndex;
                }

                if (dialog.ShowDialog(Widget) == DialogResult.Ok)
                {
                    FilePath = dialog.FileName;
                }
            }
            else
            {
                var dialog = new SelectFolderDialog();
                dialog.Title = Title;

                if (!string.IsNullOrEmpty(FilePath))
                {
                    dialog.Directory = FilePath;
                }

                if (dialog.ShowDialog(Widget) == DialogResult.Ok)
                {
                    FilePath = dialog.Directory;
                }
            }
        }
Ejemplo n.º 29
0
        private void OpenProjectClick(object sender, EventArgs e)
        {
            // todo if project is already loaded, confirm action (current save state is lost)
            // create and show dialog
            var dialog = new SelectFolderDialog
            {
                Title = "Choose the project folder and confirm"
            };

            // if user does not click on OK when opening, do nothing
            if (dialog.ShowDialog(this) == DialogResult.Ok)
            {
                this.OpenProject(dialog.Directory);
            }
        }
Ejemplo n.º 30
0
        protected override void OnExecuted(EventArgs e)
        {
            base.OnExecuted(e);
            var file = main.FileList.SelectedFile;

            if (file != null && File.Exists(file.FullName))
            {
                var dialog = new SelectFolderDialog();
                var result = dialog.ShowDialog(null);
                if (result == DialogResult.Ok)
                {
                    File.Move(file.FullName, Path.Combine(dialog.Directory, Path.GetFileName(file.FullName)));
                    main.FileList.UpdateDirectory();
                }
            }
        }