コード例 #1
0
ファイル: DocMapeoForm.cs プロジェクト: espino316/bihelper
        } // end GenerarDocumentacionButton_Click

        /// <summary>
        /// Maneja el evento "Click" del control "ExplorarArchivoXMLIPCButton"
        /// </summary>
        /// <param name="sender">El control "ExplorarArchivoXMLIPCButton"</param>
        /// <param name="e">Los argumentos del evento</param>
        private void ExplorarArchivoXmlIPCButton_Click(object sender, EventArgs e)
        {
            try
            {
                //  Abrimos una ventana de diálogo para buscar
                //  archivos xml
                OpenFileDialog openFileDlg = new OpenFileDialog();
                openFileDlg.DefaultExt = ".xml";
                openFileDlg.Filter = "XML Files (.xml)|*.xml";

                //  Si el usuario eligió un archivo
                if (openFileDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    //  Congelamos la forma
                    this.Enabled = false;
                    this.Cursor = Cursors.WaitCursor;

                    //  Mostramos el nombre del archivo
                    this.FileNameTextBox.Text = openFileDlg.FileName;

                    //  Instanciamos el importador de Informatica PC
                    this.Infa = new lib.InfaImport(openFileDlg.FileName);

                    //  Obtenemos los mapeos
                    List<string> mapeos = Infa.GetMapeos();

                    //  Si no hay algún mapeo
                    if (mapeos.Count == 0)
                    {
                        //  Lanzamos excepción
                        throw new Exception("No hay mapeos en el documento XML");

                    } // end if

                    //  Los asignamos a la caja de lista deplegable
                    this.MapeosComboBox.DataSource = mapeos;

                } // end if
                else
                {
                    throw new Exception("Debe seleccionar un archivo");

                } // end else

            } // end try
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);

            } // end try / catch
            finally
            {
                //  Descongelamos la forma
                this.Enabled = true;
                this.Cursor = Cursors.Default;
            }

        } // end ExplorarArchivoXmlIPCButton_Click
コード例 #2
0
        /// <summary>
        /// Maneja el evento "Click" del control "ExplorarArchivoXmlIPCButton"
        /// </summary>
        /// <param name="sender">El control  "ExplorarArchivoXmlIPCButton"</param>
        /// <param name="e">Los argumentos del evento</param>
        private void ExplorarArchivoXmlIPCButton_Click(object sender, EventArgs e)
        {
            try
            {
                //  Abrimos una ventana de diálogo para buscar
                //  archivos xml
                OpenFileDialog openFileDlg = new OpenFileDialog();
                openFileDlg.DefaultExt = ".xml";
                openFileDlg.Filter     = "XML Files (.xml)|*.xml";

                //  Si el usuario eligió un archivo
                if (openFileDlg.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    //  Congelamos la forma
                    this.Enabled = false;
                    this.Cursor  = Cursors.WaitCursor;

                    //  Mostramos el nombre del archivo
                    this.FileNameTextBox.Text = openFileDlg.FileName;

                    //  Instanciamos el importador de Informatica PC
                    this.Infa = new lib.InfaImport(openFileDlg.FileName);

                    //  Obtenemos la informacion del workflow
                    this.GenerarArbolWorkFlows(this.Infa.GetWorkFlowData());
                } // end if
                else
                {
                    throw new Exception("Debe seleccionar un archivo");
                } // end else
            }     // end try
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            } // end try / catch
            finally
            {
                //  Descongelamos la forma
                this.Enabled = true;
                this.Cursor  = Cursors.Default;
            }
        }