Microsoft.Win32.CommonDialog.ShowDialog()

Here are the examples of the csharp api Microsoft.Win32.CommonDialog.ShowDialog() taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

838 Examples 7

19 View Source File : Model.cs
License : MIT License
Project Creator : advancedmonitoring

public static void ButtonSaveClicked()
        {
            var dlg = new SaveFileDialog
            {
                FileName = "raw_sddl",
                DefaultExt = ".txt",
                Filter = "Text doreplacedents (*.txt)|*.txt|All files (*.*)|*.*",
                FilterIndex = 0,
                OverwritePrompt = true
            };
            if (dlg.ShowDialog() ?? false)
                File.WriteAllText(dlg.FileName, MW.GetContent());
        }

19 View Source File : ContentsBrowser.cs
License : MIT License
Project Creator : alaabenfatma

private void ImportFile()
        {
            var openFileDialog = new OpenFileDialog();
            if (openFileDialog.ShowDialog() == true)
            {
                var p = Item.Path;
                if (p.Substring(0, Math.Max(0, p.Length - 1)) == @"\")
                    File.Copy(openFileDialog.FileName, Item.Path + openFileDialog.SafeFileName);

                else
                    File.Copy(openFileDialog.FileName, Item.Path + @"\" + openFileDialog.SafeFileName);
                Refresh();
            }
        }

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private void OnOpenFileButtonClick(object sender, RoutedEventArgs e) {
			// Show a file open dialog
			OpenFileDialog dialog = new OpenFileDialog();
			if (!BrowserInteropHelper.IsBrowserHosted)
				dialog.CheckFileExists = true;
			dialog.Multiselect = false;
			dialog.Filter = "JavaScript files (*.js)|*.js|All files (*.*)|*.*";
			if (dialog.ShowDialog() == true) {
				// Open a doreplacedent (use dialog to help open the file because of security restrictions in XBAP/Silverlight)
				using (Stream stream = dialog.OpenFile()) {
					// Read the file
					this.OpenFile(Path.GetFileName(dialog.FileName), stream);
				}
			}
		}

19 View Source File : MainWindow.xaml.cs
License : GNU General Public License v2.0
Project Creator : adrifcastr

private void ipbutton_Click(object sender, RoutedEventArgs e)
        {
            openFileDialog.Filter = "NSW NSP File|*.nsp";
            openFileDialog.replacedle = "Select a NSW NSP File";

            if (openFileDialog.ShowDialog() == true)
                inputdisplay.Text = openFileDialog.FileName;

        }

19 View Source File : MainWindow.xaml.cs
License : MIT License
Project Creator : Actipro

private void OnOpenFileMenuItemClick(object sender, RoutedEventArgs e) {
			// Show a file open dialog
			OpenFileDialog dialog = new OpenFileDialog();
			dialog.CheckFileExists = true;
			dialog.Multiselect = false;
			dialog.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*";
			if (dialog.ShowDialog() == true) {
				// Create a doreplacedent window
				this.CreateTextDoreplacedentWindow(dialog.FileName);
			}
		}

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private void LoadLanguageDefinitionFromFile(string filename) {
			if (String.IsNullOrEmpty(filename)) {
				// Show a file open dialog
				OpenFileDialog dialog = new OpenFileDialog();
				if (!BrowserInteropHelper.IsBrowserHosted)
					dialog.CheckFileExists = true;
				dialog.Multiselect = false;
				dialog.Filter = "Language definition files (*.langdef)|*.langdef|All files (*.*)|*.*";
				if (dialog.ShowDialog() != true)
					return;

				// Open a language definition
				using (Stream stream = dialog.OpenFile()) {
					// Read the file
					SyntaxLanguageDefinitionSerializer serializer = new SyntaxLanguageDefinitionSerializer();
					this.LoadLanguage(serializer.LoadFromStream(stream));
				}
			}
			else {
				// Load an embedded resource .langdef file
				this.LoadLanguage(SyntaxEditorHelper.LoadLanguageDefinitionFromResourceStream(filename));
			}
		}

19 View Source File : ConfigIoModel.cs
License : Mozilla Public License 2.0
Project Creator : agebullhu

public void Load()
        {
            var sfd = new OpenFileDialog
            {
                Filter = fileType,
                FileName = Context.FileName
            };

            if (sfd.ShowDialog() != true)
            {
                return;
            }
            Load(sfd.FileName);
            DataModelDesignModel.Screen.LastFile = sfd.FileName;
            DataModelDesignModel.SaveUserScreen();

        }

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private void OnAddReferenceButtonClick(object sender, RoutedEventArgs e) {
			// Show a file open dialog
			OpenFileDialog dialog = new OpenFileDialog();
			if (!BrowserInteropHelper.IsBrowserHosted)
				dialog.CheckFileExists = true;
			dialog.Multiselect = false;
			dialog.Filter = "replacedemblies (*.dll)|*.dll|All files (*.*)|*.*";
			if (dialog.ShowDialog() == true) {
				try {
					// Add to references
					projectreplacedembly.replacedemblyReferences.AddFrom(dialog.FileName);
				}
				catch (Exception ex) {
					MessageBox.Show("An exception occurred: " + ex.Message, "Error Loading replacedembly", MessageBoxButton.OK, MessageBoxImage.Exclamation);
				}
			}
		}

19 View Source File : SettingsView.xaml.cs
License : MIT License
Project Creator : AlexanderPro

private void BrowseVideoFile_Click(object sender, RoutedEventArgs e)
        {
            var viewModel = (SettingsViewModel)DataContext;
            var openFileDialog = new OpenFileDialog
            {
                Filter = $"Video files ({string.Join(";", viewModel.Settings.VideoFileExtensions)})|{string.Join(";", viewModel.Settings.VideoFileExtensions)}|All files (*.*)|*.*"
            };
            if (openFileDialog.ShowDialog() == true)
            {
                viewModel.VideoFileName = openFileDialog.FileName;
            }
        }

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private void fileOpenCommand_Execute(object sender, ExecutedRoutedEventArgs e) {
			// Open a doreplacedent
			OpenFileDialog dialog = new OpenFileDialog();
			dialog.Filter = "Images Files (*.bmp; *.gif; *.jpg; *.jpeg; *.png; *.tif; *.tiff)|*.bmp;*.gif;*.jpg;*.jpeg;*.png;*.tif;*.tiff";
			if (dialog.ShowDialog() == true) {
				ImageSource imageSource = null;
				try {
					BitmapDecoder decoder = BitmapDecoder.Create(dialog.OpenFile(), BitmapCreateOptions.None, BitmapCacheOption.None);
					imageSource = decoder.Frames[0];
				}
				catch (Exception) {
					// No-op
				}

				if (null == imageSource) {
					MessageBox.Show("Unable to open image file.", "ZoomContentControl", MessageBoxButton.OK, MessageBoxImage.Error);
					return;
				}

				this.zoomContentControl.BeginUpdate();
				try {
					this.image.Source = imageSource;
					this.zoomContentControl.UpdateLayout();
					this.zoomContentControl.ZoomToFit();
				}
				finally {
					this.zoomContentControl.EndUpdate(false);
				}
			}
		}

19 View Source File : MainWindow.xaml.cs
License : MIT License
Project Creator : ADeltaX

private void MenuItem_Click_1(object sender, RoutedEventArgs e)
        {
            var openFileDialog = new Microsoft.Win32.OpenFileDialog
            {
                replacedle = "Open settings.dat",
                CheckFileExists = true,
                CheckPathExists = true,
                Multiselect = true
            };

            if (openFileDialog.ShowDialog() == true)
                LoadAndVerifyHives(openFileDialog.FileNames);
        }

19 View Source File : DLLForm.xaml.cs
License : GNU General Public License v3.0
Project Creator : AdhocAdam

private void btn_BrowseSMExcoPSPath(object sender, RoutedEventArgs e)
        {
            //OpenFileDialog openFileDialog = new OpenFileDialog();
            Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog();
            openFileDialog.Filter = "PowerShell Scripts (*.ps1)|*.ps1";
            if (openFileDialog.ShowDialog() == true)
            {
                txtSMExcoPS1.Text = openFileDialog.FileName;
            }
        }

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private void OnOpenFileButtonClick(object sender, RoutedEventArgs e) {
			// Show a file open dialog
			OpenFileDialog dialog = new OpenFileDialog();
			if (!BrowserInteropHelper.IsBrowserHosted)
				dialog.CheckFileExists = true;
			dialog.Multiselect = false;
			dialog.Filter = "Python files (*.py)|*.py|All files (*.*)|*.*";
			if (dialog.ShowDialog() == true) {
				// Open a doreplacedent (use dialog to help open the file because of security restrictions in XBAP/Silverlight)
				using (Stream stream = dialog.OpenFile()) {
					// Read the file
					this.OpenFile(dialog.FileName, stream);
				}
			}
		}

19 View Source File : SettingsWindow.xaml.cs
License : MIT License
Project Creator : adrianmteo

private void BrowseWallpaperHyperlink_Click(object sender, RoutedEventArgs e)
        {
            Hyperlink hyperlink = (Hyperlink)sender;

            OpenFileDialog dialog = new OpenFileDialog();

            string initialPath = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures);

            dialog.Filter = "Image files|*.jpg;*.jpeg;*.png|All files|*.*";
            dialog.replacedle = "Select a wallpaper";
            dialog.InitialDirectory = initialPath;

            if (dialog.ShowDialog() == true)
            {
                PropertyInfo propertyInfo = _autoFileSaver.Model.GetType().GetProperty((string)hyperlink.Tag);
                propertyInfo.SetValue(_autoFileSaver.Model, dialog.FileName, null);
            }
        }

19 View Source File : MainWindow.xaml.cs
License : MIT License
Project Creator : Actipro

private void fileOpenCommand_Execute(object sender, ExecutedRoutedEventArgs e) {
			if (e.Parameter is IDoreplacedentReference) {
				// Process recent doreplacedent clicks
				MessageBox.Show("Open doreplacedent '" + ((IDoreplacedentReference)e.Parameter).Name + "' here.", "Open Recent Doreplacedent", MessageBoxButton.OK, MessageBoxImage.Information);
				return;
			}

			// Open a doreplacedent
			OpenFileDialog dialog = new OpenFileDialog();
			dialog.DefaultExt = ".rtf";
			dialog.CheckFileExists = true;
			dialog.Filter = "Doreplacedent Files (*.rtf; *.txt)|*.rtf;*.txt|Rich Text Files (*.rtf)|*.rtf|Text Files (*.txt)|*.txt";
			if (dialog.ShowDialog() == true)
				this.CurrentDoreplacedentData = new DoreplacedentData(dialog.FileName);
		}

19 View Source File : ReportModel.cs
License : MIT License
Project Creator : advancedmonitoring

public static void ButtonSave(string content)
        {
            var dlg = new SaveFileDialog
            {
                FileName = "report",
                DefaultExt = ".txt",
                Filter = "Text doreplacedents (*.txt)|*.txt|All files (*.*)|*.*",
                FilterIndex = 0,
                OverwritePrompt = true
            };
            if (dlg.ShowDialog() ?? false)
                File.WriteAllText(dlg.FileName, content);
        }

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private static void OnOpenExecuted(object sender, ExecutedRoutedEventArgs e) {
			MainControl control = (MainControl)sender;

			// Show a file open dialog
			OpenFileDialog dialog = new OpenFileDialog();
			if (!BrowserInteropHelper.IsBrowserHosted)
				dialog.CheckFileExists = true;
			dialog.Multiselect = false;
			dialog.Filter = "Code files (*.cs;*.vb;*.js;*.py;*.xml;*.txt)|*.cs;*.vb;*.js;*.py;*.xml;*.txt|All files (*.*)|*.*";
			if (dialog.ShowDialog() == true) {
				// Open a doreplacedent 
				if (BrowserInteropHelper.IsBrowserHosted) {
					// Use dialog to help open the file because of security restrictions
					using (Stream stream = dialog.OpenFile()) {
						// Read the file
						control.editor.Doreplacedent.LoadFile(stream, Encoding.UTF8);
					}
				}
				else {
					// Security is not an issue in a Windows app so use simple method
					control.editor.Doreplacedent.LoadFile(dialog.FileName);
				}
			}
		}

private void SelectFileButton_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Multiselect = false;
            ofd.InitialDirectory = CommonUtils.ApplicationStartupPath();
            if (ofd.ShowDialog() == true)
            {
                if (ButtonScriptPathType.SelectedIndex == 0)
                {
                    ButtonScript.Text = CommonUtils.ConvertPartToRelative(ofd.FileName);
                }
                else
                {
                    ButtonScript.Text = ofd.FileName;
                }
            }
        }

19 View Source File : MainMenu.xaml.cs
License : GNU General Public License v3.0
Project Creator : ACEmulator

private async void OpenFile_Click(object sender, RoutedEventArgs e)
        {
            var openFileDialog = new OpenFileDialog();
            openFileDialog.Filter = "DAT files (*.dat)|*.dat|All files (*.*)|*.*";
            if (openFileDialog.ShowDialog() == true)
            {
                var files = openFileDialog.FileNames;
                if (files.Length < 1) return;
                var file = files[0];

                MainWindow.Status.WriteLine("Reading " + file);

                await Task.Run(() => ReadDATFile(file));

                //Particle.ReadFiles();

                //var cellFiles = DatManager.CellDat.AllFiles.Count;
                //var portalFiles = DatManager.PortalDat.AllFiles.Count;

                //MainWindow.Status.WriteLine($"CellFiles={cellFiles}, PortalFiles={portalFiles}");

                MainWindow.Status.WriteLine("Done");

                GameView.PostInit();
            }
        }

19 View Source File : SaveLoad.xaml.cs
License : MIT License
Project Creator : alaabenfatma

private void Load()
        {
            var ofd = new OpenFileDialog();
            ofd.Filter = "CDE file (*.cde)|*.cde";
            var save = ofd.ShowDialog();
            if (save == true)
                Hub.LoadVirtualData(vControl, File.ReadAllText(ofd.FileName));
        }

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private void OnOpenSchemaButtonClick(object sender, RoutedEventArgs e) {
			// Show a file open dialog
			OpenFileDialog dialog = new OpenFileDialog();
			if (!BrowserInteropHelper.IsBrowserHosted)
				dialog.CheckFileExists = true;
			dialog.Multiselect = false;
			dialog.Filter = "XSD files (*.xsd)|*.xsd|All files (*.*)|*.*";
			if (dialog.ShowDialog() == true) {
				// Open a doreplacedent (use dialog to help open the file because of security restrictions in XBAP/Silverlight)
				using (Stream stream = dialog.OpenFile()) {
					// Read the file
					this.OpenSchema(Path.GetFileName(dialog.FileName), null, stream);
				}
			}
		}

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private void OnOpenButtonClick(object sender, RoutedEventArgs e) {
			OpenFileDialog dialog = new OpenFileDialog();
			if (!BrowserInteropHelper.IsBrowserHosted)
				dialog.CheckFileExists = true;
			dialog.Multiselect = false;
			dialog.Filter = "Code files (*.js)|*.js|All files (*.*)|*.*";
			if (dialog.ShowDialog() == true) {
				// Open a doreplacedent 
				if (BrowserInteropHelper.IsBrowserHosted) {
					// Use dialog to help open the file because of security restrictions
					using (Stream stream = dialog.OpenFile()) {
						// Read the file
						editor.Doreplacedent.LoadFile(stream, Encoding.UTF8);
					}
				}
				else {
					// Security is not an issue in a Windows app so use simple method
					editor.Doreplacedent.LoadFile(dialog.FileName);
				}
			}

			// Focus the editor
			editor.Focus();
		}

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private void OnOpenDoreplacedentMenuItemClick(object sender, RoutedEventArgs e) {
			// Show a file open dialog
			var dialog = new OpenFileDialog();
			dialog.CheckFileExists = true;
			dialog.Multiselect = false;
			dialog.Filter = "Code files (*.txt;*.cs;*.js;*.py;*.vb;*.xml)|*.txt;*.cs;*.js;*.py;*.vb;*.xml|All files (*.*)|*.*";
			if (dialog.ShowDialog() == true)
				this.CreateSyntaxEditorDoreplacedent(Path.GetExtension(dialog.FileName), dialog.FileName, String.Empty);
		}

19 View Source File : DLLForm.xaml.cs
License : GNU General Public License v3.0
Project Creator : AdhocAdam

private void btn_BrowseEWSPath(object sender, RoutedEventArgs e)
        {
            //OpenFileDialog openFileDialog = new OpenFileDialog();
            Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog();
            openFileDialog.Filter = "DLL files (*.dll)|*.dll|All files (*.*)|*.*";
            if (openFileDialog.ShowDialog() == true)
            {
                txtEWSapiDll.Text = openFileDialog.FileName;
            }
        }

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private void OnOpenFileButtonClick(object sender, RoutedEventArgs e) {
			// Show a file open dialog
			OpenFileDialog dialog = new OpenFileDialog();
			if (!BrowserInteropHelper.IsBrowserHosted)
				dialog.CheckFileExists = true;
			dialog.Multiselect = false;
			dialog.Filter = "C# files (*.cs)|*.cs|All files (*.*)|*.*";
			if (dialog.ShowDialog() == true) {
				// Open a doreplacedent (use dialog to help open the file because of security restrictions in XBAP/Silverlight)
				using (Stream stream = dialog.OpenFile()) {
					// Read the file
					this.OpenFile(Path.GetFileName(dialog.FileName), stream);
				}
			}
		}

19 View Source File : ConnectionDialogViewModel.cs
License : BSD 2-Clause "Simplified" License
Project Creator : adospace

void Browse(object parameter)
        {
            var dlg = new OpenFileDialog();
            dlg.Filter = "LiteDB Database (*.db)|*.db|All files (*.*)|*.*";
            if (dlg.ShowDialog().GetValueOrDefault())
            {
                Filename = dlg.FileName;
                RaisePropertyChanged("ConnectionProperties");
            }
        }

19 View Source File : DLLForm.xaml.cs
License : GNU General Public License v3.0
Project Creator : AdhocAdam

private void btn_BrowseMimeKitPath(object sender, RoutedEventArgs e)
        {
            //OpenFileDialog openFileDialog = new OpenFileDialog();
            Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog();
            openFileDialog.Filter = "DLL files (*.dll)|*.dll|All files (*.*)|*.*";
            if (openFileDialog.ShowDialog() == true)
            {
                txtMimeKitDLL.Text = openFileDialog.FileName;
            }
        }

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private void OnOpenFileButtonClick(object sender, RoutedEventArgs e) {
			// Show a file open dialog
			OpenFileDialog dialog = new OpenFileDialog();
			if (!BrowserInteropHelper.IsBrowserHosted)
				dialog.CheckFileExists = true;
			dialog.Multiselect = false;
			dialog.Filter = "Visual Basic files (*.vb)|*.vb|All files (*.*)|*.*";
			if (dialog.ShowDialog() == true) {
				// Open a doreplacedent (use dialog to help open the file because of security restrictions in XBAP/Silverlight)
				using (Stream stream = dialog.OpenFile()) {
					// Read the file
					this.OpenFile(Path.GetFileName(dialog.FileName), stream);
				}
			}
		}

19 View Source File : SettingsWindow.xaml.cs
License : MIT License
Project Creator : adrianmteo

private void BrowseThemeHyperlink_Click(object sender, RoutedEventArgs e)
        {
            Hyperlink hyperlink = (Hyperlink)sender;

            OpenFileDialog dialog = new OpenFileDialog();

            string localAppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
            string initialPath = Path.Combine(localAppDataPath, @"Microsoft\Windows\Themes");

            dialog.Filter = "Theme files|*.theme";
            dialog.replacedle = "Select a theme";
            dialog.InitialDirectory = initialPath;

            if (dialog.ShowDialog() == true)
            {
                PropertyInfo propertyInfo = _autoFileSaver.Model.GetType().GetProperty((string)hyperlink.Tag);
                propertyInfo.SetValue(_autoFileSaver.Model, dialog.FileName, null);
            }
        }

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

public void OnSaveImageButtonClick(object sender, RoutedEventArgs e) {
			// Show a save dialog
			SaveFileDialog dialog = new SaveFileDialog();
			dialog.CheckPathExists = true;
			dialog.replacedle = "Save .PNG Image";
			dialog.Filter = "Image files (*.png)|*.png";
			dialog.OverwritePrompt = true;
			if (dialog.ShowDialog() == true) {
				// Write the PNG file... use different encoders to output file types like BMP, GIF, JPEG, TIFF, etc.
				using (FileStream outStream = new FileStream(dialog.FileName, FileMode.Create)) {
					PngBitmapEncoder enc = new PngBitmapEncoder();
					enc.Frames.Add(BitmapFrame.Create((BitmapSource)outputImage.Source));
					enc.Save(outStream);
				}
			}
		}

19 View Source File : MainWindow.xaml.cs
License : GNU General Public License v2.0
Project Creator : adrifcastr

private void upnspipbutton_Click(object sender, RoutedEventArgs e)
        {
            openFileDialog.Filter = "NSW NSP File|*.nsp";
            openFileDialog.replacedle = "Select a NSW NSP File";

            if (openFileDialog.ShowDialog() == true)
                upnspinputdisplay.Text = openFileDialog.FileName;
        }

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private void OnOpenStandardLibraryButtonClick(object sender, RoutedEventArgs e) {
			// Show a file open dialog
			OpenFileDialog dialog = new OpenFileDialog();
			if (!BrowserInteropHelper.IsBrowserHosted) {
				dialog.CheckFileExists = true;
				dialog.replacedle = "Select a file from the Lib folder of your Python standard library";
			}
			dialog.Multiselect = false;
			dialog.Filter = "Python files (*.py)|*.py|All files (*.*)|*.*";
			if (dialog.ShowDialog() == true) {
				try {
					var directoryPath = Path.GetDirectoryName(dialog.FileName);
					if (Directory.Exists(directoryPath)) {
						// Add the containing directory as a search path
						var project = codeEditor.Doreplacedent.Language.GetProject();
						project.SearchPaths.Clear();
						project.SearchPaths.Add(directoryPath);

						// Add the site-packages child folder, if present
						var sitePackagesPath = Path.Combine(directoryPath, "site-packages");
						if (Directory.Exists(sitePackagesPath))
							project.SearchPaths.Add(sitePackagesPath);

						MessageBox.Show("Standard library location set to '" + directoryPath + "'.");
					}
				}
				catch (ArgumentException) {}
				catch (IOException) {}
				catch (SecurityException) {}
			}
		}

19 View Source File : Model.cs
License : MIT License
Project Creator : advancedmonitoring

public static void ButtonFillFilesClicked()
        {
            var dlg = new OpenFileDialog
            {
                Multiselect = true,
                Filter = "All files (*.*)|*.*"
            };
            if (dlg.ShowDialog() ?? false)
            {
                MW.SetContent();
                if (MW.CmbxRightsType.SelectedIndex != 2)
                    MW.CmbxRightsType.SelectedIndex = 2;
                var sb = new StringBuilder();
                foreach (var file in dlg.FileNames)
                {
                    try
                    {
                        if ((string.IsNullOrWhiteSpace(file)) || (!File.Exists(file)))
                            continue;
                        var localSb = new StringBuilder();
                        localSb.AppendLine($"{file}");
                        var sddlString = "Unable obtain SDDL";
                        try
                        {
                            sddlString = File.GetAccessControl(file).GetSecurityDescriptorSddlForm(AccessControlSections.All);
                        }
                        catch
                        {
                            // ignore
                        }
                        localSb.AppendLine(sddlString);
                        sb.AppendLine(localSb.ToString());
                    }
                    catch
                    {
                        // continue
                    }
                }
                MW.SetContent(sb.ToString());
            }
        }

19 View Source File : ChartPrintingMultiPaneCharts.xaml.cs
License : MIT License
Project Creator : ABTSoftware

private void Export_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new SaveFileDialog();
            dialog.Filter = "Png Image (.png)|*.png";
            dialog.AddExtension = true;
            if (dialog.ShowDialog() == true)
            {
                var writeableBitmap = ChartGroup.RenderToBitmap((int)ChartGroup.ActualWidth, (int)ChartGroup.ActualHeight);
                using (FileStream stream5 = new FileStream(dialog.FileName, FileMode.Create))
                {
                    PngBitmapEncoder encoder5 = new PngBitmapEncoder();
                    encoder5.Frames.Add(BitmapFrame.Create(writeableBitmap));
                    encoder5.Save(stream5);
                }

                Process.Start(dialog.FileName);
            }
        }

19 View Source File : Model.cs
License : MIT License
Project Creator : advancedmonitoring

public static void ButtonOpenClicked()
        {
            var dlg = new OpenFileDialog
            {
                FileName = "raw_sddl",
                DefaultExt = ".txt",
                Filter = "Text doreplacedents (*.txt)|*.txt|All files (*.*)|*.*",
                FilterIndex = 0,
                CheckFileExists = true,
                CheckPathExists = true
            };
            if (dlg.ShowDialog() ?? false)
            {
                MW.SetContent();
                MW.SetContent(File.ReadAllText(dlg.FileName));
            }
        }

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private void OnFileImportVSSettingsMenuItemClick(object sender, RoutedEventArgs e) {
			// Show a file open dialog
			OpenFileDialog dialog = new OpenFileDialog();
			if (!BrowserInteropHelper.IsBrowserHosted)
				dialog.CheckFileExists = true;
			dialog.Multiselect = false;
			dialog.Filter = "Visual Studio Settings files (*.vssettings)|*.vssettings|All files (*.*)|*.*";
			if (dialog.ShowDialog() == true) {
				using (Stream stream = dialog.OpenFile()) {
					// Read the file
					ActiproSoftware.Windows.Controls.SyntaxEditor.Highlighting.AmbientHighlightingStyleRegistry.Instance.ImportHighlightingStyles(stream);
				}
			}
		}

19 View Source File : ChatBoxViewModel.cs
License : MIT License
Project Creator : AFei19911012

private void OpenImage()
        {
            var dialog = new OpenFileDialog();
            if (dialog.ShowDialog() == true)
            {
                var fileName = dialog.FileName;
                if (File.Exists(fileName))
                {
                    var info = new ChatInfoModel
                    {
                        Message = BitmapFrame.Create(new Uri(fileName)),
                        SenderId = _id,
                        Type = ChatMessageType.Image,
                        Role = ChatRoleType.Sender,
                        Enclosure = fileName
                    };
                    ChatInfos.Add(info);
                    Messenger.Default.Send(info, "SendChatMessage");
                }
            }
        }

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private void OnOpenExecute(object sender, ExecutedRoutedEventArgs e) {
			if (e.Parameter is IDoreplacedentReference) {
				// Process recent doreplacedent clicks
				MessageBox.Show("Open doreplacedent '" + ((IDoreplacedentReference)e.Parameter).Name + "' here.", "Open Recent Doreplacedent", MessageBoxButton.OK, MessageBoxImage.Information);
				return;
			}

			// Show the open file dialog
			OpenFileDialog dialog = new OpenFileDialog();
			dialog.CheckFileExists = true;
			dialog.Filter = "All Files (*.*)|*.*";
			if (dialog.ShowDialog() == true) {
				// Add a new doreplacedent reference to the recent doreplacedent manager by calling the helper notify method...
				//   Alternatively you could create a DoreplacedentReference and add it to recentDocManager.Doreplacedents manually
				//   but the benefit of this helper is that it checks for an existing Uri match so that you don't add duplicates
				recentDocManager.NotifyDoreplacedentOpened(new Uri(dialog.FileName));
			}

		}

19 View Source File : MainWindow.xaml.cs
License : MIT License
Project Creator : AkiniKites

private async Task btnLoadPatch_Click(object sender, EventArgs e)
        {
            using var _ = new ControlLock(btnLoadPatch);
            var ofd = new OpenFileDialog
            {
                CheckFileExists = true,
                Multiselect = false,
                Filter = "Pack files (*.bin)|*.bin|All files (*.*)|*.*"
            };

            if (ofd.ShowDialog() != true)
                return;

            await LoadExistingPack(ofd.FileName, false);
        }

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private void OnOpenButtonClick(object sender, RoutedEventArgs e) {
			// Show a file open dialog
			OpenFileDialog dialog = new OpenFileDialog();
			if (!BrowserInteropHelper.IsBrowserHosted)
				dialog.CheckFileExists = true;
			dialog.Multiselect = false;
			dialog.Filter = "XHTML files (*.html;*.xhtml)|*.html;*.xhtml|All files (*.*)|*.*";
			if (dialog.ShowDialog() == true) {
				// Open a doreplacedent 
				if (BrowserInteropHelper.IsBrowserHosted) {
					// Use dialog to help open the file because of security restrictions
					using (Stream stream = dialog.OpenFile()) {
						// Read the file
						syntaxEditor.Doreplacedent.LoadFile(stream, Encoding.UTF8);
					}
				}
				else {
					// Security is not an issue in a Windows app so use simple method
					syntaxEditor.Doreplacedent.LoadFile(dialog.FileName);
				}
			}
		}

private void SelectFileButton_Click(object sender, RoutedEventArgs e)
        {
            OpenFileDialog ofd = new OpenFileDialog();
            ofd.Multiselect = false;
            ofd.InitialDirectory = CommonUtils.ApplicationStartupPath();
            if (ofd.ShowDialog() == true)
            {
                if(ButtonScriptPathType.SelectedIndex == 0)
                {
                    ButtonScript.Text = CommonUtils.ConvertPartToRelative(ofd.FileName);
                }
                else
                {
                    ButtonScript.Text = ofd.FileName;
                }
            }
        }

19 View Source File : ExportAndScreenshotOptionsChart.xaml.cs
License : MIT License
Project Creator : ABTSoftware

private bool GetAndCheckPath(string filter, out string path)
        {
            var ret = false;
            var isGoodPath = false;
            var saveFileDialog = CreateFileDialog(filter);
            path = null;

            while (!isGoodPath)
            {
                if (saveFileDialog.ShowDialog() == true)
                {
                    if (IsFileGoodForWriting(saveFileDialog.FileName))
                    {
                        path = saveFileDialog.FileName;
                        isGoodPath = true;
                        ret = true;
                    }
                    else
                    {
                        MessageBox.Show(
                            "File is inaccesible for writing or you can not create file in this location, please choose another one.");
                    }
                }
                else
                {
                    isGoodPath = true;
                }
            }

            return ret;
        }

19 View Source File : SaveLoad.xaml.cs
License : MIT License
Project Creator : alaabenfatma

private void Save()
        {
            var sfd = new SaveFileDialog();
            sfd.Filter = "CDE file (*.cde)|*.cde";
            sfd.FileName = "ProjectName";
            var save = sfd.ShowDialog();
            if (save == true)
                File.WriteAllText(sfd.FileName, vControl.SerializeAll());
        }

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private void OnOpenFileButtonClick(object sender, RoutedEventArgs e) {
			// Show a file open dialog
			OpenFileDialog dialog = new OpenFileDialog();
			if (!BrowserInteropHelper.IsBrowserHosted)
				dialog.CheckFileExists = true;
			dialog.Multiselect = false;
			dialog.Filter = "XML files (*.xml)|*.xml|All files (*.*)|*.*";
			if (dialog.ShowDialog() == true) {
				// Open a doreplacedent (use dialog to help open the file because of security restrictions in XBAP/Silverlight)
				using (Stream stream = dialog.OpenFile()) {
					// Read the file
					this.OpenFile(Path.GetFileName(dialog.FileName), stream);
				}
			}
		}

19 View Source File : DocumentHelper.cs
License : MIT License
Project Creator : Actipro

public static DoreplacedentWindow OpenTextDoreplacedentWindow(DockSite dockSite) {
			// Show a file open dialog
			var dialog = new OpenFileDialog();
			dialog.CheckFileExists = true;
			dialog.Multiselect = false;
			dialog.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*";
			if (dialog.ShowDialog() == true) {
				// Create a doreplacedent window
				return DoreplacedentHelper.CreateTextDoreplacedentWindow(dockSite, dialog.FileName, 0);
			}

			return null;
		}

19 View Source File : GrblSettingsWindow.xaml.cs
License : MIT License
Project Creator : 3RD-Dimension

private void ButtonGrblExport_Click(object sender, RoutedEventArgs e)
        {
            if (MessageBox.Show("This will export the currently displayed settings to a file - even any modified values that you have entered.  If you need to export the settings before modifications, please export before changing.  Continue To Export?", "Important", MessageBoxButton.YesNo, MessageBoxImage.Information) == MessageBoxResult.Yes)
            { // YES - Export               
                SaveFileDialog exportFileName = new SaveFileDialog();
                exportFileName.Filter = "Text File (*.txt)|*.txt";
                exportFileName.replacedle = "Save exported GRBL Settings";
                exportFileName.FileName = "Exported_GRBL_Settings.txt";

                if (exportFileName.ShowDialog() == true)
                {
                    List<Tuple<int, double>> ToExport = new List<Tuple<int, double>>();
                    foreach (KeyValuePair<int, double> kvp in CurrentSettings)
                    {
                        ToExport.Add(new Tuple<int, double>(kvp.Key, kvp.Value));
                    }

                    using (StreamWriter sw = new StreamWriter(exportFileName.FileName))
                    {
                        sw.WriteLine("{0,-10} {1,-10} {2,-18} {3, -35}", "Setting", "Value", "Units", "Description");

                        foreach (Tuple<int, double> setting in ToExport)
                        // setting.Item1 = GRBL Code, setting.Item2 = Setting Value, Util.GrblCodeTranslator.Settings[setting.Item1].Item1 = Setting Description, Util.GrblCodeTranslator.Settings[setting.Item1].Item2 = Units
                        {
                            sw.WriteLine("{0,-10} {1,-10} {2,-18} {3, -35}", "$" + setting.Item1, setting.Item2.ToString(Util.Constants.DecimalOutputFormat), Util.GrblCodeTranslator.Settings[setting.Item1].Item2, Util.GrblCodeTranslator.Settings[setting.Item1].Item1);
                        }
                        MessageBox.Show("Settings Exported to " + exportFileName.FileName, "Exported GRBL Settings", MessageBoxButton.OK, MessageBoxImage.Information);
                    }
                }
            }
            else
            { // NO
                return;
            }
        }

19 View Source File : CustomChangeThemeModifier.cs
License : MIT License
Project Creator : ABTSoftware

private void Export(string filter, bool useXaml, Size? size = null)
        {
            var saveFileDialog = new SaveFileDialog
            {
                Filter = filter,
                InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
            };

            if (saveFileDialog.ShowDialog() == true)
            {
                if (!(ParentSurface is SciChartSurface surface)) return;

                var exportType = filter.ToUpper().Contains("XPS") ? ExportType.Xps : ExportType.Png;

                if (size.HasValue)
                {
                    surface.ExportToFile(saveFileDialog.FileName, exportType, useXaml, size.Value);
                }
                else
                {
                    surface.ExportToFile(saveFileDialog.FileName, exportType, useXaml);
                }

                try
                {
                    Process.Start(saveFileDialog.FileName);
                }
                catch (Win32Exception e)
                {
                    if (e.NativeErrorCode == 1155)
                    {
                        MessageBox.Show("Can't open because no application is replacedociated with the specified file for this operation.", "Exported successfully!");
                    }
                }
                
            }
        }

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private void InitializeDialogEditorButtonCommands() {
			editablePathEditor.ButtonCommand = new DelegateCommand<object>(p => {
				var propertyModel = p as IPropertyModel;
				if (propertyModel != null) {
					// Show a file open dialog
					var dialog = new OpenFileDialog();
					dialog.replacedle = "Select the file path";
					if (dialog.ShowDialog() == true) {
						// Update the property value
						propertyModel.Value = dialog.FileName;
					}
				}
			});

			readOnlyPathEditor.ButtonCommand = new DelegateCommand<object>(p => {
				var propertyModel = p as IPropertyModel;
				if (propertyModel != null) {
					// Show the path
					MessageBox.Show(propertyModel.Valuereplacedtring, "Property Value");
				}
			});

			uneditablePathEditor.ButtonCommand = editablePathEditor.ButtonCommand;
		}

19 View Source File : MainControl.xaml.cs
License : MIT License
Project Creator : Actipro

private void OnSaveToFileButtonClick(object sender, RoutedEventArgs e) {
			// Show a save dialog
			SaveFileDialog dialog = new SaveFileDialog();
			dialog.CheckPathExists = true;
			dialog.replacedle = "Save XPS Doreplacedent";
			dialog.FileName = "SyntaxEditorDoreplacedent.xps";
			dialog.Filter = "XPS files (*.xps)|*.xps";
			dialog.OverwritePrompt = true;
			if (dialog.ShowDialog() == true) {
				// Write the doreplacedent to an XPS file
				FixedDoreplacedent doreplacedent = editor.PrintSettings.CreateFixedDoreplacedent(editor);
				XpsDoreplacedent xpsd = new XpsDoreplacedent(dialog.FileName, FileAccess.Write);
				XpsDoreplacedentWriter xw = XpsDoreplacedent.CreateXpsDoreplacedentWriter(xpsd);
				xw.Write(doreplacedent);
				xpsd.Close();
			}
		}

19 View Source File : DLLForm.xaml.cs
License : GNU General Public License v3.0
Project Creator : AdhocAdam

private void btn_BrowsePIIRegexPath(object sender, RoutedEventArgs e)
        {
            //OpenFileDialog openFileDialog = new OpenFileDialog();
            Microsoft.Win32.OpenFileDialog openFileDialog = new Microsoft.Win32.OpenFileDialog();
            openFileDialog.Filter = "Text files (*.txt)|*.txt|All files (*.*)|*.*";
            if (openFileDialog.ShowDialog() == true)
            {
                txtPIIRegex.Text = openFileDialog.FileName;
            }
        }

See More Examples