Ejemplo n.º 1
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.º 2
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.º 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_Click(object sender, EventArgs e)
        {
            SelectFolderDialog.ShowDialog();

            pathBox.Text = SelectFolderDialog.SelectedPath.ToString();
            AppSettings.Default.downlaodpath = SelectFolderDialog.SelectedPath.ToString();
            AppSettings.Default.Save();
        }
Ejemplo n.º 5
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.º 6
0
 private void BtnChooseFolder_Clicked(object sender, EventArgs e)
 {
     var dlg = new SelectFolderDialog();
     if(dlg.Run() == true)
     {
         textInput.Text = dlg.Folder;
     }
 }
		public string SelectFolder ()
		{
			var dialog = new SelectFolderDialog ();
			if (dialog.Run ()) {
				return dialog.SelectedFile;
			}
			return null;
		}
Ejemplo n.º 8
0
        private string SelectFolder(string selectedPath)
        {
            var sfd = new SelectFolderDialog
            {
                Directory = selectedPath
            };

            return(sfd.ShowDialog(this) != DialogResult.Ok ? string.Empty : sfd.Directory);
        }
Ejemplo n.º 9
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.º 10
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;
            }
        }
Ejemplo n.º 11
0
		public async void AddExistingFolder ()
		{
			var project = (Project) CurrentNode.GetParentDataItem (typeof(Project), true);
			var selectedFolder = ((FilePath) GetFolderPath (CurrentNode.DataItem)).CanonicalPath;
			
			var ofdlg = new SelectFolderDialog (GettextCatalog.GetString ("Add Existing Folder")) {
				CurrentFolder = !PreviousFolderPath.IsNullOrEmpty ? PreviousFolderPath : selectedFolder 
			};
			if(!ofdlg.Run ())
				return;

			// We store the parent directory of the folder the user chooses as they will not need to add the same
			// directory twice. We can save them navigating up one directory by doing it for them
			PreviousFolderPath = ofdlg.SelectedFile.CanonicalPath;
			if (!PreviousFolderPath.ParentDirectory.IsNullOrEmpty)
				PreviousFolderPath = PreviousFolderPath.ParentDirectory;

			var srcRoot = ofdlg.SelectedFile.CanonicalPath;
			var targetRoot = selectedFolder.Combine (srcRoot.FileName);

			bool changedProject = false;

			if (File.Exists (targetRoot)) {
				MessageService.ShowWarning (GettextCatalog.GetString (
					"There is already a file with the name '{0}' in the target directory", srcRoot.FileName));
				return;
			}

			var existingPf = project.Files.GetFileWithVirtualPath (targetRoot.ToRelative (project.BaseDirectory));
			if (existingPf != null) {
				if (existingPf.Subtype != Subtype.Directory) {
					MessageService.ShowWarning (GettextCatalog.GetString (
						"There is already a link with the name '{0}' in the target directory", srcRoot.FileName));
					return;
				}
			}

			var foundFiles = Directory.GetFiles (srcRoot, "*", SearchOption.AllDirectories);
			
			using (var impdlg = new IncludeNewFilesDialog (GettextCatalog.GetString ("Select files to add from {0}", srcRoot.FileName), srcRoot.ParentDirectory)) {
				impdlg.AddFiles (foundFiles);
				if (MessageService.ShowCustomDialog (impdlg) == (int)ResponseType.Ok) {
					var srcFiles = impdlg.SelectedFiles;
					var targetFiles = srcFiles.Select (f => targetRoot.Combine (f.ToRelative (srcRoot)));
					if (IdeApp.ProjectOperations.AddFilesToProject (project, srcFiles.ToArray (), targetFiles.ToArray (), null).Any ())
						changedProject = true;
					else if (!srcFiles.Any () && existingPf == null) {
						// Just add empty folder.
						project.Files.Add (new ProjectFile (targetRoot) { Subtype = Subtype.Directory });
						changedProject = true;
					}
				}
			
				if (changedProject)
					await IdeApp.ProjectOperations.SaveAsync (project);
			}
		}
        public void AddExistingFolder()
        {
            var project        = (FolderBasedProject)CurrentNode.GetParentDataItem(typeof(FolderBasedProject), true);
            var selectedFolder = ((FilePath)GetPath(CurrentNode.DataItem)).CanonicalPath;

            var ofdlg = new SelectFolderDialog(GettextCatalog.GetString("Add Existing Folder"))
            {
                CurrentFolder = !PreviousFolderPath.IsNullOrEmpty ? PreviousFolderPath : selectedFolder
            };

            if (!ofdlg.Run())
            {
                return;
            }

            // We store the parent directory of the folder the user chooses as they will not need to add the same
            // directory twice. We can save them navigating up one directory by doing it for them
            PreviousFolderPath = ofdlg.SelectedFile.CanonicalPath;
            if (!PreviousFolderPath.ParentDirectory.IsNullOrEmpty)
            {
                PreviousFolderPath = PreviousFolderPath.ParentDirectory;
            }

            var srcRoot    = ofdlg.SelectedFile.CanonicalPath;
            var targetRoot = selectedFolder.Combine(srcRoot.FileName);

            if (File.Exists(targetRoot))
            {
                MessageService.ShowWarning(GettextCatalog.GetString(
                                               "There is already a file with the name '{0}' in the target directory", srcRoot.FileName));
                return;
            }

            var foundFiles = Directory.GetFiles(srcRoot, "*", SearchOption.AllDirectories);

            using (var impdlg = new IncludeNewFilesDialog(GettextCatalog.GetString("Select files to add from {0}", srcRoot.FileName), srcRoot.ParentDirectory)) {
                impdlg.AddFiles(foundFiles);
                if (MessageService.ShowCustomDialog(impdlg) == (int)ResponseType.Ok)
                {
                    var srcFiles    = impdlg.SelectedFiles;
                    var targetFiles = srcFiles.Select(f => targetRoot.Combine(f.ToRelative(srcRoot)));
                    foreach (var srcFile in srcFiles)
                    {
                        foreach (var targetFile in targetFiles)
                        {
                            if (srcFile.ToRelative(srcRoot).Equals(targetFile.ToRelative(targetRoot)))
                            {
                                CopyFile(srcFile, targetFile);
                            }
                        }
                    }
                    project.OnFilesAdded(targetFiles.ToList());
                }
            }
            Tree.BuilderContext.GetTreeBuilder(CurrentNode).UpdateChildren();
        }
        private void OnSelectFolder()
        {
            var dialog = new SelectFolderDialog();

            dialog.Description = "Select some folder you like";
            if (dialog.ShowDialog() == true)
            {
                SelectedFolder = dialog.SelectedPath;
            }
        }
Ejemplo n.º 14
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.º 15
0
        public string SelectFolder()
        {
            var dialog = new SelectFolderDialog();

            if (dialog.Run())
            {
                return(dialog.SelectedFile);
            }
            return(null);
        }
Ejemplo n.º 16
0
        public void AddExistingFolder()
        {
            var project = (Project) CurrentNode.GetParentDataItem (typeof(Project), true);
            var selectedFolder = ((FilePath) GetFolderPath (CurrentNode.DataItem)).CanonicalPath;

            var ofdlg = new SelectFolderDialog (GettextCatalog.GetString ("Add Existing Folder")) {
                CurrentFolder = !PreviousFolderPath.IsNullOrEmpty ? PreviousFolderPath : selectedFolder
            };
            if(!ofdlg.Run ())
                return;

            // We store the parent directory of the folder the user chooses as they will not need to add the same
            // directory twice. We can save them navigating up one directory by doing it for them
            PreviousFolderPath = ofdlg.SelectedFile.CanonicalPath;
            if (!PreviousFolderPath.ParentDirectory.IsNullOrEmpty)
                PreviousFolderPath = PreviousFolderPath.ParentDirectory;

            var srcRoot = ofdlg.SelectedFile.CanonicalPath;
            var targetRoot = selectedFolder.Combine (srcRoot.FileName);

            bool changedProject = false;

            if (File.Exists (targetRoot)) {
                MessageService.ShowWarning (GettextCatalog.GetString (
                    "There is already a file with the name '{0}' in the target directory", srcRoot.FileName));
                return;
            }

            var existingPf = project.Files.GetFileWithVirtualPath (targetRoot.ToRelative (project.BaseDirectory));
            if (existingPf != null) {
                if (existingPf.Subtype != Subtype.Directory) {
                    MessageService.ShowWarning (GettextCatalog.GetString (
                        "There is already a link with the name '{0}' in the target directory", srcRoot.FileName));
                    return;
                }
            } else {
                project.Files.Add (new ProjectFile (targetRoot) { Subtype = Subtype.Directory });
                changedProject = true;
            }

            var foundFiles = Directory.GetFiles (srcRoot, "*", SearchOption.AllDirectories);

            var impdlg = new IncludeNewFilesDialog (GettextCatalog.GetString ("Select files to add from {0}", srcRoot.FileName), srcRoot.ParentDirectory);
            impdlg.AddFiles (foundFiles);
            if (MessageService.ShowCustomDialog (impdlg) == (int) ResponseType.Ok) {
                var srcFiles = impdlg.SelectedFiles;
                var targetFiles = srcFiles.Select (f => targetRoot.Combine (f.ToRelative (srcRoot)));
                if (IdeApp.ProjectOperations.AddFilesToProject (project, srcFiles.ToArray (), targetFiles.ToArray (), null).Any ())
                    changedProject = true;
            }

            if (changedProject)
                IdeApp.ProjectOperations.Save (project);
        }
Ejemplo n.º 17
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.º 18
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.º 19
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.º 20
0
        private void ButtonBrowse_Click(object sender, EventArgs e)
        {
            var dialog = new SelectFolderDialog();

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

            if (dialog.Show(this) == DialogResult.Ok)
            {
                textBox1.Text = _controller.GetRelativePath(dialog.Directory);
            }
        }
Ejemplo n.º 21
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.º 22
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.º 23
0
        public MainWindow()
        {
            model      = new Model();
            controller = new Controller(model);

            this.Width   = 600;
            this.Height  = 400;
            this.Closed += delegate {
                model.Synthesizer.Stop();
                Application.Exit();
            };

            this.MainMenu = new Menu();

            var file = new MenuItem("_File");

            file.SubMenu = new Menu();
            this.MainMenu.Items.Add(file);

            var configPatchDir = new MenuItem("_Configure Patch directory");

            configPatchDir.Clicked += delegate {
                var dirdlg = new SelectFolderDialog("Choose Patch directory.")
                {
                    Multiselect = false,
                };
                if (dirdlg.Run(this))
                {
                    controller.SetPatchDirectory(dirdlg.Folder);
                }
            };
            file.SubMenu.Items.Add(configPatchDir);

            var exit = new MenuItem("E_xit");

            exit.Clicked += (o, e) => Close();
            file.SubMenu.Items.Add(exit);

            var patch = new MenuItem("_Patch");

            this.MainMenu.Items.Add(patch);

            model.PatchDirectoryUpdated += delegate { patch.SubMenu = XwtUtility.BuildDirectoryTree(new DirectoryInfo(model.PatchDirectory), s => Task.Run(() => controller.SelectPatchFile(s))); };

            var button = new Button("PLAY");

            button.Clicked += delegate {
                Task.Run(() => controller.PlayTestSound());
            };
            this.Content = button;

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

            if (result == DialogResult.OK)
            {
                selectedPath = SelectFolderDialog.SelectedPath;
                SelectDirsUpdate();
            }
        }
Ejemplo n.º 25
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.º 26
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.º 27
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.º 28
0
        public bool ChooseContentFolder(string initialDirectory, out string folder)
        {
            var dialog = new SelectFolderDialog();
            dialog.Directory = initialDirectory;

            var result = dialog.Show(this) == DialogResult.Ok;
            if (result)
                folder = dialog.Directory;
            else
                folder = string.Empty;

            return result;
        }
Ejemplo n.º 29
0
		protected override string ShowBrowseDialog (string name, string startIn)
		{
			var fd = new SelectFolderDialog (name);
			if (startIn != null)
				fd.CurrentFolder = startIn;

			fd.SetFilters (FileFilters);
			fd.TransientFor = GetTransientFor ();
			
			if (fd.Run ())
				return fd.SelectedFile;
			return null;
		}
		protected override string ShowBrowseDialog (string name, string start_in)
		{
			SelectFolderDialog fd = new SelectFolderDialog (name);
			if (start_in != null)
				fd.InitialFileName = start_in;
			
			fd.TransientFor = GetTransientFor ();
			
			if (fd.Run ())
				return fd.SelectedFile;
			else
				return null;
		}
        void OnBrowse(object sender, EventArgs args)
        {
            using (SelectFolderDialog folderSelect = new SelectFolderDialog("Browse Folder"))
            {
                folderSelect.Multiselect      = false;
                folderSelect.CanCreateFolders = true;

                if (folderSelect.Run(MessageDialog.RootWindow))
                {
                    _pathEntry.Text = folderSelect.Folder;
                }
            }
        }
Ejemplo n.º 32
0
        void RunSoundFontDirectoryChooser()
        {
            // FIXME: current XWt is buggy and does not respect my `Multiselect = true`.
            // var dlg = new SelectFolderDialog { Title = "Select soundfont directories", Multiselect = true, CanCreateFolders = false };
            var dlg = new SelectFolderDialog {
                Title = "Select soundfont directories", CanCreateFolders = false
            };

            if (dlg.Run())
            {
                model.UpdateDirectoryList(model.UserSettings.SoundFontPaths.Concat(dlg.Folders).ToArray());
            }
        }
Ejemplo n.º 33
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.º 34
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.º 35
0
		void ButtonBrowsePathsClicked (object sender, EventArgs e)
		{
			var dlg = new SelectFolderDialog (GettextCatalog.GetString ("Select directory")) {
				TransientFor = this,
			};
			
			string defaultFolder = comboboxentryPath.Entry.Text;
			if (string.IsNullOrEmpty (defaultFolder))
				defaultFolder = IdeApp.ProjectOperations.ProjectsDefaultPath;
			if (!string.IsNullOrEmpty (defaultFolder))
				dlg.CurrentFolder = defaultFolder;
			
			if (dlg.Run ())
				comboboxentryPath.Entry.Text = dlg.SelectedFile;
		}
Ejemplo n.º 36
0
		protected virtual void OnButtonAddClicked (object sender, System.EventArgs e)
		{
			var dlg = new SelectFolderDialog (GettextCatalog.GetString ("Select the mono installation prefix")) {
				TransientFor = this.Toplevel as Gtk.Window,
			};

			//set a platform-dependent default folder for the dialog if possible
			if (Platform.IsWindows) {
				// ProgramFilesX86 is broken on 32-bit WinXP
				string programFilesX86 = GetProgramFilesX86 ();
				if (!string.IsNullOrEmpty (programFilesX86) && System.IO.Directory.Exists (programFilesX86))
					dlg.CurrentFolder = programFilesX86;
			} else {
				if (System.IO.Directory.Exists ("/usr"))
					dlg.CurrentFolder = "/usr";
			}

			if (!dlg.Run ())
				return;

			var rinfo64 = new MonoRuntimeInfo (dlg.SelectedFile, true);
			var rinfo32 = new MonoRuntimeInfo (dlg.SelectedFile, false);
			if (rinfo64.IsValidRuntime && rinfo32.IsValidRuntime) {
				newInfos.Add (rinfo64);
				store.AppendValues (rinfo64.DisplayName, rinfo64);
				newInfos.Add (rinfo32);
				store.AppendValues (rinfo32.DisplayName, rinfo32);
			} else if (rinfo64.IsValidRuntime) {
				newInfos.Add (rinfo64);
				store.AppendValues (rinfo64.DisplayName, rinfo64);
			} else if (rinfo32.IsValidRuntime) {
				newInfos.Add (rinfo32);
				store.AppendValues (rinfo32.DisplayName, rinfo32);
			} else {
				var rinfo = new MonoRuntimeInfo (dlg.SelectedFile, null);
				if (rinfo.IsValidRuntime) {
					newInfos.Add (rinfo);
					store.AppendValues (rinfo.DisplayName, rinfo);
				} else {
					MessageService.ShowError (GettextCatalog.GetString ("Mono runtime not found"), GettextCatalog.GetString ("Please provide a valid directory prefix where mono is installed (for example, /usr)"));
				}
			}
		}
Ejemplo n.º 37
0
        public void AddFilesFromFolder()
        {
            var project = (Project) CurrentNode.GetParentDataItem (typeof(Project), true);
            var targetRoot = ((FilePath) GetFolderPath (CurrentNode.DataItem)).CanonicalPath;

            var ofdlg = new SelectFolderDialog (GettextCatalog.GetString ("Import From Folder")) {
                CurrentFolder = !PreviousFolderPath.IsNullOrEmpty ? PreviousFolderPath : targetRoot
            };
            if(!ofdlg.Run ())
                return;
            PreviousFolderPath = ofdlg.SelectedFile.CanonicalPath;
            if (!PreviousFolderPath.ParentDirectory.IsNullOrEmpty)
                PreviousFolderPath = PreviousFolderPath.ParentDirectory;

            var srcRoot = ofdlg.SelectedFile.CanonicalPath;
            var foundFiles = Directory.GetFiles (srcRoot, "*", SearchOption.AllDirectories);

            var impdlg = new IncludeNewFilesDialog (GettextCatalog.GetString ("Select files to add from {0}", srcRoot.FileName), srcRoot);
            impdlg.AddFiles (foundFiles);
            if (MessageService.ShowCustomDialog (impdlg) != (int) ResponseType.Ok)
                return;

            var srcFiles = impdlg.SelectedFiles;
            var targetFiles = srcFiles.Select (f => targetRoot.Combine (f.ToRelative (srcRoot)));

            var added = IdeApp.ProjectOperations.AddFilesToProject (project, srcFiles.ToArray (), targetFiles.ToArray (), null).Any ();
            if (added)
                IdeApp.ProjectOperations.Save (project);
        }
Ejemplo n.º 38
0
		protected virtual void OnButtonAddClicked (object sender, System.EventArgs e)
		{
			var dlg = new SelectFolderDialog (GettextCatalog.GetString ("Select the mono installation prefix")) {
				TransientFor = this.Toplevel as Gtk.Window,
			};
			
			//set a platform-dependent default folder for the dialog if possible
			if (PropertyService.IsWindows) {
				string folder = Environment.GetFolderPath (Environment.SpecialFolder.ProgramFilesX86);
				if (!string.IsNullOrEmpty (folder) && System.IO.Directory.Exists (folder))
					dlg.CurrentFolder = folder;
			} else {
				if (System.IO.Directory.Exists ("/usr"))
					dlg.CurrentFolder = "/usr";
			}
			
			if (!dlg.Run ())
				return;
			
			var rinfo = new MonoRuntimeInfo (dlg.SelectedFile);
			if (!rinfo.IsValidRuntime) {
				MessageService.ShowError (GettextCatalog.GetString ("Mono runtime not found"), GettextCatalog.GetString ("Please provide a valid directory prefix where mono is installed (for example, /usr)"));
				return;
			}
			newInfos.Add (rinfo);
			store.AppendValues (rinfo.DisplayName, rinfo);
		}
		protected virtual void OnButtonAddClicked (object sender, System.EventArgs e)
		{
			var dlg = new SelectFolderDialog (GettextCatalog.GetString ("Select the mono installation prefix")) {
				TransientFor = this.Toplevel as Gtk.Window,
				CurrentFolder = "/usr",
			};
			if (!dlg.Run ())
				return;
			
			var rinfo = new MonoRuntimeInfo (dlg.SelectedFile);
			if (!rinfo.IsValidRuntime) {
				MessageService.ShowError (GettextCatalog.GetString ("Mono runtime not found"), GettextCatalog.GetString ("Please provide a valid directory prefix where mono is installed (for example, /usr)"));
				return;
			}
			newInfos.Add (rinfo);
			store.AppendValues (rinfo.DisplayName, rinfo);
		}
		FilePath BrowseForFolder (FilePath startingFolder)
		{
			var dialog = new SelectFolderDialog ();
			if (startingFolder != null)
				dialog.CurrentFolder = startingFolder;

			dialog.TransientFor = Toplevel as Window;

			if (dialog.Run ())
				return dialog.SelectedFile;
			return null;
		}