private void btnInputFolder_Click(object sender, RoutedEventArgs e)
        {
            var fbd = new FolderBrowserDialog
            {
                SelectedPath =
                    Directory.Exists(txtInputFolder.Text)
                        ? txtInputFolder.Text
                        : VariousFunctions.GetApplicationLocation()
            };
            if (fbd.ShowDialog() != DialogResult.OK) return;

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

            var di = new DirectoryInfo(txtInputFolder.Text);
            FileInfo[] fis = di.GetFiles();
            foreach (
                FileInfo 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)
                });
            }
        }
Example #2
1
        private void BrowseClick(object sender, EventArgs e)
        {
            var browseDialog = new FolderBrowserDialog();

            if (browseDialog.ShowDialog() == DialogResult.OK)
                Directory.Text = browseDialog.SelectedPath;
        }
        private void button1_Click(object sender, EventArgs e)
        {
            // Der Dialog zur Auswahl eines beliebigen Log-Verzeichnisses wird angeboten.

            System.Windows.Forms.FolderBrowserDialog objDialog = new FolderBrowserDialog();
            objDialog.Description = "Wählen Sie ein Exportverzeichnis. \nDer Inhalt einer evtl. vorhandenen Datei wird überschrieben.";
            objDialog.SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);

            // Nur wenn in dem FolderBrowserDialog tatsächlich mit OK ein Pfad gewählt wurde,
            // kommt es zum Export.

            if (objDialog.ShowDialog() == DialogResult.OK)
            {
                // Export

                string exportverzeichnis = Path.Combine(objDialog.SelectedPath, "alias.csv");

                TextWriter tw = new StreamWriter(exportverzeichnis);

                for (int i = 0; i < Global.AliasMail.Count(); i++)
                {
                    tw.WriteLine("" + Global.AliasMail[i].Email + ", " + Global.AliasMail[i].Kürzel + ", " + Global.AliasMail[i].Name + ", " + Global.AliasMail[i].Alias1 + ", " + Global.AliasMail[i].Alias2 + ", " + Global.AliasMail[i].Alias3 + ", " + Global.AliasMail[i].Alias4 + "");
                }
                tw.Close();
            }
        }
Example #4
1
 private void btnExport_Click(object sender, EventArgs e)
 {
     FolderBrowserDialog fbd = new FolderBrowserDialog();
     DialogResult result = fbd.ShowDialog();
     if (result == DialogResult.Cancel) {
         //do nothing, cancel was clicked
     } else if (fbd.SelectedPath != null) {
         if (Directory.GetFiles(fbd.SelectedPath).Length == 0) {
             int count = 0;
             foreach (ListViewItem item in lvExport.Items) {
                 try {
                     string source = item.ImageKey + @"\" + item.SubItems[3].Text + ".jpg";
                     string destination = fbd.SelectedPath + @"\"
                         + item.SubItems[1].Text + "-"       //firstname
                         + item.Text + "-"                   //last name
                         + item.SubItems[2].Text + "-"       //grade
                         + item.SubItems[3].Text             //ID
                         + ".jpg";
                     File.Copy(source, destination);
                     count++;
                 } catch (Exception) {
                     //skip that one, probably an IOException due to file exists already
                     //HOWEVER, 2013-14 missed 1 file
                 }
             }
             MessageBox.Show("Copied " + count + " picture" + (count == 1 ? "." : "s."));
         } else {
             string error = "Files exist in the folder you selected.\n\nPlease create or select an empty folder and try again.";
             string caption = "Choose an Empty Folder";
             MessageBox.Show(error, caption, MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
Example #5
1
        private void btnNew_Click(object sender, EventArgs e)
        {
            // 获取文件夹绝对路径    显示在 txtbox 控件里

            System.Windows.Forms.FolderBrowserDialog folder = new System.Windows.Forms.FolderBrowserDialog();

            string StrFileName = "";
            // 获取文件和路径名 一起显示在 txtbox 控件里

            OpenFileDialog dialog = new OpenFileDialog();
            if (dialog.ShowDialog() == DialogResult.OK)
            {
                string SavePathFile = AppDomain.CurrentDomain.BaseDirectory + "\\image\\gdc" +DateTime.Now.ToString("yyyyMMddHHmmss")+ ".jpg";
                StrFileName = dialog.SafeFileName;
                if (File.Exists(SavePathFile))
                {
                    File.Delete(SavePathFile);
                } File.Copy( dialog.FileName,SavePathFile);
                if (!db.InsertH_Para("H_gdc", "gdc" + DateTime.Now.ToString("yyyyMMddHHmmss") + ".jpg", db.GetMaxID("gdc", "H_gdc")))
                {
                    MessageBox.Show("保存失败!"); return;
                }
                else
                {
                    MessageBox.Show("保存成功!");
                    ShowDt(PageInt);
                }
            }
        }
Example #6
1
        private void cmdBatch_Click(object sender, EventArgs e)
        {
            try
            {
                FolderBrowserDialog dlgFolder = new FolderBrowserDialog();

                dlgFolder.Description = "Batch files all image files from this folder.";

                if (dlgFolder.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    DirectoryInfo dirInfo = new DirectoryInfo(dlgFolder.SelectedPath.ToString());

                    FileInfo[] ImageFiles = dirInfo.GetFiles("*.jpg").Concat(dirInfo.GetFiles("*.jpeg")).Concat(dirInfo.GetFiles("*.png")).ToArray();

                    for (int i = 0; i < ImageFiles.Length; ++i)
                    {
                        FileInfo ImageFile = ImageFiles[i];
                        Bitmap ImageBitmap = new Bitmap(ImageFile.FullName);

                        ProcessImage(ImageBitmap);
                    }

                    MessageBox.Show("Image Files Process Completed", "Process Completed", MessageBoxButtons.OK);
                }
            }
            catch (Exception ex)
            {
                LogException(ex);
            }
        }
        public void Execute(IMenuCommand command)
        {
            IDiagram diagram = this.DiagramContext.CurrentDiagram;
            IModelStore modelStore = diagram.ModelStore;

            string SqlFile = @"C:\MyLoStore\MyLoStorePostgres.sql";
            string PythonFile = @"C:\MyLoStore\MyLoStore.py";

            FolderBrowserDialog openFolderDialog1 = new FolderBrowserDialog();
            openFolderDialog1.RootFolder = Environment.SpecialFolder.MyComputer;
            openFolderDialog1.Description =
                "Select the directory that you want to use for generated output";

            if (openFolderDialog1.ShowDialog() == DialogResult.OK)
            {
                string folderName = openFolderDialog1.SelectedPath;
                SqlFile = folderName + @"\MyLoStorePostgres.sql";
                PythonFile = folderName + @"\MyLoStore.py";

                using (StreamWriter fsSql = new StreamWriter(SqlFile, false))
                {
                    using (StreamWriter fsPy = new StreamWriter(PythonFile, false))
                    {

                        SQLWriter mySql = new SQLWriter(SQLGenerateRun.Postgres);
                        PythonClassWriter py = new PythonClassWriter();
                        SQLGenerator sqlGen = new SQLGenerator(fsSql, mySql, fsPy, py, modelStore);
                        sqlGen.GenerateMySQL();
                    }
                }
            }
        }
Example #8
1
 private void btnBrowser_Click(object sender, EventArgs e)
 {
     FolderBrowserDialog path = new FolderBrowserDialog();
     //path.RootFolder = Environment.SpecialFolder.;
     path.ShowDialog();
     txtFrom.Text = path.SelectedPath;
 }
 private void BtnExportAll_Click(object sender, System.EventArgs e)
 {
     using (FolderBrowserDialog browserDlg = new FolderBrowserDialog())
     {
         browserDlg.Description = "Export all files";
         if (browserDlg.ShowDialog() == DialogResult.OK)
         {
             foreach (OContainer.fileEntry file in container.content)
             {
                 string fileName = Path.Combine(browserDlg.SelectedPath, file.name);
                 string dir = Path.GetDirectoryName(fileName);
                 if (!Directory.Exists(dir)) Directory.CreateDirectory(dir);
                 if (file.loadFromDisk)
                 {
                     byte[] buffer = new byte[file.fileLength];
                     container.data.Seek(file.fileOffset, SeekOrigin.Begin);
                     container.data.Read(buffer, 0, buffer.Length);
                     File.WriteAllBytes(fileName, buffer);
                 }
                 else
                     File.WriteAllBytes(fileName, file.data);
             }
         }
     }
 }
 public CleaningInterface()
 {
     InitializeComponent();
     this.m_directoryBrowser = new FolderBrowserDialog();
     this.registry = Microsoft.Win32.Registry.LocalMachine.CreateSubKey(@"Software\FileNameCleaner");
     this.SetDirectory(this.LastDirectory);
 }
Example #11
1
 private void btnChooseDir_Click(object sender, RoutedEventArgs e)
 {
     var dialog = new FolderBrowserDialog();
     dialog.ShowDialog();
     if (dialog.SelectedPath.IsNullOrEmpty()) return;
     MainData.Path = dialog.SelectedPath;
 }
Example #12
1
 private void BrowseButtonOnClick(object sender, EventArgs eventArgs)
 {
     FolderBrowserDialog fbd = new FolderBrowserDialog();
     if (fbd.ShowDialog() == DialogResult.OK){
         textBox1.Text = fbd.SelectedPath;
     }
 }
Example #13
1
        public MainWindow()
        {
            InitializeComponent();
            openFolderDialog = new FolderBrowserDialog();
            openFolderDialog.Description = "Podaj katalog z przykładami";
            openFileDialog = new OpenFileDialog();
            openFileDialog.Filter = "*JPEG|*.jpg|Wszystkie pliki|*.*";
            openFileDialog.Title = "Podaj plik przeznaczony do rozponania";

            ojIterations = 10;
            iterationsText.Text = ojIterations.ToString();
            printLineDelegate = printByDispatcher;
            saveImagesDelegate = saveImages;
            createLearningExamplesDelegate = createLearningExamples;
            getFilesDelegate = getFiles;
            setExamplesDelegate = setExamples;
            OnStateChange = stateChange;
            OnReductionFinished = reductionFinished;
            OnReductionStarted = reductionStarted;
            files = null;
            learnButton.IsEnabled = false;
            compareButton.IsEnabled = false;
            outputDimension = 7;
            dimensionText.Text = outputDimension.ToString();

            dataBaseFileName = "C:\\database.db";
            dataBasePathText.Text = dataBaseFileName;
            getDataBaseFileNameDelegate += DBFN;

            examplesHeight = 0;
            examplesWidth = 0;
        }
Example #14
1
	private void btnBrowseDir_Click(object sender, RoutedEventArgs e) {
		var dialog = new FolderBrowserDialog {
			Description = "Select the directory containing PCSX2"
		};
		if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
			tbPcsx2Dir.Text = dialog.SelectedPath;
	}
Example #15
1
 private void button10_Click(object sender, EventArgs e)
 {
     FolderBrowserDialog dlg = new FolderBrowserDialog();
     dlg.SelectedPath = Application.StartupPath + "\\Output";
     dlg.ShowDialog();
     textBox8.Text = dlg.SelectedPath;
 }
	static void SetFolderBrowserProperties (SelectFileDialogData data, FolderBrowserDialog dialog)
	{
		if (!string.IsNullOrEmpty (data.Title))
			dialog.Description = data.Title;
		
		dialog.SelectedPath = data.CurrentFolder;
	}
        private void btnPackInputBrowse_Click(object sender, System.EventArgs e)
        {
            FolderBrowserDialog fbd = new FolderBrowserDialog();

            if (fbd.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                tbPackInput.Text = fbd.SelectedPath;
        }
 /// <summary>
 /// Constructor with dialog description</summary>
 /// <param name="description">Dialog description</param>
 public FolderBrowserDialogUITypeEditor(string description)
 {
     // create instance of editing control, 
     // resuse this instance for subsequence calls
     m_dialog = new FolderBrowserDialog();
     m_dialog.Description = description;
 }
        private void FolderStore_Click(object sender, RoutedEventArgs e)
        {
            FolderBrowserDialog FolderDialog = new FolderBrowserDialog();
            FolderDialog.ShowDialog();

            FolderSave = FolderDialog.SelectedPath;
        }
        private void BtnAdd_Click(object sender, EventArgs e)
        {
            var dialog =
                new FolderBrowserDialog
                    {
                        Description = "Select a folder",
                        RootFolder = Environment.SpecialFolder.Desktop,
                        ShowNewFolderButton = false
                    };
            if (dialog.ShowDialog(this) == DialogResult.OK)
            {
                var folder = dialog.SelectedPath;

                // Check for duplicates
                var bDuplicate = false;
                foreach (ListViewItem item in m_lstFolders.Items)
                {
                    if (string.Compare(folder, item.Text, StringComparison.OrdinalIgnoreCase) != 0)
                        continue;

                    bDuplicate = true;
                    break;
                }

                // Add item to ListView
                if (!bDuplicate)
                    m_lstFolders.Items.Add(folder);
            }
            dialog.Dispose();
        }
 public Settings()
 {
     InitializeComponent();
     steam_txb.Text = Properties.Settings.Default.steamDir;
     shortcut_txb.Text = Properties.Settings.Default.shortcutDir;
     fbd = new FolderBrowserDialog();
 }
Example #22
0
 private void btnSelectFolder_Click(object sender, EventArgs e)
 {
     FolderBrowserDialog dlg = new FolderBrowserDialog();
     if (dlg.ShowDialog(this) != DialogResult.OK)
         return;
     txtDestFolder.Text = dlg.SelectedPath;
 }
 private void browseButton_Click(object sender, EventArgs e)
 {
     FolderBrowserDialog folderDialog = new FolderBrowserDialog();
     DialogResult result = folderDialog.ShowDialog();
     if (result == DialogResult.OK)
         pathTextBox.Text = folderDialog.SelectedPath;
 }
 private void BtnBrowseFolder_Click(object sender, EventArgs e)
 {
     using (FolderBrowserDialog dlg = new FolderBrowserDialog())
     {
         if (dlg.ShowDialog() == DialogResult.OK) TxtOutFolder.Text = dlg.SelectedPath;
     }
 }
Example #25
0
        private void btn_New_Click(object sender, EventArgs e)
        {
            btn_New.Enabled = false;//将新建按钮设置为不可用
            ThreadPool.QueueUserWorkItem(//开始线程池
                (pp) =>
                {
                    object G_missing = System.Reflection.Missing.Value;
                    object G_str_path = System.Reflection.Missing.Value;
                    Word.Application G_wa = new Microsoft.Office.Interop.Word.Application();//创建应用程序对象
                    object P_obj = "Normal.dot";//定义文档模版

                    FolderBrowserDialog G_FolderBrowserDialog = new FolderBrowserDialog();
                    Word.Document P_wd = G_wa.Documents.Add(ref P_obj, ref G_missing, ref G_missing, ref G_missing);
                    G_str_path = string.Format(//计算文件保存路径
                        @"{0}\{1}",G_FolderBrowserDialog.SelectedPath,DateTime.Now.ToString("yyyy年M月d日h时s秒fff毫秒")+".doc"
                        );
                    P_wd.SaveAs(
                        ref G_str_path,
                        ref G_missing,ref G_missing,ref G_missing,ref G_missing,
                        ref G_missing,ref G_missing,ref G_missing,ref G_missing,
                        ref G_missing,ref G_missing,ref G_missing,ref G_missing,
                        ref G_missing,ref G_missing,ref G_missing
                        );

                    ((Word.Application)G_wa.Application).Quit(ref G_missing, ref G_missing, ref G_missing);
                    this.Invoke(
                        (MethodInvoker)(()=>
                            {
                                MessageBox.Show("Word文档已经建立!","提示!");
                                btn_diplay.Enabled = true;
                            }
                            )
                        );
                });
        }
Example #26
0
 private void Button_Select_Click(Object sender, RoutedEventArgs e)
 {
     using (var d = new FolderBrowserDialog()) {
         var r = d.ShowDialog();
         if (r == System.Windows.Forms.DialogResult.OK) FolderLocation.Text = d.SelectedPath;
     }
 }
Example #27
0
 private void BrowseSource_Click(object sender, EventArgs e)
 {
     FolderBrowserDialog dialog = new FolderBrowserDialog();
     dialog.SelectedPath = PushDestination.Text;
     if (dialog.ShowDialog() == DialogResult.OK)
         PushDestination.Text = dialog.SelectedPath;
 }
Example #28
0
        /// <summary>
        /// Opens a a FolderBrowserDialog with the path in "getter" preselected and 
        /// if the DialogResult.OK is returned uses "setter" to set the path
        /// </summary>
        /// <param name="getter"></param>
        /// <param name="setter"></param>
        public void ShowFolderBrowserDialogWithPreselectedPath(Func<string> getter, Action<string> setter)
        {
            string directoryInfoPath = null;
            try
            {
                directoryInfoPath = new DirectoryInfo(getter()).FullName;
            }
            catch (Exception)
            {
                // since the DirectoryInfo stuff is for convenience we swallow exceptions
            }

            using (var dialog = new FolderBrowserDialog
            {
                RootFolder = Environment.SpecialFolder.Desktop,
                // if we do not use the DirectoryInfo then a path with slashes instead of backslashes won't work
                SelectedPath = directoryInfoPath ?? getter()
            })
            {
                // TODO: do we need ParentForm or is "this" ok?
                if (dialog.ShowDialog(ParentForm) == DialogResult.OK)
                {
                    setter(dialog.SelectedPath);
                }
            }
        }
Example #29
0
        private void btnLoadData_Click(object sender, EventArgs e)
        {
            using (FolderBrowserDialog dlgFolder = new FolderBrowserDialog())
            {
                if (dlgFolder.ShowDialog() == DialogResult.OK)
                {

                    for (int i = 0; i < this.feretDataSet.faces.Rows.Count; i++)
                    {
                        this.feretDataSet.faces.Rows[i].Delete();

                    }

                    updateDatabase();

                    BackgroundWorker worker = new BackgroundWorker();
                    worker.WorkerReportsProgress = true;
                    worker.DoWork += new DoWorkEventHandler(worker_DoWork);
                    worker.ProgressChanged += new ProgressChangedEventHandler(worker_ProgressChanged);
                    worker.RunWorkerAsync(dlgFolder.SelectedPath);

                    lstInfo.Enabled = false;
                    //lstSelect.Enabled = false;
                    btnLoadData.Enabled = false;
                    btnSaveSetList.Enabled = false;
                    dataGridView1.Enabled = false;
                }

            }
        }
Example #30
0
        private void button2_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog folderBrowser = new FolderBrowserDialog();
            if (!String.IsNullOrEmpty(textBox2.Text))
            {
                folderBrowser.SelectedPath = textBox2.Text;
            }
            folderBrowser.ShowDialog();

            if (!String.IsNullOrEmpty(folderBrowser.SelectedPath))
            {
                listBox1.Items.Clear();
                textBox2.Text = folderBrowser.SelectedPath;

                DirectoryInfo directoryInfo = new DirectoryInfo(folderBrowser.SelectedPath);
                foreach (FileInfo fileInfo in directoryInfo.GetFiles())
                {
                    Console.WriteLine("Extension : " + fileInfo.Extension);
                    if (fileInfo.Extension.ToLower().Equals(".apk"))
                    {
                        listBox1.Items.Add(fileInfo);
                    }
                }
            }
        }