protected override void Run() { var dlg = new OpenFileDialog(GettextCatalog.GetString("File to Open"), MonoDevelop.Components.FileChooserAction.Open) { TransientFor = IdeServices.DesktopService.GetFocusedTopLevelWindow(), ShowEncodingSelector = true, ShowViewerSelector = true, }; if (!dlg.Run()) { return; } var file = dlg.SelectedFile; if (dlg.SelectedViewer != null) { dlg.SelectedViewer.OpenFile(file, dlg.Encoding); return; } if (Services.ProjectService.IsWorkspaceItemFile(file) || Services.ProjectService.IsSolutionItemFile(file)) { WarnIfWorkspaceItemIsAlreadyOpen(file); IdeApp.Workspace.OpenWorkspaceItem(file, dlg.CloseCurrentWorkspace); } else { IdeApp.Workbench.OpenDocument(file, null, dlg.Encoding, OpenDocumentOptions.DefaultInternal); } }
public PatchWidget(ComparisonView comparisonView, VersionControlDocumentInfo info) { this.Build(); diffEditor = new Mono.TextEditor.TextEditor(); diffEditor.Document.MimeType = "text/x-diff"; diffEditor.Options.FontName = info.Document.TextEditorData.Options.FontName; diffEditor.Options.ColorScheme = info.Document.TextEditorData.Options.ColorScheme; diffEditor.Options.ShowFoldMargin = false; diffEditor.Options.ShowIconMargin = false; diffEditor.Options.ShowTabs = true; diffEditor.Options.ShowSpaces = true; diffEditor.Options.ShowInvalidLines = info.Document.TextEditorData.Options.ShowInvalidLines; diffEditor.Document.ReadOnly = true; scrolledwindow1.Child = diffEditor; diffEditor.ShowAll(); using (var writer = new StringWriter()) { UnifiedDiff.WriteUnifiedDiff(comparisonView.Diff, writer, System.IO.Path.GetFileName(info.Item.Path) + " (repository)", System.IO.Path.GetFileName(info.Item.Path) + " (working copy)", 3); diffEditor.Document.Text = writer.ToString(); } buttonSave.Clicked += delegate { var dlg = new OpenFileDialog(GettextCatalog.GetString("Save as..."), FileChooserAction.Save) { TransientFor = IdeApp.Workbench.RootWindow }; if (!dlg.Run()) { return; } File.WriteAllText(dlg.SelectedFile, diffEditor.Document.Text); }; }
void AddButtonEventHandler(object sender, EventArgs e) { if (scrolledWindow.Children[0] == stringTreeView) { ResponseType response = (ResponseType)stringDialog.Run(); stringDialog.Hide(); if (response == ResponseType.Ok && !string.IsNullOrWhiteSpace(stringDialog.NodeName)) { var note = new ResXDataNode(stringDialog.NodeName, stringDialog.NodeText) { Comment = stringDialog.NodeComment }; this.AddItem(note); editorView.IsDirty = true; } stringDialog.NodeText = ""; stringDialog.NodeName = ""; stringDialog.NodeComment = ""; return; } else { //add existing item if (openDialog.Run()) { AddFileAsItem(openDialog.SelectedFile); return; } } }
private void ShowNewItem(DBItem item) { newItem = item; var fileColumn = Table.Columns.GetByKey(DBColumnKeys.File); if (fileColumn != null) { using (var dialog = new OpenFileDialog { Multiselect = false }) { if (dialog.Run(ParentWindow)) { item[fileColumn] = File.ReadAllBytes(dialog.FileName); var fileNameColumn = Table.Columns.GetByKey(DBColumnKeys.FileName); if (fileNameColumn != null) { item[fileNameColumn] = Path.GetFileName(dialog.FileName); } } } } if (OwnerRow != null && baseColumn != null) { item[baseColumn] = OwnerRow.PrimaryId; } if (Table.GroupKey != null && Selected != null && Selected.Table == Table) { item[Table.GroupKey] = Selected.PrimaryId; } toolWindow.ButtonAccept.Sensitive = true; ((LayoutList)toolWindow.Target).FieldSource = item; toolWindow.Show(bar, toolAdd.Bound.BottomLeft); }
void OpenJavaLibraries() { string [] results = null; using (var dlg = new OpenFileDialog() { Title = "Select .jar file to load", Multiselect = true, }) { dlg.Filters.Add(new FileDialogFilter("Any file", "*")); dlg.Filters.Add(new FileDialogFilter("Jar files", "*.jar")); dlg.Filters.Add(new FileDialogFilter("Aar files", "*.aar")); dlg.Filters.Add(new FileDialogFilter("DLL files", "*.dll")); dlg.Filters.Add(new FileDialogFilter("XML files", "*.xml")); dlg.Filters.Add(new FileDialogFilter("DEX files", "*.dex")); dlg.Filters.Add(new FileDialogFilter("APK files", "*.apk")); results = dlg.Run() ? dlg.FileNames : null; } ThreadPool.QueueUserWorkItem((state) => { if (results != null) { model.LoadApiFromFiles(results); } }, null); }
private void OnToolLoadClick(object sender, EventArgs e) { var dialog = new OpenFileDialog(); if (dialog.Run(ParentWindow)) { StateInfoList newList = null; using (var fileStream = File.Open(dialog.FileName, FileMode.Open, FileAccess.Read)) { Stream stream; if (Helper.IsGZip(fileStream)) { stream = Helper.GetUnGZipStrem(fileStream); } else { stream = fileStream; } newList = Serialization.Deserialize(stream) as StateInfoList; stream.Close(); } var form = new ToolWindow(); form.Label.Text = Path.GetFileNameWithoutExtension(dialog.FileName); form.Target = new LogList() { ListSource = newList }; form.Mode = ToolShowMode.Dialog; form.Show(this, new Point(0, 0)); } }
protected override void Run() { var dlg = new OpenFileDialog(GettextCatalog.GetString("File to Open"), Gtk.FileChooserAction.Open) { TransientFor = IdeApp.Workbench.RootWindow, ShowEncodingSelector = true, ShowViewerSelector = true, }; if (!dlg.Run()) { return; } var file = dlg.SelectedFile; if (dlg.SelectedViewer != null) { dlg.SelectedViewer.OpenFile(file, dlg.Encoding); return; } if (Services.ProjectService.IsWorkspaceItemFile(file) || Services.ProjectService.IsSolutionItemFile(file)) { IdeApp.Workspace.OpenWorkspaceItem(file, dlg.CloseCurrentWorkspace); } else { IdeApp.Workbench.OpenDocument(file, dlg.Encoding); } }
public MarkDownSample() { var openFileDialog = new OpenFileDialog("Select File"); var markdown = new MarkdownView() { Markdown = MarkDownText, LineSpacing = 3, }; var scrolled = new ScrollView(markdown) { MinHeight = 400 }; var button = new Button("Open File"); button.Clicked += delegate { if (openFileDialog.Run(ParentWindow)) { markdown.Markdown = File.ReadAllText(openFileDialog.FileName); } }; PackStart(button, true); PackStart(scrolled, true); }
void HandleFromFile(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(GettextCatalog.GetString("Select Policy File")); dlg.Action = FileChooserAction.Open; dlg.TransientFor = this; dlg.AddFilter(GettextCatalog.GetString("MonoDevelop policy files"), "*.mdpolicy"); dlg.AddAllFilesFilter(); dlg.CurrentFolder = ExportProjectPolicyDialog.DefaultFileDialogPolicyDir; if (dlg.Run()) { try { PolicySet pset = new PolicySet(); pset.LoadFromFile(dlg.SelectedFile); if (string.IsNullOrEmpty(pset.Name)) { pset.Name = dlg.SelectedFile.FileNameWithoutExtension; } pset.Name = GetValidName(pset.Name); sets.Add(pset); ExportProjectPolicyDialog.DefaultFileDialogPolicyDir = dlg.SelectedFile.ParentDirectory; FillPolicySets(); policiesCombo.Active = sets.IndexOf(pset); } catch (Exception ex) { MessageService.ShowException(ex, GettextCatalog.GetString("The policy set could not be loaded")); } } }
private void OnDropDownClick(object sender, EventArgs e) { if (fdOpen.Run(Editor.ParentWindow)) { if (File.Exists(fdOpen.FileName)) { using (var stream = File.Open(fdOpen.FileName, FileMode.Open, FileAccess.Read, FileShare.Read)) { var buf = new byte[stream.Length]; int count = buf.Length; int sum = 0; while ((count = stream.Read(buf, sum, buf.Length - sum)) > 0) { sum += count; // sum is a buffer offset for next reading } Value = buf; } } string name = Path.GetFileName(fdOpen.FileName); if (invoker != null) { invoker.SetValue(EditItem, name); } EntryText = name; } }
void AddButtonEventHandler(object sender, EventArgs e) { if (sender == addMenuStringItem) { ResponseType response = (ResponseType)stringDialog.Run(); stringDialog.Hide(); if (response == ResponseType.Ok && !string.IsNullOrWhiteSpace(stringDialog.NodeName)) { this.AddItem(new ResXDataNode(stringDialog.NodeName, stringDialog.NodeText)); editorView.IsDirty = true; } stringDialog.NodeText = ""; stringDialog.NodeName = ""; return; } if (sender == addMenuExistingFileItem) { if (openDialog.Run()) { AddFileAsItem(openDialog.SelectedFile); return; } } }
public PatchWidget (ComparisonView comparisonView, VersionControlDocumentInfo info) { this.Build (); diffEditor = new Mono.TextEditor.TextEditor (); diffEditor.Document.MimeType = "text/x-diff"; diffEditor.Options.FontName = info.Document.Editor.Options.FontName; diffEditor.Options.ColorScheme = info.Document.Editor.Options.ColorScheme; diffEditor.Options.ShowFoldMargin = false; diffEditor.Options.ShowIconMargin = false; diffEditor.Options.ShowTabs = true; diffEditor.Options.ShowSpaces = true; diffEditor.Options.ShowInvalidLines = info.Document.Editor.Options.ShowInvalidLines; diffEditor.Document.ReadOnly = true; scrolledwindow1.Child = diffEditor; diffEditor.ShowAll (); using (var writer = new StringWriter ()) { UnifiedDiff.WriteUnifiedDiff (comparisonView.Diff, writer, System.IO.Path.GetFileName (info.Item.Path) + " (repository)", System.IO.Path.GetFileName (info.Item.Path) + " (working copy)", 3); diffEditor.Document.Text = writer.ToString (); } buttonSave.Clicked += delegate { var dlg = new OpenFileDialog (GettextCatalog.GetString ("Save as..."), FileChooserAction.Save) { TransientFor = IdeApp.Workbench.RootWindow }; if (!dlg.Run ()) return; File.WriteAllText (dlg.SelectedFile, diffEditor.Document.Text); }; }
protected void ToolProjectOpenClick(object sender, EventArgs e) { if (openFD.Run()) { //string fileExt = System.IO.Path.GetExtension(openFD.FileName); List <ProjectHandler> list = GuiEnvironment.ProjectsInfo.Select("FileName", CompareType.Equal, openFD.FileName).ToList(); if (list.Count != 0) { CurrentProject = list[0]; } else { object project = Serialization.Deserialize(openFD.FileName); foreach (ProjectType type in editors) { if (project.GetType() == type.Project) { CurrentProject = new ProjectHandler { Project = project, Type = type, FileName = openFD.FileName }; return; } if (project != null) { EditOptions(project, project.ToString()); } } } } }
protected override void Run() { var dialog = new OpenFileDialog(GettextCatalog.GetString("Sample file output"), MonoDevelop.Components.FileChooserAction.Open); if (dialog.Run()) { MonoDevelop.Utilities.SampleProfiler.ConvertJITAddressesToMethodNames(Options.OutputPath, dialog.SelectedFile, "External"); } }
void HandleClicked(object sender, EventArgs e) { var dlg = new OpenFileDialog(GettextCatalog.GetString("Select Assembly"), MonoDevelop.Components.FileChooserAction.Open); // dlg.AddFilter (GettextCatalog.GetString ("Assemblies"), "*.[Dd][Ll][Ll]", "*.[Ee][Xx][Ee]"); dlg.AddFilter(GettextCatalog.GetString("Assemblies"), "*.dll", "*.exe"); dlg.CurrentFolder = basePath; dlg.SelectMultiple = true; dlg.TransientFor = selectDialog; if (dlg.Run()) { basePath = dlg.CurrentFolder; foreach (string file in dlg.SelectedFiles) { var fn = new FilePath(file).CanonicalPath; var asm = assemblies.FirstOrDefault(a => a.File.Equals(fn)); if (asm != null) { if (!asm.Selected) { asm.Selected = true; AddReference(file); } continue; } bool isAssembly = true; try { SystemAssemblyService.GetAssemblyName(System.IO.Path.GetFullPath(file)); } catch { isAssembly = false; } if (isAssembly) { assemblies.Add(new AssemblyInfo(file) { Selected = true }); AddReference(file); if (IsExternalAssembly(file)) { selectDialog.RegisterFileReference(file); } else if (!IsNuGetAssembly(file)) { selectDialog.RegisterFileReference(file, project.ParentSolution.FileName); } } else { MessageService.ShowError(GettextCatalog.GetString("File '{0}' is not a valid .Net Assembly", file)); } } Reset(); } }
private void toolLoadClick(object sender, EventArgs e) { var dialog = new OpenFileDialog(); if (dialog.Run(ParentWindow)) { EditImage = Image.FromFile(dialog.FileName); } }
protected override void Run() { var dialog = new OpenFileDialog(GettextCatalog.GetString("Sample file output"), MonoDevelop.Components.FileChooserAction.Open); if (dialog.Run()) { UIThreadMonitor.ConvertJITAddressesToMethodNames(dialog.SelectedFile, "External"); } }
protected virtual void OnCtagsBrowseClicked(object sender, EventArgs e) { var dialog = new OpenFileDialog(GettextCatalog.GetString("Choose ctags executable"), FileChooserAction.Open); if (dialog.Run()) { ctagsEntry.Text = dialog.SelectedFile; } }
protected virtual void OnCucumberBrowseClicked(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog(GettextCatalog.GetString("Choose cucumber executable"), Gtk.FileChooserAction.Open); if (dialog.Run()) { cucumberEntry.Text = dialog.SelectedFile; } }
} } void HandleOpenFileClicked (object sender, EventArgs e) { OpenFileDialog fc = new OpenFileDialog("select a gladebuilder file"); fc.Filters.Add(new FileDialogFilter("Gladebuilder","*.gladebuilder")); if (fc.Run())
void BrowseButtonClicked(object sender, EventArgs e) { using (var folderDialog = new OpenFileDialog()) { folderDialog.Title = GettextCatalog.GetString("Browse"); folderDialog.Multiselect = false; if (folderDialog.Run()) { OnApplicationSelected(folderDialog.FileName); } } }
private void OnChooseScriptFileButtonClick(Object sender, EventArgs args) { OpenFileDialog openScriptFile = new OpenFileDialog(); String file = openScriptFile.Run(@" CSharp files (*.cs)|*.cs", Path.GetFullPath("."), @"Choose C# script file", 0); if (file != String.Empty) { _scriptFile = file; _serverScriptBox.Text = Path.GetFileName(_scriptFile); } }
/// <summary> /// Select file. /// </summary> private void SelectFile_Clicked(object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog(Director.Properties.Resources.DialogOpenScenario); dlg.Multiselect = false; dlg.Filters.Add(new FileDialogFilter("All files", "*.*")); if (dlg.Run()) { FilePath.Text = dlg.FileName; } }
private void SelectCommand() { using (var fileSelect = new OpenFileDialog("Choose executable")) { fileSelect.Multiselect = false; if (fileSelect.Run(this)) { commandNameEntry.TooltipText = commandNameEntry.Text = fileSelect.FileName; } } }
private void ToolDeserializeClick(object sender, EventArgs e) { using (var dialog = new OpenFileDialog()) { dialog.Filters.Add(new FileDialogFilter("Config(*.xml)", "*.xml")); if (dialog.Run(ParentWindow)) { DBService.Schems.Deserialize(dialog.FileName, dataTree.SelectedDBItem); } } }
private void ToolLoadClick(object sender, EventArgs e) { using (var dialog = new OpenFileDialog()) { dialog.Filters.Add(new FileDialogFilter("Query", "*.sql")); if (dialog.Run(ParentWindow)) { string file = dialog.FileName; queryText.Text = System.IO.File.ReadAllText(file); } } }
private void OnChooseCompilerOptionsFileButtonClick(Object sender, EventArgs args) { OpenFileDialog openScriptFile = new OpenFileDialog(); String file = openScriptFile.Run(@" Text files (*.txt)|*.txt|Config files (*.conf)|*.conf|Config files (*.cfg)|*.cfg|Any file (*.*)|*.*", Path.GetFullPath("."), @"Choose Compiler options file", 0); if (file != String.Empty) { _compilerOptionsFile = file; _compilerOptionsTextBox.Text = file; } }
protected override void OnToolInsertClick(object sender, EventArgs e) { using (var dialog = new OpenFileDialog()) { dialog.Multiselect = true; if (dialog.Run(ParentWindow)) { var documents = Document.CreateData <T>(dialog.FileNames).ToList(); ShowObject(documents.FirstOrDefault()); } } }
void load_layout(object sender, EventArgs e) { using (var dialog = new OpenFileDialog()) { dialog.Title = "Save dockk layout"; Init(dialog); if (dialog.Run(this)) { LoadDock(dialog.FileName); } } }
private void OnChooseConfigFileButtonClick(Object sender, EventArgs args) { OpenFileDialog openScriptFile = new OpenFileDialog(); String file = openScriptFile.Run(@" Text files (*.txt)|*.txt|Config files (*.conf)|*.conf|Config files (*.cfg)|*.cfg|Any file (*.*)|*.*", Path.GetFullPath("."), @"Choose Server settings file", 0); if (file != String.Empty) { _configFile = file; DisplayConfig(); _configChanged = true; } }
void OnFileDialogClicked(object sender, EventArgs e) { if (fileDialog.Run(this)) { _imagesStore.Clear(); foreach (var fileName in fileDialog.FileNames) { var row = _imagesStore.AddRow(); _imagesStore.SetValue(row, _imageNameField, Path.GetFileNameWithoutExtension(fileName)); _imagesStore.SetValue(row, _imagePathField, fileName); } } }
protected override void Run () { var dlg = new OpenFileDialog (GettextCatalog.GetString ("File to Open"), Gtk.FileChooserAction.Open) { TransientFor = IdeApp.Workbench.RootWindow, ShowEncodingSelector = true, ShowViewerSelector = true, }; if (!dlg.Run ()) return; var file = dlg.SelectedFile; if (dlg.SelectedViewer != null) { dlg.SelectedViewer.OpenFile (file, dlg.Encoding); return; } if (Services.ProjectService.IsWorkspaceItemFile (file) || Services.ProjectService.IsSolutionItemFile (file)) { IdeApp.Workspace.OpenWorkspaceItem (file, dlg.CloseCurrentWorkspace); } else IdeApp.Workbench.OpenDocument (file, dlg.Encoding); }
void ShowLoadSourceFile (StackFrame sf) { if (messageOverlayWindow != null) { messageOverlayWindow.Destroy (); messageOverlayWindow = null; } messageOverlayWindow = new OverlayMessageWindow (); var hbox = new HBox (); hbox.Spacing = 8; var label = new Label (string.Format ("{0} not found. Find source file at alternative location.", Path.GetFileName (sf.SourceLocation.FileName))); hbox.TooltipText = sf.SourceLocation.FileName; var color = (HslColor)editor.ColorStyle.NotificationText.Foreground; label.ModifyFg (StateType.Normal, color); int w, h; label.Layout.GetPixelSize (out w, out h); hbox.PackStart (label, true, true, 0); var openButton = new Button (Gtk.Stock.Open); openButton.WidthRequest = 60; hbox.PackEnd (openButton, false, false, 0); var container = new HBox (); const int containerPadding = 8; container.PackStart (hbox, true, true, containerPadding); messageOverlayWindow.Child = container; messageOverlayWindow.ShowOverlay (editor); messageOverlayWindow.SizeFunc = () => openButton.SizeRequest ().Width + w + hbox.Spacing * 5 + containerPadding * 2; openButton.Clicked += delegate { var dlg = new OpenFileDialog (GettextCatalog.GetString ("File to Open"), SelectFileDialogAction.Open) { TransientFor = IdeApp.Workbench.RootWindow, ShowEncodingSelector = true, ShowViewerSelector = true }; if (!dlg.Run ()) return; var newFilePath = dlg.SelectedFile; try { if (File.Exists (newFilePath)) { if (SourceCodeLookup.CheckFileMd5 (newFilePath, sf.SourceLocation.FileHash)) { SourceCodeLookup.AddLoadedFile (newFilePath, sf.SourceLocation.FileName); sf.UpdateSourceFile (newFilePath); if (IdeApp.Workbench.OpenDocument (newFilePath, null, sf.SourceLocation.Line, 1, OpenDocumentOptions.Debugger) != null) { this.WorkbenchWindow.CloseWindow (false); } } else { MessageService.ShowWarning ("File checksum doesn't match."); } } else { MessageService.ShowWarning ("File not found."); } } catch (Exception) { MessageService.ShowWarning ("Error opening file"); } }; }
protected override void Run () { var lang = "text/x-csharp"; OpenFileDialog dlg = new OpenFileDialog ("Export Rules", MonoDevelop.Components.FileChooserAction.Save); dlg.InitialFileName = "rules.html"; if (!dlg.Run ()) return; Dictionary<CodeDiagnosticDescriptor, DiagnosticSeverity?> severities = new Dictionary<CodeDiagnosticDescriptor, DiagnosticSeverity?> (); foreach (var node in BuiltInCodeDiagnosticProvider.GetBuiltInCodeDiagnosticDecsriptorsAsync (CodeRefactoringService.MimeTypeToLanguage(lang), true).Result) { severities [node] = node.DiagnosticSeverity; // if (node.GetProvider ().SupportedDiagnostics.Length > 1) { // foreach (var subIssue in node.GetProvider ().SupportedDiagnostics) { // severities [subIssue] = node.GetSeverity (subIssue); // } // } } var grouped = severities.Keys.OfType<CodeDiagnosticDescriptor> () .GroupBy (node => node.GetProvider ().SupportedDiagnostics.First ().Category) .OrderBy (g => g.Key, StringComparer.Ordinal); using (var sw = new StreamWriter (dlg.SelectedFile)) { sw.WriteLine ("<h1>Code Rules</h1>"); foreach (var g in grouped) { sw.WriteLine ("<h2>" + g.Key + "</h2>"); sw.WriteLine ("<table border='1'>"); foreach (var node in g.OrderBy (n => n.Name, StringComparer.Ordinal)) { var title = node.Name; var desc = node.GetProvider ().SupportedDiagnostics.First ().Description.ToString () != title ? node.GetProvider ().SupportedDiagnostics.First ().Description : ""; sw.WriteLine ("<tr><td>" + title + "</td><td>" + desc + "</td><td>" + node.DiagnosticSeverity + "</td></tr>"); if (node.GetProvider ().SupportedDiagnostics.Length > 1) { foreach (var subIssue in node.GetProvider ().SupportedDiagnostics) { title = subIssue.Description.ToString (); desc = subIssue.Description.ToString () != title ? subIssue.Description : ""; sw.WriteLine ("<tr><td> - " + title + "</td><td>" + desc + "</td><td>" + node.GetSeverity (subIssue) + "</td></tr>"); } } } sw.WriteLine ("</table>"); } var providerStates = new Dictionary<CodeRefactoringDescriptor, bool> (); foreach (var node in BuiltInCodeDiagnosticProvider.GetBuiltInCodeRefactoringDescriptorsAsync (CodeRefactoringService.MimeTypeToLanguage(lang), true).Result) { providerStates [node] = node.IsEnabled; } sw.WriteLine ("<h1>Code Actions</h1>"); sw.WriteLine ("<table border='1'>"); var sortedAndFiltered = providerStates.Keys.OrderBy (n => n.Name, StringComparer.Ordinal); foreach (var node in sortedAndFiltered) { sw.WriteLine ("<tr><td>" + node.IdString + "</td><td>" + node.Name + "</td></tr>"); } sw.WriteLine ("</table>"); } }
// return a file location prompting user where necessary. return null to cancel string GetFileLocation(string fileName) { var dialog = new OpenFileDialog (GettextCatalog.GetString ("Select where to save file to"), Gtk.FileChooserAction.Save); dialog.InitialFileName = fileName; if (dialog.Run ()) return dialog.SelectedFile.ToString (); else return null; // cancelled }
protected virtual void OnCtagsBrowseClicked (object sender, System.EventArgs e) { OpenFileDialog dialog = new OpenFileDialog (GettextCatalog.GetString ("Choose ctags executable"), FileChooserAction.Open); if (dialog.Run ()) ctagsEntry.Text = dialog.SelectedFile; }
void HandleClicked (object sender, EventArgs e) { var dlg = new OpenFileDialog (GettextCatalog.GetString ("Select Assembly"), FileChooserAction.Open); // dlg.AddFilter (GettextCatalog.GetString ("Assemblies"), "*.[Dd][Ll][Ll]", "*.[Ee][Xx][Ee]"); dlg.AddFilter (GettextCatalog.GetString ("Assemblies"), "*.dll", "*.exe"); dlg.CurrentFolder = basePath; dlg.SelectMultiple = true; if (dlg.Run ()) { basePath = dlg.CurrentFolder; foreach (string file in dlg.SelectedFiles) { var fn = new FilePath (file).CanonicalPath; var asm = assemblies.FirstOrDefault (a => a.File.Equals (fn)); if (asm != null) { if (!asm.Selected) { asm.Selected = true; AddReference (file); } continue; } bool isAssembly = true; try { SystemAssemblyService.GetAssemblyName (System.IO.Path.GetFullPath (file)); } catch { isAssembly = false; } if (isAssembly) { assemblies.Add (new AssemblyInfo (file) { Selected = true }); AddReference (file); if (IsExternalAssembly (file)) selectDialog.RegisterFileReference (file); else if (!IsNuGetAssembly (file)) selectDialog.RegisterFileReference (file, project.ParentSolution.FileName); } else { MessageService.ShowError (GettextCatalog.GetString ("File '{0}' is not a valid .Net Assembly", file)); } } Reset (); } }
protected virtual void OnCucumberBrowseClicked(object sender, EventArgs e) { OpenFileDialog dialog = new OpenFileDialog (GettextCatalog.GetString ("Choose cucumber executable"), Gtk.FileChooserAction.Open); if (dialog.Run ()) cucumberEntry.Text = dialog.SelectedFile; }
protected override void Run () { var lang = "text/x-csharp"; OpenFileDialog dlg = new OpenFileDialog ("Export Rules", FileChooserAction.Save); dlg.InitialFileName = "rules.html"; if (!dlg.Run ()) return; Dictionary<BaseCodeIssueProvider, Severity> severities = new Dictionary<BaseCodeIssueProvider, Severity> (); foreach (var node in RefactoringService.GetInspectors (lang)) { severities [node] = node.GetSeverity (); if (node.HasSubIssues) { foreach (var subIssue in node.SubIssues) { severities [subIssue] = subIssue.GetSeverity (); } } } var grouped = severities.Keys.OfType<CodeIssueProvider> () .GroupBy (node => node.Category) .OrderBy (g => g.Key, StringComparer.Ordinal); using (var sw = new StreamWriter (dlg.SelectedFile)) { sw.WriteLine ("<h1>Code Rules</h1>"); foreach (var g in grouped) { sw.WriteLine ("<h2>" + g.Key + "</h2>"); sw.WriteLine ("<table border='1'>"); foreach (var node in g.OrderBy (n => n.Title, StringComparer.Ordinal)) { var title = node.Title; var desc = node.Description != title ? node.Description : ""; sw.WriteLine ("<tr><td>" + title + "</td><td>" + desc + "</td><td>" + node.GetSeverity () + "</td></tr>"); if (node.HasSubIssues) { foreach (var subIssue in node.SubIssues) { title = subIssue.Title; desc = subIssue.Description != title ? subIssue.Description : ""; sw.WriteLine ("<tr><td> - " + title + "</td><td>" + desc + "</td><td>" + subIssue.GetSeverity () + "</td></tr>"); } } } sw.WriteLine ("</table>"); } Dictionary<CodeActionProvider, bool> providerStates = new Dictionary<CodeActionProvider, bool> (); string disabledNodes = PropertyService.Get ("ContextActions." + lang, ""); foreach (var node in RefactoringService.ContextAddinNodes.Where (n => n.MimeType == lang)) { providerStates [node] = disabledNodes.IndexOf (node.IdString, StringComparison.Ordinal) < 0; } sw.WriteLine ("<h1>Code Actions</h1>"); sw.WriteLine ("<table border='1'>"); var sortedAndFiltered = providerStates.Keys.OrderBy (n => n.Title, StringComparer.Ordinal); foreach (var node in sortedAndFiltered) { var desc = node.Title != node.Description ? node.Description : ""; sw.WriteLine ("<tr><td>" + node.Title + "</td><td>" + desc + "</td></tr>"); } sw.WriteLine ("</table>"); } }
void HandleToFile (object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog (GettextCatalog.GetString ("Select Policy File")); dlg.TransientFor = this; dlg.InitialFileName = currentSet.Name + ".mdpolicy"; dlg.Action = FileChooserAction.Save; dlg.AddFilter (BrandingService.BrandApplicationName (GettextCatalog.GetString ("MonoDevelop policy files")), "*.mdpolicy"); dlg.AddAllFilesFilter (); dlg.CurrentFolder = ExportProjectPolicyDialog.DefaultFileDialogPolicyDir; if (dlg.Run ()) { try { currentSet.SaveToFile (dlg.SelectedFile); ExportProjectPolicyDialog.DefaultFileDialogPolicyDir = dlg.SelectedFile.ParentDirectory; } catch (Exception ex) { MessageService.ShowException (ex, GettextCatalog.GetString ("The policy set could not be saved")); } } }
void HandleFromFile (object sender, EventArgs e) { OpenFileDialog dlg = new OpenFileDialog (GettextCatalog.GetString ("Select Policy File")); dlg.Action = FileChooserAction.Open; dlg.TransientFor = this; dlg.AddFilter (BrandingService.BrandApplicationName (GettextCatalog.GetString ("MonoDevelop policy files")), "*.mdpolicy"); dlg.AddAllFilesFilter (); dlg.CurrentFolder = ExportProjectPolicyDialog.DefaultFileDialogPolicyDir; if (dlg.Run ()) { try { PolicySet pset = new PolicySet (); pset.LoadFromFile (dlg.SelectedFile); if (string.IsNullOrEmpty (pset.Name)) pset.Name = dlg.SelectedFile.FileNameWithoutExtension; pset.Name = GetUnusedName (pset.Name); sets.Add (pset); ExportProjectPolicyDialog.DefaultFileDialogPolicyDir = dlg.SelectedFile.ParentDirectory; FillPolicySets (); policiesCombo.Active = sets.IndexOf (pset); } catch (Exception ex) { MessageService.ShowException (ex, GettextCatalog.GetString ("The policy set could not be loaded")); } } }