コード例 #1
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;
            }
        }
コード例 #2
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)
            {
            }
        }
コード例 #3
0
 private void btnOpen_Click(object sender, EventArgs e)
 {
     if (OFD.ShowDialog() == DialogResult.OK)
     {
         tbInput.Text = OFD.FileName;
     }
 }
コード例 #4
0
ファイル: frmInvestimentos.cs プロジェクト: nfrick/MoneyBin2
 private string[] GetExtratoAcoes()
 {
     OFD.DefaultExt  = "csv";
     OFD.Filter      = @"CSV files|*.csv";
     OFD.Multiselect = false;
     return((OFD.ShowDialog() == DialogResult.Cancel) ? null : OFD.FileNames);
 }
コード例 #5
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;
                }
            }
        }
コード例 #6
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);
        }
コード例 #7
0
 private void btnSelectFile_Click(object sender, EventArgs e)
 {
     if (OFD.ShowDialog() == DialogResult.OK)
     {
         tbFile.Text = OFD.FileName;
     }
 }
コード例 #8
0
 private void btnBrowseBackupFile_Click(object sender, EventArgs e)
 {
     OFD.ShowDialog();
     txtRestoreFile.Text         = OFD.FileName;
     settings.Default.BackupFile = OFD.FileName;
     settings.Default.Save();
 }
コード例 #9
0
ファイル: OfdDataForm.cs プロジェクト: ipltv/MCDFiscalManager
        private void editOfdDataButton_Click(object sender, EventArgs e)
        {
            if (ofdDataGridView.SelectedRows.Count > 0)
            {
                int  index = ofdDataGridView.SelectedRows[0].Index;
                int  id;
                bool converted = int.TryParse(ofdDataGridView[0, index].Value.ToString(), out id);
                if (!converted)
                {
                    return;
                }

                var ofds = from t in controller.Elements where t.ID == id select t;
                OFD ofd  = ofds.First();

                OfdForm ofdForm = new OfdForm();
                ofdForm.fullNameTextBox.Text = ofd.FullName;
                ofdForm.tinTextBox.Text      = ofd.TIN;

                DialogResult dialogResult = ofdForm.ShowDialog(this);

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

                ofd.FullName = ofdForm.fullNameTextBox.Text;
                ofd.TIN      = ofdForm.tinTextBox.Text;

                controller.UpdateElement(ofd);
                ofdDataGridView.DataSource = controller.Elements;
            }
        }
コード例 #10
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);
 }
コード例 #11
0
ファイル: MainForm.cs プロジェクト: playepic/ParseGet
        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);
        }
コード例 #12
0
 private void btn_FIle_Click(object sender, EventArgs e)
 {
     if (OFD.ShowDialog() == DialogResult.OK)
     {
         File_Read(OFD.FileName);
     }
 }
コード例 #13
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;
            }
        }
コード例 #14
0
ファイル: Form1.cs プロジェクト: xiaoxiongnpu/7Sharp
 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();
     }
 }
コード例 #15
0
ファイル: FrmTest.cs プロジェクト: JBPKII/Geometry
        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();
        }
コード例 #16
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);
     }
 }
コード例 #17
0
        public void OFDDataControllerTest1()
        {
            OFD ofd = new OFD("77777777", "OFD NILS");
            OFDDataController ofdDataController = new OFDDataController(ofd);

            Assert.AreEqual(ofd, ofdDataController.GetCurrentElement());
        }
コード例 #18
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");
                }
            }
        }
コード例 #19
0
 private void openToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (OFD.ShowDialog() == DialogResult.OK)
     {
         OpenFile(OFD.FileName);
     }
 }
コード例 #20
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";
            }
        }
コード例 #21
0
 private void btnBoot_Click(object sender, EventArgs e)
 {
     OFD.Filter = BOOT;
     if (OFD.ShowDialog() == DialogResult.OK)
     {
         tbBoot.Text = OFD.FileName;
     }
 }
コード例 #22
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;
     }
 }
コード例 #23
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;
     }
 }
コード例 #24
0
 private void cmdBrowse_Click(object sender, EventArgs e)
 {
     if (OFD.ShowDialog() == DialogResult.OK)
     {
         cboFilename.Text = OFD.FileName;
         cboName.Text     = Path.GetFileNameWithoutExtension(OFD.FileName);
     }
 }
コード例 #25
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();
 }
コード例 #26
0
 private void btnReadme_Click(object sender, EventArgs e)
 {
     OFD.Filter = README;
     if (OFD.ShowDialog() == DialogResult.OK)
     {
         tbReadme.Text = OFD.FileName;
     }
 }
コード例 #27
0
ファイル: frmCryptoInput.cs プロジェクト: nondejus/CryptoPad
 private void btnKeyfile_Click(object sender, EventArgs e)
 {
     if (OFD.ShowDialog() == DialogResult.OK)
     {
         tbKeyfile.Text    = OFD.FileName;
         cbKeyfile.Checked = true;
     }
 }
コード例 #28
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();
        }
コード例 #29
0
        public void SetCurrentElementTest()
        {
            OFD ofd = new OFD("77777777", "OFD NILS");
            OFDDataController ofdDataController = new OFDDataController(ofd);

            Assert.IsTrue(ofdDataController.SetCurrentElement(ofd.TIN));
            Assert.AreEqual(ofd, ofdDataController.GetCurrentElement());
        }
コード例 #30
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();
 }