Example #1
0
        /// <summary>
        /// handler for the OK button click
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void okBtn_Click(object sender, ExecutedRoutedEventArgs e)
        {
            ReportListBoxItem item = this.listBox1.SelectedItem as ReportListBoxItem;

            if (item != null)
            {
                string reportDesc = null;
                this.GetItemValues(item, true, ref this.reportName, ref reportDesc, ref this.filePath, ref this.translator);

                if (string.IsNullOrEmpty(this.reportName))
                {
                    MessageBox.Show("Report Name needed");
                    return;
                }

                if (string.IsNullOrEmpty(this.reportName))
                {
                    MessageBox.Show("Report Path needed");
                    return;
                }

                this.DialogResult = true;
            }


            this.Close();
        }
Example #2
0
 /// <summary>
 /// get the values Name/Description/Xml from the ListBox item
 /// </summary>
 /// <param name="item">usually the selected item in the list box as ReportListBoxItem</param>
 /// <param name="createTmpFile">true if should create the file in the xml on disk</param>
 /// <param name="reportName">ref to the report Name</param>
 /// <param name="reportDesc">ref to the report Description</param>
 /// <param name="filePath">ref to the reportFilePath</param>
 private void GetItemValues(ReportListBoxItem item, bool createTmpFile, ref string reportName,
                            ref string reportDesc, ref string filePath, ref FluidTrade.Reporting.Interfaces.IStaticReportTranslation translator)
 {
     if (item.Row != null)
     {
         //the item is pointing to a row in the dataModel
         ReportXmlHelper.XmlToTempFile(item.Row.Xaml, createTmpFile, out reportName, out reportDesc, out filePath, out translator);
     }
     else if (string.IsNullOrEmpty(item.LocalFilePath) == false)
     {
         //item is pointing at a local file
         reportName = filePath = item.LocalFilePath;
         reportDesc = string.Empty;
     }
     else if (string.IsNullOrEmpty(item.Xml) == false)
     {
         //item is pointing at a newly imported report
         ReportXmlHelper.XmlToTempFile(item.Xml, createTmpFile, out reportName, out reportDesc, out filePath, out translator);
     }
     else
     {
         //error
         return;
     }
 }
Example #3
0
        /// <summary>
        /// handler for the import button click, Shows Import Window to user
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void importBtn_Click(object sender, ExecutedRoutedEventArgs e)
        {
            WindowImportProperties win = new WindowImportProperties(true, true);

            if (true.Equals(win.ShowDialog()))
            {
                //closed with ok so the dlg will have sent the reprt to the
                //db but need to update the pick list and select the new item
                ReportListBoxItem newItem = new ReportListBoxItem(win.ReportName, win.ImportedXml);
                this.listBox1.Items.Add(newItem);
                this.listBox1.SelectedItem = newItem;
            }
        }
Example #4
0
        /// <summary>
        /// handler for the local file button click, Shows select local file Window to user
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void localFileBtn_Click(object sender, ExecutedRoutedEventArgs e)
        {
            string localFile = WindowPickReportFromDisk.PickReport();

            if (string.IsNullOrEmpty(localFile))
            {
                return;
            }

            //have a new item add it to the list and select it
            ReportListBoxItem newItem = new ReportListBoxItem(localFile);

            this.listBox1.Items.Add(newItem);
            this.listBox1.SelectedItem = newItem;
        }
Example #5
0
        /// <summary>
        /// handler for the property button click. Will show the properties window if
        /// the listbox has a selected item
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void propBtn_Click(object sender, ExecutedRoutedEventArgs e)
        {
            //get the selected item
            ReportListBoxItem item = this.listBox1.SelectedItem as ReportListBoxItem;

            if (item == null)
            {
                return;                 //no selected item so return
            }
            string reportName = null;
            string reportDesc = null;
            string filePath   = null;

            FluidTrade.Reporting.Interfaces.IStaticReportTranslation translator = null;
            //get the values from the item
            this.GetItemValues(item, false, ref reportName, ref reportDesc, ref filePath, ref translator);

            //show the properties window
            WindowImportProperties win = new WindowImportProperties(reportName, reportDesc);

            win.ShowDialog();
        }