コード例 #1
0
ファイル: TextEditorForm.cs プロジェクト: zixing131/LAEACC
        private void Init()
        {
            tbText.Font = DrawUtils.DefaultReportFont;
            tvData.CreateNodes(FReport.Dictionary);
            if (FExpandedNodes != null)
            {
                tvData.ExpandedNodes = FExpandedNodes;
            }

            Config.RestoreFormState(this);
            XmlItem xi = Config.Root.FindItem("Forms").FindItem("TextEditorForm");

            cbWordWrap.Checked = xi.GetProp("WordWrap") != "0";
            string s = xi.GetProp("Splitter");

            if (s != "")
            {
                splitContainer1.SplitterDistance = int.Parse(s);
            }
            s = xi.GetProp("DescriptionHeight");
            if (s != "")
            {
                lblDescription.Height = int.Parse(s);
            }
        }
コード例 #2
0
        public float GetLastY()
        {
            float result = 0;

            for (int i = 0; i < xmlItem.Count; i++)
            {
                XmlItem xi = xmlItem[i];

                BandBase obj = preparedPages.Dictionary.GetOriginalObject(xi.Name) as BandBase;
                if (obj != null && !(obj is PageFooterBand) && !(obj is OverlayBand))
                {
                    string s   = xi.GetProp("t");
                    float  top = (s != "") ? Converter.StringToFloat(s) : obj.Top;
                    s = xi.GetProp("h");
                    float height = (s != "") ? Converter.StringToFloat(s) : obj.Height;

                    if (top + height > result)
                    {
                        result = top + height;
                    }
                }
            }

            return(result);
        }
コード例 #3
0
ファイル: PreparedPage.cs プロジェクト: satem02/FastReport
        public void PasteObjects(XmlItem objects, float x, float y)
        {
            if (objects.Count > 0)
            {
                // get the top object's location
                float pastedY = (objects[0].GetProp("t") != "") ?
                                Converter.StringToFloat(objects[0].GetProp("t")) : 0;

                float deltaX = x;
                float deltaY = y - pastedY;

                while (objects.Count > 0)
                {
                    XmlItem obj = objects[0];

                    // shift the object's location
                    float objX = (obj.GetProp("l") != "") ?
                                 Converter.StringToFloat(obj.GetProp("l")) : 0;
                    float objY = (obj.GetProp("t") != "") ?
                                 Converter.StringToFloat(obj.GetProp("t")) : 0;
                    obj.SetProp("l", Converter.ToString(objX + deltaX));
                    obj.SetProp("t", Converter.ToString(objY + deltaY));

                    // add object to a page
                    xmlItem.AddItem(obj);
                }
            }
        }
コード例 #4
0
ファイル: OutlineControl.cs プロジェクト: zixing131/LAEACC
        private void FTree_AfterNodeSelect(object sender, AdvTreeNodeEventArgs e)
        {
            // avoid bug when closing the preview
            if (!Visible)
            {
                return;
            }
            if (e.Node == null)
            {
                return;
            }

            XmlItem item = e.Node.Tag as XmlItem;
            string  s    = item.GetProp("Page");

            if (s != "")
            {
                int pageNo = int.Parse(s);
                s = item.GetProp("Offset");
                if (s != "")
                {
                    float offset = (float)Converter.FromString(typeof(float), s);
                    FPreview.PositionTo(pageNo + 1, new PointF(0, offset));
                }
            }
        }
コード例 #5
0
        static HomeController()
        {
            XmlDocument reports = new XmlDocument();

            reports.Load(Path.Combine(ReportsFolder, "reports.xml"));

            for (int i = 0; i < reports.Root.Count; i++)
            {
                XmlItem folderItem = reports.Root[i];
                if (folderItem.GetProp("WinDemo") == "false")
                {
                    continue;
                }
                if (folderItem.GetProp("WebDemo") == "false")
                {
                    continue;
                }
                if (folderItem.GetProp("Core") == "false")
                {
                    continue;
                }
                string culture = System.Globalization.CultureInfo.CurrentCulture.Name;
                string text    = folderItem.GetProp("Name-" + culture);
                if (String.IsNullOrEmpty(text))
                {
                    text = folderItem.GetProp("Name");
                }

                Dictionary <string, int> folderNode = new Dictionary <string, int>();
                Reports[text] = folderNode;

                for (int j = 0; j < folderItem.Count; j++)
                {
                    XmlItem reportItem = folderItem[j];
                    if (reportItem.GetProp("WinDemo") == "false")
                    {
                        continue;
                    }
                    if (reportItem.GetProp("WebDemo") == "false")
                    {
                        continue;
                    }
                    if (reportItem.GetProp("Core") == "false")
                    {
                        continue;
                    }

                    string file     = reportItem.GetProp("File");
                    string fileName = reportItem.GetProp("Name-" + culture);
                    if (String.IsNullOrEmpty(fileName))
                    {
                        fileName = Path.GetFileNameWithoutExtension(file);
                    }


                    folderNode[fileName] = ReportFiles.Count;
                    ReportFiles.Add(Path.Combine(ReportsFolder, file));
                }
            }
        }
コード例 #6
0
ファイル: Bookmarks.cs プロジェクト: zixing131/LAEACC
 public void Load(XmlItem rootItem)
 {
     Clear();
     for (int i = 0; i < rootItem.Count; i++)
     {
         XmlItem item = rootItem[i];
         Add(Converter.FromXml(item.GetProp("Name")), int.Parse(item.GetProp("Page")),
             (float)Converter.FromString(typeof(float), item.GetProp("Offset")));
     }
 }
コード例 #7
0
        private List <FolderStruct> GetFolderList()
        {
            var folders = new List <FolderStruct>();

            try
            {
                XmlDocument reports = new XmlDocument();
                reports.Load(Path.Combine(reportsFolder, "reports.xml"));

                for (int i = 0; i < reports.Root.Count; i++)
                {
                    FolderStruct folder = new FolderStruct();

                    XmlItem folderItem = reports.Root[i];
                    if (folderItem.GetProp("WinDemo") == "false")
                    {
                        continue;
                    }

                    string text = folderItem.GetProp("Name");

                    folder.FolderName  = text;
                    folder.Description = folderItem.GetProp("Description");
                    for (int j = 0; j < folderItem.Count; j++)
                    {
                        ReportStruct report = new ReportStruct();

                        XmlItem reportItem = folderItem[j];
                        //if (reportItem.GetProp("WinDemo") == "false")
                        //    continue;

                        string file = reportItem.GetProp("File");

                        if (!File.Exists(Path.Combine(reportsFolder, file)))
                        {
                            continue;
                        }

                        string fileName = Path.GetFileNameWithoutExtension(file);

                        report.FileName = fileName;
                        report.File     = file;
                        folder.Reports.Add(report);
                    }

                    folders.Add(folder);
                }
            }
            catch
            {
            }
            return(folders);
        }
コード例 #8
0
ファイル: LabelWizardForm.cs プロジェクト: zixing131/LAEACC
        private void Init()
        {
            // load standard labels
            FLabels = new XmlDocument();
            using (Stream labelStream = ResourceLoader.UnpackStream("labels.dat"))
            {
                FLabels.Load(labelStream);
            }

            // add user-defined labels
            XmlItem customManufacturer = FLabels.Root.Add();

            customManufacturer.SetProp("Name", Res.Get("Forms,LabelWizard,Custom"));

            // get the list of user labels from config file
            XmlItem configLabels = Config.Root.FindItem("LabelWizard");

            for (int i = 0; i < configLabels.Count; i++)
            {
                XmlItem addItem = customManufacturer.Add();
                addItem.Text = configLabels[i].Text;
            }

            // make a list of manufacturers
            lbxLabels.ItemHeight = DrawUtils.DefaultItemHeight;
            for (int i = 0; i < FLabels.Root.Count; i++)
            {
                cbxLabels.Items.Add(FLabels.Root[i].GetProp("Name"));
            }

            // position to last used items
            int index = cbxLabels.Items.IndexOf(configLabels.GetProp("Manufacturer"));

            if (index >= 0)
            {
                cbxLabels.SelectedIndex = index;

                for (int i = 0; i < lbxLabels.Items.Count; i++)
                {
                    XmlItem item = lbxLabels.Items[i] as XmlItem;
                    if (item.GetProp("Name") == configLabels.GetProp("Label"))
                    {
                        lbxLabels.SelectedIndex = i;
                        break;
                    }
                }
            }
            else
            {
                cbxLabels.SelectedIndex = 0;
            }
        }
コード例 #9
0
ファイル: Outline.cs プロジェクト: zwyl2001/FastReport
        private void EnumItems(XmlItem item, float shift)
        {
            int   pageNo = int.Parse(item.GetProp("Page"));
            float offset = Converter.StringToFloat(item.GetProp("Offset"));

            item.SetProp("Page", Converter.ToString(pageNo + 1));
            item.SetProp("Offset", Converter.ToString(offset + shift));

            for (int i = 0; i < item.Count; i++)
            {
                EnumItems(item[i], shift);
            }
        }
コード例 #10
0
        public override void RestoreState()
        {
            XmlItem xi = Config.Root.FindItem("Designer").FindItem(Name);

            DialogWorkspace.ShowGrid   = xi.GetProp("ShowGrid") == "1";
            DialogWorkspace.SnapToGrid = xi.GetProp("SnapToGrid") != "0";
            string size = xi.GetProp("SnapSize");

            if (size == "")
            {
                size = "4";
            }
            DialogWorkspace.Grid.SnapSize = int.Parse(size);
        }
コード例 #11
0
ファイル: CodePageSettings.cs プロジェクト: zixing131/LAEACC
        static CodePageSettings()
        {
            XmlItem xi = Config.Root.FindItem("Designer").FindItem("Code");

            EnableVirtualSpace = xi.GetProp("EnableVirtualSpace") != "0";
            UseSpaces          = xi.GetProp("UseSpaces") != "0";
            AllowOutlining     = xi.GetProp("AllowOutlining") != "0";
            string tabSize = xi.GetProp("TabSize");

            if (String.IsNullOrEmpty(tabSize))
            {
                tabSize = "2";
            }
            TabSize = int.Parse(tabSize);
        }
コード例 #12
0
        private string Get(string id, XmlDocument locale)
        {
            XmlItem xi = locale.Root;
            int     i;

            foreach (string category in categories)
            {
                i = xi.Find(category);
                if (i == -1)
                {
                    return(null);
                }
                xi = xi[i];
            }

            // find 'id'
            i = xi.Find(id);
            if (i == -1)
            {
                return(null);
            }
            xi = xi[i];

            return(xi.GetProp("Text"));
        }
コード例 #13
0
ファイル: PropertiesWindow.cs プロジェクト: zixing131/LAEACC
        /// <inheritdoc/>
        public override void RestoreState()
        {
            XmlItem xi = Config.Root.FindItem("Designer").FindItem(Name);

            Grid.PropertySort       = xi.GetProp("Sort") == "Alphabetical" ? PropertySort.Alphabetical : PropertySort.CategorizedAlphabetical;
            btnCategory.Checked     = Grid.PropertySort == PropertySort.CategorizedAlphabetical;
            btnAlphabetical.Checked = !btnCategory.Checked;
        }
コード例 #14
0
        private void Init()
        {
            ts1.Font              = DrawUtils.Default96Font;
            cbxFontName.Font      = ts1.Font;
            cbxFontSize.Font      = ts1.Font;
            btnColor.DefaultColor = Color.Black;
            ts1.Renderer          = Config.DesignerSettings.ToolStripRenderer;

            tvData.CreateNodes(FRich.Report.Dictionary);
            if (FExpandedNodes != null)
            {
                tvData.ExpandedNodes = FExpandedNodes;
            }

            rtbText.Rtf = FRich.Text;
            if (rtbText.TextLength == 0)
            {
                rtbText.SelectAll();
                rtbText.SelectionFont = Config.DesignerSettings.DefaultFont;
            }
            rtbText.Modified   = false;
            rtbText.AllowDrop  = true;
            rtbText.DragEnter += new DragEventHandler(rtbText_DragEnter);
            rtbText.DragDrop  += new DragEventHandler(rtbText_DragDrop);

            Config.RestoreFormState(this);
            XmlItem xi = Config.Root.FindItem("Forms").FindItem("RichEditorForm");
            string  s  = xi.GetProp("Splitter");

            if (s != "")
            {
                splitContainer1.SplitterDistance = int.Parse(s);
            }
            s = xi.GetProp("DescriptionHeight");
            if (s != "")
            {
                lblDescription.Height = int.Parse(s);
            }
            s = xi.GetProp("Zoom");
            if (s == "")
            {
                s = "100%";
            }
            cbxZoom.SelectedIndex = cbxZoom.Items.IndexOf(s);
        }
コード例 #15
0
ファイル: PreviewControl.cs プロジェクト: zixing131/LAEACC
        private void RestoreState()
        {
            XmlItem xi = Config.Root.FindItem("Preview");

            string zoom = xi.GetProp("Zoom");

            if (!String.IsNullOrEmpty(zoom))
            {
                FDefaultZoom = (float)Converter.FromString(typeof(float), zoom);
            }

            string width = xi.GetProp("OutlineWidth");

            if (!String.IsNullOrEmpty(width))
            {
                outlineControl.Width = int.Parse(width);
            }
        }
コード例 #16
0
ファイル: DictionaryWindow.cs プロジェクト: zixing131/LAEACC
        /// <inheritdoc/>
        public override void RestoreState()
        {
            XmlItem xi = Config.Root.FindItem("Designer").FindItem(Name);
            string  s  = xi.GetProp("DescriptionHeight");

            if (s != "")
            {
                lblDescription.Height = int.Parse(s);
            }
        }
コード例 #17
0
        public override void RestoreState()
        {
            XmlItem xi = Config.Root.FindItem("Designer").FindItem(Name);
            string  s  = xi.GetProp("BandStructureSplitter");

            if (s != "")
            {
                RulerPanel.SplitterDistance = int.Parse(s);
            }
            // all other ReportWorkspace properties are restored in the ReportWorkspace static constructor
        }
コード例 #18
0
ファイル: LabelWizardForm.cs プロジェクト: zixing131/LAEACC
 private void lbxLabels_DrawItem(object sender, DrawItemEventArgs e)
 {
     e.DrawBackground();
     if (e.Index >= 0)
     {
         XmlItem item = lbxLabels.Items[e.Index] as XmlItem;
         using (Brush brush = new SolidBrush(e.ForeColor))
         {
             e.Graphics.DrawString(item.GetProp("Name"), e.Font, brush, e.Bounds.X, e.Bounds.Y);
         }
     }
 }
コード例 #19
0
ファイル: LabelWizardForm.cs プロジェクト: zixing131/LAEACC
        private void lbxLabels_SelectedIndexChanged(object sender, EventArgs e)
        {
            XmlItem item = lbxLabels.SelectedItem as XmlItem;

            if (item != null)
            {
                float  width       = Converter.StringToFloat(item.GetProp("Width")) * Units.Inches;
                float  height      = Converter.StringToFloat(item.GetProp("Height")) * Units.Inches;
                float  paperWidth  = Converter.StringToFloat(item.GetProp("PaperWidth")) * Units.Inches;
                float  paperHeight = Converter.StringToFloat(item.GetProp("PaperHeight")) * Units.Inches;
                string rows        = item.GetProp("Rows");
                if (String.IsNullOrEmpty(rows))
                {
                    rows = "1";
                }
                string columns = item.GetProp("Columns");
                if (String.IsNullOrEmpty(columns))
                {
                    columns = "1";
                }

                lblSize1.Text = Converter.ToString(width, typeof(UnitsConverter)) + " x " +
                                Converter.ToString(height, typeof(UnitsConverter));
                lblPaperSize1.Text = Converter.ToString(paperWidth, typeof(UnitsConverter)) + " x " +
                                     Converter.ToString(paperHeight, typeof(UnitsConverter));
                lblRows1.Text    = rows;
                lblColumns1.Text = columns;
            }

            btnDelete.Enabled = item != null;
        }
コード例 #20
0
ファイル: OutlineControl.cs プロジェクト: zixing131/LAEACC
        private void EnumNodes(XmlItem rootItem, NodeCollection rootNode)
        {
            // skip root xml item
            if (rootItem.Parent != null)
            {
                string text = Converter.FromXml(rootItem.GetProp("Text"));
                Node   node = new Node();
                node.Text = text;
                node.Tag  = rootItem;
                rootNode.Add(node);
                rootNode = node.Nodes;
            }

            for (int i = 0; i < rootItem.Count; i++)
            {
                EnumNodes(rootItem[i], rootNode);
            }
        }
コード例 #21
0
ファイル: Outline.cs プロジェクト: zwyl2001/FastReport
        internal void Shift(XmlItem from, float newY)
        {
            if (from == null || from.Parent == null)
            {
                return;
            }
            int i = from.Parent.IndexOf(from);

            if (i + 1 >= from.Parent.Count)
            {
                return;
            }
            from = from.Parent[i + 1];

            float topY = Converter.StringToFloat(from.GetProp("Offset"));

            EnumItems(from, newY - topY);
        }
コード例 #22
0
ファイル: PluginsOptions.cs プロジェクト: zixing131/LAEACC
        public override void Init()
        {
            cbxUIStyle.SelectedIndex = (int)FDesigner.UIStyle;

            btnUp.Image   = Res.GetImage(208);
            btnDown.Image = Res.GetImage(209);

            XmlItem pluginsItem = Config.Root.FindItem("Plugins");

            for (int i = 0; i < pluginsItem.Count; i++)
            {
                XmlItem xi = pluginsItem[i];
                AddPlugin(xi.GetProp("Name"));
            }

            lblNote.Width  = tab2.Width - lblNote.Left * 2;
            lblNote.Height = tab2.Height - lblNote.Top;
            lbPlugins_SelectedIndexChanged(this, EventArgs.Empty);
        }
コード例 #23
0
ファイル: WebResources.cs プロジェクト: zwyl2001/FastReport
        private string Get(string id, XmlDocument locale)
        {
            string[] categories = id.Split(new char[] { ',' });
            XmlItem  xi         = locale.Root;

            foreach (string category in categories)
            {
                int i = xi.Find(category);
                if (i == -1)
                {
                    return(id + " " + badResult);
                }
                xi = xi[i];
            }
            string result = xi.GetProp("Text");

            if (result == "")
            {
                result = id + " " + badResult;
            }
            return(result);
        }
コード例 #24
0
ファイル: Form1.cs プロジェクト: wlongbin/XCYC
        private void Form1_Load(object sender, EventArgs e)
        {
            lblVersion.Text         = "Version " + Config.Version;
            comboBox1.SelectedIndex = (int)Config.UIStyle;

            FindReportsFolder();
            CreateDataSources();

            FReport         = new Report();
            FReport.Preview = previewControl1;
            Config.ReportSettings.ShowPerformance = true;
            Config.ReportSettings.StartProgress  += new EventHandler(ReportSettings_StartProgress);
            Config.ReportSettings.Progress       += new ProgressEventHandler(ReportSettings_Progress);
            Config.ReportSettings.FinishProgress += new EventHandler(ReportSettings_FinishProgress);

            tvReports.ImageList = Res.GetImages();

            XmlDocument reports = new XmlDocument();

            reports.Load(FReportsFolder + "reports.xml");

            for (int i = 0; i < reports.Root.Count; i++)
            {
                XmlItem folderItem = reports.Root[i];
                if (folderItem.GetProp("WinDemo") == "false")
                {
                    continue;
                }
#if Basic
                if (folderItem.GetProp("Basic") == "false")
                {
                    continue;
                }
#endif
                string culture = System.Globalization.CultureInfo.CurrentCulture.Name;
                string text    = folderItem.GetProp("Name-" + culture);
                if (String.IsNullOrEmpty(text))
                {
                    text = folderItem.GetProp("Name");
                }

                TreeNode folderNode = tvReports.Nodes.Add(text + "     ");
                folderNode.ImageIndex         = 66;
                folderNode.SelectedImageIndex = folderNode.ImageIndex;
                folderNode.NodeFont           = new Font(Font, FontStyle.Bold);

                for (int j = 0; j < folderItem.Count; j++)
                {
                    XmlItem reportItem = folderItem[j];
                    if (reportItem.GetProp("WinDemo") == "false")
                    {
                        continue;
                    }
#if Basic
                    if (reportItem.GetProp("Basic") == "false")
                    {
                        continue;
                    }
#endif

                    string file     = reportItem.GetProp("File");
                    string fileName = reportItem.GetProp("Name-" + culture);
                    if (String.IsNullOrEmpty(fileName))
                    {
                        fileName = Path.GetFileNameWithoutExtension(file);
                    }

                    TreeNode fileNode = folderNode.Nodes.Add(fileName);
                    fileNode.ImageIndex         = 134;
                    fileNode.SelectedImageIndex = fileNode.ImageIndex;
                    fileNode.Tag = FReportsFolder + file;
                }
            }

            if (tvReports.Nodes.Count > 0 && tvReports.Nodes[0].Nodes.Count > 0)
            {
                tvReports.SelectedNode = tvReports.Nodes[0].Nodes[0];
            }
            tvReports.Focus();
        }
コード例 #25
0
ファイル: LabelWizardForm.cs プロジェクト: zixing131/LAEACC
        private void SetReportPageLayout(XmlItem labelParameters, ReportPage page)
        {
            float paperWidth  = Converter.StringToFloat(labelParameters.GetProp("PaperWidth"), true) * 25.4f;
            float paperHeight = Converter.StringToFloat(labelParameters.GetProp("PaperHeight"), true) * 25.4f;
            float leftMargin  = Converter.StringToFloat(labelParameters.GetProp("LeftMargin"), true) * 25.4f;
            float topMargin   = Converter.StringToFloat(labelParameters.GetProp("TopMargin"), true) * 25.4f;

            float labelWidth  = Converter.StringToFloat(labelParameters.GetProp("Width"), true) * 25.4f;
            float labelHeight = Converter.StringToFloat(labelParameters.GetProp("Height"), true) * 25.4f;
            int   rows        = (int)Converter.StringToFloat(labelParameters.GetProp("Rows"), true);

            if (rows == 0)
            {
                rows = 1;
            }
            int columns = (int)Converter.StringToFloat(labelParameters.GetProp("Columns"), true);

            if (columns == 0)
            {
                columns = 1;
            }
            float rowGap    = Converter.StringToFloat(labelParameters.GetProp("RowGap"), true) * 25.4f;
            float columnGap = Converter.StringToFloat(labelParameters.GetProp("ColumnGap"), true) * 25.4f;

            // setup paper
            page.Clear();
            page.Landscape    = labelParameters.GetProp("Landscape") == "true";
            page.PaperWidth   = paperWidth;
            page.PaperHeight  = paperHeight;
            page.LeftMargin   = leftMargin;
            page.RightMargin  = 0;
            page.TopMargin    = topMargin;
            page.BottomMargin = 0;

            // setup columns
            page.Columns.Count = columns;
            page.Columns.Width = labelWidth;
            page.Columns.Positions.Clear();
            for (int i = 0; i < columns; i++)
            {
                page.Columns.Positions.Add(i * (labelWidth + columnGap));
            }

            // setup data band
            DataBand band = new DataBand();

            page.Bands.Add(band);
            band.CreateUniqueName();
            band.Width  = labelWidth * Units.Millimeters;
            band.Height = labelHeight * Units.Millimeters;
            // setup row gap (use child band)
            if (rowGap > 0)
            {
                band.Child = new ChildBand();
                band.Child.CreateUniqueName();
                band.Child.Height = rowGap * Units.Millimeters;
            }
        }
コード例 #26
0
ファイル: TextToolbar.cs プロジェクト: zixing131/LAEACC
        public override void RestoreState()
        {
            XmlItem xi = Config.Root.FindItem("Designer").FindItem(Name);

            cbxName.MruFonts = xi.GetProp("MruFonts");
        }
コード例 #27
0
ファイル: EmailExportForm.cs プロジェクト: zixing131/LAEACC
        private void Init()
        {
            XmlItem xi = Config.Root.FindItem("EmailExport").FindItem("AccountSettings");

            // restore account info from the config
            if (String.IsNullOrEmpty(FExport.Account.Address))
            {
                FExport.Account.Address         = xi.GetProp("Address");
                FExport.Account.Name            = xi.GetProp("Name");
                FExport.Account.MessageTemplate = xi.GetProp("Template");
                FExport.Account.Host            = xi.GetProp("Host");
                string port = xi.GetProp("Port");
                if (port != "")
                {
                    FExport.Account.Port = int.Parse(port);
                }
                FExport.Account.UserName  = xi.GetProp("UserName");
                FExport.Account.Password  = xi.GetProp("Password");
                FExport.Account.EnableSSL = xi.GetProp("EnableSSL") == "1";
            }

            // fill account info
            tbAddressFrom.Text  = FExport.Account.Address;
            tbName.Text         = FExport.Account.Name;
            tbTemplate.Text     = FExport.Account.MessageTemplate;
            tbHost.Text         = FExport.Account.Host;
            udPort.Value        = FExport.Account.Port;
            tbUserName.Text     = FExport.Account.UserName;
            tbPassword.Text     = FExport.Account.Password;
            cbEnableSSL.Checked = FExport.Account.EnableSSL;

            // fill email
            string[] addresses = xi.GetProp("RecentAddresses").Split(new char[] { '\r' });
            cbxAddressTo.Items.AddRange(addresses);
            if (!String.IsNullOrEmpty(FExport.Address))
            {
                cbxAddressTo.Text = FExport.Address;
            }
            else if (cbxAddressTo.Items.Count > 0)
            {
                cbxAddressTo.SelectedIndex = 0;
            }

            string[] subjects = xi.GetProp("RecentSubjects").Split(new char[] { '\r' });
            cbxSubject.Items.AddRange(subjects);
            if (!String.IsNullOrEmpty(FExport.Subject))
            {
                cbxSubject.Text = FExport.Subject;
            }
            else if (cbxSubject.Items.Count > 0)
            {
                cbxSubject.SelectedIndex = 0;
            }

            if (!String.IsNullOrEmpty(FExport.MessageBody))
            {
                tbMessage.Text = FExport.MessageBody;
            }
            else
            {
                tbMessage.Text = tbTemplate.Text;
            }

            // fill exports
            FExports = new List <ExportBase>();
            List <ObjectInfo> list = new List <ObjectInfo>();

            RegisteredObjects.Objects.EnumItems(list);

            int exportIndex = 0;

            cbxAttachment.Items.Add(Res.Get("Preview,SaveNative"));
            FExports.Add(null);

            foreach (ObjectInfo info in list)
            {
                if (info.Object != null && info.Object.IsSubclassOf(typeof(ExportBase)))
                {
                    cbxAttachment.Items.Add(Res.TryGet(info.Text));
                    FExports.Add(Activator.CreateInstance(info.Object) as ExportBase);
                    if (FExport.Export != null && FExport.Export.GetType() == info.Object)
                    {
                        exportIndex = FExports.Count - 1;
                    }
                }
            }

            string recentExport = xi.GetProp("RecentExport");

            if (exportIndex != 0)
            {
                cbxAttachment.SelectedIndex = exportIndex;
            }
            else if (recentExport != "")
            {
                cbxAttachment.SelectedIndex = int.Parse(recentExport);
            }
            else
            {
                cbxAttachment.SelectedIndex = 0;
            }
        }
コード例 #28
0
        private void Form1_Load(object sender, EventArgs e)
        {
            tvReports.Hide();
            lblVersion.Text = "Version " + Config.Version;
            comboBox1.Items.Clear();
            comboBox1.Items.AddRange(UIStyleUtils.UIStyleNames);
            comboBox1.SelectedIndex = (int)Config.UIStyle;

            FindReportsFolder();
            CreateDataSources();

            Config.ReportSettings.ShowPerformance    = true;
            Config.ReportSettings.StartProgress     += new EventHandler(ReportSettings_StartProgress);
            Config.ReportSettings.Progress          += new ProgressEventHandler(ReportSettings_Progress);
            Config.ReportSettings.FinishProgress    += new EventHandler(ReportSettings_FinishProgress);
            FastReport.Map.MapObject.ShapefileFolder = reportsFolder + @"..\Maps";

            tvReports.ImageList = Res.GetImages();

            try
            {
                XmlDocument reports = new XmlDocument();
                reports.Load(reportsFolder + "reports.xml");

                for (int i = 0; i < reports.Root.Count; i++)
                {
                    XmlItem folderItem = reports.Root[i];
                    if (folderItem.GetProp("WinDemo") == "false")
                    {
                        continue;
                    }

                    string culture = System.Globalization.CultureInfo.CurrentCulture.Name;
                    string text    = folderItem.GetProp("Name-" + culture);
                    if (String.IsNullOrEmpty(text))
                    {
                        text = folderItem.GetProp("Name");
                    }

                    TreeNode folderNode = tvReports.Nodes.Add(text + "     ");
                    folderNode.ImageIndex         = 66;
                    folderNode.SelectedImageIndex = folderNode.ImageIndex;
                    folderNode.NodeFont           = new Font(Font, FontStyle.Bold);

                    for (int j = 0; j < folderItem.Count; j++)
                    {
                        XmlItem reportItem = folderItem[j];
                        if (reportItem.GetProp("WinDemo") == "false")
                        {
                            continue;
                        }


                        string file     = reportItem.GetProp("File");
                        string fileName = reportItem.GetProp("Name-" + culture);
                        if (String.IsNullOrEmpty(fileName))
                        {
                            fileName = Path.GetFileNameWithoutExtension(file);
                        }

                        TreeNode fileNode = folderNode.Nodes.Add(fileName);
                        fileNode.ImageIndex         = 134;
                        fileNode.SelectedImageIndex = fileNode.ImageIndex;
                        fileNode.Tag = reportsFolder + file;
                    }
                }

                tvReports.ExpandAll();
                tvReports.Show();

                if (tvReports.Nodes.Count > 0)
                {
                    tvReports.SelectedNode = tvReports.Nodes[0];
                }

                if (tvReports.Nodes.Count > 0 && tvReports.Nodes[0].Nodes.Count > 0)
                {
                    tvReports.SelectedNode = tvReports.Nodes[0].Nodes[0];
                }

                tvReports.Focus();
            }
            catch (Exception err)
            {
                MessageBox.Show(err.Message);
            }
        }