示例#1
0
        private void button1_Click(object sender, EventArgs e)
        {
            /* Checklist for parameters:
             * C Stream Output,
             * C string Format,
             * C Layout Layout,
             * ? Template Template,
             * C List<PwGroup> Groups,
             * ? Dictionary<string, string> ConfigParams
             */

            Stream Output = null;
            string Format = "";
            Layout Layout = (Layout)comboLayout.SelectedItem;
            Template Template = (Template)comboTemplate.SelectedItem;
            List<PwGroup> Groups = getSelectedGroups(treeGroups.Nodes);
            Dictionary<string, string> ConfigParams = new Dictionary<string, string>();

            saveFileDialog.DefaultExt = "";

            if (tabFormat.SelectedTab == tabPageScreen) {
                Format = "SCREEN";
            } else if (tabFormat.SelectedTab == tabPagePDF) {
                Format = "PDF";
                saveFileDialog.Filter = "PDF (*.pdf)|*.pdf";
                saveFileDialog.DefaultExt = "pdf";
            } else if (tabFormat.SelectedTab == tabPageHTML) {
                Format = "HTML";
                saveFileDialog.Filter = "HTML (*.html)|*.html";
                saveFileDialog.DefaultExt = "html";
            } else if (tabFormat.SelectedTab == tabPageCSV) {
                Format = "CSV";
                saveFileDialog.Filter = "Comma separated text (*.csv)|*.csv";
                saveFileDialog.DefaultExt = "csv";
            }

            //TODO: SORRY NOT IMPLEMENTED

            saveFileDialog.AddExtension = true;

            if (saveFileDialog.DefaultExt.Length != 0) {

                if (saveFileDialog.ShowDialog() == DialogResult.OK) {
                    Output = saveFileDialog.OpenFile();
                }

                if (Output == null) {
                    MessageBox.Show("Error during opening output file!");
                    return;
                }
            }

            if (Layout == null) {
                MessageBox.Show("Layout not selected!");
                return;
            }

            ReportConfig config = new ReportConfig(Output, Format, Layout, Template, Groups, ConfigParams);

            GeneratingForm genform = new GeneratingForm(config);
            genform.ShowDialog();
            Close();
        }
示例#2
0
        private void button1_Click(object sender, EventArgs e)
        {
            /* Checklist for parameters:
             * C Stream Output,
             * C string Format,
             * C Layout Layout,
             * ? Template Template,
             * C List<PwGroup> Groups,
             * ? Dictionary<string, string> ConfigParams
             */


            Stream         Output   = null;
            string         Format   = "";
            Layout         Layout   = (Layout)comboLayout.SelectedItem;
            Template       Template = (Template)comboTemplate.SelectedItem;
            List <PwGroup> Groups   = getSelectedGroups(treeGroups.Nodes);
            Dictionary <string, string> ConfigParams = new Dictionary <string, string>();

            saveFileDialog.DefaultExt = "";

            if (tabFormat.SelectedTab == tabPageScreen)
            {
                Format = "SCREEN";
            }
            else if (tabFormat.SelectedTab == tabPagePDF)
            {
                Format = "PDF";
                saveFileDialog.Filter     = "PDF (*.pdf)|*.pdf";
                saveFileDialog.DefaultExt = "pdf";
            }
            else if (tabFormat.SelectedTab == tabPageHTML)
            {
                Format = "HTML";
                saveFileDialog.Filter     = "HTML (*.html)|*.html";
                saveFileDialog.DefaultExt = "html";
            }
            else if (tabFormat.SelectedTab == tabPageCSV)
            {
                Format = "CSV";
                saveFileDialog.Filter     = "Comma separated text (*.csv)|*.csv";
                saveFileDialog.DefaultExt = "csv";
            }

            //TODO: SORRY NOT IMPLEMENTED

            saveFileDialog.AddExtension = true;

            if (saveFileDialog.DefaultExt.Length != 0)
            {
                if (saveFileDialog.ShowDialog() == DialogResult.OK)
                {
                    Output = saveFileDialog.OpenFile();
                }

                if (Output == null)
                {
                    MessageBox.Show("Error during opening output file!");
                    return;
                }
            }

            if (Layout == null)
            {
                MessageBox.Show("Layout not selected!");
                return;
            }


            ReportConfig config = new ReportConfig(Output, Format, Layout, Template, Groups, ConfigParams);

            GeneratingForm genform = new GeneratingForm(config);

            genform.ShowDialog();
            Close();
        }