Exemple #1
0
 private void Deserialization_filename_label_Click(object sender, EventArgs e)
 {
     if (Serialization_comboBox.SelectedIndex != -1)
     {
         var DeserializationName = Serialization_comboBox.SelectedItem.ToString();
         foreach (var element in serializations)
         {
             if (DeserializationName == element.Name)
             {
                 var Deserializator = Activator.CreateInstance(element);
                 var p = Deserializator.GetType().GetField("filters");
                 OpenFileDialog1.Filter = p.GetValue(p).ToString();
             }
         }
         if (OpenFileDialog1.ShowDialog() == DialogResult.Cancel)
         {
             return;
         }
         string filename = OpenFileDialog1.FileName;
         Deserialization_textBox.Text = filename;
     }
     else
     {
         MessageBox.Show("Choose serialization");
     }
 }
Exemple #2
0
        private void InsertImageToolStripMenuItem_Click(object sender, System.EventArgs e)
        {
            OpenFileDialog1.Title       = "RTE - Insert Image File";
            OpenFileDialog1.DefaultExt  = "rtf";
            OpenFileDialog1.Filter      = "Bitmap Files|*.bmp|JPEG Files|*.jpg|GIF Files|*.gif";
            OpenFileDialog1.FilterIndex = 1;
            OpenFileDialog1.ShowDialog();

            if (OpenFileDialog1.FileName == "")
            {
                return;
            }

            try
            {
                string strImagePath = OpenFileDialog1.FileName;
                Image  img;
                img = Image.FromFile(strImagePath);
                Clipboard.SetDataObject(img);
                DataFormats.Format df;
                df = DataFormats.GetFormat(DataFormats.Bitmap);
                if (this.rtbDoc.CanPaste(df))
                {
                    this.rtbDoc.Paste(df);
                }
            }
            catch
            {
                MessageBox.Show("Unable to insert image format selected.", "RTE - Paste", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemple #3
0
 private void Openfilebtn_Click(object sender, EventArgs e)
 {
     if (OpenFileDialog1.ShowDialog() != DialogResult.Cancel)
     {
         AttemptStashLoad(OpenFileDialog1.FileName);
     }
 }
Exemple #4
0
        private void Decompressed_label_Click(object sender, EventArgs e)
        {
            string filter = "";

            foreach (var element in plugins)
            {
                if (!element.IsInterface)
                {
                    var Decompresser = Activator.CreateInstance(element);
                    var p            = Decompresser.GetType().GetField("filters");
                    filter = filter + p.GetValue(p).ToString() + "|";
                }
            }
            if (filter.EndsWith("|"))
            {
                filter = filter.Substring(0, filter.Length - 1);
            }
            OpenFileDialog1.Filter = filter;
            if (OpenFileDialog1.ShowDialog() == DialogResult.Cancel)
            {
                return;
            }
            string filename = OpenFileDialog1.FileName;

            Decompress_textBox.Text = filename;
        }
Exemple #5
0
        private void BtnLoadClick(object sender, EventArgs e)
        {
            String line, laststatus;
            eMode  lastMode;

            G20set = false;

            if (OpenFileDialog1.ShowDialog() == DialogResult.OK)
            {
                lastMode = currentMode;
                setMode(eMode.LOADING);
                System.IO.StreamReader sr = new
                                            System.IO.StreamReader(OpenFileDialog1.FileName);
                while ((line = sr.ReadLine()) != null)
                {
                    listBoxGcode.Items.Add(line);
                    Application.DoEvents();
                }
                sr.Close();
                OpenFile(OpenFileDialog1.FileName);

                setMode(lastMode);
                Text = System.IO.Path.GetFileName(OpenFileDialog1.FileName);
            }
        }
Exemple #6
0
        public void FromUserFileToArray()
        {
            // Read all values from the file selected from the openfiledialog control in a csv format
            // and writes it to the array (ImagingArray).
            string filename = "";

            if (OpenFileDialog1.ShowDialog() == DialogResult.OK)
            {
                filename = OpenFileDialog1.FileName;
            }

            if (File.Exists(filename))
            {
                int          linecount = 0;
                StreamReader oRead     = new StreamReader(filename);
                while (!oRead.EndOfStream)
                {
                    string LineIn = oRead.ReadLine();

                    data_array = LineIn.Split(new Char[] { ',' });
                    for (int i = 0; i <= data_array.Length - 1; i++)
                    {
                        sd.ImagingArray[linecount, i] = data_array[i];
                    }
                    linecount += 1;
                }
                oRead.Close();
            }
        }
Exemple #7
0
 private void Button6_Click(object sender, EventArgs e)
 {
     if (OpenFileDialog1.ShowDialog() == DialogResult.OK)
     {
         TextBox2.Text = OpenFileDialog1.FileName;
     }
 }
Exemple #8
0
        private void ApriToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog1.Title    = "Seleziona File da processare";
            OpenFileDialog1.FileName = "";
            OpenFileDialog1.Filter   = "Excel File|*.xls;*.xlsx";

            if (OpenFileDialog1.ShowDialog() == DialogResult.OK)
            {
                string sFileName = OpenFileDialog1.FileName;
                if (sFileName.Trim() != "")
                {
                    if (sFileName == string.Empty)
                    {
                        MessageBox.Show("Selezionare un file da caricare");
                        return;
                    }
                    if (!File.Exists(sFileName))
                    {
                        MessageBox.Show("file non trovato");
                        return;
                    }
                    data = LoadFile(sFileName);
                    dataGridView1.DataSource = data;
                    if (data != null)
                    {
                        map = new Dictionary <string, string>();
                        map.Add("CodiceArticolo", data.Columns[0].ColumnName);
                        buttonColumnsMapping.Enabled = true;
                        buttonElabora.Enabled        = true;
                        buttonStop.Enabled           = false;
                    }
                }
            }
        }
Exemple #9
0
        public void BrowseButton_Click(System.Object sender, System.EventArgs e)
        {
            try
            {
                //Set the initial directory in the Select a file dialog
                OpenFileDialog1.InitialDirectory = vault1.RootFolderPath;
                //Show the Select a file dialog
                System.Windows.Forms.DialogResult DialogResult;
                DialogResult = OpenFileDialog1.ShowDialog();

                if (!(DialogResult == System.Windows.Forms.DialogResult.OK))
                {
                    // Do nothing
                }
                else
                {
                    // Browse for a file whose serial number to set
                    // File's data card must have a Part Number associated
                    // with a serial number generator and must be checked out
                    string fileName = OpenFileDialog1.FileName;
                    FileListBox.Items.Add(fileName);
                    IEdmFolder5 retFolder = default(IEdmFolder5);
                    aFile = vault1.GetFileFromPath(fileName, out retFolder);
                }
            }
            catch (System.Runtime.InteropServices.COMException ex)
            {
                MessageBox.Show("HRESULT = 0x" + ex.ErrorCode.ToString("X") + " " + ex.Message);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Exemple #10
0
 private void Button1_Click(object sender, EventArgs e)
 {
     if (OpenFileDialog1.ShowDialog() != DialogResult.Cancel)
     {
         try
         {
             TextBox5.Text = OpenFileDialog1.FileName;
             FileInfo myFile       = new FileInfo(Program.Form.FileSelectiontxt.Text);
             long     sizeInBytes  = myFile.Length;
             FileInfo myFile2      = new FileInfo(TextBox5.Text);
             long     sizeInBytes2 = myFile2.Length;
             if (sizeInBytes2 < sizeInBytes)
             {
                 MessageBox.Show("This file must be the same/bigger size in order for this engine to work.");
                 TextBox5.Text = "";
                 return;
             }
         }
         catch (ArgumentException)
         {
             MessageBox.Show("Please load a file into the corruptor first before loading in a file in the merge engine. (Argument Exception)");
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.ToString());
         }
     }
 }
 private void Button1_Click(object sender, EventArgs e)
 {
     if (OpenFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         Index = 0;
         Array.Resize(ref PSM_Surface, OpenFileDialog1.FileNames.Length);
         for (int i = 0; i <= OpenFileDialog1.FileNames.Length - 1; i++)
         {
             PSM_Surface[i] = new PSM();
             if (OpenFileDialog1.FilterIndex == 1)
             {
                 PSM_Surface[i].LoadPSM(OpenFileDialog1.FileNames[i], CheckBox1.Checked);
             }
             else if (OpenFileDialog1.FilterIndex == 2)
             {
                 PSM_Surface[i].LoadPTC(OpenFileDialog1.FileNames[i], CheckBox1.Checked);
             }
             else if (OpenFileDialog1.FilterIndex == 3)
             {
                 PSM_Surface[i].LoadPSF(OpenFileDialog1.FileNames[i], CheckBox1.Checked);
             }
         }
         Label1.Text = (Index + 1).ToString() + @"\" + PSM_Surface.Length.ToString();
         GlControl1.Invalidate();
     }
 }
Exemple #12
0
        /// <summary>
        /// Plays the current audio file that is opened or asks to open a new audio file if one has not already
        /// been selected.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void BtnPlay_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrWhiteSpace(_audioPlayer.Filename) || !File.Exists(_audioPlayer.Filename))
            {
                OpenFileDialog1.FileName    = "";
                OpenFileDialog1.Multiselect = false;
                OpenFileDialog1.Filter      = "*.mp3|*.mp3|*.wav|*.wav";
                OpenFileDialog1.ShowDialog();

                if (string.IsNullOrWhiteSpace(_audioPlayer.Filename) || !File.Exists(_audioPlayer.Filename))
                {
                    return;
                }

                _audioPlayer.Filename = OpenFileDialog1.FileName;
                this.Text             = OpenFileDialog1.FileName;
                lblFilename.Text      = OpenFileDialog1.FileName;
                btnPause.CheckState   = CheckState.Unchecked;
                btnRecord.Enabled     = false;
                _audioPlayer.Play();
                PlaybackTimer.Enabled = true;
            }
            else
            {
                btnPause.CheckState   = CheckState.Unchecked;
                btnRecord.Enabled     = false;
                PlaybackTimer.Enabled = true;
                _audioPlayer.Play();
            }
        }
Exemple #13
0
 private void PbGambar_Click(object sender, EventArgs e)
 {
     OpenFileDialog1.Filter = "JPG|*.jpg|PNG|*.png";
     if (OpenFileDialog1.ShowDialog() == DialogResult.OK)
     {
         PbGambar.Image = Image.FromFile(OpenFileDialog1.FileName);
     }
 }
Exemple #14
0
 private void FinishedButton_Click(object sender, EventArgs e)
 {
     if (OpenFileDialog1.ShowDialog() == DialogResult.OK)
     {
         label1.Text = OpenFileDialog1.FileName;
         FileName    = label1.Text;
     }
 }
Exemple #15
0
 private void Browse_Click(object sender, EventArgs e)
 {
     //Clear the file name
     OpenFileDialog1.FileName = "";
     if (OpenFileDialog1.ShowDialog() == DialogResult.OK)
     {
         pictureBox1.Image = Image.FromFile(OpenFileDialog1.FileName);
     }
 }
Exemple #16
0
 private void SelectFileFromComputerToolStripMenuItem_Click(object sender, EventArgs e)
 {
     OpenFileDialog1.FileName    = "";
     OpenFileDialog1.Filter      = "Video Files|*.*";
     OpenFileDialog1.Multiselect = false;
     OpenFileDialog1.Title       = "Select Video File To Cast";
     OpenFileDialog1.ShowDialog();
     LoadLocalStream(OpenFileDialog1.FileName);
 }
Exemple #17
0
 void TxtOderCsvToolStripMenuItemClick(object sender, EventArgs e)
 {
     if (OpenFileDialog1.ShowDialog() != DialogResult.OK)
     {
         return;
     }
     loadCsv(OpenFileDialog1.FileName);
     DataGridView1.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
 }
 private void DownloadFile1_Click(object sender, EventArgs e)
 {
     if (OpenFileDialog1.ShowDialog() == DialogResult.OK)
     {
         WorkWithFiles file = new WorkWithFiles(OpenFileDialog1.FileName);
         TextBox1.Lines = file.Text;
         OpenFileDialog1.Dispose();
     }
 }
Exemple #19
0
 private void Button_DatPathRef_Haven_Click(System.Object sender, System.EventArgs e)
 {
     if (OpenFileDialog1.ShowDialog() == DialogResult.OK)
     {
         //OKボタンがクリックされたとき
         //選択されたファイル名を表示する
         TextBox_DatPath_Haven.Text = OpenFileDialog1.FileName;
     }
 }
Exemple #20
0
 private void browseButton_Click(object sender, EventArgs e)
 {
     OpenFileDialog1.Filter          = "Elasto Mania levels|*.lev";
     OpenFileDialog1.CheckFileExists = true;
     if (OpenFileDialog1.ShowDialog() == DialogResult.OK)
     {
         LevelTemplateBox.Text = OpenFileDialog1.FileName;
     }
 }
Exemple #21
0
 private void Open()
 {
     if (OpenFileDialog1.ShowDialog() == DialogResult.OK)
     {
         TextBox1.Clear();
         TextBox1.Text = File.ReadAllText(OpenFileDialog1.FileName);
         FileName      = string.Format("{0} -Windows 메모장", Path.GetFileName(OpenFileDialog1.FileName));
         this.Text     = FileName;
     }
 }
 private void BtnBrowsePicture_Click(object sender, EventArgs e)
 {
     if (OpenFileDialog1.ShowDialog(this) == DialogResult.OK)
     {
         // TODO: Mover para o BO
         Bitmap img = (Bitmap)Bitmap.FromFile(OpenFileDialog1.FileName);
         ImgPicture.Image =
             ImageProcessing.Resize(img, new Size(160, 120));
     }
 }
Exemple #23
0
        private void OpenFile()
        {
            try
            {
                OpenFileDialog1.Title       = "RTE - Open File";
                OpenFileDialog1.DefaultExt  = "rtf";
                OpenFileDialog1.Filter      = "Rich Text Files|*.rtf|Text Files | *.txt | HTML Files | *.htm | All Files | *.* ";
                OpenFileDialog1.FilterIndex = 1;
                OpenFileDialog1.FileName    = string.Empty;

                if (OpenFileDialog1.ShowDialog() == DialogResult.OK)
                {
                    if (OpenFileDialog1.FileName == "")
                    {
                        return;
                    }

                    string strExt;
                    strExt =
                        System.IO.Path.GetExtension(OpenFileDialog1.FileName);
                    strExt = strExt.ToUpper();

                    if (strExt == ".RTF")
                    {
                        rtbDoc.LoadFile(OpenFileDialog1.FileName,
                                        RichTextBoxStreamType.RichText);
                    }
                    else
                    {
                        System.IO.StreamReader txtReader;
                        txtReader = new
                                    System.IO.StreamReader(OpenFileDialog1.FileName);
                        rtbDoc.Text = txtReader.ReadToEnd();
                        txtReader.Close();
                        txtReader              = null;
                        rtbDoc.SelectionStart  = 0;
                        rtbDoc.SelectionLength = 0;
                    }

                    currentFile     = OpenFileDialog1.FileName;
                    rtbDoc.Modified = false;
                    this.Text       = "Editor: " + currentFile.ToString();
                }
                else
                {
                    MessageBox.Show("Open File request cancelled by user.",
                                    "Cancelled");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString(), "Error");
            }
        }
Exemple #24
0
        private void mnuOpen_Click(object sender, EventArgs e)
        {
            // 開啟檔案瀏覽
            OpenFileDialog1.Filter = "All Files (*.*)|*.*";
            OpenFileDialog1.Title  = "Open";

            if (OpenFileDialog1.ShowDialog() == DialogResult.OK)
            {
                webBrowser.Navigate(OpenFileDialog1.FileName);
            }
        }
Exemple #25
0
        private void button1_Click(object sender, EventArgs e)  // :безопасность
        {
            if (OpenFileDialog1.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                return;
            }

            var fi = new FileInfo(OpenFileDialog1.FileName);

            MainPack(createChechBox.Checked, keyNameBox.Text, fi, packetNameBox.Text, true);
        }
Exemple #26
0
        private void loadExtensionsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog1.ShowDialog();

            ScriptSource script = pyEngine.CreateScriptSourceFromFile(OpenFileDialog.FileName);

            script.Execute(pyScope);
            Console.WriteLine(OpenFileDialog1.FileName);
            dynamic DodajFunk = pyScope.GetVariable("DodajFunkciju");

            DodajFunk(this);
        }
Exemple #27
0
        private void Button1_Click(object sender, EventArgs e)
        {
            OpenFileDialog1.Filter = "Resim Dosyaları|" + "*.jpg;*.png;*.gif";
            DialogResult cevap = OpenFileDialog1.ShowDialog();

            if (cevap == DialogResult.OK)
            {
                PictureBox1.Image = Image.FromFile(OpenFileDialog1.FileName);
                a = OpenFileDialog1.FileName;
                OpenFileDialog1.Reset();
            }
        }
        private void cmdBrowse_Click(object sender, EventArgs e)
        {
            OpenFileDialog1.CheckFileExists = true;
            OpenFileDialog1.FileName        = string.Empty;
            if (OpenFileDialog1.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            Settings.Default.ScanSymbols = OpenFileDialog1.FileName;

            GetSymbols();
        }
Exemple #29
0
 public void PictureBox1_Click(object sender, EventArgs e)
 {
     try
     {
         OpenFileDialog1.ShowDialog();
         txtpicture.Text   = OpenFileDialog1.FileName;
         PictureBox1.Image = Image.FromFile(txtpicture.Text);
     }
     catch (Exception)
     {
         MessageBox.Show("Error");
     }
 }
 public void ptbProfile_Click_1(object sender, EventArgs e)
 {
     try
     {
         OpenFileDialog1.ShowDialog();
         txtPath1.Text    = OpenFileDialog1.FileName;
         ptbProfile.Image = Image.FromFile(txtPath1.Text);
     }
     catch (Exception)
     {
         MessageBox.Show("Error!");
     }
 }