Exemplo n.º 1
0
        private void GetOutputDirectory()
        {
            System.Windows.Forms.FolderBrowserDialog fbd = new FolderBrowserDialog();
            fbd.Description = "Select an output folder for the created classes.";
            fbd.ShowNewFolderButton = true;

            if (m_GuiDataLayerOutputDirectory.Text.Length == 0)
            {
                if (m_LastSelectedOutputdirectory.Length > 0)
                {
                    fbd.SelectedPath = m_LastSelectedOutputdirectory;
                }
            }
            else
            {
                fbd.SelectedPath = m_GuiDataLayerOutputDirectory.Text;
            }

            if (fbd.ShowDialog(this) == DialogResult.OK)
            {
                m_LastSelectedOutputdirectory = fbd.SelectedPath;
                m_GuiDataLayerOutputDirectory.Text = m_LastSelectedOutputdirectory;
            }

            fbd.Dispose();
        }
Exemplo n.º 2
0
        public static string LoadConfigInfo(string aGroupName, string aFieldName, string pathName)
        {
            string configPath = @".\Config.ini";

            if (!File.Exists(configPath))
            {
                File.Create(configPath).Dispose();
            }

            EasyConfig.ConfigFile configFile = new EasyConfig.ConfigFile(configPath);
            string _fieldName = configFile[aGroupName][aFieldName].AsString();

            if (string.IsNullOrEmpty(_fieldName))
            {
                System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog();
                dialog.Description  = "请选择" + pathName;
                dialog.SelectedPath = Application.StartupPath;
                if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    configFile[aGroupName].WriteSetting(aFieldName, dialog.SelectedPath);
                    configFile.Save(configPath);
                    dialog.Dispose();
                    return(configFile[aGroupName][aFieldName].AsString());
                }
            }
            return(_fieldName);
        }
Exemplo n.º 3
0
 // Opens browse dialgoue box for output path.
 private void button2_Click(object sender, RoutedEventArgs e)
 {
     var dialog = new System.Windows.Forms.FolderBrowserDialog();
     System.Windows.Forms.DialogResult result = dialog.ShowDialog();
     textBox3.Text = dialog.SelectedPath;
     dialog.Dispose();
 }
Exemplo n.º 4
0
 private void Button_OpenGame_Click(object sender, RoutedEventArgs e)
 {
     WinForm.FolderBrowserDialog dialog = new WinForm.FolderBrowserDialog();
     dialog.ShowDialog();
     TextBox_GamePath.Text = dialog.SelectedPath;
     dialog.Dispose();
 }
        private void button1_Click(object sender, EventArgs e)
        {
            if (subdivisions > 3)
            {
                if (MessageBox.Show("Warning: this will create " + Math.Pow(2,subdivisions * subdivisions) + " image icons.  Proceed?", "Warning!", MessageBoxButtons.OKCancel) != DialogResult.OK)
                {
                    return;
                }
            }
            try
            {
                FolderBrowserDialog fbd = new FolderBrowserDialog();
                fbd.Description = "Select the directory that you wish to create your icons in.";
                if (fbd.ShowDialog() == DialogResult.OK)
                {
                    directory = fbd.SelectedPath;

                }
                fbd.Dispose();
            }
            catch (ArgumentException err)
            {
                MessageBox.Show("There was an error.  " +
                    "Check the path.\r\nERROR:" + err.Message + " " + err.StackTrace);
            }
            CreateSilkScreenTiles();
        }
Exemplo n.º 6
0
        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();
        }
Exemplo n.º 7
0
        public static void ShowRefreshDialog(this Database d)
        {
            isRefreshing = true;
            var dialog = new winform.FolderBrowserDialog()
            {
                ShowNewFolderButton = false, SelectedPath = App.instance.path
            };

            while (true)
            {
                if (dialog.ShowDialog() == winform.DialogResult.OK)
                {
                    if (!d.Refresh(dialog.SelectedPath))
                    {
                        MessageBox.Show("Xảy ra lỗi ! Không có quyền truy cập thư mục !");
                        continue;
                    }

                    isRefreshing      = false;
                    App.instance.path = dialog.SelectedPath;
                    dialog.Dispose();
                    Watcher.okState = true;
                    Watcher.instance?.Dispose();
                    new Watcher();
                    MainWindow.instance.Close();
                    new MainWindow().Show();
                    return;
                }
            }
        }
Exemplo n.º 8
0
 private void btnBrowseModFolder_Click(object sender, EventArgs e)
 {
     FolderBrowserDialog fldrBrowserdlg = new FolderBrowserDialog();
     fldrBrowserdlg.ShowDialog();
     txtModDirectory.Text = fldrBrowserdlg.SelectedPath;
     fldrBrowserdlg.Dispose();
     settings.SaveSetting("ModDirectory", txtModDirectory.Text);
 }
 private void cmdFolder_Click(object sender, EventArgs e)
 {
     FolderBrowserDialog fbd = new FolderBrowserDialog();
     fbd.Description = "Select the Output Directory";
     fbd.SelectedPath = ".";
     fbd.ShowDialog(this);
     txtPath.Text = fbd.SelectedPath;
     fbd.Dispose();
 }
Exemplo n.º 10
0
 private void btnBrowseLocation_Click(object sender, EventArgs e)
 {
     FolderBrowserDialog dialog = new FolderBrowserDialog();
     if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         textLocation.Text = dialog.SelectedPath;
     }
     dialog.Dispose();
 }
Exemplo n.º 11
0
 private void buttonOpenDirectory_Click(object sender, EventArgs e)
 {
     var dialog = new FolderBrowserDialog();
     if (dialog.ShowDialog() == DialogResult.OK)
     {
         textBoxSaveDirectory.Text = dialog.SelectedPath;
     }
     dialog.Dispose();
 }
Exemplo n.º 12
0
 private void txtUrl_Click(object sender, EventArgs e)
 {
     FolderBrowserDialog fbd = new FolderBrowserDialog();
     if (fbd.ShowDialog() == DialogResult.OK)
     {
         txtUrl.Text = fbd.SelectedPath;
     }
     fbd.Dispose();
 }
Exemplo n.º 13
0
 private void OnClickBrowse(object sender, EventArgs e)
 {
     FolderBrowserDialog dialog = new FolderBrowserDialog();
     dialog.Description = "Select directory containing the map files";
     dialog.ShowNewFolderButton = false;
     if (dialog.ShowDialog() == DialogResult.OK)
         textBox1.Text = dialog.SelectedPath;
     dialog.Dispose();
 }
        private void btnBrowseDocument_Click(object sender, RoutedEventArgs e)
        {
            FolderBrowserDialog dialog = new FolderBrowserDialog();

            if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;
            string path = txtDirectory.Text = dialog.SelectedPath;

            dialog.Dispose();
        }
Exemplo n.º 15
0
 private void btnBrowse2_Click(object sender, RoutedEventArgs e)
 {
     var d = new FolderBrowserDialog();
     d.ShowNewFolderButton = true;
     d.ShowDialog();
     if(d.SelectedPath != null && !d.SelectedPath.Equals(""))
         txtManipulatedPath.Text = System.IO.Path.GetFullPath(d.SelectedPath);
     d.Dispose();
 }
Exemplo n.º 16
0
 private void directoryBrowse_Click(object sender, EventArgs e)
 {
     FolderBrowserDialog fbd = new FolderBrowserDialog();
     if (fbd.ShowDialog() == DialogResult.OK)
     {
         explorerText.Text = fbd.SelectedPath;
         fileBrowser.Url = new Uri(explorerText.Text);
     }
     fbd.Dispose();
 }
Exemplo n.º 17
0
 private void button2_Click(object sender, EventArgs e)
 {
     FolderBrowserDialog dd = new FolderBrowserDialog();
     dd.SelectedPath = this.LocalFilePath.Text.Trim();
     if (dd.ShowDialog() == DialogResult.OK)
     {
         this.LocalFilePath.Text = dd.SelectedPath;
     }
     dd.Dispose();
 }
Exemplo n.º 18
0
 public static string GetFolder(string title)
 {
     string result = "";
     FolderBrowserDialog d = new FolderBrowserDialog();
     d.Description = title;
     d.ShowNewFolderButton = true;
     if (d.ShowDialog() == DialogResult.OK) result = d.SelectedPath;
     d.Dispose(); d = null;
     return result;
 }
 private void cmdChooseDownloadDir_Click(object sender, EventArgs e)
 {
     FolderBrowserDialog theDialog = new FolderBrowserDialog();
     if (theDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         Properties.Settings.Default.DownloadDir = theDialog.SelectedPath;
         Properties.Settings.Default.Save();
     }
     theDialog.Dispose();
 }
Exemplo n.º 20
0
 private void btnPath_Click(object sender, EventArgs e)
 {
     using (FolderBrowserDialog dlg = new FolderBrowserDialog())
     {
         if (dlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
         {
             txtDownloadPath.Text = dlg.SelectedPath;
         }
         dlg.Dispose();
     }
 }
Exemplo n.º 21
0
 private void button2_Click(object sender, EventArgs e)
 {
     FolderBrowserDialog folderDia = new FolderBrowserDialog();
     folderDia.Description = "Please select the folder where you have extracted resource.dat to";
     folderDia.SelectedPath = Application.StartupPath;
     folderDia.ShowDialog();
     tbPathResources.Text = folderDia.SelectedPath;
     resPath = folderDia.SelectedPath;
     UpdatePaths();
     folderDia.Dispose();
 }
Exemplo n.º 22
0
 private void button_select_folder_Click(object sender, EventArgs e)
 {
     FolderBrowserDialog folderBrowserDialog1 = new FolderBrowserDialog();
     folderBrowserDialog1.RootFolder = Environment.SpecialFolder.Desktop;
     folderBrowserDialog1.SelectedPath = Cfg.image_folder;
     if (folderBrowserDialog1.ShowDialog() == DialogResult.OK)
     {
         Cfg.image_folder = folderBrowserDialog1.SelectedPath;
     }
     folderBrowserDialog1.Dispose();
 }
Exemplo n.º 23
0
 private void BTN_Browse_Click(object sender, RoutedEventArgs e)
 {
     WinForms.FolderBrowserDialog dialog = new WinForms.FolderBrowserDialog();
     if (dialog.ShowDialog() == WinForms.DialogResult.OK && dialog.SelectedPath.Length > 0)
     {
         _targetPath    = dialog.SelectedPath;
         TB_Target.Tag  = "OK";
         TB_Target.Text = dialog.SelectedPath;
     }
     dialog.Dispose();
 }
Exemplo n.º 24
0
 protected virtual void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (concreteFolderBrowserDialog != null)
         {
             concreteFolderBrowserDialog.Dispose();
             concreteFolderBrowserDialog = null;
         }
     }
 }
Exemplo n.º 25
0
        static void Main(string[] args)
        {
            string folder;

             if (args.Length == 0)
             {
            Console.WriteLine("For the future. Usage: WPConsoleTool.exe \"folder\\path\"\n");
            Console.WriteLine(" ");
            FolderBrowserDialog folderChooser = new FolderBrowserDialog() { Description = STR_PleaseChooseTheFolderYourPhonesImages, RootFolder = Environment.SpecialFolder.MyPictures, ShowNewFolderButton = false };
            folderChooser.ShowDialog();
            while (!Directory.Exists(folder = folderChooser.SelectedPath))
            {
               DialogResult res = MessageBox.Show("You must choose the folder with your phone's images. Would you like to try again?", "No folder selected", MessageBoxButtons.RetryCancel, MessageBoxIcon.Stop);

               if (res == DialogResult.Cancel)
               {
                  return;
               }

               folderChooser.ShowDialog();
            }

            folderChooser.Dispose();
             }
             else
             {
            folder = args[0];
             }

             WPPictureFolderFixer fixer = new WPPictureFolderFixer(folder);

             Console.WriteLine(STR_InstructionsAndOptionsPrompt);

             Console.Write("\n\nEnter an option (1 or 2): ");

             char key;
             while ((key = Char.ToUpper(Convert.ToChar(Console.Read()))) != CHAR_Option1 && key != CHAR_Option2) { }

             WPPictureFolderFixerResult result = null;
             try
             {
            result = fixer.Run(key == CHAR_Option1 ? true : false, Console.WriteLine);
             }
             catch (Exception e)
             {
            Console.WriteLine("FATAL ERROR! Please, see below:\n");
            Console.WriteLine(e);
            return;
             }

             Console.WriteLine(string.Format("\nOperation Complete!\n{0}", result));
             Console.WriteLine("Press any key to continue... ");
             Console.ReadKey();
        }
Exemplo n.º 26
0
 private void button1_Click(object sender, EventArgs e)
 {
     FolderBrowserDialog dialog = new FolderBrowserDialog
     {
         Description = "Select a modded gsc folder (pc format)"
     };
     if (dialog.ShowDialog() == DialogResult.OK)
     {
         mod_path = dialog.SelectedPath;
         textBox1.Text = mod_path;
     }
     dialog.Dispose();
 }
Exemplo n.º 27
0
        /// <summary>
        /// Invokes the action.
        /// </summary>
        /// <param name="parameter">The parameter to the action; but not used.</param>
        protected override void Invoke(object parameter)
        {
            WinForms.FolderBrowserDialog dialog = null;

            try
            {
                dialog = new WinForms.FolderBrowserDialog();

                dialog.Description         = this.Description;
                dialog.RootFolder          = this.RootFolder;
                dialog.SelectedPath        = this.SelectedPath;
                dialog.ShowNewFolderButton = this.ShowNewFolderButton;
                dialog.Site = this.Site;
                dialog.Tag  = this.Tag;

                var dialogResult = dialog.ShowDialog(new Win32Window(this.Owner));

                switch (dialogResult)
                {
                case WinForms.DialogResult.OK:
                    if (this.OkCommand != null)
                    {
                        var result = new FolderBrowserDialogActionResult(dialog.SelectedPath);
                        if (this.OkCommand.CanExecute(result))
                        {
                            this.OkCommand.Execute(result);
                        }
                    }

                    break;

                case WinForms.DialogResult.Cancel:
                    if (this.CancelCommand != null)
                    {
                        if (this.CancelCommand.CanExecute(null))
                        {
                            this.CancelCommand.Execute(null);
                        }
                    }

                    break;

                default:
                    throw new NotImplementedException("Should not reach here.");
                }
            }
            finally
            {
                dialog.Dispose();
            }
        }
Exemplo n.º 28
0
        // 出力パス参照
        private void buttonOutputRef_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog folderBrowserDialog = new FolderBrowserDialog();

            folderBrowserDialog.Description = "output path";
            folderBrowserDialog.RootFolder = System.Environment.SpecialFolder.MyComputer;
            folderBrowserDialog.SelectedPath = this.TextBoxOutputPath.Text;
            folderBrowserDialog.ShowNewFolderButton = true;
            if (folderBrowserDialog.ShowDialog() == DialogResult.OK)
            {
                this.TextBoxOutputPath.Text = folderBrowserDialog.SelectedPath;
            }
            folderBrowserDialog.Dispose();
        }
Exemplo n.º 29
0
 private void FileDialog(object sender, RoutedEventArgs e)
 {
     SWF.FolderBrowserDialog dialog = new SWF.FolderBrowserDialog();
     dialog.ShowNewFolderButton = true;
     dialog.Description         = "请选择输出路径";
     dialog.SelectedPath        = DirTextBox.Text;
     if (dialog.ShowDialog() == SWF.DialogResult.OK)
     {
         string foldPath = dialog.SelectedPath;
         DirTextBox.Text = foldPath;
         //SWF.MessageBox.Show("已选择文件夹:" + foldPath, "选择文件夹提示", SWF.MessageBoxButtons.OK, SWF.MessageBoxIcon.Information);
     }
     dialog.Dispose();
 }
Exemplo n.º 30
0
 /// <summary>
 /// Releases the unmanaged resources used by the <see cref="Creek.CoLFileDialogalog" /> and optionally releases the managed resources.
 /// </summary>
 /// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
 protected override void Dispose(bool disposing)
 {
     try
     {
         if (disposing && _downlevelDialog != null)
         {
             _downlevelDialog.Dispose();
         }
     }
     finally
     {
         base.Dispose(disposing);
     }
 }
Exemplo n.º 31
0
 private void renderEachChunkAsAnImageToolStripMenuItem_Click(object sender, EventArgs e) //Sounds Simple Enough...
 {
     using (System.Windows.Forms.FolderBrowserDialog dlg = new System.Windows.Forms.FolderBrowserDialog())
     {
         dlg.Description = "Select A Folder To Place The Chunks In";
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             if (LoadedChunkVer != (int)RSDKver.RSDK1)
             {
                 for (int i = 0; i < 512; i++)
                 {
                     if (LoadedChunkVer == (int)RSDKver.RSDK4)
                     {
                         Bitmap b;
                         b = Chunksv4.RenderChunk(i, Tiles);
                         b.Save(dlg.SelectedPath + "\\" + i + ".png");
                     }
                     if (LoadedChunkVer == (int)RSDKver.RSDK3)
                     {
                         Bitmap b;
                         b = Chunksv3.RenderChunk(i, Tiles);
                         b.Save(dlg.SelectedPath + "\\" + i + ".png");
                     }
                     if (LoadedChunkVer == (int)RSDKver.RSDK2)
                     {
                         Bitmap b;
                         b = Chunksv2.RenderChunk(i, Tiles);
                         b.Save(dlg.SelectedPath + "\\" + i + ".png");
                     }
                 }
             }
             else
             {
                 for (int i = 0; i < 256; i++)
                 {
                     if (LoadedChunkVer == (int)RSDKver.RSDK1)
                     {
                         Bitmap b;
                         b = Chunksv1.RenderChunk(i, Tiles);
                         b.Save(dlg.SelectedPath + "\\" + i + ".png");
                     }
                 }
             }
         }
         dlg.Dispose();
     }
 }
Exemplo n.º 32
0
 private void renderEachChunkAsAnImageToolStripMenuItem_Click(object sender, EventArgs e) //Sounds Simple Enough...
 {
     using (System.Windows.Forms.FolderBrowserDialog dlg = new System.Windows.Forms.FolderBrowserDialog())
     {
         dlg.Description = "Select A Folder To Place The Chunks In";
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             for (int i = 0; i < Chunks.MaxChunks; i++)
             {
                 Bitmap b;
                 b = Chunks.ChunkList[i].Render(Tiles);
                 b.Save(dlg.SelectedPath + "\\" + i + ".png");
             }
         }
         dlg.Dispose();
     }
 }
Exemplo n.º 33
0
		/// <summary>
		/// Scan selected directory
		/// </summary>
		private void TxBx_Loc_Click(object sender, EventArgs e)
		{
			FolderBrowserDialog fbd = new FolderBrowserDialog();
			fbd.RootFolder = Environment.SpecialFolder.Desktop;
			fbd.Description = "Select the directory you want to scan.";

			if (string.IsNullOrWhiteSpace(TxBx_Loc.Text) || !Directory.Exists(TxBx_Loc.Text))
				fbd.SelectedPath = Environment.CurrentDirectory;
			else
				fbd.SelectedPath = TxBx_Loc.Text;

			if (fbd.ShowDialog() == DialogResult.OK) {
				TxBx_Loc.Text = fbd.SelectedPath;
				TxBx_Loc.SelectionStart = TxBx_Loc.Text.Length;
				TryScan();
			}
			fbd.Dispose();
			LV_Found.Select();
		}
Exemplo n.º 34
0
        public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value)
        {
            if (context == null || provider == null || context.Instance == null)
            {
                return base.EditValue(provider, value);
            }

            FolderBrowserDialog pathDlg = new FolderBrowserDialog();
            pathDlg.Description =  "Select " + context.PropertyDescriptor.DisplayName;
            pathDlg.ShowNewFolderButton = true;
            pathDlg.SelectedPath = (string)value;

            if (pathDlg.ShowDialog() == DialogResult.OK)
            {
                value = pathDlg.SelectedPath;
            }
            pathDlg.Dispose();
            return value;
        }
Exemplo n.º 35
0
        private void HotPathButton_DoubleClick(object sender, EventArgs e)
        {
            // open menu to change hotpath
            FolderBrowserDialog f = new FolderBrowserDialog();
            DialogResult result = f.ShowDialog();
            Debug.WriteLine(result.ToString());
            if (result != DialogResult.OK)
            {
                return;
            }

            DirectoryInfo di = new DirectoryInfo(f.SelectedPath);
            hotPath = di;

            Debug.WriteLine(f.SelectedPath);
            //hotPathString = f.SelectedPath;

            f.Dispose();
        }
Exemplo n.º 36
0
        public void GetDirectoryPath()
        {
            WinForms.FolderBrowserDialog fbd = new WinForms.FolderBrowserDialog();
            fbd.RootFolder = Environment.SpecialFolder.MyComputer;
            var result = fbd.ShowDialog();

            if (result == WinForms.DialogResult.OK)
            {
                DirPath = fbd.SelectedPath;
                if (!Directory.Exists(fbd.SelectedPath))
                {
                    MessageBox.Show("Invalid path: directory does not exist.");
                }
                else
                {
                    UpdateList(Directory.GetFiles(fbd.SelectedPath));
                }
            }
            fbd.Dispose();
        }
Exemplo n.º 37
0
        /// <summary>
        /// Fired upon pressing Create Local Repository.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnCreateLocalRepository(object sender, RoutedEventArgs e)
        {
            var dialog = new WinForms.FolderBrowserDialog
            {
                Description = "Create and choose the folder for your new repository."
            };

            dialog.ShowDialog();

            // Open the selected folder if possible.
            if (!String.IsNullOrEmpty(dialog.SelectedPath))
            {
                LibGit2Sharp.Repository.Init(dialog.SelectedPath).Dispose();

                if (OpenNewRepository(dialog.SelectedPath) == false)
                    MessageBox.Show(String.Format("Something went wrong with the creation of the new repository. Try again."));
            }

            dialog.Dispose();
        }
Exemplo n.º 38
0
        /// <summary>
        /// Fired upon pressing Open Local Repository.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnOpenLocalRepository(object sender, RoutedEventArgs e)
        {
            var dialog = new WinForms.FolderBrowserDialog
            {
                ShowNewFolderButton = false
            };

            dialog.ShowDialog();

            // Open the selected repository, if possible.
            if (!String.IsNullOrEmpty(dialog.SelectedPath))
            {
                if (OpenNewRepository(dialog.SelectedPath) == false)
                {
                    MessageBox.Show(String.Format("Could not open \"{0}\". Are you sure it is an existing Git repository?", dialog.SelectedPath));
                }
            }

            dialog.Dispose();
        }
Exemplo n.º 39
0
        /// <summary>
        /// Fired upon pressing Create Local Repository.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnCreateLocalRepository(object sender, RoutedEventArgs e)
        {
            var dialog = new WinForms.FolderBrowserDialog
            {
                Description = "Create and choose the folder for your new repository."
            };

            dialog.ShowDialog();

            // Open the selected folder if possible.
            if (!String.IsNullOrEmpty(dialog.SelectedPath))
            {
                LibGit2Sharp.Repository.Init(dialog.SelectedPath).Dispose();

                if (OpenNewRepository(dialog.SelectedPath) == false)
                {
                    MessageBox.Show(String.Format("Something went wrong with the creation of the new repository. Try again."));
                }
            }

            dialog.Dispose();
        }
Exemplo n.º 40
0
 /// <summary>
 /// Browse for the output folder
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnBrowse_Click(object sender, EventArgs e)
 {
     try
     {
         FolderBrowserDialog folder = new FolderBrowserDialog();
         DialogResult result = folder.ShowDialog();
         if (result == DialogResult.OK)
         {
             Option opt = new Option();
             if (opt.setValue("basePath", folder.SelectedPath + "\\"))
             {
                 txtBasePath.Text = folder.SelectedPath + "\\";
             }
         }
         folder.Dispose();
         folder = null;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "WinStruct", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 41
0
        private void buttonBrowser_Click(object sender, EventArgs e)
        {
            Button element = sender as Button;
            if (element == null)
                return;

            int mapnum = (element == buttonBrowser0) ? 0 : (element == buttonBrowser1) ? 1 : (element == buttonBrowser2) ? 2 : (element == buttonBrowser3) ? 3 : (element == buttonBrowser4) ? 4 : -1;
            if (mapnum < 0)
                return;

            TextBox textBox = (mapnum == 0) ? textBoxPath0 : (mapnum == 1) ? textBoxPath1 : (mapnum == 2) ? textBoxPath2 : (mapnum == 3) ? textBoxPath3 : (mapnum == 4) ? textBoxPath4 : null;

            if(mapnum != 0)
            {
                OpenFileDialog dialog = new OpenFileDialog();
                dialog.Multiselect = false;
                dialog.Title = "Выбирите *.mul файл";
                dialog.CheckFileExists = true;
                dialog.Filter = "map files|map*.mul|staidx files|staidx*.mul|statics files|statics*.mul|All mul files(*.mull)|*.mul";
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    if (!File.Exists(dialog.FileName))
                        return;
                    textBox.Text = dialog.FileName;
                }
                dialog.Dispose();
            }
            else
            {
                FolderBrowserDialog dialog = new FolderBrowserDialog();
                dialog.Description = "Выбирите *.mul файл";
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    textBox.Text = dialog.SelectedPath;
                }
                dialog.Dispose();
            }
        }
Exemplo n.º 42
0
        void SetPath_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog f = new FolderBrowserDialog();

            if (f.ShowDialog() == DialogResult.OK)
            {
                Path.Text = f.SelectedPath;
                p.tipok.SetToolTip(SetPath, "Установить путь\r\nТекущий путь : "+Path.Text);
            }

            f.Dispose();
        }
Exemplo n.º 43
0
        private void GetMonitorFolder()
        {
            try
            {
                FolderBrowserDialog dlgFolder = new FolderBrowserDialog();

                dlgFolder.Description = "Folder you wquld like to monitor.";

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

                    if (msMonitorFolder.ToLower() == msSaveFolder.ToLower())
                    {
                        msMonitorFolder = "";
                        this.lblMonitorFolder.Text = "No folder selected.";
                        MessageBox.Show("The folder to monitor cannot be the same folder where the images are saved.  Please select another folder.",
                            "Monitor Folder Issue",
                            MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                    else
                    {
                        SaveSetting("MonitorFolder", msMonitorFolder);
                        this.lblMonitorFolder.Text = msMonitorFolder;

                        if (FolderWatcher != null)
                        {
                            FolderWatcher.Path = msMonitorFolder;
                        }
                    }
                }

                dlgFolder.Dispose();
            }
            catch (Exception ex)
            {
                LogException(ex);
            }
        }
Exemplo n.º 44
0
 public void Dispose()
 {
     fileDialog.Dispose();
     folderDialog.Dispose();
 }
Exemplo n.º 45
0
        /// <summary>
        /// Copy the changed files to a selected folder.
        /// </summary>
        /// <param name="baseFolder">The base parent folder the files are in.</param>
        /// <param name="fileList">The list of files to copy.</param>
        /// <param name="destination">The resulting base path files were saved to.</param>
        public void CopyFiles(string baseFolder, IEnumerable <ChangedFile> fileList, out string destination)
        {
            List <string> errorList = new List <string>();

            WF.FolderBrowserDialog fbd = new WF.FolderBrowserDialog();
            destination = "";

            try
            {
                if (!string.IsNullOrEmpty(Properties.Settings.Default.LastCopied))
                {
                    if (Directory.Exists(Properties.Settings.Default.LastCopied))
                    {
                        fbd.SelectedPath = Properties.Settings.Default.LastCopied;
                    }
                }

                fbd.ShowNewFolderButton = true;
                var dr = fbd.ShowDialog();

                switch (dr)
                {
                case WF.DialogResult.OK:
                case WF.DialogResult.Yes:
                    // Save selected folder as most recent directory.
                    Properties.Settings.Default.LastCopied = fbd.SelectedPath;
                    Properties.Settings.Default.Save();

                    // Create folder using reverse date format for final folder.
                    var now = DateTime.Now;
                    destination = Path.Combine(fbd.SelectedPath,
                                               string.Format("{0}-{1}-{2}",
                                                             now.Year,
                                                             now.Month < 10 ? "0" + now.Month.ToString() : now.Month.ToString(),
                                                             now.Day < 10 ? "0" + now.Day.ToString() : now.Day.ToString()));

                    // Check if folder already exists and if so append an index number.
                    int    idx       = 2;
                    string checkName = destination;
                    while (Directory.Exists(checkName))
                    {
                        checkName = string.Format("{0}-{1}", destination, idx++);
                    }
                    destination = checkName;

                    // Copy files.
                    foreach (var file in fileList)
                    {
                        try
                        {
                            if (!file.Exists)
                            {
                                string errorReason = "File does not exist";
                                errorList.Add(Environment.NewLine);
                                errorList.Add("Could not copy file: " + file.FullPath);
                                errorList.Add("Reason: " + errorReason);
                                errorList.Add(Environment.NewLine);
                                continue;
                            }
                            string directory = file.File.Directory.FullName.Replace(baseFolder, "").TrimStart('\\');
                            string copyDir   = Path.Combine(@"\\?\", destination, directory);

                            CreateDirectoryStructure(new DirectoryInfo(copyDir));

                            file.Copy(Path.Combine(copyDir, file.Name), true);
                        }
                        catch (Exception ex)
                        {
                            OnMessageRaised(ex.Message);

                            errorList.Add(Environment.NewLine);
                            errorList.Add("EXCEPTION: " + file.FullPath);
                            errorList.Add("Reason: " + ex.Message);
                            errorList.Add(Environment.NewLine);
                        }
                    }

                    if (errorList.Count > 0)
                    {
                        try
                        {
                            string errorPath = Path.Combine(destination, "errors.txt");
                            System.IO.File.WriteAllLines(errorPath, errorList);
                        }
                        catch
                        {
                        }
                    }

                    break;

                case WF.DialogResult.No:
                case WF.DialogResult.Cancel:
                default:
                    break;
                }
            }
            finally
            {
                fbd.Dispose();
            }
        }
Exemplo n.º 46
0
 public void Dispose()
 {
     _folderBrowserDialog.Dispose();
 }