示例#1
0
 private void btnSelectFile_Click(object sender, EventArgs e)
 {
     if (OFD.ShowDialog() == DialogResult.OK)
     {
         tbFile.Text = OFD.FileName;
     }
 }
示例#2
0
        /************************************************************
         *      La création d'un contrôle OpenFileDialog nommé OFD est nécessaire.
         *      Ouvre une boite de dialogue "Explorateur de fichiers"
         *      Récupére le chemin d'accès au fichier sélectionné et copie son contenu (ligne par ligne) dans une ListBox.
         *************************************************************/
        private void btnOFD_Click(object sender, EventArgs e)
        {
            String ligne;

            OFD.Title  = "Les fichiers texte.";  //titre de la boite de dialogue
            OFD.Filter = "Fichiers texte|*.txt"; // Filtre : n'affiche que les fichiers ".txt"

            if (OFD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                try
                {
                    lbxFichiers.Items.Clear();                          // vider la listbox
                    StreamReader SR = new StreamReader(OFD.OpenFile()); // Ouvrir le flux en lecture
                    while ((ligne = SR.ReadLine()) != null)             //lire le fichier ligne par ligne
                    {
                        lbxFichiers.Items.Add(ligne);                   // copier les lignes du fichier dans la listBox
                    }
                    SR.Close();                                         // fermer le flux
                }
                catch
                {
                    MessageBox.Show("Erreur: Lecture du fichier impossible");
                }
            }
        }
示例#3
0
        public bool LerExtratos()
        {
            OFD.Filter   = $@"Arquivos de extrato|*.{_conta.Banco.ExtensaoExtrato}|Todos os arquivos|*.*";
            OFD.FileName = null;

            if (OFD.ShowDialog(this) != DialogResult.OK)
            {
                return(false);
            }

            OFD.InitialDirectory = Path.GetDirectoryName(OFD.FileNames[0]);
            var getAll = MessageBox.Show(@"Incluir todos os itens?", DialogTitle, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes;

            _conta.LerExtratos(OFD.FileNames, getAll, _ctx.Regras.OrderByDescending(r => r.Ocorrencias));

            if (!_conta.ExtratoHasData)
            {
                MessageBox.Show("Extrato não contém movimentos.", Text, MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }

            dgvExtrato.RowStateChanged -= dgvExtrato_RowStateChanged;
            bsExtrato.DataSource        = _conta.Extrato;
            dgvExtrato.Refresh();
            dgvExtrato.RowStateChanged += dgvExtrato_RowStateChanged;
            SelectRow(0);
            return(true);
        }
示例#4
0
        private void openBtn_Click(object sender, EventArgs e)
        {
            DialogResult Result;

            DGV1.EndEdit();
            try
            {
                Result = OFD.ShowDialog();
                if (Result == DialogResult.OK)
                {
                    StreamReader FileToOpen = new StreamReader(OFD.FileName);
                    OpenFileStream(FileToOpen);
                    CurrentOpenFileName    = OFD.FileName;
                    txtRowCount1.Text      = DGV1.RowCount.ToString();
                    txtColumnCount1.Text   = DGV1.ColumnCount.ToString();
                    this.saveAsBtn.Enabled = true;
                    this.saveBtn.Enabled   = true;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                this.Cursor = Cursors.Arrow;
            }
        }
示例#5
0
        private void BtnOpen_Click(object sender, EventArgs e)
        {
            var Result = OFD.ShowDialog();

            if (Result == DialogResult.OK)
            {
                try
                {
                    if (File.Exists(OFD.FileName))
                    {
                        var Rd = Service.LeerXml(OFD.FileName);
                        if (Rd != null)
                        {
                            Red = Rd;
                        }
                        else
                        {
                            MessageBox.Show("El dataset está corrupto o está mal configurado");
                        }
                        ShowInfo(Red);
                    }
                    else
                    {
                        MessageBox.Show("Se ha eliminado o movido el archivo");
                    }
                }
                catch (Exception er)
                {
                    MessageBox.Show("Error al abrir el archivo => " + er.Message, "Proceso fallido", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
            }
            else if (Result == DialogResult.Cancel)
            {
            }
        }
示例#6
0
 private void btnBrowseBackupFile_Click(object sender, EventArgs e)
 {
     OFD.ShowDialog();
     txtRestoreFile.Text         = OFD.FileName;
     settings.Default.BackupFile = OFD.FileName;
     settings.Default.Save();
 }
示例#7
0
        private void btnOpenImage_Click(object sender, EventArgs e)
        {
            OFD.Title       = "Carregar Imagem";
            OFD.Multiselect = true;
            OFD.Filter      = "Image Files (*.png *.jpg *.bmp) |*png; *.jpg; *.bmp";
            if (OFD.ShowDialog() == DialogResult.OK)
            {
                txtPathImage.Text = OFD.FileName;
                foreach (var myFile in OFD.FileNames)
                {
                    // Criar um novo fluxo para carregar esta foto em
                    var MyStream = new FileStream(myFile, FileMode.Open, FileAccess.Read);
                    // Criar um buffer para armazenar o fluxo de bytes
                    var myImageBuffer = new byte[(int)(MyStream.Length + 1)];

                    // Leia os bytes deste fluxo e colocá-lo no buffer de imagem
                    MyStream.Read(myImageBuffer, 0, Convert.ToInt32(MyStream.Length));
                    // Fechar o fluxo
                    MyStream.Close();
                    var Streamed = new MemoryStream(myImageBuffer);
                    PicBox.Image = Image.FromStream(Streamed);
                    Streamed.Close();
                    myImageBuffer = null;
                }
            }
        }
示例#8
0
 private void rbnBtnOpenEx_Click(object sender, EventArgs e)
 {
     try
     {
         //Preparing to show open file dialog :
         OFD.FileName = "";
         OFD.Title    = "Open an image file";
         OFD.Filter   = "JPEG Images (*.jpg)|*.jpg|Bitmap Images (*.bmp)|*.bmp";
         OFD.ShowDialog();
         if (OFD.FileName != "")
         {
             picExample.Load(OFD.FileName);
         }
         else
         {
             picExample.ImageLocation = "";
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(
             ex.Message,
             "Open Dialog Error", MessageBoxButtons.OK,
             MessageBoxIcon.Error);
     }
 }
示例#9
0
 private void tsb_Import_Click(object sender, EventArgs e)
 {
     OFD.Filter = "MiMfa Report Package Style File (*" + ReportStyle.Extension + ") | *" + ReportStyle.Extension;
     if (OFD.InitialDirectory == null)
     {
         OFD.InitialDirectory = ReportStyle.GetPath();
     }
     if (OFD.ShowDialog() == DialogResult.OK)
     {
         ReportStyle report = new ReportStyle();
         MiMFa_IOService.OpenDeserializeFile(OFD.FileName, ref report);
         if (string.IsNullOrEmpty(tstb_Subject.Text) || tstb_Subject.Text == "Default")
         {
             ReportStyle = report;
         }
         else
         {
             ReportStyle.MRLCode = report.MRLCode;
             ReportStyle.Script  = report.Script;
             ReportStyle.Css     = report.Css;
             ReportStyle.Extra   = report.Extra;
         }
         ReportStyle.Address = OFD.FileName;
     }
     Initialize(null, ReportStyle, false);
 }
示例#10
0
        private void MS_File_Open_Click(object sender, System.EventArgs e)
        {
            OFD.FileName     = "";
            SS_LBStatus.Text = "圖片開啟中";
            if (OFD.ShowDialog() == DialogResult.OK)
            {
                StopProcess();

                this.Cursor = Cursors.WaitCursor;

                string filepath = OFD.FileName;

                OImg   = new Bitmap(filepath);
                RImg   = new Bitmap(filepath);
                OrQImg = GrayImg.From(filepath);
                OrSImg = BGRImg.From(filepath);

                PB_Result.Image  = OrQImg.ToImage();
                PB_Result.Height = FLP_Result.Height;
                PB_Result.Width  = OrQImg.Width * FLP_Result.Height / OrQImg.Height;

                QImg = OrQImg.Extend();
                SImg = OrSImg.Extend();

                K = new SimpleMotionKernel(QImg.Width, QImg.Height, 53);

                QImg.FFT2();
                SImg.FFT2();

                QThread = new Thread(QProcess);
                QThread.Start();

                this.Cursor = Cursors.Default;
            }
        }
示例#11
0
 private string[] GetExtratoAcoes()
 {
     OFD.DefaultExt  = "csv";
     OFD.Filter      = @"CSV files|*.csv";
     OFD.Multiselect = false;
     return((OFD.ShowDialog() == DialogResult.Cancel) ? null : OFD.FileNames);
 }
示例#12
0
        private void CmBCargar_Click(object sender, EventArgs e)
        {
            if (TxtRuta.Text == "")
            {
                if (OFD.ShowDialog(this) == DialogResult.OK)
                {
                    TxtRuta.Text = OFD.FileName;
                }
            }

            try
            {
                //Des-serializa la colección de vértices
                lstPuntos3d = Geometry.Geometrias.Serialize.Serialize.DesSerializaPuntos3D(TxtRuta.Text);
            }
            catch (Exception sysEx)
            {
                System.Windows.Forms.MessageBox.Show(this,
                                                     sysEx.ToString(),
                                                     this.Text,
                                                     MessageBoxButtons.OK,
                                                     MessageBoxIcon.Error);
                lstPuntos3d = new List <Punto3D>();
            }

            CargarDGV();
        }
示例#13
0
 private void btn_FIle_Click(object sender, EventArgs e)
 {
     if (OFD.ShowDialog() == DialogResult.OK)
     {
         File_Read(OFD.FileName);
     }
 }
示例#14
0
 private void btnOpen_Click(object sender, EventArgs e)
 {
     if (OFD.ShowDialog() == DialogResult.OK)
     {
         tbInput.Text = OFD.FileName;
     }
 }
示例#15
0
 private void LoadButton_Click(object sender, EventArgs e)
 {
     Console.WriteLine("HI");
     if (OFD.ShowDialog() == DialogResult.OK)
     {
         Console.WriteLine("HI");
         StreamReader sr = new StreamReader(OFD.FileName);
         CmdName.Text = sr.ReadLine();                 //command name
         while (sr.EndOfStream == false)
         {
             string[] split = sr.ReadLine().Split(' ');
             foreach (string i in split)
             {
                 i.Replace(' ', '~');
                 i.Replace("~", "\\~");
             }
             Blocks b = new Blocks();
             b.com = split[0];
             b.a1  = split[1];
             b.a2  = split[2];
             b.a3  = split[3];
             b.a4  = split[4];
             CommandSpace.Controls.Add(b);
             Console.WriteLine("YES!");
             CommandSpace.Update();
         }
         sr.Close();
         sr.Dispose();
     }
 }
示例#16
0
 private void openToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (OFD.ShowDialog() == DialogResult.OK)
     {
         OpenFile(OFD.FileName);
     }
 }
示例#17
0
        void miParseOnly_DropDownItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            var mi = e.ClickedItem as ToolStripMenuItem;

            btnOption.HideDropDown();

            if (mi == miRunDownloader && (miRunDownloader.Checked || !File.Exists(AppConfig.Settings.ExternalDownloader)) &&
                OFD.ShowDialog() == DialogResult.OK)
            {
                AppConfig.Settings.ExternalDownloader = OFD.FileName;
            }

            if (File.Exists(AppConfig.Settings.ExternalDownloader))
            {
                miCopyURL.Checked = miRunDownloader.Checked = false;
                mi.Checked        = true;
            }
            else
            {
                miCopyURL.Checked       = true;
                miRunDownloader.Checked = false;
                mi = miCopyURL;
            }

            AppConfig.Settings.ExternalMethod = miParseOnly.DropDownItems.IndexOf(mi);
        }
示例#18
0
        private void btSimVFR_Click(object sender, EventArgs e)
        {
            lblLink.Text       = "...";
            btSimVFR.BackColor = btDropLink.BackColor; // this is the native button color...

            OFD.Filter = "Script Files|*.vsc|All Files|*.*";
            OFD.Title  = "Load VFR Model File";
            if (OFD.ShowDialog(this) == DialogResult.OK)
            {
                lblLink.Text = $"Simulation of: {OFD.FileName}\n";
                var sim = new VFRSimulation(m_dataLocation, 2, cbxLogging.Enabled);
                if (sim.Valid)
                {
                    btSimVFR.BackColor = Color.ForestGreen;

                    if (!sim.RunSimulation(OFD.FileName, txRwy.Text))
                    {
                        lblLink.Text      += sim.Error;
                        btSimVFR.BackColor = Color.IndianRed;
                    }
                    else
                    {
                        lblLink.Text += "KML File created in script folder";
                    }
                }
                else
                {
                    // error
                    lblLink.Text      += sim.Error;
                    btSimVFR.BackColor = Color.IndianRed;
                }
                lblLink.Text += $"DONE";
            }
        }
示例#19
0
 private void button1_Click(object sender, EventArgs e)
 {
     contTXT     += 1;
     OFD.Title    = "Seleccione el archivo de TXT";
     OFD.FileName = string.Empty;
     OFD.Filter   = "Archivos de TXT (*.txt)|*.txt";
     OFD.ShowDialog();
 }
示例#20
0
        }     //Fin de metodo ok de open file dialog

        private void btnXML_Click(object sender, EventArgs e)
        {
            contXML     += 1;
            OFD.Title    = "Seleccione el archivo de XML";
            OFD.FileName = string.Empty;
            OFD.Filter   = "Archivos de XML (*.xml)|*.xml";
            OFD.ShowDialog();
        }
示例#21
0
文件: Form1.cs 项目: amrchnk/labs
 private void button1_Click(object sender, EventArgs e)
 {
     if (OFD.ShowDialog() == DialogResult.OK)
     {
         file = OFD.FileName;
         this.fileName.Text = OFD.FileName;
     }
 }
 private void cmdBrowse_Click(object sender, EventArgs e)
 {
     if (OFD.ShowDialog() == DialogResult.OK)
     {
         cboFilename.Text = OFD.FileName;
         cboName.Text     = Path.GetFileNameWithoutExtension(OFD.FileName);
     }
 }
示例#23
0
 private void btnBoot_Click(object sender, EventArgs e)
 {
     OFD.Filter = BOOT;
     if (OFD.ShowDialog() == DialogResult.OK)
     {
         tbBoot.Text = OFD.FileName;
     }
 }
示例#24
0
 private void btnReadme_Click(object sender, EventArgs e)
 {
     OFD.Filter = README;
     if (OFD.ShowDialog() == DialogResult.OK)
     {
         tbReadme.Text = OFD.FileName;
     }
 }
示例#25
0
 private void btnSelectFile_Click(object sender, EventArgs e)
 {
     OFD.CheckFileExists = false;
     if ((int)OFD.ShowDialog() == (int)System.Windows.Forms.DialogResult.OK)
     {
         txtFileName.Text = OFD.FileName;
     }
 }
示例#26
0
 private void tsb_ChangeStyle_Click(object sender, EventArgs e)
 {
     OFD.Filter = "All File(*" + ReportStyle.Extension + ") | *" + ReportStyle.Extension + "";
     if (OFD.ShowDialog() == DialogResult.OK && !string.IsNullOrEmpty(OFD.FileName))
     {
         ChangeStyle(OFD.FileName);
     }
 }
示例#27
0
 private void cbSelectSource_Click(object sender, EventArgs e)
 {
     if (OFD.ShowDialog() == System.Windows.Forms.DialogResult.OK)
     {
         txtSource.Text = OFD.FileName;
         txtDest.Text   = txtSource.Text + ".dict";
     }
 }
示例#28
0
 private void btnCargar_Click(object sender, EventArgs e)
 {
     contExcel   += 1;
     OFD.Title    = "Seleccione el archivo de Excel";
     OFD.FileName = string.Empty;
     OFD.Filter   = "Archivos de Excel (*.xls;*.xlsx)|*.xls;*.xlsx";
     OFD.ShowDialog();
 }
示例#29
0
 private void btnKeyfile_Click(object sender, EventArgs e)
 {
     if (OFD.ShowDialog() == DialogResult.OK)
     {
         tbKeyfile.Text    = OFD.FileName;
         cbKeyfile.Checked = true;
     }
 }
示例#30
0
 private void pb_profile_Click(object sender, EventArgs e)
 {
     //open dialog and select picture
     if (OFD.ShowDialog() == DialogResult.OK)
     {
         pb_profile.Image = Image.FromFile(OFD.FileName);
     }
 }