public string GetFolderPath() { _folderName = (System.IO.Directory.Exists(_folderName)) ? _folderName : ""; Ionic.Utils.FolderBrowserDialogEx folderBrowserDialogEx = new Ionic.Utils.FolderBrowserDialogEx { Description = "Select a folder:", ShowNewFolderButton = true, ShowEditBox = true, //NewStyle = false, SelectedPath = _folderName, ShowFullPathInEditBox = false }; folderBrowserDialogEx.RootFolder = System.Environment.SpecialFolder.MyComputer; DialogResult result = folderBrowserDialogEx.ShowDialog(); if (result == DialogResult.OK) { return(folderBrowserDialogEx.SelectedPath); } return(string.Empty); }
public string GetFolderPath() { _folderName = (System.IO.Directory.Exists(_folderName)) ? _folderName : ""; Ionic.Utils.FolderBrowserDialogEx folderBrowserDialogEx = new Ionic.Utils.FolderBrowserDialogEx { Description = "Select a folder:", ShowNewFolderButton = true, ShowEditBox = true, //NewStyle = false, SelectedPath = _folderName, ShowFullPathInEditBox = false }; folderBrowserDialogEx.RootFolder = System.Environment.SpecialFolder.MyComputer; DialogResult result = folderBrowserDialogEx.ShowDialog(); if (result == DialogResult.OK) { return folderBrowserDialogEx.SelectedPath; } return string.Empty; }
private void btn_Output_Click(object sender, EventArgs e) { //For output Directory var dialogBox = new Ionic.Utils.FolderBrowserDialogEx(); if (System.IO.Directory.Exists(txtBox_Input.Text)) { dialogBox.SelectedPath = txtBox_Input.Text; } dialogBox.Description = "Select an output destination."; dialogBox.ShowNewFolderButton = true; dialogBox.ShowEditBox = true; //dialogBox.SelectedPath = txtBox_Output.Text; dialogBox.ShowFullPathInEditBox = true; dialogBox.RootFolder = System.Environment.SpecialFolder.MyComputer; System.Windows.Forms.DialogResult result = dialogBox.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { txtBox_Output.Text = dialogBox.SelectedPath; } if (txtBox_Input.Text == "") { lbl_Progress.Text = "Waiting on input path..."; lbl_Progress.Update(); } else { lbl_Progress.Text = "Waiting to start extraction..."; lbl_Progress.Update(); } dialogBox = null; }
private void bBrowse_Click(object sender, EventArgs e) { //FolderBrowserDialog fbd = new FolderBrowserDialog(); using (var dialogue = new Ionic.Utils.FolderBrowserDialogEx()) { dialogue.Description = "Select a directory:"; dialogue.ShowNewFolderButton = false; dialogue.ShowEditBox = true; if (!string.IsNullOrEmpty(BindFileConfig.Instance.FolderPath) && Directory.Exists(BindFileConfig.Instance.FolderPath)) { dialogue.SelectedPath = BindFileConfig.Instance.FolderPath; } dialogue.ShowFullPathInEditBox = true; dialogue.RootFolder = System.Environment.SpecialFolder.MyComputer; DialogResult dr = dialogue.ShowDialog(); if (dr == DialogResult.OK) { //txtFolder.Text = fbd.SelectedPath; BindFileConfig.Instance.FolderPath = dialogue.SelectedPath; BindFileConfig.Instance.Save(); } } LoadUI(); }
private void UpdatePath_OnClick(object sender, RoutedEventArgs e) { try { var dlg1 = new Ionic.Utils.FolderBrowserDialogEx { Description = "Select a folder:", ShowNewFolderButton = true, ShowEditBox = true, SelectedPath = ProductUpdateSource.Text, ShowFullPathInEditBox = true, RootFolder = System.Environment.SpecialFolder.MyComputer }; //dlg1.NewStyle = false; // Show the FolderBrowserDialog. var result = dlg1.ShowDialog(); if (result == DialogResult.OK) { ProductUpdateSource.Text = dlg1.SelectedPath; } } catch (Exception ex) { LogErrorMessage(ex); } }
private void openButtonClick(object sender, EventArgs e) { var dlg1 = new Ionic.Utils.FolderBrowserDialogEx(); dlg1.Description = "Select a file or folder"; dlg1.ShowNewFolderButton = true; dlg1.ShowEditBox = true; dlg1.ShowBothFilesAndFolders = true; dlg1.ShowFullPathInEditBox = true; dlg1.RootFolder = System.Environment.SpecialFolder.MyComputer; // Show the FolderBrowserDialog. DialogResult result = dlg1.ShowDialog(); if (result == DialogResult.OK) { var path = dlg1.SelectedPath; if (Directory.Exists(dlg1.SelectedPath)) { MessageBox.Show("Directory selected: " + dlg1.SelectedPath); } else { MessageBox.Show("File selected: " + dlg1.SelectedPath); } } }
void AddFolder(NodeStore Store) { if (PlatformDetection.IsWindows) { using (Ionic.Utils.FolderBrowserDialogEx dialog = new Ionic.Utils.FolderBrowserDialogEx()) { dialog.Description = "Choose the Folder to scan."; dialog.ShowNewFolderButton = false; dialog.ShowFullPathInEditBox = true; if (dialog.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (!String.IsNullOrWhiteSpace(dialog.SelectedPath)) { try { Store.AddNode(new StringNode() { Value = new System.IO.DirectoryInfo(dialog.SelectedPath).FullName }); } catch (Exception ex) { MessageBox.Show(ex.Message); } } } } } else { using (Gtk.FileChooserDialog fc = new Gtk.FileChooserDialog("Choose the Folder to scan.", this, FileChooserAction.SelectFolder, "Cancel", ResponseType.Cancel, "Open", ResponseType.Accept)) { fc.LocalOnly = false; if (fc.Run() == (int)ResponseType.Accept) { try { Store.AddNode(new StringNode() { Value = new System.IO.DirectoryInfo(fc.Filename).FullName }); } catch (Exception ex) { MessageBox.Show(ex.Message); } } //Don't forget to call Destroy() or the FileChooserDialog window won't get closed. fc.Destroy(); } } }
private void CasparCGNetworkVideoFolderBrowseButton_Click(object sender, EventArgs e) { var FolderBrowser = new Ionic.Utils.FolderBrowserDialogEx(); FolderBrowser.Description = "Please select the CasparCG media folder (e.g. \\\\CasparServer\\CasparCG\\media):"; FolderBrowser.SelectedPath = CasparCGNetworkVideoFolderTextBox.Text; // Show the FolderBrowserDialog. if (FolderBrowser.ShowDialog() == DialogResult.OK) { CasparCGNetworkVideoFolderTextBox.Text = FolderBrowser.SelectedPath; } }
/// <summary> /// Shows a FolderBrowserDialog to select a directory, then calls loadDir() with selected directory /// </summary> public void openDir() { var fbDailog = new Ionic.Utils.FolderBrowserDialogEx(); fbDailog.Description = "Select a directory to open"; fbDailog.ShowNewFolderButton = true; fbDailog.ShowEditBox = true; fbDailog.ShowFullPathInEditBox = true; DialogResult result = fbDailog.ShowDialog(); if (result == DialogResult.OK) { this.directory = new DirectoryInfo(fbDailog.SelectedPath); loadDir(); } }
private void generateResourcesMenuItem_Click(object sender, EventArgs e) { using (Ionic.Utils.FolderBrowserDialogEx fbd = new Ionic.Utils.FolderBrowserDialogEx()) { fbd.Description = "Where to save Resources.zip:"; fbd.NewStyle = true; fbd.RootFolder = Environment.SpecialFolder.Desktop; fbd.SelectedPath = Path.GetDirectoryName(Application.ExecutablePath); fbd.ShowBothFilesAndFolders = false; fbd.ShowEditBox = true; fbd.ShowFullPathInEditBox = false; fbd.ShowNewFolderButton = true; if (fbd.ShowDialog(this) == DialogResult.OK) { PatcherLib.ResourcesClass.GenerateDefaultResourcesZip(Path.Combine(fbd.SelectedPath, "Resources.zip")); } } }
private void btDefaultPath_Click(object sender, EventArgs e) { var folderDialog = new Ionic.Utils.FolderBrowserDialogEx(); folderDialog.Description = "Escolha uma pasta para salvar os arquivos " + "de backup e configurações:"; folderDialog.ShowNewFolderButton = true; folderDialog.ShowEditBox = true; //dlg1.NewStyle = false; folderDialog.SelectedPath = textBackupPath.Text; folderDialog.ShowFullPathInEditBox = true; folderDialog.RootFolder = System.Environment.SpecialFolder.MyComputer; // Show the FolderBrowserDialog. if (folderDialog.ShowDialog() == DialogResult.OK) { textBackupPath.Text = folderDialog.SelectedPath + @"\"; } }
private string browseForDir() { var fbDailog = new Ionic.Utils.FolderBrowserDialogEx(); fbDailog.Description = "Select a directory"; fbDailog.ShowNewFolderButton = true; fbDailog.ShowEditBox = true; fbDailog.ShowFullPathInEditBox = true; var result = fbDailog.ShowDialog(); string path = fbDailog.SelectedPath; if (result == DialogResult.OK && Directory.Exists(path)) { return(path); } return(""); }
private CommonDialogResult RunLegacyDialog(IntPtr hwndOwner) { var fbd = new Ionic.Utils.FolderBrowserDialogEx() { ShowNewFolderButton = true, Description = m_Title, SelectedPath = m_FolderPath }; var result = fbd.ShowDialog(new WindowHandleWrapper(hwndOwner)); if (result != System.Windows.Forms.DialogResult.OK) { return(CommonDialogResult.Cancel); } m_FolderPath = fbd.SelectedPath; return(CommonDialogResult.OK); }
private void itemNewFolder_Click(object sender, EventArgs e) { var dlg1 = new Ionic.Utils.FolderBrowserDialogEx(); dlg1.Description = "Select a folder to extract to:"; dlg1.ShowNewFolderButton = true; dlg1.ShowEditBox = true; //dlg1.NewStyle = false; //dlg1.SelectedPath = txtExtractDirectory.Text; dlg1.ShowFullPathInEditBox = true; // dlg1.RootFolder = System.Environment.SpecialFolder.MyComputer; // Show the FolderBrowserDialog. DialogResult result = dlg1.ShowDialog(); if (result != DialogResult.OK) { // txtExtractDirectory.Text = dlg1.SelectedPath; return; } //FolderBrowserDialog fbd = new FolderBrowserDialog(); //using (new Ambiesoft.CenterWinDialog(this)) //{ // if (DialogResult.OK != fbd.ShowDialog(this)) // return; //} List <string> dirs = new List <string>(DiskDirs); dirs.RemoveAll(n => n.Equals(dlg1.SelectedPath, StringComparison.OrdinalIgnoreCase)); dirs.Insert(0, dlg1.SelectedPath); if (dirs.Count > MaxDirCount) { dirs = dirs.GetRange(0, MaxDirCount); } DiskDirs = dirs.ToArray(); moveToAndClose(dlg1.SelectedPath); }
private void btnDirBrowse_Click(object sender, EventArgs e) { Ionic.Utils.FolderBrowserDialogEx dlg1 = new Ionic.Utils.FolderBrowserDialogEx(); dlg1.Description = "Select a folder for the extracted files:"; dlg1.ShowNewFolderButton = true; dlg1.ShowEditBox = true; //dlg1.NewStyle = false; if (Directory.Exists(txtExtractDirectory.Text)) { dlg1.SelectedPath = txtExtractDirectory.Text; } else { string d = txtExtractDirectory.Text; while (d.Length > 2 && !Directory.Exists(d)) { d = Path.GetDirectoryName(d); } if (d.Length < 2) { dlg1.SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); } else { dlg1.SelectedPath = d; } } dlg1.ShowFullPathInEditBox = true; //dlg1.RootFolder = System.Environment.SpecialFolder.MyComputer; // Show the FolderBrowserDialog. DialogResult result = dlg1.ShowDialog(); if (result == DialogResult.OK) { txtExtractDirectory.Text = dlg1.SelectedPath; } }
/// <summary> /// Spawns a FolderBrowserDialog to choose a directory /// to scan music files. /// </summary> /// <returns>A string containing a directory path</returns> private string SpawnSelectScanDir() { Ionic.Utils.FolderBrowserDialogEx dialog = new Ionic.Utils.FolderBrowserDialogEx(); //System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog(); dialog.Description = "Select music directory"; dialog.ShowEditBox = true; dialog.ShowNewFolderButton = false; dialog.ShowBothFilesAndFolders = true; System.Windows.Forms.DialogResult result = dialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK && string.IsNullOrWhiteSpace(dialog.SelectedPath)) { MessageBox.Show("Cant scan a invalid directory", "Directory selection failed"); return(null); } else if (result == System.Windows.Forms.DialogResult.Cancel) { return(null); } return(dialog.SelectedPath); }
private void SetDefaultPath(object sender, RoutedEventArgs e) { var dlg1 = new Ionic.Utils.FolderBrowserDialogEx(); dlg1.Description = "Select a folder"; dlg1.ShowNewFolderButton = true; dlg1.ShowEditBox = true; dlg1.ShowBothFilesAndFolders = false; dlg1.ShowFullPathInEditBox = true; dlg1.RootFolder = System.Environment.SpecialFolder.MyComputer; // Show the FolderBrowserDialog. DialogResult result = dlg1.ShowDialog(); if (result == DialogResult.OK) { var path = dlg1.SelectedPath; Console.WriteLine(path); DefaultPath.Text = path; Properties.Settings.Default["Path"] = path; Properties.Settings.Default.Save(); } }
// Launch Arrow /// <summary> /// Base arrow launch method /// </summary> /// <param name="a"></param> /// <param name="args">Argument to send to this arrow.</param> /// <param name="urlEncode">Whether insert urlEncode argument to the Cmd.</param> /// <returns>If launch succeed, returns true.</returns> public bool LaunchArrow(Arrow a, string arg = "") { string extention = Common.GetExtension(a.Name); string cmd = a.Cmd; // Crypt if (bool.Parse(a.Encrypted)) { if (string.IsNullOrEmpty(Main.Setting.Password)) { Main.Report(Resource.Exception_DecryptFailed); AccountManager accountWindow = new AccountManager(); accountWindow.Show(); return false; } else { try { cmd = Crypter.AESString.Decrypt(cmd, Main.Setting.Password); arg = Crypter.AESString.Decrypt(arg, Main.Setting.Password); } catch { Main.Report(Resource.Exception_DecryptFailed); AccountManager accountWindow = new AccountManager(); accountWindow.Show(); return false; } } } if (extention == string.Empty) { string type = Common.AutoGetType(cmd); if (type != string.Empty) { a.Name = a.Name.TrimEnd('.') + "." + type; } extention = type; } switch (extention.ToLower()) { #region fileName system object case "f": arg = Common.UnfoldEV(arg); string arg_origin = arg; string startDir = string.Empty; string[] cmds = cmd.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries); int exceptionCount = 0; foreach(string item in cmds) { if (item.StartsWith("*")) startDir = item.TrimStart('*').Trim(new char[] { '\r', '\n', '"' }); cmd = Common.UnfoldEV(item); arg = arg_origin; Common.InsertArg(ref cmd, ref arg); try { if (!Directory.Exists(cmd) && Directory.Exists(arg)) ys.Common.Start(arg); else ys.Common.Start(cmd, arg, startDir); goto CountOnce; } catch { exceptionCount++; } } if (exceptionCount == cmds.Length && Report(Resource.Exception_FSONotFound, false, MessageBoxButtons.OKCancel) == DialogResult.OK) { Ionic.Utils.FolderBrowserDialogEx ofdEx = new Ionic.Utils.FolderBrowserDialogEx(); ofdEx.Description = string.Format(Resource.ChooseFSO, cmd); ofdEx.ShowEditBox = true; ofdEx.ShowFullPathInEditBox = true; ofdEx.ShowNewFolderButton = true; ofdEx.ShowBothFilesAndFolders = true; ofdEx.SelectedPath = ys.Common.GetAvailableParentDir(cmd); if (ofdEx.ShowDialog() == DialogResult.OK) { a.Cmd += '\n' + ofdEx.SelectedPath; try { ys.Common.Start(ofdEx.SelectedPath, arg); } catch (Exception ex) { Report(ex.Message); } break; } else return false; } else return false; #endregion #region Url case "u": Common.InsertArg(ref cmd, ref arg, ModifierKeys != Keys.Control); try { ys.Common.Start(ys.Common.GetFileFullPath(Setting.DefaultBrowser), cmd + arg); } catch { Report(Resource.Exception_BrowserNotFound); return false; } break; #endregion #region Text selected case "t": string temp = Clipboard.GetText(); // Keep the pre content of the clipboard. try { SendKeys.SendWait("^c"); string argument = Clipboard.GetText(); Common.InsertArg(ref cmd, ref argument, ModifierKeys != Keys.Control); ys.Common.Start(ys.Common.GetFileFullPath(Setting.DefaultBrowser), cmd + argument); } catch (Exception ex) { Report(ex.Message); return false; } try { Clipboard.SetText(temp); } catch { } break; #endregion #region Copy and paste Cmd case "c": try { Clipboard.SetText(cmd + arg); ShowHideWindow(false); SendKeys.SendWait("^v"); } catch (Exception ex) { Report(ex.Message); } break; #endregion #region Stroke of hardware inputs case "s": try { if (currentArrow == a) { ys.StrokeParser.SendStrokes(cmd + arg, a.HotKey); } else ys.StrokeParser.SendStrokes(cmd, a.HotKey); } catch (Exception ex) { Report(ex.Message); } break; #endregion #region Internal function case "i": if (!InternalFunction._RunFunction(cmd, arg)) return false; break; #endregion #region UnknownType case "": Report(Resource.UnknownType + "\" " + a.Name + ".f \""); return false; #endregion #region _RunFunction C# script case "c#": string[] args = ys.Common.GetArgs(arg); // Get the references: args in list that starts with "!". string[] refs = Array.FindAll(args, m=> { return m.StartsWith("!"); }); for (int i = 0; i < refs.Length; i++) { refs[i] = refs[i].TrimStart('!'); } try { CSharpInterpreter.CSharpInterpreter.RunFromSrc(cmd, refs, args); } catch (Exception ex) { Report(ex.Message); } break; #endregion #region _RunFunction registered script default: try { TempFiles.Add(Common.RunTempScript(cmd, extention, arg)); } catch (Exception ex) { Report(ex.Message); return false; } break; #endregion } CountOnce: a.CountOnce(); return true; }
public void LoadDB(string DefaultPath, bool IsDisplayPlateSelection) { if (!Directory.Exists(DefaultPath)) DefaultPath = ""; string SelectedPath = DefaultPath; if (DefaultPath == "") { var dlg1 = new Ionic.Utils.FolderBrowserDialogEx(); dlg1.Description = "Select the folder containing your databases."; dlg1.ShowNewFolderButton = true; dlg1.ShowEditBox = true; if (DefaultPath != "") dlg1.SelectedPath = DefaultPath; //dlg1.NewStyle = false; //dlg1.SelectedPath = txtExtractDirectory.Text; dlg1.ShowFullPathInEditBox = true; dlg1.RootFolder = System.Environment.SpecialFolder.Desktop; // Show the FolderBrowserDialog. DialogResult result = dlg1.ShowDialog(); if (result != DialogResult.OK) return; SelectedPath = dlg1.SelectedPath; } if (Directory.Exists(SelectedPath) == false) return; FormForPlateDimensions PlateDim = new FormForPlateDimensions(); PlateDim.checkBoxAddCellNumber.Checked = false; PlateDim.checkBoxAddCellNumber.Visible = true; PlateDim.checkBoxIsOmitFirstColumn.Visible = true; PlateDim.labelHisto.Visible = true; PlateDim.numericUpDownHistoSize.Visible = true; if (PlateDim.ShowDialog() != System.Windows.Forms.DialogResult.OK) return; LoadCellByCellDB(PlateDim, SelectedPath, IsDisplayPlateSelection); }
private void SetWorkingDirectory() { string _folderName = "c:\\dinoch"; _folderName = (System.IO.Directory.Exists(_folderName)) ? _folderName : ""; var dlg1 = new Ionic.Utils.FolderBrowserDialogEx { Description = "Select a folder for temporary files and dosefile:", ShowNewFolderButton = true, ShowEditBox = true, //NewStyle = false, SelectedPath = _folderName, ShowFullPathInEditBox = false, }; dlg1.RootFolder = System.Environment.SpecialFolder.MyComputer; var result = dlg1.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { _folderName = dlg1.SelectedPath; } PathSet.ActiveDirectory = _folderName; }
private void dumpAllImagesMenuItem_Click(object sender, EventArgs e) { using (Ionic.Utils.FolderBrowserDialogEx fbd = new Ionic.Utils.FolderBrowserDialogEx()) { fbd.ShowNewFolderButton = true; fbd.ShowFullPathInEditBox = true; fbd.ShowEditBox = true; fbd.ShowBothFilesAndFolders = false; fbd.RootFolder = Environment.SpecialFolder.Desktop; fbd.NewStyle = true; Cursor oldCursor = Cursor; ProgressChangedEventHandler progressHandler = delegate(object sender2, ProgressChangedEventArgs args2) { MethodInvoker mi = (() => progressBar1.Value = args2.ProgressPercentage); if (progressBar1.InvokeRequired) { progressBar1.Invoke(mi); } else { mi(); } }; RunWorkerCompletedEventHandler completeHandler = null; completeHandler = delegate(object sender1, RunWorkerCompletedEventArgs args1) { MethodInvoker mi = delegate() { var result = args1.Result as AllOtherImages.AllImagesDoWorkResult; tabControl1.Enabled = true; progressBar1.Visible = false; if (oldCursor != null) { Cursor = oldCursor; } backgroundWorker1.RunWorkerCompleted -= completeHandler; backgroundWorker1.ProgressChanged -= progressHandler; backgroundWorker1.DoWork -= allOtherImagesEditor1.AllOtherImages.DumpAllImages; MyMessageBox.Show(this, string.Format("{0} images saved", result.ImagesProcessed), result.DoWorkResult.ToString(), MessageBoxButtons.OK); }; if (InvokeRequired) { Invoke(mi); } else { mi(); } }; if (fbd.ShowDialog(this) == DialogResult.OK) { progressBar1.Bounds = new Rectangle(ClientRectangle.Left + 10, (ClientRectangle.Height - progressBar1.Height) / 2, ClientRectangle.Width - 20, progressBar1.Height); progressBar1.Value = 0; progressBar1.Visible = true; backgroundWorker1.DoWork += allOtherImagesEditor1.AllOtherImages.DumpAllImages; backgroundWorker1.ProgressChanged += progressHandler; backgroundWorker1.RunWorkerCompleted += completeHandler; backgroundWorker1.WorkerReportsProgress = true; tabControl1.Enabled = false; Cursor = Cursors.WaitCursor; progressBar1.BringToFront(); backgroundWorker1.RunWorkerAsync(new AllOtherImages.AllImagesDoWorkData(currentStream, fbd.SelectedPath)); //backgroundWorker1.RunWorkerCompleted //allOtherImagesEditor1.AllOtherImages.DumpAllImages( currentStream, fbd.SelectedPath ); } } }
private void repair_Click(object sender, RoutedEventArgs e) { if (rbRecycle.IsChecked == true) { state.Source = Source.Recycle; } else // other { state.Source = Source.Other; } // See if they want a backup if (!Properties.Settings.Default.HasBackedUp) { MessageBoxResult r = MessageBox.Show("Repair will make changes to your system. If you have not made a backup of your task files, " + "using the Backup Tasks button below, now might be a good time. Do you want to proceed with the Repair?", "Proceed?", MessageBoxButton.YesNo); if (r == MessageBoxResult.No) { return; } } // We are using our downloaded zip file of Windows 7 task files, or an independent source of task XML files, // so prompt for the zip file or folder that contains them if (state.Source == Source.Other) { var dialog = new Ionic.Utils.FolderBrowserDialogEx { Description = "Select the downloaded zip file of Windows 7 task files, or a directory containing backed up task files.", ShowNewFolderButton = false, ShowEditBox = true, NewStyle = true, RootFolder = Environment.SpecialFolder.Desktop, SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments), ShowBothFilesAndFolders = true, ShowFullPathInEditBox = false, DontExpandZip = true, ValidExtensions = new string[1] { "zip" }, }; if (dialog.ShowDialog() != System.Windows.Forms.DialogResult.OK) { return; } else { if (Path.GetExtension(dialog.SelectedPath).ToLower() == ".zip") { if (!VerifyZip(state, dialog.SelectedPath)) { return; } state.Source = Source.Zip; } state.SourcePath = dialog.SelectedPath; } } state.Reports.Clear(); state.CanScan = false; state.CanRepair = false; state.Status = "Repairing..."; ThreadPool.QueueUserWorkItem(Repair, state); }
private void openCopytoDlgButton_Click(object sender, EventArgs e) { var dlg1 = new Ionic.Utils.FolderBrowserDialogEx { Description = "Select a folder the file be located:", ShowNewFolderButton = true, ShowEditBox = true, SelectedPath = txtEpkDir.Text, ShowFullPathInEditBox = true, RootFolder = System.Environment.SpecialFolder.MyComputer }; //dlg1.NewStyle = false; // Show the FolderBrowserDialog. DialogResult result = dlg1.ShowDialog(); if (result == DialogResult.OK) { txtEpkCopyToDir.Text = dlg1.SelectedPath; writeToDebugPanel(DateTime.Now.ToString("H:mm:ss") + " destination directory changed to " + txtEpkDir.Text); } }
private void openBrowser_Click(object sender, RoutedEventArgs e) { var dlg1 = new Ionic.Utils.FolderBrowserDialogEx(); dlg1.Description = "Select a file or folder"; dlg1.ShowNewFolderButton = true; dlg1.ShowEditBox = true; dlg1.ShowBothFilesAndFolders = true; dlg1.ShowFullPathInEditBox = true; dlg1.RootFolder = System.Environment.SpecialFolder.MyComputer; // Show the FolderBrowserDialog. DialogResult result = dlg1.ShowDialog(); if (result == DialogResult.OK) { var path = dlg1.SelectedPath; //System.Windows.Forms.MessageBox.Show(path); var match = Regex.Match(path, @".*\\(.*)$"); var name = match.Groups[1].Value; var myPath = "\\\\" + Environment.MachineName + "\\" + name; int accessType = 0; if (Directory.Exists(dlg1.SelectedPath)) { var check = ShareWin.CreateSharedFolder(path, name, name, accessType); switch (check) { case 0: Console.WriteLine("Folder successfuly shared."); AppendNewShare(name, path); break; case 1: Console.WriteLine("Exception Thrown"); break; case 2: Console.WriteLine("Access Denied"); break; case 8: Console.WriteLine("Unknown Failure"); break; case 9: Console.WriteLine("Invalid Name"); break; case 10: Console.WriteLine("Invalid Level"); break; case 21: Console.WriteLine("Invalid Parameter"); break; case 22: Console.WriteLine("Duplicate Share"); break; case 23: Console.WriteLine("Redirected Path"); break; case 24: Console.WriteLine("Unknown Device or Directory"); break; case 25: Console.WriteLine("Net Name Not Found"); break; default: Console.WriteLine("Folder cannot be shared."); break; } } else { System.Windows.Forms.MessageBox.Show("Not allowed in Windows Environment"); } } }
void ExportFilesCmdExecuted(object target, ExecutedRoutedEventArgs e) { string folder = Environment.GetFolderPath(Environment.SpecialFolder.MyPictures); var dlg1 = new Ionic.Utils.FolderBrowserDialogEx { Description = "Select a location to export to:", ShowNewFolderButton = true, ShowEditBox = true, NewStyle = true, RootFolder = System.Environment.SpecialFolder.MyComputer, SelectedPath = folder, ShowFullPathInEditBox = false, }; var result = dlg1.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { folder = dlg1.SelectedPath; } else { return; } ProgressBarDialog progressBar = new ProgressBarDialog() { TotalThreads = fileList.Count }; string folderName = Path.GetFileName(folder); if (string.IsNullOrWhiteSpace(folderName)) { folderName = Path.GetRandomFileName(); } using (FileStream file = File.Create(Path.Combine(folder, Path.ChangeExtension(folderName, ".manga")))) { file.WriteByte(0); } using (FileStream file = File.Create(Path.Combine(folder, Path.ChangeExtension(folderName, ".manga_save")))) { string output = string.Format("LAST=/mnt/us/pictures/{0}/{1}", folderName, fileList.First().OutputName); byte[] info = new UTF8Encoding(true).GetBytes(output); file.Write(info, 0, info.Length); } progressBar.CancellationTokenSource = new CancellationTokenSource(); foreach (FileConversionInfo fileInfo in fileList) { fileInfo.OutputPath = Path.Combine(folder, fileInfo.OutputName); fileInfo.KindleProfile = this.SelectedProfile; ConversionThread thread = new ConversionThread(progressBar); ThreadPool.QueueUserWorkItem(thread.ThreadCallback, fileInfo); } progressBar.ShowDialog(); }
public cFeedBackMessage Run() { if (this.Input == null) { base.FeedBackMessage.IsSucceed = false; base.FeedBackMessage.Message += ": No input defined!"; return base.FeedBackMessage; } else { if (base.Start() == false) { base.FeedBackMessage.IsSucceed = false; return base.FeedBackMessage; } #region Properties Management object _firstValue = base.ListProperties.FindByName("Open HTML File ?"); bool IsDisplayResult = true; if (_firstValue == null) { base.GenerateError("-Open HTML File ?- not found !"); return base.FeedBackMessage; } try { cProperty TmpProp = (cProperty)_firstValue; IsDisplayResult = (bool)TmpProp.GetValue(); } catch (Exception) { base.GenerateError("-Open HTML File ?- cast didn't work"); return base.FeedBackMessage; } #endregion if (IsDisplayUIForFilePath) { var dlg1 = new Ionic.Utils.FolderBrowserDialogEx(); dlg1.Description = "Select the folder containing your databases."; dlg1.ShowNewFolderButton = true; dlg1.ShowEditBox = true; dlg1.ShowFullPathInEditBox = true; DialogResult result = dlg1.ShowDialog(); if (result != DialogResult.OK) { FeedBackMessage.IsSucceed = false; FeedBackMessage.Message = "Incorrect Folder Name."; return FeedBackMessage; } string Path = dlg1.SelectedPath; if (Directory.Exists(Path) == false) { FeedBackMessage.IsSucceed = false; FeedBackMessage.Message = "Incorrect Folder Name."; return FeedBackMessage; } //FolderBrowserDialog WorkingFolderDialog = new FolderBrowserDialog(); //WorkingFolderDialog.ShowNewFolderButton = true; //WorkingFolderDialog.Description = "Select destination folder"; //if (WorkingFolderDialog.ShowDialog() != DialogResult.OK) //{ // FeedBackMessage.IsSucceed = false; // FeedBackMessage.Message = "Incorrect Folder Name."; // return FeedBackMessage; //} //FolderName = WorkingFolderDialog.SelectedPath; FolderName = dlg1.SelectedPath; } string HTMLFileName = FolderName + "\\Index.html"; Directory.CreateDirectory(FolderName + @"\\Images\\"); int IdxImage = 0; #region Create HTML document using (StreamWriter myFile = new StreamWriter(HTMLFileName, false, Encoding.Default)) { // Export titles: string ToBeWritten = "<!DOCTYPE html><html><body><h1>Report : " + this.Input.Name + @"</h1><table border=1>"; string RowString = "<tr>"; // if ListTags associated to the table, then create a new column if (this.Input.ListTags != null) { RowString += "<td>"; RowString += "Associated Tag"; RowString += "</td>"; } // if ListRowNames then create another column if (this.Input.ListRowNames != null) { RowString += "<td>"; RowString += this.Input.Name; RowString += "</td>"; } // ??? probleme column/row ??? for (int j = 0; j < this.Input.Count; j++) { RowString += "<td>"; RowString += this.Input[j].Name; RowString += "</td>"; } RowString += "</tr>"; ToBeWritten += RowString; // Now let's process the table by itself for (int i = 0; i < this.Input[0].Count; i++) { RowString = "<tr>"; // if List Tags, then include the associated object if it is an image #region Include Tags if (this.Input.ListTags != null) { RowString += "<td align=\"center\">"; if ((this.Input.ListTags[i] != null) && (this.Input.ListTags[i].GetType() == typeof(Bitmap))) { // RowString += "Associated Tag"; string ImageName = FolderName + @"\Images\Image" + IdxImage.ToString() + ".jpg"; ((Bitmap)(this.Input.ListTags[i])).Save(ImageName, System.Drawing.Imaging.ImageFormat.Jpeg); RowString += "<img src=\"Images\\Image" + IdxImage.ToString() + ".jpg\">"; RowString += "</td>"; IdxImage++; if (this.Input.ListRowNames != null) { RowString += "<td>"; RowString += this.Input.ListRowNames[i]; RowString += "</td>"; } for (int j = 0; j < this.Input.Count; j++) { RowString += "<td>"; RowString += this.Input[j][i].ToString(); RowString += "</td>"; } RowString += "</tr>"; ToBeWritten += RowString; continue; } Chart A = null; try { A = (Chart)this.Input.ListTags[i]; } catch (Exception) { //throw; } if (A != null) { try { int TmpWidth = A.Width; int TmpHeight = A.Height; A.Width = 500; A.Height = 300; string ImageName = FolderName + @"\Images\Image" + IdxImage.ToString() + ".jpg"; ((Chart)this.Input.ListTags[i]).SaveImage(ImageName, ChartImageFormat.Jpeg); A.Width = TmpWidth; A.Height = TmpHeight; RowString += "<img src=\"Images\\Image" + IdxImage.ToString() + ".jpg\">"; IdxImage++; } catch (Exception) { RowString += "n.a."; } } else { RowString += "n.a."; } RowString += "</td>"; } #endregion #region Include Names if (this.Input.ListRowNames != null) { RowString += "<td>"; if (i >= this.Input.ListRowNames.Count) RowString += ""; else RowString += this.Input.ListRowNames[i]; RowString += "</td>"; } #endregion #region Include the values for (int j = 0; j < this.Input.Count; j++) { RowString += "<td>"; if ((this.Input[j].ListTags != null) && (i < this.Input[j].Count)) { Chart A = null; try { A = (Chart)this.Input[j].ListTags[i]; } catch (Exception) { //throw; } if (A != null) { try { int TmpWidth = A.Width; int TmpHeight = A.Height; A.Width = 500; A.Height = 300; string ImageName = FolderName + @"\Images\Image" + IdxImage.ToString() + ".jpg"; A.SaveImage(ImageName, ChartImageFormat.Jpeg); A.Width = TmpWidth; A.Height = TmpHeight; RowString += "<img src=\"Images\\Image" + IdxImage.ToString() + ".jpg\">"; IdxImage++; } catch (Exception) { RowString += "n.a."; } } } else { RowString += this.Input[j][i].ToString(); } RowString += "</td>"; } #endregion RowString += "</tr>"; ToBeWritten += RowString; } ToBeWritten += "</table>"; ToBeWritten += "</body></html>"; myFile.Write(ToBeWritten); myFile.Close(); } #endregion if (IsDisplayResult) { System.Diagnostics.Process proc = new System.Diagnostics.Process(); if (cGlobalInfo.OptionsWindow.radioButtonIE.Checked) proc.StartInfo.FileName = "iexplore"; else proc.StartInfo.FileName = "chrome"; proc.StartInfo.Arguments = HTMLFileName; proc.Start(); } } return base.FeedBackMessage; }
private void extractToToolStripMenuItem_Click(object sender, EventArgs e) { var items = getSelectedItems().ToList(); if (items.Count < 1) { return; } string pathDestRoot; using (var fd = new Ionic.Utils.FolderBrowserDialogEx()) { fd.Description = "Choose destination folder"; fd.ShowNewFolderButton = true; fd.ShowEditBox = true; if (!String.IsNullOrEmpty(m_lastExtractPath)) { fd.SelectedPath = m_lastExtractPath; } fd.ShowFullPathInEditBox = true; fd.RootFolder = System.Environment.SpecialFolder.MyComputer; DialogResult result = fd.ShowDialog(); if (DialogResult.OK != result) { return; } pathDestRoot = fd.SelectedPath; } m_lastExtractPath = pathDestRoot; if (!Directory.Exists(pathDestRoot)) { throw new FileNotFoundException(); } Cursor.Current = Cursors.WaitCursor; Stopwatch swAll = new Stopwatch(); Stopwatch swLastPulse = new Stopwatch(); TimeSpan tsPulseInterval = TimeSpan.FromSeconds(5); int nFiles = 0; long cbTotalBytes = 0; swAll.Start(); using (var trans = sess.BeginTransaction()) { swLastPulse.Start(); IterateSelection ( items, (eFile, path) => { string pathDest = Path.Combine(pathDestRoot, path); if (File.Exists(pathDest)) { File.Delete(pathDest); } using (var sInput = eFile.data.Read(rs.cursor)) fileIo.Write(sInput, pathDest); FileInfo fi = new FileInfo(pathDest); fi.CreationTimeUtc = eFile.dtCreation; fi.LastWriteTimeUtc = eFile.dtModification; fi.LastAccessTimeUtc = eFile.dtAccess; fi.Attributes = eFile.attributes; if (swLastPulse.Elapsed > tsPulseInterval) { trans.LazyCommitAndReopen(); swLastPulse.Reset(); swLastPulse.Start(); } nFiles++; cbTotalBytes += eFile.Length; }, (eFolder, path) => { string pathDest = Path.Combine(pathDestRoot, path); if (File.Exists(pathDest)) { File.Delete(pathDest); } if (!Directory.Exists(pathDest)) { Directory.CreateDirectory(pathDest); DirectoryInfo di = new DirectoryInfo(pathDest); di.CreationTimeUtc = eFolder.dtCreation; di.LastWriteTimeUtc = eFolder.dtModification; di.LastAccessTimeUtc = eFolder.dtAccess; di.Attributes = eFolder.attributes; } } ); swAll.Stop(); } Cursor.Current = Cursors.Default; string msg = FormatCopyRateSummary(nFiles, cbTotalBytes, swAll.Elapsed); MessageBox.Show(this, msg, "Extract Complete", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void rebuildFFTPackMenuItem_Click( object sender, EventArgs e ) { using (Ionic.Utils.FolderBrowserDialogEx folderBrowserDialog = new Ionic.Utils.FolderBrowserDialogEx()) { DoWorkEventHandler doWork = delegate( object sender1, DoWorkEventArgs args ) { FFTPack.MergeDumpedFiles( folderBrowserDialog.SelectedPath, saveFileDialog.FileName, sender1 as BackgroundWorker ); }; ProgressChangedEventHandler progress = delegate( object sender2, ProgressChangedEventArgs args ) { progressBar.Visible = true; progressBar.Value = args.ProgressPercentage; }; RunWorkerCompletedEventHandler completed = null; completed = delegate( object sender3, RunWorkerCompletedEventArgs args ) { progressBar.Visible = false; Enabled = true; patchPsxBackgroundWorker.ProgressChanged -= progress; patchPsxBackgroundWorker.RunWorkerCompleted -= completed; patchPsxBackgroundWorker.DoWork -= doWork; if (args.Error is Exception) { MyMessageBox.Show( this, "Could not merge files.\n" + "Make sure you chose the correct file and that there is\n" + "enough room in the destination directory.", "Error", MessageBoxButtons.OK ); } }; saveFileDialog.OverwritePrompt = true; saveFileDialog.Filter = "fftpack.bin|fftpack.bin|All Files (*.*)|*.*"; saveFileDialog.FilterIndex = 0; folderBrowserDialog.Description = "Where are the extracted files?"; folderBrowserDialog.NewStyle = true; folderBrowserDialog.RootFolder = Environment.SpecialFolder.Desktop; folderBrowserDialog.SelectedPath = Environment.CurrentDirectory; folderBrowserDialog.ShowBothFilesAndFolders = false; folderBrowserDialog.ShowEditBox = true; folderBrowserDialog.ShowFullPathInEditBox = false; folderBrowserDialog.ShowNewFolderButton = false; if ((folderBrowserDialog.ShowDialog( this ) == DialogResult.OK) && (saveFileDialog.ShowDialog( this ) == DialogResult.OK)) { patchPsxBackgroundWorker.ProgressChanged += progress; patchPsxBackgroundWorker.RunWorkerCompleted += completed; patchPsxBackgroundWorker.DoWork += doWork; Environment.CurrentDirectory = folderBrowserDialog.SelectedPath; Enabled = false; progressBar.Value = 0; progressBar.Visible = true; progressBar.BringToFront(); patchPsxBackgroundWorker.RunWorkerAsync(); } } }
private void rebuildFFTPackMenuItem_Click(object sender, EventArgs e) { using (Ionic.Utils.FolderBrowserDialogEx folderBrowserDialog = new Ionic.Utils.FolderBrowserDialogEx()) { DoWorkEventHandler doWork = delegate(object sender1, DoWorkEventArgs args) { FFTPack.MergeDumpedFiles(folderBrowserDialog.SelectedPath, saveFileDialog.FileName, sender1 as BackgroundWorker); }; ProgressChangedEventHandler progress = delegate(object sender2, ProgressChangedEventArgs args) { progressBar.Visible = true; progressBar.Value = args.ProgressPercentage; }; RunWorkerCompletedEventHandler completed = null; completed = delegate(object sender3, RunWorkerCompletedEventArgs args) { progressBar.Visible = false; Enabled = true; patchPsxBackgroundWorker.ProgressChanged -= progress; patchPsxBackgroundWorker.RunWorkerCompleted -= completed; patchPsxBackgroundWorker.DoWork -= doWork; if (args.Error is Exception) { MyMessageBox.Show(this, "Could not merge files.\n" + "Make sure you chose the correct file and that there is\n" + "enough room in the destination directory.", "Error", MessageBoxButtons.OK); } }; saveFileDialog.OverwritePrompt = true; saveFileDialog.Filter = "fftpack.bin|fftpack.bin|All Files (*.*)|*.*"; saveFileDialog.FilterIndex = 0; folderBrowserDialog.Description = "Where are the extracted files?"; folderBrowserDialog.NewStyle = true; folderBrowserDialog.RootFolder = Environment.SpecialFolder.Desktop; folderBrowserDialog.SelectedPath = Environment.CurrentDirectory; folderBrowserDialog.ShowBothFilesAndFolders = false; folderBrowserDialog.ShowEditBox = true; folderBrowserDialog.ShowFullPathInEditBox = false; folderBrowserDialog.ShowNewFolderButton = false; if ((folderBrowserDialog.ShowDialog(this) == DialogResult.OK) && (saveFileDialog.ShowDialog(this) == DialogResult.OK)) { patchPsxBackgroundWorker.ProgressChanged += progress; patchPsxBackgroundWorker.RunWorkerCompleted += completed; patchPsxBackgroundWorker.DoWork += doWork; Environment.CurrentDirectory = folderBrowserDialog.SelectedPath; Enabled = false; progressBar.Value = 0; progressBar.Visible = true; progressBar.BringToFront(); patchPsxBackgroundWorker.RunWorkerAsync(); } } }
private void importScreenDirectoryToolStripMenuItem_Click(object sender, EventArgs e) { var dlg1 = new Ionic.Utils.FolderBrowserDialogEx(); dlg1.Description = "Select the folder containing your files"; dlg1.ShowNewFolderButton = true; dlg1.ShowEditBox = true; dlg1.ShowFullPathInEditBox = true; dlg1.RootFolder = System.Environment.SpecialFolder.Desktop; DialogResult result = dlg1.ShowDialog(); if (result != DialogResult.OK) return; string Path = dlg1.SelectedPath; if (Directory.Exists(Path) == false) return; string[] ListFiles = null; try { ListFiles = Directory.GetFiles(Path, "*.csv", SearchOption.AllDirectories); } catch (System.Exception excep) { MessageBox.Show(excep.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (ListFiles.Length == 0) { MessageBox.Show("No CSV files found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } FormForPlateSelection FFP = new FormForPlateSelection(ListFiles,true); if (FFP.ShowDialog() != System.Windows.Forms.DialogResult.OK) return; string[] ListFilesForPlates = FFP.GetListPlatesSelected(); ImportFiles(ListFilesForPlates); }
void ToolStripMenuItem_DRCAnalysisMultiDesc_Click(object sender, EventArgs e) { List<cDescriptorType> ListSelectedDescs = cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptors(); cListListWells CurrentSelectedGroups = this.BuildListListWells(); #region select folder var dlg1 = new Ionic.Utils.FolderBrowserDialogEx(); dlg1.Description = "Select the folder containing your databases."; dlg1.ShowNewFolderButton = true; dlg1.ShowEditBox = true; dlg1.ShowFullPathInEditBox = true; DialogResult result = dlg1.ShowDialog(); if (result != DialogResult.OK) return; string Path = dlg1.SelectedPath; if (Directory.Exists(Path) == false) return; string FolderName = dlg1.SelectedPath; #endregion foreach (var item in ListSelectedDescs) { string TmpFolder = FolderName + "\\" + item.GetName(); Directory.CreateDirectory(TmpFolder); int IdxNode = 0; List<cDescriptorType> ListSelectedDesc = new List<cDescriptorType>(); ListSelectedDesc.Add(item); cExtendedTable TableForGeneralResuts = new cExtendedTable(); TableForGeneralResuts.Add(new cExtendedList("p-Value")); TableForGeneralResuts.Add(new cExtendedList("EC50")); TableForGeneralResuts.Add(new cExtendedList("Slope")); TableForGeneralResuts.Add(new cExtendedList("Bottom")); TableForGeneralResuts.Add(new cExtendedList("Top")); TableForGeneralResuts.Add(new cExtendedList("Window")); TableForGeneralResuts.Add(new cExtendedList("Area Under Curve")); TableForGeneralResuts.ListRowNames = new List<string>(); TableForGeneralResuts.ListTags = new List<object>(); foreach (cListWells TmpListWells in CurrentSelectedGroups) { // List<cDescriptorType> LType = new List<cDescriptorType>(); // LType.Add(ListSelectedDesc[i]); cExtendedTable CompleteTable = TmpListWells.GetAverageDescriptorValues(ListSelectedDesc, true, false); //cExtendedTable CompleteTable = GLP.GetOutPut(); cCurveForGraph CFG = new cCurveForGraph(); CFG.SetInputData(CompleteTable); CFG.Run(); cSigmoidFitting SF = new cSigmoidFitting(); SF.SetInputData(CompleteTable); if (SF.Run().IsSucceed == false) continue; // double Ratio = LR.GetOutPut()[0][LR.GetOutPut().Count - 1] / SF.GetOutPut()[0][SF.GetOutPut().Count - 1]; cANOVA A = new cANOVA(); cExtendedTable NewTable = CFG.ListPtValues.Crop(0, CFG.ListPtValues.Count - 1, 1, CFG.ListPtValues[0].Count - 1); A.SignificanceThreshold = 1E-11; A.SetInputData(NewTable); A.Run(); cExtendedTable Sigmoid = SF.GetFittedRawValues(CFG.GetListXValues()); CompleteTable[0] = Sigmoid[1]; CompleteTable[0].Name = ListSelectedDesc[0].GetName() + "\n" + Sigmoid[1].Name; cDesignerSplitter DS = new cDesignerSplitter(); //cViewerTableAsRichText VT = new cViewerTableAsRichText(); cViewerTable VT = new cViewerTable(); cExtendedTable TableResults = SF.GetOutPut(); if ((A.GetOutPut() != null) && (A.GetOutPut().Count > 0)) { TableResults[0].Add(A.GetOutPut()[0][0]); TableResults[0].Add(A.GetOutPut()[0][1]); TableResults.ListRowNames.Add("p-Value"); TableResults.ListRowNames.Add("Rejected?"); TableForGeneralResuts[0].Add(A.GetOutPut()[0][0]); } else { TableForGeneralResuts[0].Add(1); } TableResults.Name = TV.Nodes[IdxNode].Text; TableResults[0].Name = "Fitting Parameters"; VT.SetInputData(TableResults); VT.DigitNumber = -1; VT.Run(); cViewerGraph1D VS1 = new cViewerGraph1D(); cExtendedTable MyTable = new cExtendedTable(Sigmoid[1]); MyTable.Name = TmpListWells.Name;// TV.Nodes[IdxNode].Text; VS1.SetInputData(MyTable); VS1.AddCurve(CFG); VS1.Chart.X_AxisValues = Sigmoid[0]; VS1.Chart.IsLogAxis = true; VS1.Chart.IsLine = true; VS1.Chart.IsShadow = false; VS1.Chart.Opacity = 210; VS1.Chart.LineWidth = 3; VS1.Chart.MarkerSize = 8; VS1.Chart.IsDisplayValues = cGlobalInfo.OptionsWindow.FFAllOptions.checkBoxDRCDisplayValues.Checked; VS1.Chart.LabelAxisX = "Concentration"; VS1.Chart.LabelAxisY = CompleteTable[1].Name; VS1.Chart.XAxisFormatDigitNumber = cGlobalInfo.OptionsWindow.FFAllOptions.GetDRCNumberOfDigit(); VS1.Chart.IsZoomableX = true; Classes.Base_Classes.General.cLineVerticalForGraph VLForEC50 = new Classes.Base_Classes.General.cLineVerticalForGraph(SF.GetOutPut()[0][2]); //VLForEC50.AddText("EC50: " + SF.GetOutPut()[0][2].ToString("e3")/* + "\nError Ratio:" + Ratio.ToString("N4")*/); VS1.Chart.ListVerticalLines.Add(VLForEC50); TableForGeneralResuts.ListRowNames.Add(TV.Nodes[IdxNode].Text); TableForGeneralResuts.ListTags.Add((Chart)VS1.Chart);//ListSelectedDesc[0]); //EC50 TableForGeneralResuts[1].Add(SF.GetOutPut()[0][2]); // Slope TableForGeneralResuts[2].Add(SF.GetOutPut()[0][3]); // Bottom TableForGeneralResuts[3].Add(SF.GetOutPut()[0][0]); // Top TableForGeneralResuts[4].Add(SF.GetOutPut()[0][1]); // Window double Window = SF.GetOutPut()[0][1] / SF.GetOutPut()[0][0]; TableForGeneralResuts[5].Add(Window); TableForGeneralResuts[6].Add(SF.GetOutPut()[0][5]); VS1.Chart.ArraySeriesInfo = new cSerieInfoDesign[CompleteTable.Count]; for (int IdxCurve = 0; IdxCurve < CompleteTable.Count; IdxCurve++) { cSerieInfoDesign TmpSerieInfo = new cSerieInfoDesign(); TmpSerieInfo.color = cGlobalInfo.ListCellularPhenotypes[IdxCurve % cGlobalInfo.ListCellularPhenotypes.Count].ColourForDisplay; TmpSerieInfo.markerStyle = MarkerStyle.None; VS1.Chart.ArraySeriesInfo[IdxCurve] = TmpSerieInfo; } VS1.Run(); //DS.SetInputData(VS1.GetOutPut()); //DS.SetInputData(VT.GetOutPut()); //DS.Orientation = Orientation.Horizontal; //DS.Title = TV.Nodes[IdxNode++].Text; //TmpListWells.ti;// ListSelectedDesc[0].GetName(); //DS.Run(); IdxNode++; // DT.SetInputData(DS.GetOutPut()); } cTableToHTML THTML = new cTableToHTML(); TableForGeneralResuts.Name = item.GetName(); THTML.SetInputData(TableForGeneralResuts); THTML.IsDisplayUIForFilePath = false; THTML.FolderName = TmpFolder; THTML.ListProperties.FindByName("Open HTML File ?").SetNewValue((bool)false); THTML.ListProperties.FindByName("Open HTML File ?").IsGUIforValue = false; THTML.Run(); } System.Diagnostics.Process.Start(FolderName); }
private void HarmonyToDB(string DefaultPath) { #region Get the directory if (!Directory.Exists(DefaultPath)) DefaultPath = ""; var dlg1 = new Ionic.Utils.FolderBrowserDialogEx(); dlg1.Description = "Select the folder of your experiment."; dlg1.ShowNewFolderButton = true; dlg1.ShowEditBox = true; if (DefaultPath != "") dlg1.SelectedPath = DefaultPath; //dlg1.NewStyle = false; //dlg1.SelectedPath = txtExtractDirectory.Text; dlg1.ShowFullPathInEditBox = true; dlg1.RootFolder = System.Environment.SpecialFolder.Desktop; // Show the FolderBrowserDialog. DialogResult result = dlg1.ShowDialog(); if (result != DialogResult.OK) return; string Path = dlg1.SelectedPath; if (Directory.Exists(Path) == false) return; #endregion #region Get the different files string[] ListFilesForPlates = null; try { ListFilesForPlates = Directory.GetFiles(Path, "Objects_Population - *.txt", SearchOption.AllDirectories); } catch (System.Exception excep) { MessageBox.Show(excep.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (ListFilesForPlates.Length == 0) { MessageBox.Show("The selected directory do not contain any Objects_Population files !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } string[] Sep = new string[1]; Sep[0] = "\\"; Dictionary<string, string> CurrentPlateDico = new Dictionary<string, string>(); // string[] FirstListImages = Directory.GetFiles(PlateDirectories[i], TmpPlateName + "_*.C01", SearchOption.AllDirectories); foreach (var item in ListFilesForPlates) { string[] Res = item.Split(Sep, StringSplitOptions.RemoveEmptyEntries); string CurrentName = Res[Res.Length-1]; if (CurrentPlateDico.ContainsKey(CurrentName.Remove(CurrentName.Length - 4))) continue; CurrentPlateDico.Add(CurrentName.Remove(CurrentName.Length-4), item); } string[] ListTypes = CurrentPlateDico.Keys.ToArray(); // plates selection GUI FormForPlateSelection FFP = new FormForPlateSelection(ListTypes,false); FFP.Text = "Object Types Selection"; if (FFP.ShowDialog() != System.Windows.Forms.DialogResult.OK) return; ListFilesForPlates = FFP.GetListPlatesSelected(); #endregion if (ListFilesForPlates.Length == 0) return; ListFilesForPlates = Directory.GetFiles(Path, ListFilesForPlates[0] + ".txt", SearchOption.AllDirectories); #region And now let's analyse the files adn create the CSV CsvRow CurrentRow = new CsvRow(); bool IsHeaderWritten = false; string OriginalHeader = ""; Sep[0] = "\\"; string[] TmpSplit = ListFilesForPlates[0].Split(Sep, StringSplitOptions.RemoveEmptyEntries); //TmpSplit[TmpSplit.Length-1].Replace(".txt",".csv"); string TPath = Path + "\\" + TmpSplit[TmpSplit.Length - 1].Replace(".txt", ".csv"); Sep[0] = ","; // specifically for the bounding box processing FormForProgress MyProgressBar = new FormForProgress(); MyProgressBar.progressBar.Maximum = ListFilesForPlates.Length; MyProgressBar.Show(); for (int i = 0; i < ListFilesForPlates.Length ; i++) { MyProgressBar.richTextBoxForComment.AppendText(ListFilesForPlates[i]); MyProgressBar.richTextBoxForComment.Update(); StreamWriter stream = new StreamWriter(TPath, true, Encoding.ASCII); #region process the header string CurrentFile = ListFilesForPlates[i]; CsvFileReader CSVReader = new CsvFileReader(CurrentFile); CSVReader.Separator = '\t'; CSVReader.ReadRow(CurrentRow); // let's take care of the header first while (CurrentRow[0]!="Plate Name") { CSVReader.ReadRow(CurrentRow); } string PlateName = CurrentRow[1]; // skip the rest of the header while (CurrentRow[0] != "[Data]") { CSVReader.ReadRow(CurrentRow); } // read the columns names CSVReader.ReadRow(CurrentRow); List<string> Descs = CurrentRow; string TobeWritten = "Plate Name,"; int IdxBoundingBox = -1; int IndexCol = -1; int IndexRow = -1; int IndexCompound = -1; int IndexConcentration = -1; int IndexCellcount = -1; int NumDesc = Descs.Count; for (int j = 0; j < Descs.Count; j++) { if (Descs[j] == "Bounding Box") { TobeWritten += "X_Min,Y_Min,X_Max,Y_Max,"; IdxBoundingBox = j; // NumDesc += 3; } else if (Descs[j] == "Row") { IndexRow = j; TobeWritten += "Well Position,"; } else if (Descs[j] == "Column") { IndexCol = j; } else if (Descs[j] == "Compound") { // skipped IndexCompound = j; } else if (Descs[j] == "Concentration") { // skipped IndexConcentration = j; } else if (Descs[j] == "Cell Count") { // skipped IndexCellcount = j; } else TobeWritten += Descs[j] + ","; } TobeWritten = TobeWritten.Remove(TobeWritten.Length - 1); if (IsHeaderWritten == false) { OriginalHeader = TobeWritten; stream.WriteLine(TobeWritten); IsHeaderWritten = true; } else { // inconsistency between the headers... skip the plate if (TobeWritten != OriginalHeader) { continue; } } #endregion // now let's process the data int IdxRow = 0; while (!CSVReader.EndOfStream) { CSVReader.ReadRow(CurrentRow); TobeWritten = PlateName+","; for (int j = 0; j < Descs.Count; j++) { if ((IdxBoundingBox > -1) && (j == IdxBoundingBox)) { // let's process the bounding box string BB = CurrentRow[j]; BB = BB.Remove(BB.Length - 1); BB = BB.Remove(0, 1); string[] Splitted = BB.Split(Sep, StringSplitOptions.None); TobeWritten += Splitted[0] + "," + Splitted[1] + "," + Splitted[2] + "," + Splitted[3] + ","; // j += 3; } else if (j == IndexRow) { TobeWritten += ConvertPosition(int.Parse(CurrentRow[IndexCol]), int.Parse(CurrentRow[IndexRow]))+","; } else if ((j == IndexCol)||(j==IndexCellcount)||(j==IndexCompound)||(j==IndexConcentration)) { // do nothing } else { if (CurrentRow[j] != "") TobeWritten += CurrentRow[j] + ","; else TobeWritten += "NaN,"; } } TobeWritten = TobeWritten.Remove(TobeWritten.Length - 1); stream.WriteLine(TobeWritten ); IdxRow++; } CSVReader.Close(); stream.Dispose(); MyProgressBar.progressBar.Value++; MyProgressBar.progressBar.Update(); } MyProgressBar.Close(); #endregion #region let's build the database now // if (CSVFeedBackWindow == null) return; // if (CSVFeedBackWindow.ShowDialog() != System.Windows.Forms.DialogResult.OK) return; string DBPath = Path + "\\DB"; Directory.CreateDirectory(DBPath); cConvertCSVtoDB CCTODB = CSVtoDB(TPath, ",", DBPath); if (CCTODB == null) { return; } else { // update image accessor cGlobalInfo.OptionsWindow.radioButtonImageAccessDefined.Checked = false; cGlobalInfo.OptionsWindow.radioButtonImageAccessHarmony35.Checked = true; cGlobalInfo.OptionsWindow.textBoxImageAccesImagePath.Text = Path; cGlobalInfoToBeExported GlobalInfoToBeExported = new cGlobalInfoToBeExported(); cGlobalInfo.OptionsWindow.TmpOptionPath = GlobalInfoToBeExported.Save(DBPath+"\\Options.opt"); //cGlobalInfo.OptionsWindow.sav } #endregion }
private void buttonUpdateImagePath_Click(object sender, EventArgs e) { var dlg1 = new Ionic.Utils.FolderBrowserDialogEx(); dlg1.Description = "Select the folder containing your databases."; dlg1.ShowNewFolderButton = true; dlg1.ShowEditBox = true; //dlg1.NewStyle = false; // dlg1.SelectedPath = txtExtractDirectory.Text; dlg1.ShowFullPathInEditBox = true; dlg1.RootFolder = System.Environment.SpecialFolder.Desktop; dlg1.SelectedPath = this.textBoxImageAccesImagePath.Text; // Show the FolderBrowserDialog. DialogResult result = dlg1.ShowDialog(); if (result != DialogResult.OK) return; //FolderBrowserDialog OpenFolderDialog = new FolderBrowserDialog(); //if (OpenFolderDialog.ShowDialog() != DialogResult.OK) return; this.textBoxImageAccesImagePath.Text = dlg1.SelectedPath; }
public cFeedBackMessage Run() { if (this.Input == null) { FeedBackMessage.IsSucceed = false; FeedBackMessage.Message = "No input data defined."; return FeedBackMessage; } string PathForImages; if (IsDisplayUIForFilePath) { SaveFileDialog CurrSaveFileDialog = new SaveFileDialog(); CurrSaveFileDialog.Filter = "CSV file (*.csv)|*.csv| XLS file (*.xls)|*.xls| ARFF file (*.arff)|*.arff"; System.Windows.Forms.DialogResult Res = CurrSaveFileDialog.ShowDialog(); if (Res != System.Windows.Forms.DialogResult.OK) { FeedBackMessage.IsSucceed = false; FeedBackMessage.Message = "Incorrect File Name."; return FeedBackMessage; } FilePath = CurrSaveFileDialog.FileName; if (CurrSaveFileDialog.FilterIndex == 1) this.FileType = eFileType.CSV; else if (CurrSaveFileDialog.FilterIndex == 2) this.FileType = eFileType.XLS; else this.FileType = eFileType.ARFF; } else if (IsIncludeImageAsComment) { this.FileType = eFileType.XLS; var dlg1 = new Ionic.Utils.FolderBrowserDialogEx(); dlg1.Description = "Create a folder that will contain your file and the images."; dlg1.ShowNewFolderButton = true; dlg1.ShowEditBox = true; //dlg1.NewStyle = false; // dlg1.SelectedPath = txtExtractDirectory.Text; dlg1.ShowFullPathInEditBox = true; dlg1.RootFolder = System.Environment.SpecialFolder.Desktop; // Show the FolderBrowserDialog. DialogResult result = dlg1.ShowDialog(); if (result != DialogResult.OK) { FeedBackMessage.IsSucceed = false; FeedBackMessage.Message = "Incorrect File Name."; return FeedBackMessage; } PathForImages = dlg1.SelectedPath; if (Directory.Exists(PathForImages) == false) { FeedBackMessage.IsSucceed = false; FeedBackMessage.Message = "Incorrect File Name."; return FeedBackMessage; } } else { if (this.FilePath == "") { FeedBackMessage.IsSucceed = false; FeedBackMessage.Message = "Incorrect File Name."; return FeedBackMessage; } } if (this.FileType == eFileType.CSV) { if (IsTagToBeSaved == false) { using (StreamWriter myFile = new StreamWriter(FilePath, this.IsAppend, Encoding.Default)) { // Export titles: string sHeaders = ""; if (this.Input.ListRowNames != null) sHeaders += this.Separator; for (int j = 0; j < this.Input.Count; j++) { sHeaders = sHeaders.ToString() + this.Input[j].Name + Separator; } sHeaders = sHeaders.Remove(sHeaders.Length - 1); myFile.WriteLine(sHeaders); // Export data. for (int i = 0; i < this.Input[0].Count; i++) { string stLine = ""; if ((this.Input.ListRowNames != null) && (this.Input.ListRowNames.Count > i)) stLine += this.Input.ListRowNames[i] + this.Separator; for (int j = 0; j < this.Input.Count; j++) { stLine = stLine.ToString() + this.Input[j][i] + Separator; } stLine = stLine.Remove(stLine.Length - 1); myFile.WriteLine(stLine); } myFile.Close(); } } } else if (this.FileType == eFileType.XLS) { // ExportToExcel(this.Input, FilePath, PathForImages); //Microsoft.Office.Interop.Excel.Application xlApp = new Microsoft.Office.Interop.Excel.Application(); //Microsoft.Office.Interop.Excel.Workbook xlWorkBook; //Microsoft.Office.Interop.Excel.Worksheet xlWorkSheet; //object misValue = System.Reflection.Missing.Value; //// xlApp = new Excel.ApplicationClass(); //xlWorkBook = xlApp.Workbooks.Add(misValue); //xlWorkSheet = (Microsoft.Office.Interop.Excel.Worksheet)xlWorkBook.Worksheets.get_Item(1); //// Microsoft.Office.Interop.Excel.Range cell = GetMyPictureCELL(taperSheet); ////xlWorkSheet.Cells[j + 2, 1].AddComment(" "); ////xlWorkSheet.Cells[j + 2, 1].Comment.Shape.Fill.UserPicture(imagenames[j]); //xlWorkBook.SaveAs(FilePath, Microsoft.Office.Interop.Excel.XlFileFormat.xlWorkbookNormal, misValue, misValue, misValue, misValue, // Microsoft.Office.Interop.Excel.XlSaveAsAccessMode.xlExclusive, misValue, misValue, misValue, misValue, misValue); //xlWorkBook.Close(true, misValue, misValue); //xlApp.Quit(); //releaseObject(xlWorkSheet); //releaseObject(xlWorkBook); //releaseObject(xlApp); } else if (this.FileType == eFileType.ARFF) { Instances insts = this.Input.CreateWekaInstances(); ArffSaver saver = new ArffSaver(); CSVSaver savercsv = new CSVSaver(); saver.setInstances(insts); saver.setFile(new java.io.File(FilePath)); saver.writeBatch(); // System.Diagnostics.Process proc1 = new System.Diagnostics.Process(); // proc1.StartInfo.FileName = "C:\\Program Files\\Weka-3-6\\RunWeka.bat explorer"; // proc1.StartInfo.Arguments = FilePath; // proc1.Start(); } if (this.IsRunEXCEL) { System.Diagnostics.Process proc = new System.Diagnostics.Process(); proc.StartInfo.FileName = "excel"; proc.StartInfo.Arguments = FilePath; proc.Start(); } return FeedBackMessage; }
private void btnDirBrowse_Click(object sender, EventArgs e) { Ionic.Utils.FolderBrowserDialogEx dlg1 = new Ionic.Utils.FolderBrowserDialogEx(); dlg1.Description = "Select a folder for the extracted files:"; dlg1.ShowNewFolderButton = true; dlg1.ShowEditBox = true; //dlg1.NewStyle = false; if (Directory.Exists(txtExtractDirectory.Text)) dlg1.SelectedPath = txtExtractDirectory.Text; else { string d = txtExtractDirectory.Text; while (d.Length > 2 && !Directory.Exists(d)) { d = Path.GetDirectoryName(d); } if (d.Length < 2) dlg1.SelectedPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal); else dlg1.SelectedPath = d; } dlg1.ShowFullPathInEditBox = true; //dlg1.RootFolder = System.Environment.SpecialFolder.MyComputer; // Show the FolderBrowserDialog. DialogResult result = dlg1.ShowDialog(); if (result == DialogResult.OK) { txtExtractDirectory.Text = dlg1.SelectedPath; } }
/// <summary> /// Spawns a FolderBrowserDialog to choose a directory /// to scan music files. /// </summary> /// <returns>A string containing a directory path</returns> private string SpawnSelectScanDir() { Ionic.Utils.FolderBrowserDialogEx dialog = new Ionic.Utils.FolderBrowserDialogEx(); //System.Windows.Forms.FolderBrowserDialog dialog = new System.Windows.Forms.FolderBrowserDialog(); dialog.Description = "Select music directory"; dialog.ShowEditBox = true; dialog.ShowNewFolderButton = false; dialog.ShowBothFilesAndFolders = true; System.Windows.Forms.DialogResult result = dialog.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK && string.IsNullOrWhiteSpace(dialog.SelectedPath)) { MessageBox.Show("Cant scan a invalid directory", "Directory selection failed"); return null; } else if (result == System.Windows.Forms.DialogResult.Cancel) { return null; } return dialog.SelectedPath; }
private void generateResourcesMenuItem_Click( object sender, EventArgs e ) { using (Ionic.Utils.FolderBrowserDialogEx fbd = new Ionic.Utils.FolderBrowserDialogEx()) { fbd.Description = "Where to save Resources.zip:"; fbd.NewStyle = true; fbd.RootFolder = Environment.SpecialFolder.Desktop; fbd.SelectedPath = Path.GetDirectoryName( Application.ExecutablePath ); fbd.ShowBothFilesAndFolders = false; fbd.ShowEditBox = true; fbd.ShowFullPathInEditBox = false; fbd.ShowNewFolderButton = true; if (fbd.ShowDialog( this ) == DialogResult.OK) { PatcherLib.ResourcesClass.GenerateDefaultResourcesZip( Path.Combine( fbd.SelectedPath, "Resources.zip" ) ); } } }
private void openFolderDialog(object sender) { // TODO : need a EXtract Method; TextBox passedTextBox = (TextBox)this.Controls.Find(this.txtEpkDir.Name + ((Button)sender).Name.Replace("openEpkDlgButton", string.Empty), true)[0]; var dlg1 = new Ionic.Utils.FolderBrowserDialogEx(); dlg1.Description = "Select a folder which will be checked :"; dlg1.ShowNewFolderButton = true; dlg1.ShowEditBox = true; //dlg1.NewStyle = false; dlg1.SelectedPath = txtEpkDir.Text; dlg1.ShowFullPathInEditBox = true; dlg1.RootFolder = System.Environment.SpecialFolder.MyComputer; // Show the FolderBrowserDialog. DialogResult result = dlg1.ShowDialog(); if (result == DialogResult.OK) { passedTextBox.Text = dlg1.SelectedPath; writeToDebugPanel(DateTime.Now.ToString("H:mm:ss") + " file directory changed to " + txtEpkDir.Text); } }