public void Add()
        {
            var project = (DotNetProject)CurrentNode.GetParentDataItem(typeof(DotNetProject), true);
            var inrproj = project as INativeReferencingProject;

            var dlg = new SelectFileDialog(GettextCatalog.GetString("Select Native Library"), Gtk.FileChooserAction.Open);

            dlg.SelectMultiple = true;
            dlg.AddAllFilesFilter();

            foreach (var filter in inrproj.NativeReferenceFileFilters)
            {
                dlg.AddFilter(filter.Description, "*" + filter.FileExtension);
            }

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

            foreach (var file in dlg.SelectedFiles)
            {
                var item = new NativeReference(file, inrproj.GetNativeReferenceKind(file));
                project.Items.Add(item);
            }

            IdeApp.ProjectOperations.Save(project);
        }
예제 #2
0
        private static void OpenCmd_Execute(object sender, CommandRunArgs e)
        {
            string str = (string)null;

            if (e.DataItem == null)
            {
                string lastBrowserLocation = Services.RecentFileService.LastBrowserLocation;
                if (Option.IsXP)
                {
                    str = FileChooserDialogModel.GetOpenFilePath(new string[1] {
                        "*.ccs"
                    }, "Open File", false, lastBrowserLocation).FileName;
                    Services.RecentFileService.LastBrowserLocation = Path.GetDirectoryName(str);
                }
                else
                {
                    SelectFileDialog selectFileDialog = new SelectFileDialog();
                    selectFileDialog.Title          = LanguageInfo.Menu_File_OpenProject;
                    selectFileDialog.Action         = FileChooserAction.Open;
                    selectFileDialog.SelectMultiple = false;
                    selectFileDialog.CurrentFolder  = (FilePath)lastBrowserLocation;
                    selectFileDialog.AddFilter("Solution Files", "*.ccs");
                    if (selectFileDialog.Run())
                    {
                        str = (string)selectFileDialog.SelectedFile;
                        Services.RecentFileService.LastBrowserLocation = Path.GetDirectoryName(str);
                    }
                }
            }
            else
            {
                str = e.DataItem.ToString();
            }
            StartInfoService.Instance.HandleOpenSolution(str);
        }
예제 #3
0
        public override object EditValue(ITypeDescriptorContext context, [CanBeNull] IServiceProvider provider, object value)
        {
            Assert.ArgumentNotNull(context, nameof(context));

            var renderingItem = context.Instance as IItem;

            if (renderingItem == null)
            {
                // ReSharper disable once AssignNullToNotNullAttribute
                return(value);
            }

            var dialog = new SelectFileDialog
            {
                Site = renderingItem.ItemUri.Site
            };

            if (!dialog.ShowDialog())
            {
                // ReSharper disable once AssignNullToNotNullAttribute
                return(value);
            }

            return(dialog.SelectedFilePath.Replace("\\", "/"));
        }
    void LoadKeyFrames()
    {
        var sfd = new SelectFileDialog()
                  .SetFilter("KeyFrame data\0*.json\0")
                  .SetTitle("Select KeyFrame data")
                  .SetDefaultExt("json")
                  .Show();

        if (sfd.IsSucessful)
        {
            foreach (var obj in scriptObjects)
            {
                if (obj.IsCamera)
                {
                    Destroy(obj);
                }
                else
                {
                    Destroy(obj.gameObject);
                }
            }

            currentFile   = sfd.File;
            scriptObjects = ScriptObject.FromJson(File.ReadAllText(currentFile));

            currentTime = 0;
            ass.time    = 0;

            StartCoroutine(AfterLoadKeyFrames());
        }
    }
예제 #5
0
        /// <summary> Opens the template selection window. </summary>
        /// <returns></returns>
        protected override IQOpResult <string> OpenEditor(string defaultValue, IQVarElementTarget target)
        {
            // other_files_folder\eSCRIBE
            string otherFilesEscribe = EscribeOperations.EscribeRoot;

            // other_files_folder\eSCRIBE\<TemplatesRoot>
            // default TemplatesRoot to the eScribe templates, i.e. 'WKGroup'
            string templatesRoot = !String.IsNullOrEmpty(TemplatesRoot)
                                        ? TemplatesRoot
                                        : EscribeConstants.EscribeTemplatesRoot;

            string otherFilesEscribeTemplatesRoot = Path.Combine(otherFilesEscribe, templatesRoot);

            string selectedTemplate = SelectFileDialog.IsValidTemplate(defaultValue)
                                                ? Path.Combine(otherFilesEscribe, defaultValue)
                                                : defaultValue;

            var editor = new SelectFileDialog(otherFilesEscribeTemplatesRoot, String.Empty, selectedTemplate);

            if (editor.ShowDialog() != DialogResult.OK)
            {
                return new IQOpResult <string> {
                           Result = OpResultEnum.Cancelled
                }
            }
            ;

            // trim the 'other_files_folder\eSCRIBE\' part
            selectedTemplate = SelectFileDialog.TrimTemplateRoot(otherFilesEscribe, editor.SelectedFile);
            return(new IQOpResult <string> {
                Result = OpResultEnum.Completed, Value = selectedTemplate
            });
        }
    }
		protected virtual void OnButton24Clicked (object sender, System.EventArgs e)
		{
			var dialog = new SelectFileDialog (GettextCatalog.GetString ("Add items to toolbox")) {
				SelectMultiple = true,
				TransientFor = this,
			};
			dialog.AddFilter (null, "*.dll");
			if (dialog.Run ()) {
				indexModified = true;
				// Add the new files to the index
				using (var monitor = new MessageDialogProgressMonitor (true, false, false, true)) {
					monitor.BeginTask (GettextCatalog.GetString ("Looking for components..."), dialog.SelectedFiles.Length);
					foreach (string s in dialog.SelectedFiles) {
						var cif = index.AddFile (s);
						monitor.Step (1);
						if (cif != null) {
							// Select all new items by default
							foreach (var it in cif.Components)
								currentItems.Add (it, it);
						}
						else
							MessageService.ShowWarning (GettextCatalog.GetString ("The file '{0}' does not contain any component.", s));
					}
				}
				Fill ();
			}
		}
예제 #7
0
        /// <summary>Allows the user to browse the file system for a stylesheet.</summary>
        /// <returns>The stylesheet filename the user selected; otherwise null.</returns>
        public static string BrowseForStylesheetFile()
        {
            var dlg = new SelectFileDialog(GettextCatalog.GetString("Select XSLT Stylesheet"))
            {
                TransientFor = IdeApp.Workbench.RootWindow,
            };

            dlg.AddFilter(new SelectFileDialogFilter(
                              GettextCatalog.GetString("XML Files"),
                              new string[] { "*.xml" },
                              new string[] { "text/xml", "application/xml" }
                              ));
            dlg.AddFilter(new SelectFileDialogFilter(
                              GettextCatalog.GetString("XSL Files"),
                              new string[] { "*.xslt", "*.xsl" },
                              new string[] { "text/x-xslt" }
                              ));
            dlg.AddAllFilesFilter();

            if (dlg.Run())
            {
                return(dlg.SelectedFile);
            }
            return(null);
        }
예제 #8
0
        protected virtual void OnButtonBrowseClicked(object sender, System.EventArgs e)
        {
            var dlg = new SelectFileDialog(GettextCatalog.GetString("Select File"))
            {
                CurrentFolder  = entry.BaseDirectory,
                SelectMultiple = false,
                TransientFor   = this.Toplevel as Gtk.Window,
            };

            if (!dlg.Run())
            {
                return;
            }
            if (System.IO.Path.IsPathRooted(dlg.SelectedFile))
            {
                entryCommand.Text = FileService.AbsoluteToRelativePath(entry.BaseDirectory, dlg.SelectedFile);
            }
            else
            {
                entryCommand.Text = dlg.SelectedFile;
            }
            if (entryCommand.Text.IndexOf(' ') != -1)
            {
                entryCommand.Text = '"' + entryCommand.Text + '"';
            }
        }
예제 #9
0
        void HandleButtonExportClicked(object sender, EventArgs e)
        {
            var dialog = new SelectFileDialog(GettextCatalog.GetString("Highlighting Scheme"), Gtk.FileChooserAction.Save)
            {
                TransientFor = this.Toplevel as Gtk.Window,
            };

            dialog.AddFilter(GettextCatalog.GetString("Color schemes"), "*.json");
            if (!dialog.Run())
            {
                return;
            }
            TreeIter selectedIter;

            if (styleTreeview.Selection.GetSelected(out selectedIter))
            {
                var sheme        = (Mono.TextEditor.Highlighting.ColorScheme) this.styleStore.GetValue(selectedIter, 1);
                var selectedFile = dialog.SelectedFile.ToString();
                if (!selectedFile.EndsWith(".json", StringComparison.Ordinal))
                {
                    selectedFile += ".json";
                }
                sheme.Save(selectedFile);
            }
        }
예제 #10
0
        void PrivateKeyLocationButton_Clicked(object sender, EventArgs e)
        {
            var dialog = new SelectFileDialog(GettextCatalog.GetString("Select a private SSH key to use."))
            {
                ShowHidden    = true,
                CurrentFolder = System.IO.File.Exists(privateKeyLocationTextEntry.Text) ?
                                System.IO.Path.GetDirectoryName(privateKeyLocationTextEntry.Text) : Environment.GetFolderPath(Environment.SpecialFolder.Personal)
            };

            dialog.AddFilter(GettextCatalog.GetString("Private Key Files"), "*");
            if (dialog.Run())
            {
                privateKeyLocationTextEntry.Text = dialog.SelectedFile;
                if (System.IO.File.Exists(privateKeyLocationTextEntry.Text + ".pub"))
                {
                    publicKeyLocationTextEntry.Text = privateKeyLocationTextEntry.Text + ".pub";
                }

                OnCredentialsChanged();

                if (string.IsNullOrEmpty(Credentials.PublicKey))
                {
                    publicKeyLocationTextEntry.SetFocus();
                }
                else if (passphraseEntry.Sensitive)
                {
                    passphraseEntry.SetFocus();
                }
            }
            ;
        }
예제 #11
0
        public override void Execute(object parameter)
        {
            var context = parameter as ContentEditorFieldContext;

            if (context == null)
            {
                return;
            }

            var fieldUri = context.Field.FieldUris.FirstOrDefault();

            if (fieldUri == null)
            {
                return;
            }

            var dialog = new SelectFileDialog
            {
                Site = fieldUri.DatabaseUri.Site
            };

            if (!dialog.ShowDialog())
            {
                return;
            }

            var control = context.Field.Control;

            if (control != null)
            {
                control.SetValue(dialog.SelectedFilePath.Replace("\\", "/"));
            }
        }
예제 #12
0
        void AddColorScheme(object sender, EventArgs args)
        {
            var dialog = new SelectFileDialog(GettextCatalog.GetString("Highlighting Scheme"), Gtk.FileChooserAction.Open)
            {
                TransientFor = this.Toplevel as Gtk.Window,
            };

            dialog.AddFilter(GettextCatalog.GetString("Color schemes"), "*.json");
            dialog.AddFilter(GettextCatalog.GetString("Visual Studio .NET settings"), "*.vssettings");
            if (!dialog.Run())
            {
                return;
            }

            string newFileName = SourceEditorDisplayBinding.SyntaxModePath.Combine(dialog.SelectedFile.FileName);

            bool success = true;

            try {
                File.Copy(dialog.SelectedFile.FullPath, newFileName);
            } catch (Exception e) {
                success = false;
                LoggingService.LogError("Can't copy syntax mode file.", e);
            }
            if (success)
            {
                SourceEditorDisplayBinding.LoadCustomStylesAndModes();
                ShowStyles();
            }
        }
예제 #13
0
        void AddColorScheme(object sender, EventArgs args)
        {
            var dialog = new SelectFileDialog(GettextCatalog.GetString("Highlighting Scheme"), Gtk.FileChooserAction.Open)
            {
                TransientFor = this.Toplevel as Gtk.Window,
            };

            dialog.AddFilter(null, "*.xml");
            if (!dialog.Run())
            {
                return;
            }

            System.Collections.Generic.List <System.Xml.Schema.ValidationEventArgs> validationResult;
            try {
                validationResult = Mono.TextEditor.Highlighting.SyntaxModeService.ValidateStyleFile(dialog.SelectedFile);
            } catch (Exception) {
                MessageService.ShowError(GettextCatalog.GetString("Validation of style file failed."));
                return;
            }

            if (validationResult.Count == 0)
            {
                string newFileName = SourceEditorDisplayBinding.SyntaxModePath.Combine(dialog.SelectedFile.FileName);
                if (!newFileName.EndsWith("Style.xml"))
                {
                    newFileName = SourceEditorDisplayBinding.SyntaxModePath.Combine(dialog.SelectedFile.FileNameWithoutExtension + "Style.xml");
                }
                bool success = true;
                try {
                    File.Copy(dialog.SelectedFile, newFileName);
                } catch (Exception e) {
                    success = false;
                    LoggingService.LogError("Can't copy syntax mode file.", e);
                }
                if (success)
                {
                    SourceEditorDisplayBinding.LoadCustomStylesAndModes();
                    ShowStyles();
                }
            }
            else
            {
                StringBuilder errorMessage = new StringBuilder();
                errorMessage.AppendLine(GettextCatalog.GetString("Validation of style file failed."));
                int count = 0;
                foreach (System.Xml.Schema.ValidationEventArgs vArg in validationResult)
                {
                    errorMessage.AppendLine(vArg.Message);
                    if (count++ > 5)
                    {
                        errorMessage.AppendLine("...");
                        break;
                    }
                }
                MessageService.ShowError(errorMessage.ToString());
            }
        }
예제 #14
0
 private void Button_Click(object sender, EventArgs e)
 {
     if (SelectFileDialog.ShowDialog() == DialogResult.OK)
     {
         FilePath         = SelectFileDialog.FileName;
         txtFilePath.Text = FilePath;
         RunCallBack();
     }
 }
예제 #15
0
        protected override void Run()
        {
            var proj = GetSelectedMonoMacProject();

            var settings = proj.UserProperties.GetValue <MonoMacPackagingSettings> (PROP_KEY)
                           ?? MonoMacPackagingSettings.GetAppStoreDefault();

            MonoMacPackagingSettingsDialog dlg = null;

            try {
                dlg = new MonoMacPackagingSettingsDialog();
                dlg.LoadSettings(settings);
                if (MessageService.RunCustomDialog(dlg) != (int)ResponseType.Ok)
                {
                    return;
                }
                dlg.SaveSettings(settings);
            } finally {
                if (dlg != null)
                {
                    dlg.Destroy();
                }
            }

            var configSel = IdeApp.Workspace.ActiveConfiguration;
            var cfg       = (MonoMacProjectConfiguration)proj.GetConfiguration(configSel);

            var ext = settings.CreatePackage? ".pkg" : ".app";

            var fileDlg = new SelectFileDialog()
            {
                Title = settings.CreatePackage?
                        GettextCatalog.GetString("Save Installer Package") :
                        GettextCatalog.GetString("Save Application Bundle"),
                InitialFileName = cfg.AppName + ext,
                Action          = FileChooserAction.Save
            };

            fileDlg.DefaultFilter = fileDlg.AddFilter("", "*" + ext);

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

            proj.UserProperties.SetValue(PROP_KEY, settings);

            var target = fileDlg.SelectedFile;

            if (!string.Equals(target.Extension, ext, StringComparison.OrdinalIgnoreCase))
            {
                target.ChangeExtension(ext);
            }

            MonoMacPackaging.Package(proj, configSel, settings, target);
        }
예제 #16
0
        void AddColorScheme(object sender, EventArgs args)
        {
            var dialog = new SelectFileDialog(GettextCatalog.GetString("Import Color Theme"), MonoDevelop.Components.FileChooserAction.Open)
            {
                TransientFor = this.Toplevel as Gtk.Window,
            };

            dialog.AddFilter(GettextCatalog.GetString("Color themes (Visual Studio, Xamarin Studio, TextMate) "), "*.json", "*.vssettings", "*.tmTheme");
            if (!dialog.Run())
            {
                return;
            }

            var    fileName    = dialog.SelectedFile.FileName;
            var    filePath    = dialog.SelectedFile.FullPath;
            string newFilePath = TextEditorDisplayBinding.SyntaxModePath.Combine(fileName);

            if (!SyntaxHighlightingService.IsValidTheme(filePath))
            {
                MessageService.ShowError(GettextCatalog.GetString("Could not import color theme."));
                return;
            }

            bool success = true;

            try {
                if (File.Exists(newFilePath))
                {
                    var answer = MessageService.AskQuestion(
                        GettextCatalog.GetString(
                            "A color theme with the name '{0}' already exists in your theme folder. Would you like to replace it?",
                            fileName
                            ),
                        AlertButton.Cancel,
                        AlertButton.Replace
                        );
                    if (answer != AlertButton.Replace)
                    {
                        return;
                    }
                    File.Delete(newFilePath);
                }
                File.Copy(filePath, newFilePath);
            } catch (Exception e) {
                success = false;
                LoggingService.LogError("Can't copy color theme file.", e);
            }
            if (success)
            {
                SyntaxHighlightingService.LoadStylesAndModesInPath(TextEditorDisplayBinding.SyntaxModePath);
                TextEditorDisplayBinding.LoadCustomStylesAndModes();
                ShowStyles();
            }
        }
예제 #17
0
        public void AddFileProperty([NotNull] string text, [NotNull] string propertyName)
        {
            Assert.ArgumentNotNull(text, nameof(text));
            Assert.ArgumentNotNull(propertyName, nameof(propertyName));

            AddLabel(text);

            var property = GetProperty(propertyName);
            var binding  = new Binding(property.Name);

            var grid = new Grid();

            grid.RowDefinitions.Add(new RowDefinition());
            grid.ColumnDefinitions.Add(new ColumnDefinition());
            grid.ColumnDefinitions.Add(new ColumnDefinition
            {
                Width = GridLength.Auto
            });

            var textBox = new TextBox();

            textBox.SetBinding(TextBox.TextProperty, binding);
            textBox.VerticalAlignment = VerticalAlignment.Center;
            grid.Children.Add(textBox);
            textBox.SetValue(Grid.ColumnProperty, 0);

            var button = new Button
            {
                Content = "Browse",
                Width   = 75,
                Height  = 23,
                Margin  = new Thickness(2, 0, 0, 0)
            };

            button.Click += delegate
            {
                var dialog = new SelectFileDialog
                {
                    Site = RenderingItem.ItemUri.Site
                };

                if (dialog.ShowDialog())
                {
                    textBox.Text = dialog.SelectedFilePath.Replace("\\", "/");
                }
            };

            grid.Children.Add(button);
            button.SetValue(Grid.ColumnProperty, 1);

            Grid.Children.Add(grid);

            bindings.Add(BindingOperations.GetBindingExpressionBase(textBox, TextBox.TextProperty));
        }
예제 #18
0
        protected override void Run()
        {
            var dialog = new SelectFileDialog(GettextCatalog.GetString("Application to Debug"))
            {
                TransientFor = IdeApp.Workbench.RootWindow,
            };

            if (dialog.Run() && IdeApp.ProjectOperations.CanExecuteFile(dialog.SelectedFile))
            {
                IdeApp.ProjectOperations.DebugApplication(dialog.SelectedFile);
            }
        }
예제 #19
0
		protected override string ShowBrowseDialog (string name, string startIn)
		{
			var fd = new SelectFileDialog (name, Action);
			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)
		{
			SelectFileDialog fd = new SelectFileDialog (name);
			if (start_in != null)
				fd.InitialFileName = start_in;
			
			fd.TransientFor = GetTransientFor ();
			
			if (fd.Run ())
				return fd.SelectedFile;
			else
				return null;
		}
예제 #21
0
        private void CDImageSelect_Click(object sender, EventArgs e)
        {
            SelectFileDialog.Title           = "Extract From CD Image";
            SelectFileDialog.DefaultExt      = ".bin";
            SelectFileDialog.CheckFileExists = true;
            SelectFileDialog.Filter          = "CD Images (*.bin)|*.bin|All Files (*.*)|*.*";
            SelectFileDialog.FileName        = CDImageTextBox.Text;

            if (SelectFileDialog.ShowDialog() == DialogResult.OK)
            {
                CDImageTextBox.Text = SelectFileDialog.FileName;
            }
        }
    void DrawObjectList()
    {
        ImGui.SetNextWindowPos(new Vector2(10, 30), ImGuiCond.Once, new Vector2(0.0f, 0.0f));
        ImGui.SetNextWindowSize(new Vector2(150, Screen.height - 125), ImGuiCond.Once);
        ImGui.Begin("Objects", ImGuiWindowFlags.NoSavedSettings);
        {
            if (ImGui.Checkbox("Camera View", ref camView))
            {
                ToggleCameraView();
            }

            ImGui.BeginChild("ObjectList", new Vector2(0, -ImGui.GetFrameHeightWithSpacing() * 2), true);
            {
                foreach (var obj in scriptObjects)
                {
                    if (ImGui.Selectable(obj.name, activeObject == obj))
                    {
                        activeObject = obj;
                    }
                }
            }
            ImGui.EndChild();

            if (ImGui.Button("+"))
            {
                var sfd = new SelectFileDialog()
                          .SetFilter("Image file\0*.jpg;*.png\0")
                          .SetTitle("Select image")
                          .SetDefaultExt("png")
                          .Show();

                if (sfd.IsSucessful)
                {
                    var gameObJ   = new GameObject();
                    var scriptObj = gameObJ.AddComponent <ScriptObject>();
                    scriptObj.TextureName = sfd.File;

                    var newKeyframe = KeyFrame.Empty();
                    newKeyframe.Position = transform.position + transform.rotation * new Vector3(0, 0, 5);
                    newKeyframe.Rotation = transform.eulerAngles;

                    scriptObj.KeyFrames.Add(newKeyframe);
                    scriptObj.Position = newKeyframe.Position;
                    scriptObj.Rotation = newKeyframe.Rotation;

                    scriptObjects.Add(scriptObj);
                }
            }
        }
        ImGui.End();
    }
        void AddLanguageBundle(object sender, EventArgs e)
        {
            var dialog = new SelectFileDialog(GettextCatalog.GetString("Language Bundles"), MonoDevelop.Components.FileChooserAction.Open)
            {
                TransientFor = this.Toplevel as Gtk.Window,
            };

            dialog.AddFilter(GettextCatalog.GetString("Bundles"), "*.tmBundle", "*.sublime-package", "*.tmbundle");
            if (!dialog.Run())
            {
                return;
            }
            string newFileName = SyntaxHighlightingService.LanguageBundlePath.Combine(dialog.SelectedFile.FileName);
            bool   success     = true;

            try {
                if (File.Exists(newFileName))
                {
                    MessageService.ShowError(string.Format(GettextCatalog.GetString("Bundle with the same name already exists. Remove {0} first."), System.IO.Path.GetFileNameWithoutExtension(newFileName)));
                    return;
                }
                File.Copy(dialog.SelectedFile.FullPath, newFileName);
            } catch (Exception ex) {
                success = false;
                LoggingService.LogError("Can't copy syntax mode file.", ex);
            }
            if (success)
            {
                var bundle = SyntaxHighlightingService.LoadStyleOrMode(SyntaxHighlightingService.userThemeBundle, newFileName) as LanguageBundle;
                if (bundle != null)
                {
#pragma warning disable CS0618 // Type or member is obsolete
                    foreach (var h in bundle.Highlightings)
                    {
                        var def = h as SyntaxHighlightingDefinition;
                        def?.PrepareMatches();
                    }
#pragma warning restore CS0618 // Type or member is obsolete
                    FillBundles();
                }
                else
                {
                    MessageService.ShowError(GettextCatalog.GetString("Invalid bundle: {0}", dialog.SelectedFile.FileName));
                    try {
                        File.Delete(newFileName);
                    } catch (Exception) {}
                }
            }
        }
예제 #24
0
        private void BinaryFileSelect_Click(object sender, EventArgs e)
        {
            SelectFileDialog.Title            = "Export Binary File";
            SelectFileDialog.DefaultExt       = ".dat";
            SelectFileDialog.CheckFileExists  = false;
            SelectFileDialog.OverwritePrompt  = true;
            SelectFileDialog.Filter           = "Binary Courses (*.dat)|*.dat|All Files (*.*)|*.*";
            SelectFileDialog.InitialDirectory = mMainForm.LocalSettings.LastPublishedBinaryFilePath;
            SelectFileDialog.FileName         = BinaryFileTextBox.Text;

            if (SelectFileDialog.ShowDialog() == DialogResult.OK)
            {
                BinaryFileTextBox.Text = SelectFileDialog.FileName;
            }
        }
        private void PresentViewViewModelOptions(List <ProjectItemAndType> docs)
        {
            var window = new SelectFileDialog();
            var vm     = new SelectFileDialogViewModel(docs, Container);

            window.DataContext = vm;

            var result = window.ShowDialog();

            if (result.GetValueOrDefault())
            {
                // Go to the selected project item.
                var win = vm.SelectedDocument.ProjectItem.Open();
                win.Visible = true;
                win.Activate();
            }
        }
        private void BrowseDestinationFolder([NotNull] object sender, [NotNull] RoutedEventArgs e)
        {
            Debug.ArgumentNotNull(sender, nameof(sender));
            Debug.ArgumentNotNull(e, nameof(e));

            var dialog = new SelectFileDialog
            {
                Site = Site
            };

            if (!dialog.ShowDialog())
            {
                return;
            }

            DestinationTextBox.Text = dialog.SelectedFilePath.TrimStart('\\') + "\\";
        }
예제 #27
0
		public override void LaunchDialogue ()
		{
			var kindAtt = this.Property.Attributes.OfType<FilePathIsFolderAttribute> ().FirstOrDefault ();
			SelectFileDialogAction action;

			string title;
			if (kindAtt == null) {
				action = SelectFileDialogAction.Open;
				title = GettextCatalog.GetString ("Select File...");
			} else {
				action = SelectFileDialogAction.SelectFolder;
				title = GettextCatalog.GetString ("Select Folder...");
			}
			var fs = new SelectFileDialog (title, action);
			if (fs.Run ())
				Property.SetValue (Instance, fs.SelectedFile);
		}
    private void Start()
    {
        if (React.Script.ScriptSource == ReactUnity.ScriptSource.File &&
            !File.Exists(React.Script.SourcePath))
        {
            var newPath = SelectFileDialog.Open();

            if (newPath == null)
            {
                return;
            }

            React.Script.SourcePath = newPath;
        }

        React.enabled = true;
    }
예제 #29
0
        /// <summary>Allows the user to browse the file system for a schema.</summary>
        /// <returns>The schema filename the user selected; otherwise null.</returns>
        public static string BrowseForSchemaFile()
        {
            var dlg = new SelectFileDialog(GettextCatalog.GetString("Select XML Schema"));

            dlg.AddFilter(new SelectFileDialogFilter(
                              GettextCatalog.GetString("XML Files"),
                              new string[] { "*.xsd" },
                              new string[] { "text/xml", "application/xml" }
                              ));
            dlg.AddAllFilesFilter();

            if (dlg.Run())
            {
                return(dlg.SelectedFile);
            }
            return(null);
        }
예제 #30
0
        protected override void Run()
        {
            var dialog = new SelectFileDialog(GettextCatalog.GetString("Application to Debug"))
            {
                TransientFor = IdeApp.Workbench.RootWindow,
            };

            if (dialog.Run())
            {
                if (IdeApp.ProjectOperations.CanDebugFile(dialog.SelectedFile))
                {
                    IdeApp.ProjectOperations.DebugApplication(dialog.SelectedFile);
                }
                else
                {
                    MessageService.ShowError(GettextCatalog.GetString("The file '{0}' can't be debugged", dialog.SelectedFile));
                }
            }
        }
		public void Add ()
		{
			var project = (DotNetProject) CurrentNode.GetParentDataItem (typeof(DotNetProject), true);
			
			var dlg = new SelectFileDialog (GettextCatalog.GetString ("Select Native Library"), Gtk.FileChooserAction.Open);
			dlg.SelectMultiple = true;
			dlg.AddAllFilesFilter ();
			//FIXME: add more filters, amke correct for platform
			dlg.AddFilter (GettextCatalog.GetString ("Static Library"), ".a");
			
			if (!dlg.Run ())
				return;
			
			foreach (var file in dlg.SelectedFiles) {
				var item = new NativeReference (file);
				project.Items.Add (item);
			}
			
			IdeApp.ProjectOperations.Save (project);
		}
예제 #32
0
        private void Browse([NotNull] object sender, [NotNull] RoutedEventArgs e)
        {
            Debug.ArgumentNotNull(sender, nameof(sender));
            Debug.ArgumentNotNull(e, nameof(e));

            var dialog = new SelectFileDialog
            {
                Site = Rendering.ItemUri.Site
            };

            if (!dialog.ShowDialog())
            {
                return;
            }

            var fileName = dialog.SelectedFilePath.Replace("\\", "/");

            Rendering.SetParameterValue("PageCodeScriptFileName", fileName);
            PageCodeTextBox.Text = fileName;
        }
예제 #33
0
        void HandleButtonExportClicked(object sender, EventArgs e)
        {
            var dialog = new SelectFileDialog(GettextCatalog.GetString("Highlighting Scheme"), Gtk.FileChooserAction.Save)
            {
                TransientFor = this.Toplevel as Gtk.Window,
            };

            dialog.AddFilter(null, "*.xml");
            if (!dialog.Run())
            {
                return;
            }
            TreeIter selectedIter;

            if (styleTreeview.Selection.GetSelected(out selectedIter))
            {
                var sheme = (Mono.TextEditor.Highlighting.ColorScheme) this.styleStore.GetValue(selectedIter, 1);
                sheme.Save(dialog.SelectedFile);
            }
        }
		void HandleButtonExportClicked (object sender, EventArgs e)
		{
			var dialog = new SelectFileDialog (GettextCatalog.GetString ("Highlighting Scheme"), MonoDevelop.Components.FileChooserAction.Save) {
				TransientFor = this.Toplevel as Gtk.Window,
			};
			dialog.AddFilter (GettextCatalog.GetString ("Color schemes"), "*.json");
			if (!dialog.Run ())
				return;
			TreeIter selectedIter;
			if (styleTreeview.Selection.GetSelected (out selectedIter)) {
				var sheme = (Mono.TextEditor.Highlighting.ColorScheme)this.styleStore.GetValue (selectedIter, 1);
				var selectedFile = dialog.SelectedFile.ToString ();
				if (!selectedFile.EndsWith (".json", StringComparison.Ordinal))
					selectedFile += ".json";
				sheme.Save (selectedFile);
			}

		}
		void HandleButtonImportClicked (object sender, EventArgs e)
		{
			var dialog = new SelectFileDialog (GettextCatalog.GetString ("Highlighting Scheme"), Gtk.FileChooserAction.Open)
				{
					TransientFor = this.Toplevel as Gtk.Window,
				};
			dialog.AddFilter ("Visual Studio 2010 settings file", "*.vssettings");
			dialog.AddFilter ("XML file", "*.xml");
			if (!dialog.Run ())
				return;
			
			var defStyle = Mono.TextEditor.Highlighting.SyntaxModeService.GetColorStyle (this.Style, "Default");
			var style = defStyle.Clone ();   
			var vsImporter = new VisualStudioHighlitingSchemeImporter ();  
			
			style.Name = "Absolutely new style";
			style.Description = "Absolutely new style description";
			
			var path = SourceEditorDisplayBinding.SyntaxModePath;
			var baseName = style.Name.Replace (" ", "_");
			
			while (File.Exists (System.IO.Path.Combine (path, baseName + "Style.xml")))
			{
				baseName = baseName + "_";
			}
			
			var fileName = System.IO.Path.Combine (path, baseName + "Style.xml");
			
			try
			{
				vsImporter.Import (dialog.SelectedFile, style);
				MonoDevelop.Ide.MessageService.ShowMessage (fileName);
				style.Save (fileName);
				Mono.TextEditor.Highlighting.SyntaxModeService.AddStyle (fileName, style);
			}
 			catch (Exception ex)
			{
				MonoDevelop.Ide.MessageService.ShowException (ex);
			}
			
			//var fileName = Mono.TextEditor.Highlighting.SyntaxModeService.GetFileNameForStyle (style);
			
			
			//style.Save (fileName);
		}
		void HandleButtonImportClicked (object sender, EventArgs e)
		{
			var dialog = new SelectFileDialog (GettextCatalog.GetString ("Profile to import"), Gtk.FileChooserAction.Open) {
				TransientFor = this.Toplevel as Gtk.Window,
			};
			dialog.AddFilter (null, "*.xml");
			if (!dialog.Run ())
				return;
			int selection = comboboxProfiles.Active;
			var p = CSharpFormattingPolicy.Load (dialog.SelectedFile);
			FormattingProfileService.AddProfile (p);
			policies.Add (p);
			InitComboBox ();
			comboboxProfiles.Active = selection;
		}
예제 #37
0
		protected override void Run ()
		{
			var dialog = new SelectFileDialog (GettextCatalog.GetString ("Application to Debug")) {
				TransientFor = IdeApp.Workbench.RootWindow,
			};
			if (dialog.Run ()) {
				if (IdeApp.ProjectOperations.CanDebugFile (dialog.SelectedFile))
					IdeApp.ProjectOperations.DebugApplication (dialog.SelectedFile);
				else
					MessageService.ShowError (GettextCatalog.GetString ("The file '{0}' can't be debugged", dialog.SelectedFile));
			}
		}
		void HandleButtonExportClicked (object sender, EventArgs e)
		{
			if (comboboxProfiles.Active < 0)
				return;
			var dialog = new SelectFileDialog (GettextCatalog.GetString ("Export profile"), Gtk.FileChooserAction.Save) {
				TransientFor = this.Toplevel as Gtk.Window,
			};
			dialog.AddFilter (null, "*.xml");
			if (!dialog.Run ())
				return;
			policies[comboboxProfiles.Active].Save (dialog.SelectedFile);
		}
예제 #39
0
		void AddColorScheme (object sender, EventArgs args)
		{
			var dialog = new SelectFileDialog (GettextCatalog.GetString ("Highlighting Scheme"), Gtk.FileChooserAction.Open) {
				TransientFor = this.Toplevel as Gtk.Window,
			};
			dialog.AddFilter (GettextCatalog.GetString ("Color schemes"), "*.json");
			dialog.AddFilter (GettextCatalog.GetString ("Visual Studio .NET settings"), "*.vssettings");
			if (!dialog.Run ())
				return;

			string newFileName = SourceEditorDisplayBinding.SyntaxModePath.Combine (dialog.SelectedFile.FileName);

			bool success = true;
			try {
				File.Copy (dialog.SelectedFile.FullPath, newFileName);
			} catch (Exception e) {
				success = false;
				LoggingService.LogError ("Can't copy syntax mode file.", e);
			}
			if (success) {
				SourceEditorDisplayBinding.LoadCustomStylesAndModes ();
				ShowStyles ();
			}
		}
		/// <summary>Allows the user to browse the file system for a schema.</summary>
		/// <returns>The schema filename the user selected; otherwise null.</returns>
		public static string BrowseForSchemaFile ()
		{
			var dlg = new SelectFileDialog (GettextCatalog.GetString ("Select XML Schema"));
			dlg.AddFilter (new SelectFileDialogFilter (
				GettextCatalog.GetString ("XML Files"),
				new string[] { "*.xsd" },
				new string[] { "text/xml", "application/xml" }
			));
			dlg.AddAllFilesFilter ();
			
			if (dlg.Run ())
				return dlg.SelectedFile;
			return null;
		}
예제 #41
0
		public static Credentials TryGet (string url, string userFromUrl, SupportedCredentialTypes types, GitCredentialsType type)
		{
			bool result = true;
			Uri uri = null;

			GitCredentialsState state;
			if (!credState.TryGetValue (type, out state))
				credState [type] = state = new GitCredentialsState ();
			state.UrlUsed = url;

			// We always need to run the TryGet* methods as we need the passphraseItem/passwordItem populated even
			// if the password store contains an invalid password/no password
			if ((types & SupportedCredentialTypes.UsernamePassword) != 0) {
				uri = new Uri (url);
				string username;
				string password;
				if (!state.NativePasswordUsed && TryGetUsernamePassword (uri, out username, out password)) {
					state.NativePasswordUsed = true;
					return new UsernamePasswordCredentials {
						Username = username,
						Password = password
					};
				}
			}

			Credentials cred;
			if ((types & SupportedCredentialTypes.UsernamePassword) != 0)
				cred = new UsernamePasswordCredentials ();
			else {
				// Try ssh-agent on Linux.
				if (!Platform.IsWindows && !state.AgentUsed) {
					bool agentUsable;
					if (!state.AgentForUrl.TryGetValue (url, out agentUsable))
						state.AgentForUrl [url] = agentUsable = true;

					if (agentUsable) {
						state.AgentUsed = true;
						return new SshAgentCredentials {
							Username = userFromUrl,
						};
					}
				}

				int key;
				if (!state.KeyForUrl.TryGetValue (url, out key)) {
					if (state.KeyUsed + 1 < Keys.Count)
						state.KeyUsed++;
					else {
						SelectFileDialog dlg = null;
						bool success = false;

						DispatchService.GuiSyncDispatch (() => {
							dlg = new SelectFileDialog (GettextCatalog.GetString ("Select a private SSH key to use."));
							dlg.ShowHidden = true;
							dlg.CurrentFolder = Environment.GetFolderPath (Environment.SpecialFolder.Personal);
							success = dlg.Run ();
						});
						if (!success || !File.Exists (dlg.SelectedFile + ".pub"))
							throw new VersionControlException (GettextCatalog.GetString ("Invalid credentials were supplied. Aborting operation."));

						cred = new SshUserKeyCredentials {
							Username = userFromUrl,
							Passphrase = "",
							PrivateKey = dlg.SelectedFile,
							PublicKey = dlg.SelectedFile + ".pub",
						};

						if (KeyHasPassphrase (dlg.SelectedFile)) {
							DispatchService.GuiSyncDispatch (delegate {
								using (var credDlg = new CredentialsDialog (url, types, cred))
									result = MessageService.ShowCustomDialog (credDlg) == (int)Gtk.ResponseType.Ok;
							});
						}

						if (result)
							return cred;
						throw new VersionControlException (GettextCatalog.GetString ("Invalid credentials were supplied. Aborting operation."));
					}
				} else
					state.KeyUsed = key;

				cred = new SshUserKeyCredentials {
					Username = userFromUrl,
					Passphrase = "",
					PrivateKey = Keys [state.KeyUsed],
					PublicKey = Keys [state.KeyUsed] + ".pub",
				};
				return cred;
			}

			DispatchService.GuiSyncDispatch (delegate {
				using (var credDlg = new CredentialsDialog (url, types, cred))
					result = MessageService.ShowCustomDialog (credDlg) == (int)Gtk.ResponseType.Ok;
			});

			if (result) {
				if ((types & SupportedCredentialTypes.UsernamePassword) != 0) {
					var upcred = (UsernamePasswordCredentials)cred;
					if (!string.IsNullOrEmpty (upcred.Password)) {
						PasswordService.AddWebUserNameAndPassword (uri, upcred.Username, upcred.Password);
					}
				}
			}

			return cred;
		}
		/// <summary>Allows the user to browse the file system for a schema.</summary>
		/// <returns>The schema filename the user selected; otherwise null.</returns>
		public static string BrowseForSchemaFile ()
		{
			var dlg = new SelectFileDialog (GettextCatalog.GetString ("Select XML Schema")) {
				TransientFor = IdeApp.Workbench.RootWindow,
			};
			dlg.AddFilter (new SelectFileDialogFilter (GettextCatalog.GetString ("XML Files"), "*.xsd") {
				MimeTypes = { "text/xml", "application/xml" },
			});
			dlg.AddAllFilesFilter ();
			
			if (dlg.Run ())
				return dlg.SelectedFile;
			return null;
		}
예제 #43
0
		protected virtual void OnButtonBrowseClicked(object sender, System.EventArgs e)
		{
			var dlg = new SelectFileDialog (GettextCatalog.GetString ("Select File")) {
				CurrentFolder = entry.BaseDirectory,
				SelectMultiple = false,
				TransientFor = this.Toplevel as Gtk.Window,
			};
			if (!dlg.Run ())
				return;
			if (System.IO.Path.IsPathRooted (dlg.SelectedFile))
				entryCommand.Text = FileService.AbsoluteToRelativePath (entry.BaseDirectory, dlg.SelectedFile);
			else
				entryCommand.Text = dlg.SelectedFile;
		}
		void AddColorScheme (object sender, EventArgs args)
		{
			var dialog = new SelectFileDialog (GettextCatalog.GetString ("Application to Debug"), Gtk.FileChooserAction.Open) {
				TransientFor = this.Toplevel as Gtk.Window,
			};
			dialog.AddFilter (null, "*.xml");
			if (!dialog.Run ())
				return;
			
			System.Collections.Generic.List<System.Xml.Schema.ValidationEventArgs> validationResult;
			try {
				validationResult = Mono.TextEditor.Highlighting.SyntaxModeService.ValidateStyleFile (dialog.SelectedFile);
			} catch (Exception) {
				MessageService.ShowError (GettextCatalog.GetString ("Validation of style file failed."));
				return;
			}
			if (validationResult.Count == 0) {
				string newFileName = SourceEditorDisplayBinding.SyntaxModePath.Combine (dialog.SelectedFile.FileName);
				if (!newFileName.EndsWith ("Style.xml"))
					newFileName = SourceEditorDisplayBinding.SyntaxModePath.Combine (dialog.SelectedFile.FileNameWithoutExtension + "Style.xml");
				bool success = true;
				try {
					File.Copy (dialog.SelectedFile, newFileName);
				} catch (Exception e) {
					success = false;
					LoggingService.LogError ("Can't copy syntax mode file.", e);
				}
				if (success) {
					SourceEditorDisplayBinding.LoadCustomStylesAndModes ();
					ShowStyles ();
				}
			} else {
				StringBuilder errorMessage = new StringBuilder ();
				errorMessage.AppendLine (GettextCatalog.GetString ("Validation of style file failed."));
				int count = 0;
				foreach (System.Xml.Schema.ValidationEventArgs vArg in validationResult) {
					errorMessage.AppendLine (vArg.Message);
					if (count++ > 5) {
						errorMessage.AppendLine ("...");
						break;
					}
				}
				MessageService.ShowError (errorMessage.ToString ());
			}
		}
예제 #45
0
		protected override void Run ()
		{
			var dialog = new SelectFileDialog (GettextCatalog.GetString ("Application to Debug")) {
				TransientFor = IdeApp.Workbench.RootWindow,
			};
			if (dialog.Run ())
				IdeApp.ProjectOperations.DebugApplication (dialog.SelectedFile);
		}
		void AddColorScheme (object sender, EventArgs args)
		{
			var dialog = new SelectFileDialog (GettextCatalog.GetString ("Highlighting Scheme"), MonoDevelop.Components.FileChooserAction.Open) {
				TransientFor = this.Toplevel as Gtk.Window,
			};
			dialog.AddFilter (GettextCatalog.GetString ("Color schemes"), "*.json");
			dialog.AddFilter (GettextCatalog.GetString ("Visual Studio .NET settings"), "*.vssettings");
			if (!dialog.Run ())
				return;

			string newFileName = MonoDevelop.Ide.Editor.TextEditorDisplayBinding.SyntaxModePath.Combine (dialog.SelectedFile.FileName);

			bool success = true;
			try {
				if (File.Exists (newFileName)) {
					MessageService.ShowError (string.Format (GettextCatalog.GetString ("Highlighting with the same name already exists. Remove {0} first."), System.IO.Path.GetFileNameWithoutExtension (newFileName)));
					return;
				}

				File.Copy (dialog.SelectedFile.FullPath, newFileName);
			} catch (Exception e) {
				success = false;
				LoggingService.LogError ("Can't copy syntax mode file.", e);
			}
			if (success) {
				Mono.TextEditor.Highlighting.SyntaxModeService.LoadStylesAndModes (TextEditorDisplayBinding.SyntaxModePath);
				MonoDevelop.Ide.Editor.Highlighting.SyntaxModeService.LoadStylesAndModes (TextEditorDisplayBinding.SyntaxModePath);
				MonoDevelop.Ide.Editor.TextEditorDisplayBinding.LoadCustomStylesAndModes ();
				ShowStyles ();
			}
		}
예제 #47
0
		public WorkspaceItem AddWorkspaceItem (Workspace parentWorkspace)
		{
			WorkspaceItem res = null;
			
			var dlg = new SelectFileDialog () {
				Action = Gtk.FileChooserAction.Open,
				CurrentFolder = parentWorkspace.BaseDirectory,
				SelectMultiple = false,
			};
		
			dlg.AddAllFilesFilter ();
			dlg.DefaultFilter = dlg.AddFilter (GettextCatalog.GetString ("Solution Files"), "*.mds", "*.sln");
			
			if (dlg.Run ()) {
				try {
					res = AddWorkspaceItem (parentWorkspace, dlg.SelectedFile);
				} catch (Exception ex) {
					MessageService.ShowException (ex, GettextCatalog.GetString ("The file '{0}' could not be loaded.", dlg.SelectedFile));
				}
			}

			return res;
		}
예제 #48
0
		public SolutionItem AddSolutionItem (SolutionFolder parentFolder)
		{
			SolutionItem res = null;
			
			var dlg = new SelectFileDialog () {
				Action = Gtk.FileChooserAction.Open,
				CurrentFolder = parentFolder.BaseDirectory,
				SelectMultiple = false,
			};
		
			dlg.AddAllFilesFilter ();
			dlg.DefaultFilter = dlg.AddFilter (GettextCatalog.GetString ("Project Files"), "*.*proj");
			
			if (dlg.Run ()) {
				if (!Services.ProjectService.IsSolutionItemFile (dlg.SelectedFile)) {
					MessageService.ShowMessage (GettextCatalog.GetString ("The file '{0}' is not a known project file format.", dlg.SelectedFile));
					return res;
				}

				if (SolutionContainsProject (parentFolder, dlg.SelectedFile)) {
					MessageService.ShowMessage (GettextCatalog.GetString ("The project '{0}' has already been added.", Path.GetFileNameWithoutExtension (dlg.SelectedFile)));
					return res;
				}

				try {
					res = AddSolutionItem (parentFolder, dlg.SelectedFile);
				} catch (Exception ex) {
					MessageService.ShowError (GettextCatalog.GetString ("The file '{0}' could not be loaded.", dlg.SelectedFile), ex);
				}
			}
			
			if (res != null)
				IdeApp.Workspace.Save ();

			return res;
		}
		/// <summary>Allows the user to browse the file system for a stylesheet.</summary>
		/// <returns>The stylesheet filename the user selected; otherwise null.</returns>
		public static string BrowseForStylesheetFile ()
		{
			var dlg = new SelectFileDialog (GettextCatalog.GetString ("Select XSLT Stylesheet")) {
				TransientFor = IdeApp.Workbench.RootWindow,
			};
			dlg.AddFilter (new SelectFileDialogFilter (
				GettextCatalog.GetString ("XML Files"),
				new string[] { "*.xml" },
				new string[] { "text/xml", "application/xml" }
			));
			dlg.AddFilter (new SelectFileDialogFilter(
				GettextCatalog.GetString ("XSL Files"),
				new string[] { "*.xslt", "*.xsl" },
				new string[] { "text/x-xslt" }
			));
			dlg.AddAllFilesFilter ();
			
			if (dlg.Run ())
				return dlg.SelectedFile;
			return null;
		}
		protected void OnAddAssembly ()
		{
			var config = (NUnitAssemblyGroupProjectConfiguration) CurrentNode.DataItem;
			
			var dlg = new SelectFileDialog (GettextCatalog.GetString ("Add files")) {
				TransientFor = IdeApp.Workbench.RootWindow,
				SelectMultiple = true,
			};
			if (!dlg.Run ())
				return;
			
			foreach (string file in dlg.SelectedFiles)
				config.Assemblies.Add (new TestAssembly (file));
			
			IdeApp.Workspace.Save();
		}
		public async Task<WorkspaceItem> AddWorkspaceItem (Workspace parentWorkspace)
		{
			WorkspaceItem res = null;
			
			var dlg = new SelectFileDialog () {
				Action = FileChooserAction.Open,
				CurrentFolder = parentWorkspace.BaseDirectory,
				SelectMultiple = false,
			};
		
			dlg.AddAllFilesFilter ();
			dlg.DefaultFilter = dlg.AddFilter (GettextCatalog.GetString ("Solution Files"), "*.mds", "*.sln");
			
			if (dlg.Run ()) {
				try {
					if (WorkspaceContainsWorkspaceItem (parentWorkspace, dlg.SelectedFile)) {
						MessageService.ShowMessage (GettextCatalog.GetString ("The workspace already contains '{0}'.", Path.GetFileNameWithoutExtension (dlg.SelectedFile)));
						return res;
					}

					res = await AddWorkspaceItem (parentWorkspace, dlg.SelectedFile);
				} catch (Exception ex) {
					MessageService.ShowError (GettextCatalog.GetString ("The file '{0}' could not be loaded.", dlg.SelectedFile), ex);
				}
			}

			return res;
		}
예제 #52
0
		public bool AddFilesToSolutionFolder (SolutionFolder folder)
		{
			var dlg = new SelectFileDialog () {
				SelectMultiple = true,
				Action = Gtk.FileChooserAction.Open,
				CurrentFolder = folder.BaseDirectory,
				TransientFor = MessageService.RootWindow,
			};
			if (dlg.Run ())
				return AddFilesToSolutionFolder (folder, dlg.SelectedFiles);
			else
				return false;
		}
예제 #53
0
		protected override void Run ()
		{
			var proj = GetSelectedMonoMacProject ();
			
			var settings = proj.UserProperties.GetValue<MonoMacPackagingSettings> (PROP_KEY)
				?? MonoMacPackagingSettings.GetAppStoreDefault ();
			
			MonoMacPackagingSettingsDialog dlg;
			try {
				dlg = new MonoMacPackagingSettingsDialog ();
				dlg.LoadSettings (settings);
				if (MessageService.RunCustomDialog (dlg) != (int)ResponseType.Ok)
					return;
				dlg.SaveSettings (settings);
			} finally {
				dlg.Destroy ();
			}
			
			var configSel = IdeApp.Workspace.ActiveConfiguration;
			var cfg = (MonoMacProjectConfiguration) proj.GetConfiguration (configSel);
			
			var ext = settings.CreatePackage? ".pkg" : ".app";
			
			var fileDlg = new SelectFileDialog () {
				Title = settings.CreatePackage?
					GettextCatalog.GetString ("Save Installer Package") :
					GettextCatalog.GetString ("Save Application Bundle"),
				InitialFileName = cfg.AppName + ext,
				Action = FileChooserAction.Save
			};
			fileDlg.DefaultFilter = fileDlg.AddFilter ("", "*" + ext);
			
			if (!fileDlg.Run ())
				return;
			
			proj.UserProperties.SetValue (PROP_KEY, settings);
			
			var target = fileDlg.SelectedFile;
			if (!string.Equals (target.Extension, ext, StringComparison.OrdinalIgnoreCase))
				target.ChangeExtension (ext);
			
			MonoMacPackaging.Package (proj, configSel, settings, target);
		}
예제 #54
0
		public SolutionItem AddSolutionItem (SolutionFolder parentFolder)
		{
			SolutionItem res = null;
			
			var dlg = new SelectFileDialog () {
				Action = Gtk.FileChooserAction.Open,
				CurrentFolder = parentFolder.BaseDirectory,
				SelectMultiple = false,
			};
		
			dlg.AddAllFilesFilter ();
			dlg.DefaultFilter = dlg.AddFilter (GettextCatalog.GetString ("Project Files"), "*.*proj", "*.mdp");
			
			if (dlg.Run ()) {
				try {
					res = AddSolutionItem (parentFolder, dlg.SelectedFile);
				} catch (Exception ex) {
					MessageService.ShowException (ex, GettextCatalog.GetString ("The file '{0}' could not be loaded.", dlg.SelectedFile));
				}
			}
			
			if (res != null)
				IdeApp.Workspace.Save ();

			return res;
		}
예제 #55
0
		void HandleButtonExportClicked (object sender, EventArgs e)
		{
			var dialog = new SelectFileDialog (GettextCatalog.GetString ("Highlighting Scheme"), Gtk.FileChooserAction.Save) {
				TransientFor = this.Toplevel as Gtk.Window,
			};
			dialog.AddFilter (null, "*.xml");
			if (!dialog.Run ())
				return;
			TreeIter selectedIter;
			if (styleTreeview.Selection.GetSelected (out selectedIter)) {
				var sheme = (Mono.TextEditor.Highlighting.ColorSheme)this.styleStore.GetValue (selectedIter, 1);
				sheme.Save (dialog.SelectedFile);
			}

		}