public CommandsEditor(string fp) { InitializeComponent(); CPriority.Items.AddRange(Enum.GetValues(typeof(CommandPriority)).Cast <CommandPriority>().ToList().ConvertAll(k => k.ToString()).ToArray()); CPriority.SelectedIndex = 0; if (FilePath == "") { OpenFile.Filter = "Rocket Commands|" + Rocket.Core.Environment.CommandsFile; if (OpenFile.ShowDialog() == DialogResult.OK) { _mem = new CommandsMemory(OpenFile.FileName); Text = "Editing: " + OpenFile.FileName; _mem._rc.CommandMappings.ForEach(k => Commands.Items.Add(k.Name)); Commands.SelectedIndex = Commands.Items.Count > 0 ? 0 : -1; RefreshCommandData(); return; } else { Load += (s, e) => Close(); return; } } _mem = new CommandsMemory(FilePath); Text = "Editing: " + FilePath; _mem._rc.CommandMappings.ForEach(k => Commands.Items.Add(k.Name)); Commands.SelectedIndex = Commands.Items.Count > 0 ? 0 : -1; RefreshCommandData(); }
private void Choose1_Click(object sender, EventArgs e) { if (OpenFile.ShowDialog() == DialogResult.OK) { Argument1.Text = OpenFile.FileName; } }
private void BtnAddPhoto_Click(object sender, EventArgs e) { if (OpenFile.ShowDialog() == DialogResult.OK) { phonoPictureBox.Load(OpenFile.FileName); } }
private void Load_Click(object sender, EventArgs e) { if (OpenFile.ShowDialog() == DialogResult.Cancel) { return; } Toolbox.Enabled = true; string filename = OpenFile.FileName; WorkPanel.Visible = true; controller.SaveCurrentProject(WorkPanel, countControls); countControls++; currentProject = countControls; TreeView.Nodes[0].Nodes.Add("Loaded Project " + countControls); TreeView.ExpandAll(); InterfaceDesigner.ActiveForm.Text = "Interface Designer - " + "Loaded Project " + countControls; controller.Load(filename, WorkPanel, ListOfFigures); if (countControls == 5) { Create.Enabled = false; Load.Enabled = false; CreateBtn.Enabled = false; DownloadBtn.Enabled = false; } }
private void OpenFileButton_Click(object sender, EventArgs e) { if (OpenFile.ShowDialog() == DialogResult.OK) { TextOutputBox.Text = null; } }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { var buffer = ""; var fileName = ""; var htmlName = ""; if (OpenFile.ShowDialog() == DialogResult.OK) { var sr = new StreamReader(OpenFile.FileName); fileName = OpenFile.SafeFileName; buffer = sr.ReadToEnd(); sr.Close(); } fileName = string.Format(@"..\..\Data\Users\{0}_{1}", Entry.userName, fileName); htmlName = @"file:///" + Path.GetFullPath(fileName); using (StreamWriter file = File.CreateText(fileName)) { file.Write("<body background = \"{0}\">", Path.GetFullPath(@"..\..\Resources\background.png")); file.Write(Markdown.ToHtml(buffer)); file.Write(@"</body>"); file.Close(); } User.userData.Recent = @"..\..\Data\Users" + fileName; User.JsonUpdate(User.userFile, User.userData); WebBrowser.Url = new Uri(htmlName); }
private void LoadButton_Click(object sender, EventArgs e) { DialogResult result = OpenFile.ShowDialog(); // OK button was pressed. if (result == DialogResult.OK) { SaveFileName = OpenFile.FileName; try { // Output the requested file in richTextBox1. SaveFile = new FileStream(SaveFileName, FileMode.Open, FileAccess.ReadWrite); LoadSaveFile(); } catch (Exception exp) { MessageBox.Show("An error occurred while attempting to load the file. The error is:" + System.Environment.NewLine + exp.ToString() + System.Environment.NewLine); } } // Cancel button was pressed. else if (result == DialogResult.Cancel) { return; } }
private void PicKonum_Click(object sender, EventArgs e) { OpenFile.ShowDialog(); Pic.ImageLocation = OpenFile.FileName.ToString(); txtPic.Text = OpenFile.FileName.ToString(); txtPic.Text = txtPic.Text.Replace("\\", "/"); }
private void FileOpenMenu_Click(object sender, EventArgs e) { try { if (OpenFile.ShowDialog(this) != DialogResult.OK) { return; } // deserialize if (new FileInfo(OpenFile.FileName).Extension.EndsWith("csv", StringComparison.InvariantCultureIgnoreCase)) { var data = Program.ImportData(OpenFile.FileName)?.ToList(); var min = data.Min(d => d.Timestamp); data.ForEach(d => d.Timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds() + (d.Timestamp - min) + 10000); _Data = data; } else { using (var fs = new FileStream(OpenFile.FileName, FileMode.Open, FileAccess.Read)) { using (var sr = new StreamReader(fs)) { var data = Serializer.Deserialize <List <ZebraData> >(sr.ReadToEnd())?.Select(z => (EventData)z).ToList(); var min = data.Min(d => d.Timestamp); data.ForEach(d => d.Timestamp = DateTimeOffset.Now.ToUnixTimeMilliseconds() + (d.Timestamp - min) + 10000); _Data = data; } } } } catch (Exception ex) { MessageBox.Show(this, ex.Message); } }
private void btnCari_Click(object sender, EventArgs e) { try { if (OpenFile.ShowDialog() == DialogResult.OK) { Cursor.Current = Cursors.WaitCursor; string pathName = OpenFile.FileName; string fileName = Path.GetFileNameWithoutExtension(OpenFile.FileName); DataTable tbContainer = new DataTable(); string strConn = string.Empty; string sheetName = "data"; FileInfo file = new FileInfo(pathName); if (!file.Exists) { throw new Exception("Error, file doesn't exists!"); } string extension = file.Extension; strConn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + pathName + ";Extended Properties='Excel 12.0;HDR=Yes;IMEX=1;'"; OleDbConnection cnnxls = new OleDbConnection(strConn); OleDbDataAdapter oda = new OleDbDataAdapter(string.Format("select * from [{0}$]", sheetName), cnnxls); oda.Fill(tbContainer); dgLog.DataSource = tbContainer; } } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void AddRef_Click(object sender, EventArgs e) { if (OpenFile.ShowDialog() == System.Windows.Forms.DialogResult.OK) { AddAssembly(OpenFile.FileName); } }
private void Open_Click(object sender, EventArgs e) { if (OpenFile.ShowDialog() == DialogResult.OK) { textBox1.Text = OpenFile.FileName; } }
/// <summary> /// Handles the Click event of the LoadBugFile control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param> void LoadBugFile_Click(object sender, EventArgs e) { if (OpenFile.ShowDialog() == DialogResult.OK) { LoadBug(OpenFile.FileName); } }
private void Open_Click(object sender, EventArgs e) { if (OpenFile.ShowDialog() == DialogResult.Cancel) { return; } }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { if (OpenFile.ShowDialog() == DialogResult.OK) { Picture.Load(OpenFile.FileName); } }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { saveConfirm(false); if (cancelPressed == true) { cancelPressed = false; return; } if (OpenFile.ShowDialog() != DialogResult.OK) { return; } { if (!OpenFile.FileName.Contains(".cnp")) { string opnfile = File.ReadAllText(OpenFile.FileName); string NameWithotPath = Path.GetFileName(OpenFile.FileName); customRTB.Text = opnfile; this.Text = appName + NameWithotPath; string cc2 = customRTB.Text.Length.ToString(CultureInfo.InvariantCulture); customRTB.Select(Convert.ToInt32(cc2), 0); return; } DecryptAES(); if (publicVar.okPressed == true) { publicVar.okPressed = false; currentFilename = Path.GetFileName(OpenFile.FileName); } } }
private void btnOpen_Click(object sender, EventArgs e) { OpenFile.Filter = "Text and Compressed Files (*.lzw,*.txt)|*.txt;*.lzw|Text Files (*.txt)|*.txt|Compressed Files (*.lzw)|*.lzw"; if (OpenFile.ShowDialog() == DialogResult.OK) { Clear(); if (OpenFile.FileName.EndsWith(".lzw") == true) { txtOriginal.WordWrap = true; txtCompressed.WordWrap = false; btnCompress.Text = "Decompress"; lblOriginal.Text = "Compressed"; lblCompressed.Text = "Original"; } else { txtOriginal.WordWrap = false; txtCompressed.WordWrap = true; btnCompress.Text = "Compress"; lblOriginal.Text = "Original"; lblCompressed.Text = "Compressed"; } Read(); InitializeDictionary(); txtPath.Text = OpenFile.FileName; btnCompress.Enabled = true; } }
private void btnBrowse_Click(object sender, EventArgs e) { int size = -1; OpenFile.InitialDirectory = "d:\\"; OpenFile.Filter = "Image Files(*.BMP; *.JPG; *.GIF)| *.BMP; *.JPG; *.GIF | All files(*.*) | *.* "; //"txt files (*.txt)|*.txt|All files (*.*)|*.*"; DialogResult result = OpenFile.ShowDialog(); if (result == DialogResult.OK) { try { string filename = null; txtFile.Text = OpenFile.FileName; // First load the image somehow Image myImage = Image.FromFile(txtFile.Text.Trim(), true); // Save the image with a quality of 50% /// string path = AppDomain.CurrentDomain.BaseDirectory; /// string path = ConfigurationManager.AppSettings["SaveImagePath"].ToString(); /// string datetimesecond = DateTime.Now.ToString("MM/dd/yyyy HH:mm:ss"); //// datetimesecond = datetimesecond.Replace("/", "").Replace(":", ""); string fileDirectory = DateTime.Now.ToString("MMMM dd") + DateTime.Now.Year.ToString(); createDirectory = path + "\\" + fileDirectory; var index = txtFile.Text.LastIndexOf(@"\"); if (index != -1) { filename = txtFile.Text.Substring((index + 1), (txtFile.Text.Trim().Length - 1) - index); } if (Directory.Exists(path)) { Directory.CreateDirectory(createDirectory); SaveJpeg(createDirectory + "\\" + filename, myImage, 50); createDirectory = ConfigurationManager.AppSettings["SaveImageforUI"].ToString() + fileDirectory + "\\" + filename; // createDirectory + "\\temp.jpg"; } else { SaveJpeg(createDirectory + "\\" + filename, myImage, 50); createDirectory = ConfigurationManager.AppSettings["SaveImageforUI"].ToString() + fileDirectory + "\\" + filename; } ///// data = ReadAllBytes(createDirectory + "\\" + txtFile.Text); ////StoreImage(data, txtFile.Text.Trim()); } catch (IOException) { } } }
private void openScriptToolStripMenuItem_Click(object sender, EventArgs e) { if (OpenFile.ShowDialog() == DialogResult.OK) { OpenLFile(OpenFile.FileName); Status.Text = "Opened file `" + CurrentFile + "` successfully."; } }
/// <summary> /// Choose ViewerPath /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnChooseViewerPath_Click(object sender, EventArgs e) { OpenFile.InitialDirectory = Application.StartupPath; if (OpenFile.ShowDialog() == System.Windows.Forms.DialogResult.OK) { txtViewerPath.Text = OpenFile.FileName; } }
private void Button_Choose_Click(object sender, EventArgs e) { if (DialogResult.OK == OpenFile.ShowDialog()) { MyFiles.Clear(); MyFiles.AddRange(OpenFile.FileNames); } }
private void ButtonOpenFile_Click(object sender, EventArgs e) { if (OpenFile.ShowDialog() == DialogResult.OK) { this.loadedFilePath = OpenFile.FileName; this.DrawImage(); } }
private void SelectImageButton_Click(object sender, EventArgs e) { DialogResult = DialogResult.Abort; if (OpenFile.ShowDialog() == DialogResult.OK) { PosterImageTB.Text = OpenFile.FileName; } }
private void butOpen_Click(object sender, EventArgs e) { OpenFile.Title = "Select Adventure to edit."; OpenFile.FileName = ""; OpenFile.DefaultExt = "*.tab"; OpenFile.Filter = "Adventure Files | *.tab"; OpenFile.ShowDialog(); }
/// <summary> /// Import Queue /// </summary> /// <param name="sender"> /// The sender. /// </param> /// <param name="e"> /// The e. /// </param> private void MnuImportClick(object sender, EventArgs e) { OpenFile.FileName = string.Empty; OpenFile.ShowDialog(); if (OpenFile.FileName != String.Empty) { queue.QueueManager.RestoreQueue(OpenFile.FileName); } }
private void btChangeFile_Click(object sender, EventArgs e) { if (OpenFile.ShowDialog() == DialogResult.OK) { string fileName = OpenFile.FileName; astroService.ChangeFileName(fileName); tbFilePath.Text = astroService.FileName; } }
private void OpenStrip_Click(object sender, EventArgs e) { if (OpenFile.ShowDialog() == DialogResult.OK) { Text = new TextFile(); SourceText.Lines = Text.ReadFile(OpenFile.FileName); Path = OpenFile.FileName; } }
private void BtnAnexar_Click(object sender, EventArgs e) { if (OpenFile.ShowDialog() == DialogResult.OK) { for (int i = 0; i < OpenFile.FileNames.Length; i++) { ListAnexos.Items.Add(OpenFile.FileNames[i]); } } }
private void Button_Add_Click(object sender, EventArgs e) { if (DialogResult.OK == OpenFile.ShowDialog()) { foreach (string file in OpenFile.FileNames) { Text_InputFiles.Text += file + "\r\n"; } } }
private void Browse(TextBox textbox, string title, string filter) { OpenFile.Title = title; OpenFile.Filter = filter; if (OpenFile.ShowDialog(this) == DialogResult.Cancel) { return; } textbox.Text = OpenFile.FileName; }