Пример #1
0
        public void Basic()
        {
            Stream stream = new MemoryStream();
            Layout layout = new Layout();
            Template template = new Template();
            List<PwGroup> groups = new List<PwGroup>();
            Dictionary<string, string> configParams = new Dictionary<string,string>();

            ReportConfig config = new ReportConfig(stream, "PDF", layout, template, groups, configParams);

            Assert.Equals(stream, config.Output);
            Assert.Equals(layout, config.Layout);
            Assert.Equals(template, config.Template);
            Assert.Equals(groups, config.Groups);
            Assert.Equals(configParams, config.ConfigParams);
        }
Пример #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();
        }
Пример #3
0
 public ReportEngine(ReportConfig config)
 {
     m_Config = config;
 }
Пример #4
0
 public GeneratingForm(ReportConfig config)
 {
     m_Config = config;
     InitializeComponent();
 }