Beispiel #1
0
        public MainWindow()
        {
            Boolean bFirst = true;
            string sSelectedItem = "";

            InitializeComponent();

            //Open folder dialog
            System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
            fbd.Description = "Please, select the folder which contains your stock market data files.";
            System.Windows.Forms.DialogResult drResult = fbd.ShowDialog();
            sLocation = fbd.SelectedPath;

            while (fbd.SelectedPath == "")
            {
                fbd = new System.Windows.Forms.FolderBrowserDialog();
                fbd.Description = "You have to choose the folder which contains your stock market data files before you continue!";
                drResult = fbd.ShowDialog();
                sLocation = fbd.SelectedPath;
            }

            //Loading all .csv files into the combo box
            foreach (string stock in Directory.EnumerateFiles(fbd.SelectedPath, "*.csv"))
            {
                string stockName = stock.Substring(stock.LastIndexOf("\\") + 1, stock.Length - (stock.LastIndexOf("\\") + 1) - 4);
                cboStock.Items.Add(stockName);
                //Load the first file - optional...can work without setting the SelectedItem...everything below may be omitted
                if (bFirst)
                {
                    sSelectedItem = stockName;
                    bFirst = false;
                }
            }
            cboStock.SelectedItem = sSelectedItem;
        }
Beispiel #2
0
 private void Button_Click_1(object sender, RoutedEventArgs e)
 {
     var dialog = new System.Windows.Forms.FolderBrowserDialog();
     dialog.SelectedPath = Environment.CurrentDirectory;
     if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         workFolderTB.Text = dialog.SelectedPath;
 }
        private void btnInputFolder_Click(object sender, RoutedEventArgs e)
        {
            var fbd = new System.Windows.Forms.FolderBrowserDialog
                          {
                              SelectedPath =
                                  Directory.Exists(txtInputFolder.Text)
                                      ? txtInputFolder.Text
                                      : Helpers.VariousFunctions.GetApplicationLocation()
                          };
            if (fbd.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;

            GeneratorMaps.Clear();
            txtInputFolder.Text = fbd.SelectedPath;

            var di = new DirectoryInfo(txtInputFolder.Text);
            var fis = di.GetFiles("*.map");
            foreach (var fi in fis.Where(fi => !fi.Name.ToLower().StartsWith("campaign") && !fi.Name.ToLower().StartsWith("shared") && !fi.Name.ToLower().StartsWith("single_player_shared")))
            {
                GeneratorMaps.Add(new MapEntry
                                      {
                                          IsSelected = true,
                                          LocalMapPath = fi.FullName,
                                          MapName = fi.Name
                                      });
            }
        }
 private void BrowseFolder_Button_Click(object sender, RoutedEventArgs e)
 {
     var dialog = new System.Windows.Forms.FolderBrowserDialog();
     System.Windows.Forms.DialogResult result = dialog.ShowDialog();
     string FolderName = dialog.SelectedPath;
     SelectFolder(FolderName);
 }
        public static bool changeConfigFolder(Window parent, ASettings settings, string setting_name,
            string description, string error_message, Permissions required_permissions) {
            string old_path = settings.get(setting_name);
            string new_path = null;
            System.Windows.Forms.FolderBrowserDialog folderBrowser = new System.Windows.Forms.FolderBrowserDialog();
            folderBrowser.ShowNewFolderButton = true;
            folderBrowser.Description = description;
            folderBrowser.SelectedPath = old_path;
            bool try_again = false;
            do {
                if (folderBrowser.ShowDialog(GetIWin32Window(parent)) == System.Windows.Forms.DialogResult.OK) {
                    new_path = folderBrowser.SelectedPath;
                    if (PermissionsHelper.isReadable(new_path)) {
                        if (required_permissions < Permissions.Write 
                            ||PermissionsHelper.isWritable(new_path)) {

                                settings.set(setting_name, new_path);

                            return new_path != old_path;
                        } else {
                            folderBrowser.Description = error_message;
                            try_again = true;
                        }
                    } else {
                        folderBrowser.Description = error_message;
                        try_again = true;
                    }
                } else {
                    try_again = false;
                }
            } while (try_again);
            return false;
        }
        private void btnInputFolder_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
            if (Directory.Exists(txtInputFolder.Text))
                fbd.SelectedPath = txtInputFolder.Text;
            else
                fbd.SelectedPath = Helpers.VariousFunctions.GetApplicationLocation();
            if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                GeneratorMaps.Clear();
                txtInputFolder.Text = fbd.SelectedPath;

                DirectoryInfo di = new DirectoryInfo(txtInputFolder.Text);
                FileInfo[] fis = di.GetFiles("*.map");
                foreach (FileInfo fi in fis)
                {
                    GeneratorMaps.Add(new MapEntry()
                    {
                        IsSelected = true,
                        LocalMapPath = fi.FullName,
                        MapName = fi.Name
                    });
                }
            }
        }
Beispiel #7
0
        public static string BrowseForFolder(string startingPath)
        {
            string initialDirectory = _lastDirectory ?? startingPath;
            string ret = null;

            try
            {
                var cfd = new CommonOpenFileDialog
                {
                    InitialDirectory = initialDirectory,
                    IsFolderPicker = true
                };

                if (cfd.ShowDialog() == CommonFileDialogResult.Ok)
                {
                    ret = cfd.FileName;
                }
            }
            catch (System.PlatformNotSupportedException)
            {
                var fd = new System.Windows.Forms.FolderBrowserDialog
                {
                    SelectedPath = initialDirectory
                };

                if (fd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    ret = fd.SelectedPath;
                }
            }

            _lastDirectory = ret;
            return ret;
        }
 public object CreateControlWithOneTabPage(IDesignerHost host, object parameter)
 {
     // Tab Page
     NeoTabPage tabPage = (NeoTabPage)host.CreateComponent(typeof(NeoTabPage));
     tabPage.BackColor = System.Drawing.Color.Transparent;
     // Tab Control
     NeoTabWindow tabControl = (NeoTabWindow)parameter;
     tabControl.Controls.Add(tabPage);
     ((ISupportInitialize)tabControl).EndInit();
     using (System.Windows.Forms.FolderBrowserDialog fdialog =
         new System.Windows.Forms.FolderBrowserDialog())
     {
         fdialog.RootFolder = Environment.SpecialFolder.MyComputer;
         fdialog.Description = "Select application directory for control rendering.";
         fdialog.ShowNewFolderButton = false;
         if (fdialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             string rootFolder = System.IO.Directory.GetCurrentDirectory();
             System.IO.Directory.SetCurrentDirectory(fdialog.SelectedPath);
             // Shows a add-in model dialog box.
             tabControl.ShowAddInRendererManager();
             System.IO.Directory.SetCurrentDirectory(rootFolder);
         }
     }
     return parameter;
 }
        // method adds a folder into the location box, 
        // then adds all the erfs in all subfolders into the list of erfs
        private void viewFolderButton_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.FolderBrowserDialog browser = new System.Windows.Forms.FolderBrowserDialog();
            browser.ShowNewFolderButton = false;
            System.Windows.Forms.DialogResult result = browser.ShowDialog();
            if (result == System.Windows.Forms.DialogResult.OK)
            {
                //User clicked OK, add the path into the location box, try to add all the erfs in there too
                if (!ResourceManager.filePaths.Contains(browser.SelectedPath))
                {
                    ResourceManager.addFilePath(browser.SelectedPath);
                }
                locationListBox.Items.Add(browser.SelectedPath);

                foreach (String s in Directory.GetDirectories(browser.SelectedPath, "*", SearchOption.AllDirectories))
                {
                    if (!ResourceManager.filePaths.Contains(s))
                    {
                        //Add all the subdirectories
                        ResourceManager.addFilePath(s);
                    }
                }

                foreach (String t in Directory.GetFiles(browser.SelectedPath, "*.erf", SearchOption.AllDirectories))
                {
                    ResourceManager.addERF(t);
                }

            }
        }
        public UIElement CreateContent(string directoryName)
        {
            Grid grid_main = new Grid();
            grid_main.ColumnDefinitions.Add(new ColumnDefinition() { Width = new GridLength(100.0, GridUnitType.Star) });
            grid_main.ColumnDefinitions.Add(new ColumnDefinition() { Width = GridLength.Auto });

            m_textBox_directoryName = new TextBox();
            m_textBox_directoryName.TextChanged += (sender, args) => { DirectoryName = m_textBox_directoryName.Text; };
            m_textBox_directoryName.Text = directoryName;
            grid_main.SetGridRowColumn(m_textBox_directoryName, 0, 0);

            Button button_openFile = new Button() { Content = "Select directory ..." };
            button_openFile.Click += (x, y) =>
                {
                    System.Windows.Forms.FolderBrowserDialog selectDirectoryDialog =
                        new System.Windows.Forms.FolderBrowserDialog()
                        {
                            SelectedPath = directoryName
                        };
                    if (selectDirectoryDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        m_textBox_directoryName.Text = selectDirectoryDialog.SelectedPath;
                };
            grid_main.SetGridRowColumn(button_openFile, 0, 1);

            return grid_main;
        }
Beispiel #11
0
        private void MediaPlayer_VlcLibDirectoryNeeded(object sender, Vlc.DotNet.Forms.VlcLibDirectoryNeededEventArgs e)
        {
            var currentAssembly = Assembly.GetEntryAssembly();
            var currentDirectory = new FileInfo(currentAssembly.Location).DirectoryName;
            if (currentDirectory == null)
                return;
            if (AssemblyName.GetAssemblyName(currentAssembly.Location).ProcessorArchitecture == ProcessorArchitecture.X86)
                e.VlcLibDirectory = new DirectoryInfo(System.IO.Path.Combine(currentDirectory, @"vlc\x86\"));
            //e.VlcLibDirectory = new DirectoryInfo(currentDirectory);
            else
                e.VlcLibDirectory = new DirectoryInfo(System.IO.Path.Combine(currentDirectory, @"vlc\x64\"));
            //e.VlcLibDirectory = new DirectoryInfo(currentDirectory);

            if (!e.VlcLibDirectory.Exists)
            {
                var folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
                folderBrowserDialog.Description = "Select Vlc libraries folder.";
                folderBrowserDialog.RootFolder = Environment.SpecialFolder.Desktop;
                folderBrowserDialog.ShowNewFolderButton = true;
                if (folderBrowserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    e.VlcLibDirectory = new DirectoryInfo(folderBrowserDialog.SelectedPath);
                }
            }
        }
Beispiel #12
0
        private void FolderBrowserEditor_Loaded(object sender, RoutedEventArgs e)
        {
            FolderBrowserDialog folderBrowser;
            Popup parentPopup;

            Dictionary<string, string> settings;
            string setting;

            // Set up folder browser
            folderBrowser = new FolderBrowserDialog();
            folderBrowser.SelectedPath = GetCurrentParameterValue();

            // Parse folder browser parameters if they have been defined
            if ((object)m_connectionString != null)
            {
                settings = m_connectionString.ParseKeyValuePairs();

                if (settings.TryGetValue("description", out setting))
                    folderBrowser.Description = setting;

                if (settings.TryGetValue("showNewFolderButton", out setting))
                    folderBrowser.ShowNewFolderButton = setting.ParseBoolean();
            }

            // Show the browser and update the parameter
            if (folderBrowser.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                UpdateParameterValue(folderBrowser.SelectedPath);

            // Close the popup that contains this control
            parentPopup = GetParentPopup();

            if ((object)parentPopup != null)
                parentPopup.IsOpen = false;
        }
Beispiel #13
0
        protected override void OnStartup(StartupEventArgs e)
        {
            var prefs = IoC.Get<IAppPreferences>();

            prefs.Load();

            if (string.IsNullOrEmpty(prefs.DataStorePath))
            {
                System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
                fbd.Description = "Choose location for BrainLab data store.  The study database, subject files, and reports will be stored in this location.";

                // Show open file dialog box
                System.Windows.Forms.DialogResult result = fbd.ShowDialog();

                // Process open file dialog box results
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    prefs.DataStorePath = fbd.SelectedPath;
                }
                else
                    System.Windows.Application.Current.Shutdown();
            }

            base.OnStartup(e);
        }
Beispiel #14
0
 private void ButtonBrowse_Click(object sender, RoutedEventArgs e)
 {
     IntPtr mainWindowPtr = new System.Windows.Interop.WindowInteropHelper(this).Handle; // 'this' means WPF Window
     var folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
     if (folderBrowserDialog.ShowDialog(new OldWindow(mainWindowPtr)) == System.Windows.Forms.DialogResult.OK)
         FolderPath.Text = folderBrowserDialog.SelectedPath;
 }
        private string AskForInstallDirectory()
        {
            MessageBox.Show("Since this is the first time the Mod Manager has been run, you need to choose the directory that Cortex Command is installed to.", "First Time", MessageBoxButton.OK, MessageBoxImage.Information);

            while (true)
            {
                var browser = new System.Windows.Forms.FolderBrowserDialog();
                browser.Description = "Choose the install location for Cortex Command";
                browser.ShowNewFolderButton = false;
                browser.RootFolder = Environment.SpecialFolder.MyComputer;

                var result = browser.ShowDialog();

                if (result != System.Windows.Forms.DialogResult.OK)
                    return null; //The user cancelled the choosing.

                var installDirectory = browser.SelectedPath;

                if (CortexCommand.IsInstalledTo(installDirectory))
                    return installDirectory;

                MessageBox.Show("The directory you chose does not have a valid Cortex Command installation in it. Please choose the folder where Cortex Command is installed.",
                    "Incorrect Folder", MessageBoxButton.OK, MessageBoxImage.Exclamation);
            }
        }
 private void brouse_Click(object sender, RoutedEventArgs e)
 {
     dlg = new System.Windows.Forms.FolderBrowserDialog();
     result = dlg.ShowDialog(this.GetIWin32Window());
     if (result == System.Windows.Forms.DialogResult.OK)
         pathLabel.Content = dlg.SelectedPath;
 }
 private void SetMode()
 {
     if(IsFileSelector)
     {
         ButtonText = "\uF15C";
         ButtonCommand = new RelayCommand(() => 
         {
             var dlg = new OpenFileDialog();
             if (dlg.ShowDialog() == true)
             {
                 ConfigItemValue = dlg.FileName;
             }
         }, true);
     }
     else
     {
         ButtonText = "\uF07C";
         ButtonCommand = new RelayCommand(() =>
         {
             var dlg = new System.Windows.Forms.FolderBrowserDialog();
             dlg.ShowNewFolderButton = true;
             dlg.ShowDialog();
             if (!String.IsNullOrEmpty(dlg.SelectedPath))
             {
                 ConfigItemValue = dlg.SelectedPath;
             }
         }, true);
     }
 }
Beispiel #18
0
 protected bool addAltPath()
 {
     string new_path;
     System.Windows.Forms.FolderBrowserDialog folderBrowser = new System.Windows.Forms.FolderBrowserDialog();
     folderBrowser.ShowNewFolderButton = true;
     folderBrowser.Description = "Choose a new Alternative Install Path.";
     bool try_again = false;
     do {
         if(folderBrowser.ShowDialog(getWindow().GetIWin32Window())== System.Windows.Forms.DialogResult.OK) {
             new_path = folderBrowser.SelectedPath;
             if(PermissionsHelper.isReadable(new_path)) {
                 if(Core.settings.addAltPath(new_path)){
                     try_again = false;
                     return true;
                 }else {
                     MessageHandler.SendError("Duplication","The path you selected has already been added.");
                     try_again = true;
                 }
             } else {
                 MessageHandler.SendError("Can't Read Selected Folder","Due to permissions or something, MASGAU can't read the folder you selected.");
                 try_again = true;
             }
         } else {
             try_again = false;
         }
     } while(try_again);
     return false;
 }
		/// <summary>
		/// This method is required for Windows Forms designer support.
		/// Do not change the method contents inside the source code editor. The Forms designer might
		/// not be able to load this method if it was changed manually.
		/// </summary>
		private void InitializeComponent()
		{
			this.folderBrowserDialog1 = new System.Windows.Forms.FolderBrowserDialog();
			this.button1 = new System.Windows.Forms.Button();
			this.SuspendLayout();
			// 
			// folderBrowserDialog1
			// 
			this.folderBrowserDialog1.Description = "Chose monitor fodler";
			// 
			// button1
			// 
			this.button1.Location = new System.Drawing.Point(100, 54);
			this.button1.Name = "button1";
			this.button1.Size = new System.Drawing.Size(186, 78);
			this.button1.TabIndex = 0;
			this.button1.Text = "chose monitor folder";
			this.button1.UseVisualStyleBackColor = true;
			this.button1.Click += new System.EventHandler(this.Button1Click);
			// 
			// MainForm
			// 
			this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
			this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
			this.ClientSize = new System.Drawing.Size(396, 264);
			this.Controls.Add(this.button1);
			this.Name = "MainForm";
			this.Text = "LoseAV";
			this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainFormFormClosing);
			this.ResumeLayout(false);

		}
        private void AsymmetricCompare_Click(object sender, RoutedEventArgs e)
        {
            XElement parsedKey;
            try {
                parsedKey = XElement.Parse(rsaKey.Text);
            } catch (Exception ex) {
                MessageBox.Show("Couldn't parse public key: " + ex.Message);
                return;
            }

            var password = PromptPassword();
            if (password == null)
                return;
            var dialog = new System.Windows.Forms.FolderBrowserDialog {
                Description = "Select a directory that contains private keys.",
                SelectedPath = Path.Combine(App.SourceRoot, @"Config")
            };
            if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                return;
            var keyPath = Directory.EnumerateFiles(dialog.SelectedPath, "*.private-key")
                                .OrderByDescending(Path.GetFileName)
                                .FirstOrDefault(p => {
                                    using (var s = File.OpenRead(p))
                                    using (var rsa = KeyStorage.ReadKey(s, password))
                                        return XNode.DeepEquals(parsedKey, XElement.Parse(rsa.ToXmlString(false)));
                                });
            if (keyPath == null)
                MessageBox.Show(dialog.SelectedPath + " has no matching private keys.");
            else
                MessageBox.Show("The public key matches " + Path.GetFileName(keyPath));
        }
        public void Run()
        {
            System.Windows.Forms.FolderBrowserDialog folderDialog = new System.Windows.Forms.FolderBrowserDialog();
            folderDialog.ShowNewFolderButton = true;
            if (folderDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                WaitWindow waitWindow = new WaitWindow("Importing collection...");
                waitWindow.ShowDialog(this.ParentWindow, () =>
                {
                    try
                    {
                        using (DirectoryCollectionImporter importer = new DirectoryCollectionImporter(folderDialog.SelectedPath, this.CollectionManager))
                        {
                            importer.Import();
                        }
                    }
                    catch (Exception ex)
                    {
                        Utility.WriteToErrorLog("Error importing: " + ex.ToString());
                        MessageBox.Show("Error importing backup: " + ex.Message);
                    }

                    this.ParentWindow.Dispatcher.BeginInvokeAction(() =>
                    {
                        CollectionManagerGlobal.OnCollectionChanged();
                    });
                });
            }
        }
Beispiel #22
0
 private void btnNewBase_Click(object sender, RoutedEventArgs e)
 {
     string path;
     var dialog = new System.Windows.Forms.FolderBrowserDialog();
     System.Windows.Forms.DialogResult result = dialog.ShowDialog();
     if (result.ToString() == "OK")
     {
         path = dialog.SelectedPath;
     }
     else
         path = null;
     if (path != null)
     {
         try
         {
             DataBaseConfig.CreateNewDB(path);
         }
         catch (Exception ex)
         {
             MessageBox.Show("Ошибка создания базы!\n\n" + ex.Message);
             return;
         }
         MessageBox.Show("База успешно создана и подключена!!");
     }
 }
Beispiel #23
0
 public bool changeSyncPath()
 {
     string old_path = Core.settings.sync_path;
     string new_path = null;
     System.Windows.Forms.FolderBrowserDialog folderBrowser = new System.Windows.Forms.FolderBrowserDialog();
     folderBrowser.ShowNewFolderButton = true;
     folderBrowser.Description = "Choose where the saves will be synced.";
     folderBrowser.SelectedPath = old_path;
     bool try_again = false;
     do {
         if (folderBrowser.ShowDialog(this.GetIWin32Window()) == System.Windows.Forms.DialogResult.OK) {
             new_path = folderBrowser.SelectedPath;
             if (PermissionsHelper.isReadable(new_path)) {
                 if (PermissionsHelper.isWritable(new_path)) {
                     Core.settings.sync_path = new_path;
                     if (new_path != old_path)
                         Core.rebuild_sync = true;
                     return new_path != old_path;
                 } else {
                     this.displayError("Config File Error", "You don't have permission to write to the selected sync folder:" + Environment.NewLine + new_path);
                     try_again = true;
                 }
             } else {
                 this.displayError("Config File Error", "You don't have permission to read from the selected sync folder:" + Environment.NewLine + new_path);
                 try_again = true;
             }
         } else {
             try_again = false;
         }
     } while (try_again);
     return false;
 }
Beispiel #24
0
        private void btnSelectFiles_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
            System.Windows.Forms.DialogResult result = fbd.ShowDialog();

            tbSelectedPath.Text = fbd.SelectedPath;
        }
Beispiel #25
0
 public bool addSavePath(AWindow window)
 {
     string new_path;
     System.Windows.Forms.FolderBrowserDialog folderBrowser = new System.Windows.Forms.FolderBrowserDialog();
     folderBrowser.ShowNewFolderButton = true;
     folderBrowser.Description = Strings.GetLabelString("SelectAltPath");
     bool try_again = false;
     do {
         if (folderBrowser.ShowDialog(window.GetIWin32Window()) == System.Windows.Forms.DialogResult.OK) {
             new_path = folderBrowser.SelectedPath;
             if (PermissionsHelper.isReadable(new_path)) {
                 if (Core.settings.addSavePath(new_path)) {
                     try_again = false;
                     return true;
                 } else {
                     this.showTranslatedError("SelectAltPathDuplicate");
                     try_again = true;
                 }
             } else {
                 this.showTranslatedError("SelectAltPathDuplicate");
                 try_again = true;
             }
         } else {
             try_again = false;
         }
     } while (try_again);
     return false;
 }
 /// <summary>
 /// Brows Button Click
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void configButtonBrowsClick(object sender, System.Windows.RoutedEventArgs e)
 {
     this.configButtonBrows.IsEnabled = false;
     Mouse.OverrideCursor = Cursors.Wait; ;
     try
     {
         System.Windows.Forms.FolderBrowserDialog backupPathDialog = new System.Windows.Forms.FolderBrowserDialog();
         backupPathDialog.Description = "Select SQl Server DATA Folder";
         backupPathDialog.ShowNewFolderButton = false;
         if (backupPathDialog.ShowDialog().Equals(System.Windows.Forms.DialogResult.OK))
         {
             this.ConfigDataFolderPath.Text = backupPathDialog.SelectedPath;
             Properties.Settings.Default.SqlDataFolder=backupPathDialog.SelectedPath;
             Properties.Settings.Default.Save();
         }
     }
     catch (Exception error)
     {
         Mouse.OverrideCursor = null;
         DXMessageBox.Show(error.Message, CvVariables.ERROR_MESSAGES[0, 0], MessageBoxButton.OK, MessageBoxImage.Error);
     }
     finally
     {
         Mouse.OverrideCursor = null;
         this.configButtonBrows.IsEnabled = true;
     }
 }
        private void btnInputFolder_Click(object sender, RoutedEventArgs e)
        {
            var fbd = new System.Windows.Forms.FolderBrowserDialog
                          {
                              SelectedPath =
                                  Directory.Exists(txtInputFolder.Text)
                                      ? txtInputFolder.Text
                                      : Helpers.VariousFunctions.GetApplicationLocation()
                          };
            if (fbd.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;

            SelectedPlugins.Clear();
            txtInputFolder.Text = fbd.SelectedPath;

            var di = new DirectoryInfo(txtInputFolder.Text);
            var fis = di.GetFiles();
            foreach (var fi in fis.Where(fi => (fi.Name.EndsWith(".asc") || fi.Name.EndsWith(".alt") || fi.Name.EndsWith(".ent") || fi.Name.EndsWith(".xml")) && Path.GetFileNameWithoutExtension(fi.Name).Length == 4))
            {
                SelectedPlugins.Add(new PluginEntry
                                        {
                                            IsSelected = true,
                                            LocalMapPath = fi.FullName,
                                            PluginClassMagic = fi.Name.Remove(fi.Name.Length - 3)
                                        });
            }
        }
Beispiel #28
0
        //pull up the modal box to select directory on click
        private void btnDir3_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new System.Windows.Forms.FolderBrowserDialog();

            System.Windows.Forms.DialogResult result = dialog.ShowDialog();
            txt3.Text = dialog.SelectedPath;
        }
 public MainWindow()
 {
     InitializeComponent();
     myDataContext = new MyDataContext();
     folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
     this.DataContext = myDataContext;
     MinimizeToTray.Enable(this);
 }
Beispiel #30
0
        private void AddFileBatch_Click(object sender, RoutedEventArgs e)
        {
            if (isRunning())
            {
                return;
            }

            System.Windows.Forms.FolderBrowserDialog fb = new System.Windows.Forms.FolderBrowserDialog();
            fb.Description = "选择PDF目录";
            if (System.Windows.Forms.DialogResult.OK != fb.ShowDialog())
            {
                return;
            }

            DirectoryInfo TheFolder = new DirectoryInfo(fb.SelectedPath);

            foreach (FileInfo NextFile in TheFolder.GetFiles("*.pdf"))
            {
                InsertData(new PdfData(NextFile.FullName));
            }
            FlushDg();
        }
Beispiel #31
0
        private string GetFolderName()
        {
            string folder = null;

            if (!string.IsNullOrEmpty(Event.Instance.FilePath))
            {
                folder = Path.GetDirectoryName(Event.Instance.FilePath);
            }
            else
            {
                var dlg = new System.Windows.Forms.FolderBrowserDialog();
                dlg.Description         = "Choose a folder to save the scores";
                dlg.SelectedPath        = Environment.CurrentDirectory;
                dlg.ShowNewFolderButton = true;
                if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    folder = dlg.SelectedPath;
                }
            }

            return(folder);
        }
Beispiel #32
0
        private void btnBrowse_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.FolderBrowserDialog dlg = new System.Windows.Forms.FolderBrowserDialog();

            if (Directory.Exists(cboDestination.Text))
            {
                dlg.SelectedPath = cboDestination.Text;
            }
            else
            {
                dlg.SelectedPath = AppPaths.DownloadsFolder;
            }

            if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                if (!cboDestination.Items.Contains(dlg.SelectedPath))
                {
                    cboDestination.Items.Add(dlg.SelectedPath);
                }
                cboDestination.Text = dlg.SelectedPath;
            }
        }
 /// <summary>
 /// 保存
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btn_Save_Click(object sender, RoutedEventArgs e)
 {
     System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
     fbd.ShowDialog();
     if (fbd.SelectedPath == string.Empty)
     {
         return;
     }
     viewModel.SavePath = fbd.SelectedPath;
     viewModel.Model.ElementList.Clear();
     viewModel.Model.ImageFiles.Clear();
     foreach (UserControl fe in elementCanvas.Children)
     {
         SeatManage.ClassModel.DimensionalElement ucElement = new SeatManage.ClassModel.DimensionalElement();
         if (fe is MyUC.UC_Element)
         {
             ucElement = (fe as MyUC.UC_Element).viewModel.Model;
         }
         else if (fe is MyUC.UC_TextElement)
         {
             ucElement = (fe as MyUC.UC_TextElement).viewModel.Model;
         }
         SeatManage.ClassModel.DimensionalElement newElement = new SeatManage.ClassModel.DimensionalElement();
         newElement.Alignment  = ucElement.Alignment;
         newElement.Angle      = ucElement.Angle;
         newElement.FontColor  = ucElement.FontColor;
         newElement.FontSize   = ucElement.FontSize;
         newElement.Height     = ucElement.Height;
         newElement.ImageFile  = ucElement.ImageFile;
         newElement.Order      = ucElement.Order;
         newElement.PosintionX = ucElement.PosintionX;
         newElement.PosintionY = ucElement.PosintionY;
         newElement.Text       = ucElement.Text;
         newElement.Type       = ucElement.Type;
         newElement.Width      = ucElement.Width;
         viewModel.Model.ElementList.Add(newElement);
     }
     viewModel.Save();
 }
        private void buttonFolder_Click(object sender, RoutedEventArgs e)
        {
            var dialog = new System.Windows.Forms.FolderBrowserDialog();

            dialog.Description = "Select disk folder";
            if (textBoxFolder.Text != "")
            {
                dialog.SelectedPath = textBoxFolder.Text;
            }
            try
            {
                System.Windows.Forms.DialogResult result = dialog.ShowDialog();
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    textBoxFolder.Text = dialog.SelectedPath;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(this, ex.Message);
            }
        }
Beispiel #35
0
        private void btnAdd_Click(object sender, RoutedEventArgs e)
        {
            var folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();

            if (folderBrowserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                var newFolder = new Wox.Infrastructure.Storage.UserSettings.FolderLink()
                {
                    Path = folderBrowserDialog.SelectedPath
                };

                if (UserSettingStorage.Instance.FolderLinks == null)
                {
                    UserSettingStorage.Instance.FolderLinks = new List <FolderLink>();
                }

                UserSettingStorage.Instance.FolderLinks.Add(newFolder);
                UserSettingStorage.Instance.Save();
            }

            lbxFolders.Items.Refresh();
        }
Beispiel #36
0
        /// <summary>
        ///    Export Write Config
        /// </summary>
        //public static void WriteConfig(MainWindow mainwindow, MainViewModel vm, INIFile conf)
        //{

        //}



        // --------------------------------------------------------------------------------------------------------
        // --------------------------------------------------------------------------------------------------------
        // Control Methods
        // --------------------------------------------------------------------------------------------------------
        // --------------------------------------------------------------------------------------------------------

        // --------------------------------------------------
        // Custom Presets Folder Browser Dialog
        // --------------------------------------------------
        public static void CustomPresetsFolderBrowser()
        {
            var folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();

            System.Windows.Forms.DialogResult result = folderBrowserDialog.ShowDialog();

            // Popup Folder Browse Window
            if (result == System.Windows.Forms.DialogResult.OK)
            {
                // Display Folder Path in Textbox
                VM.ConfigureView.CustomPresetsPath_Text = folderBrowserDialog.SelectedPath;

                // Add backslash if missing
                VM.ConfigureView.CustomPresetsPath_Text = VM.ConfigureView.CustomPresetsPath_Text.TrimEnd('\\') + @"\";

                // -------------------------
                // Load Custom Presets
                // Refresh Presets ComboBox
                // -------------------------
                Profiles.LoadCustomPresets();
            }
        }
Beispiel #37
0
        public void AddPath(object sender, MouseButtonEventArgs e)
        {
            System.Windows.Forms.FolderBrowserDialog folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();
            folderBrowserDialog.Description         = "选择文件夹";
            folderBrowserDialog.ShowNewFolderButton = true;


            if (folderBrowserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK & !string.IsNullOrWhiteSpace(folderBrowserDialog.SelectedPath))
            {
                if (vieModel_Settings.ScanPath == null)
                {
                    vieModel_Settings.ScanPath = new ObservableCollection <string>();
                }
                if (!vieModel_Settings.ScanPath.Contains(folderBrowserDialog.SelectedPath))
                {
                    vieModel_Settings.ScanPath.Add(folderBrowserDialog.SelectedPath);
                }
            }

            //保存
            Jvedio.StaticClass.SavePathToConfig(vieModel_Settings.DataBase, vieModel_Settings.ScanPath.ToList());
        }
        // show screenshot of saved character sheet
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.FolderBrowserDialog SourceDialog = new System.Windows.Forms.FolderBrowserDialog();
            SourceDialog.RootFolder          = Environment.SpecialFolder.Desktop;
            SourceDialog.Description         = "     open     ";
            SourceDialog.ShowNewFolderButton = false;

            if (SourceDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                InputPath = SourceDialog.SelectedPath;
            }
            string outputPath = InputPath + "\\" + "window" + ".png";

            if (File.Exists(outputPath))
            {
                FinalPage.Source = (new ImageSourceConverter()).ConvertFromString(outputPath) as ImageSource;
            }
            else
            {
                Console.WriteLine("File Doesn't exists.");
            }
        }
        private void pushmap_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.FolderBrowserDialog openFileDlg = new System.Windows.Forms.FolderBrowserDialog();

            System.Windows.Forms.DialogResult result = openFileDlg.ShowDialog();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                string mapDir  = openFileDlg.SelectedPath;
                string mapName = System.IO.Path.GetDirectoryName(mapDir);
                statusblock.Text = mapName;
                mapName          = mapDir.Replace(mapName, "");
                statusblock.Text = mapName;
                mapName          = mapName.Replace("\\", "");
                statusblock.Text = mapName;


                ADBcommands adb = new ADBcommands();
                adb.PushMap(mapDir, mapName, statusblock);
                adb.adbKill();
            }
        }
Beispiel #40
0
        private void FolderMode_AddButton_Click(object sender, RoutedEventArgs e)
        {
            var folderBrowserDialog = new System.Windows.Forms.FolderBrowserDialog();


            if (folderBrowserDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                List <string> audioFileExtensionList = new List <string>()
                {
                    ".aif", ".cda", ".mid", ".midi", ".mp3", ".mpa", ".ogg", ".wav", ".wma", ".wpl", ".mp4"
                };
                string[] pathFiles = Directory.GetFiles(folderBrowserDialog.SelectedPath);
                foreach (var dir in pathFiles)
                {
                    var selectedFile = new FileInfo(dir);
                    if (audioFileExtensionList.Contains(selectedFile.Extension))
                    {
                        mPlayListArray.Add(new PlayList(selectedFile, false, mNotPlayingFileNameTextColor));
                    }
                }
            }
        }
Beispiel #41
0
        public static string BrowseDirectory(string currentValue)
        {
            try
            {
                System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
                var result = fbd.ShowDialog();

                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    return(fbd.SelectedPath);
                }
                else
                {
                    return(currentValue);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                return(currentValue);
            }
        }
Beispiel #42
0
        private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
        {
            var dirDialog = new System.Windows.Forms.FolderBrowserDialog
            {
                RootFolder = Environment.SpecialFolder.Desktop
            };
            var res = dirDialog.ShowDialog();

            if (res == System.Windows.Forms.DialogResult.OK)
            {
                if (sender is Button btn)
                {
                    var field = btn.Name;
                    var path  = dirDialog.SelectedPath;
                    if (path == null)
                    {
                        return;
                    }

                    switch (field)
                    {
                    case "Db":
                        _config.Set("dbDir", path);
                        DbTextBox.Text = path;
                        break;

                    case "Img":
                        _config.Set("imgDir", path);
                        ImgTextBox.Text = path;
                        break;

                    case "Report":
                        _config.Set("reportDir", path);
                        ReportTextBox.Text = path;
                        break;
                    }
                }
            }
        }
        private void ButtonChangeFolder_OnClick(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.FolderBrowserDialog Dialog = new System.Windows.Forms.FolderBrowserDialog();
            System.Windows.Forms.DialogResult        Result = Dialog.ShowDialog();

            if (Result.ToString() == "OK")
            {
                if (!IOHelper.CheckFolderPermission(Dialog.SelectedPath))
                {
                    MessageBox.Show("Don't have permission to access the selected folder.");
                    return;
                }

                if (Dialog.SelectedPath.Last() != '\\')
                {
                    Dialog.SelectedPath += '\\';
                }

                ButtonChangeFolder.Content = Dialog.SelectedPath;
                ButtonCreate.Visibility    = Visibility.Visible;
            }
        }
        private void cmdBrowseFolder_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                System.Windows.Forms.FolderBrowserDialog objDialog = new System.Windows.Forms.FolderBrowserDialog();
                objDialog.RootFolder = Environment.SpecialFolder.MyComputer;

                if (objDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    if (string.IsNullOrEmpty(objDialog.SelectedPath) == false)
                    {
                        TxtFilePath.Text    = objDialog.SelectedPath;
                        _objEntity.FilePath = objDialog.SelectedPath;
                    }
                }
            }
            catch (Exception ex)
            {
                Util.LogException(ex);
                new MessageBoxYesNo(ex.Message, false, true).ShowDialog();
            }
        }
Beispiel #45
0
        public static void ExportSelectedAccounts(List <Account> accounts)
        {
            var dialog = new System.Windows.Forms.FolderBrowserDialog();
            var result = dialog.ShowDialog();

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    var serializer = new XmlSerializer(accounts.GetType());
                    var sw         = new StreamWriter(dialog.SelectedPath + "\\info.dat");
                    serializer.Serialize(sw, accounts);
                    sw.Close();

                    MessageBox.Show("File exported to:\n" + dialog.SelectedPath);
                }
                catch (Exception m)
                {
                    MessageBox.Show(m.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }
Beispiel #46
0
        private void documentPathBrowseButton_Click()
        {
            TabItem selectedItem = ((TabItem)openedProjectTabControl.SelectedItem);
            Dictionary <string, FrameworkElement> auxiliaryRefs;

            openedProjectAuxiliaryStorage.TryGetValue(selectedItem.Uid, out auxiliaryRefs);

            var dlg = new System.Windows.Forms.FolderBrowserDialog();

            System.Windows.Forms.DialogResult result = dlg.ShowDialog();

            if (result == System.Windows.Forms.DialogResult.OK && !string.IsNullOrWhiteSpace(dlg.SelectedPath))
            {
                FrameworkElement outputDocPath;
                auxiliaryRefs.TryGetValue("outputDocPath", out outputDocPath);
                ((TextBox)outputDocPath).Text = dlg.SelectedPath;
            }
            else
            {
                InformDialogUtil.ShowWarning("Путь не указан.");
            }
        }
        private void btn_SetFolder_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();
            if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                txt_RootPath.Text = dialog.SelectedPath.ToString() + "\\server_root";

                DirectoryInfo di_ROOT = new DirectoryInfo(txt_RootPath.Text); //Create Directoryinfo value by sDirPath

                ShareFolderPermission(di_ROOT.FullName);                      // 공유 폴더로 만든다. [6/9/2014 Mark]

                if (di_ROOT.Exists == false)                                  //If New Folder not exits
                {
                    di_ROOT.Create();                                         //create Folder
                }
                CreateFolderStructure();                                      // 각 서브 폴더 구조 만들기 [7/18/2014 Mark_laptap]


                rkey.SetValue("PATH", txt_RootPath.Text.ToString());
                MessageBox.Show("초기화 성공.");
            }
        }
Beispiel #48
0
        public static string OpenDirectory()
        {
            var showAdvanced = Environment.OSVersion.Version.Major >= 6;

            if (showAdvanced)
            {
                var result = Win32Helper.VistaDialog.Show(new WindowInteropHelper(Us).Handle, null, "Select Directory");
                if (result.Result)
                {
                    return(result.FileName);
                }
            }
            else
            {
                var dialog = new System.Windows.Forms.FolderBrowserDialog();
                if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    return(dialog.SelectedPath);
                }
            }
            return(null);
        }
Beispiel #49
0
        private void BrowseGameDirButtonClicked(object sender, RoutedEventArgs e)
        {
            var button = (sender as Button);

            if (button == null)
            {
                return;
            }

            var tagValue        = (GameTypeEnum)button.Tag;
            var textBoxes       = FindVisualChildren <TextBox>(this.GetVisualChild(0));
            var matchingTextBox = textBoxes
                                  .Where(x => x.Tag != null)
                                  .FirstOrDefault(x => (GameTypeEnum)x.Tag == tagValue);

            if (matchingTextBox == null)
            {
                return;
            }

            using (var browserDialog = new System.Windows.Forms.FolderBrowserDialog())
            {
                if (Directory.Exists(matchingTextBox.Text))
                {
                    browserDialog.SelectedPath = matchingTextBox.Text;
                }

                var res = browserDialog.ShowDialog();
                if (res == System.Windows.Forms.DialogResult.OK)
                {
                    matchingTextBox.Text = browserDialog.SelectedPath;
                    if (_changedGameDirectories.Contains(tagValue))
                    {
                        return;
                    }
                    _changedGameDirectories.Add(tagValue);
                }
            }
        }
Beispiel #50
0
 private void CreateBillBtn_Click(object sender, RoutedEventArgs e)
 {
     if (EmployeesListView.SelectedItems.Count == 0)
     {
         MessageBox.Show(SalaryManagementSystem.Properties.Resources.SelectEmployeeMsg);
         return;
     }
     using (var fbd = new System.Windows.Forms.FolderBrowserDialog())
     {
         System.Windows.Forms.DialogResult result = fbd.ShowDialog();
         if (result == System.Windows.Forms.DialogResult.OK && !string.IsNullOrWhiteSpace(fbd.SelectedPath))
         {
             string targetFolderPath = fbd.SelectedPath;
             foreach (Employee employee in EmployeesListView.SelectedItems)
             {
                 this.CreateBill(employee, targetFolderPath);
             }
             System.Diagnostics.Process.Start(targetFolderPath);
             MessageBox.Show("Done!");
         }
     }
 }
        private void btnPath_Click(object sender, RoutedEventArgs e)
        {
            //FolderBrowserDialog
            System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();

            if (System.IO.Directory.Exists(GameSetting.Instance.UserFolder))
            {
                fbd.SelectedPath = GameSetting.Instance.UserFolder;
            }

            if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                tbPath.Text = fbd.SelectedPath;

                GameSetting.Instance.UserFolder = fbd.SelectedPath;

                Webb.Playbook.Data.Terminology.Instance.SetTermFilePath(GameSetting.Instance.UserFolder);

                this.DataContext = null;
                this.DataContext = Webb.Playbook.Data.Terminology.Instance;
            }
        }
Beispiel #52
0
 private void ButtonSelectKeyDirectory_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var dlg = new System.Windows.Forms.FolderBrowserDialog()
         {
             Description = Properties.Resources.LABEL_SELECT_KEY_DIRECTORY
         };
         if (Directory.Exists(textBoxKeyDirectory.Text))
         {
             dlg.SelectedPath = textBoxKeyDirectory.Text;
         }
         if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             textBoxKeyDirectory.Text = dlg.SelectedPath;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(string.Format(Properties.Resources.ERROR_OCCURRED_0, ex.Message), Title, MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
        private void mi_genKeyPair_Click(object sender, RoutedEventArgs e)
        {
            System.Windows.Forms.FolderBrowserDialog fbd = new System.Windows.Forms.FolderBrowserDialog();
            fbd.Description = FileEncryptor.Properties.Resources.DialogTitle_CreateKey;
            if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                string publicKeyPath  = System.IO.Path.Combine(fbd.SelectedPath, "publicKey.xml");
                string privateKeyPath = System.IO.Path.Combine(fbd.SelectedPath, "privateKey.xml");

                string publicKey;
                Encryptor.Encipher.GenerateRSAKeyPair(out publicKey, out string privateKey);
                using (StreamWriter sw = File.CreateText(publicKeyPath))
                {
                    sw.Write(publicKey);
                }

                using (StreamWriter sw = File.CreateText(privateKeyPath))
                {
                    sw.Write(privateKey);
                }
            }
        }
Beispiel #54
0
        /// <summary> コマンド実行<フォルダ選択ダイアログオープン> </summary>
        /// <param name="para"> パラメータ </param>
        private void _FolderBrowserDialogOpenExecute(string para)
        {
            var dialog = new System.Windows.Forms.FolderBrowserDialog();

            dialog.Description = string.Format("Selected Resource Directory : {0}", para);
            switch (para)
            {
            case "Timeline":

                if (Directory.Exists(this.CommonDataModel.PluginSettingsData.TimelineResourceDirectory))
                {
                    dialog.SelectedPath = this.CommonDataModel.PluginSettingsData.TimelineResourceDirectory;
                }

                if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                {
                    return;
                }

                this.CommonDataModel.PluginSettingsData.TimelineResourceDirectory = dialog.SelectedPath;

                break;

            case "Sound":

                if (Directory.Exists(this.CommonDataModel.PluginSettingsData.SoundResourceDirectory))
                {
                    dialog.SelectedPath = this.CommonDataModel.PluginSettingsData.SoundResourceDirectory;
                }

                if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                {
                    return;
                }

                this.CommonDataModel.PluginSettingsData.SoundResourceDirectory = dialog.SelectedPath;
                break;
            }
        }
 private void cmdDBDir_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         var fbd = new System.Windows.Forms.FolderBrowserDialog
         {
             Description = PNLang.Instance.GetCaptionText("choose_dir", "Choose directory")
         };
         if (txtDBDir.Text.Trim().Length > 0)
         {
             fbd.SelectedPath = txtDBDir.Text.Trim();
         }
         if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             txtDBDir.Text = fbd.SelectedPath;
         }
     }
     catch (Exception ex)
     {
         PNStatic.LogException(ex);
     }
 }
Beispiel #56
0
        void OpenTransferPathDialog(object sender, RoutedEventArgs e)
        {
            try
            {
                using (var dialog = new System.Windows.Forms.FolderBrowserDialog())
                {
                    dialog.Description  = "Choose your transfer folder. (f.e. '../DropBox/Rome')";
                    dialog.SelectedPath = cTransferTextBox.Text;

                    if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                    {
                        cTransferTextBox.Text     = dialog.SelectedPath;
                        Settings.LastTransferPath = dialog.SelectedPath;
                        Settings.Save();
                    }
                }
            }
            catch (Exception exc)
            {
                Debug.ShowException(exc);
            }
        }
Beispiel #57
0
        private void SelectFolder()
        {
            var folderDialog = new System.Windows.Forms.FolderBrowserDialog();

            if (Location != "Path not set.")
            {
                folderDialog.SelectedPath = Location;
            }
            var result = folderDialog.ShowDialog();

            switch (result)
            {
            case System.Windows.Forms.DialogResult.OK:
                var folder = folderDialog.SelectedPath;
                Location = folder;
                break;

            case System.Windows.Forms.DialogResult.Cancel:
            default:
                break;
            }
        }
Beispiel #58
0
 //-------------------------------------------_________________________________________________________________________________________________________________________________
 //OpenFolder
 // Used to reach the working folder, where attachments and reports are.
 private void WorkingFolder_Click(object sender, RoutedEventArgs e)
 {
     Logger.record("[WorkingFolder_Click]: Opening working directory", "SMWidget", "info");
     // If we didn't start the session, allow changing the folder.
     // If session started, can only open
     if (currentStage == sessionStartingStage.notes)
     {
         Logger.record("\t[WorkingFolder_Click]: Loading explorer to " + currentSession.workingDir, "SMWidget", "info");
         Process.Start(new ProcessStartInfo(currentSession.workingDir));
     }
     else
     {
         Logger.record("\t[WorkingFolder_Click]: Loading folder picker", "SMWidget", "info");
         System.Windows.Forms.FolderBrowserDialog folderPick = new System.Windows.Forms.FolderBrowserDialog();
         if (folderPick.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             Logger.record("\t\t[WorkingFolder_Click]: Folder picked, will set working folder", "SMWidget", "info");
             SetWorkingDir(folderPick.SelectedPath);
         }
     }
     e.Handled = true;
 }
Beispiel #59
0
 private void label_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
 {
     try
     {
         using (System.Windows.Forms.FolderBrowserDialog FBD = new System.Windows.Forms.FolderBrowserDialog())
         {
             FBD.SelectedPath        = PicPath;
             FBD.ShowNewFolderButton = false;
             FBD.Description         = "图片目录选择";
             if (FBD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
             {
                 DS = new System.Data.DataSet();
                 DS.ReadXml(AppPath + "\\ShowPic.Dat", System.Data.XmlReadMode.ReadSchema);
                 CheckPath(FBD.SelectedPath);
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 /// <summary>
 /// Opens a folder browser dialog and returns the selected folders.
 /// </summary>
 /// <param name="owner">The owner for the dialog.</param>
 /// <returns>A list with the selected folders.</returns>
 public static IList<string> GetFolders(Window owner)
 {
     if (CommonFileDialog.IsPlatformSupported)
     {
         using (var dialog = new CommonOpenFileDialog())
         {
             dialog.IsFolderPicker = true;
             dialog.Multiselect = true;
             var result = dialog.ShowDialog(owner);
             if (result == CommonFileDialogResult.Ok)
             {
                 return dialog.FileNames.ToList();
             }
         }
     }
     else
     {
         using (var dialog = new System.Windows.Forms.FolderBrowserDialog())
         {
             var result = owner is System.Windows.Forms.IWin32Window
                            ? dialog.ShowDialog((System.Windows.Forms.IWin32Window)owner)
                            : dialog.ShowDialog();
             if (result == System.Windows.Forms.DialogResult.OK)
             {
                 return new[] { dialog.SelectedPath };
             }
         }
     }
     return Enumerable.Empty<string>().ToList();
 }