Beispiel #1
0
        static void Main(string[] args)
        {
            PrintControl print = delegate { };

            while (true)
            {
                string input = Console.ReadLine();

                switch (input)
                {
                case "ReleaseWater":
                    print += ReleaseWater;
                    break;

                case "ReleaseFertilizer":
                    print += ReleaseFertilizer;
                    break;

                case "IncreaseTemperature":
                    print += IncreaseTemperature;
                    break;

                case "run":
                    print();
                    break;

                default:
                    Console.WriteLine("No such command.");
                    break;
                }
            }
        }
Beispiel #2
0
        public static int Print()
        {
            PrintControl printControl = new PrintControl();
            Drawing      drawing      = new Drawing();

            drawing.Clear();

            Drawing.Text date = new Drawing.Text(330, 150, "Univers", "ПАРТ " + Startup.currentDate);
            date.Height = 10;
            drawing    += date;

            Drawing.Barcode barcode = new Drawing.Barcode(330, 30, "CODE128", BarcodeScanner.scannedBarcode);
            barcode.Height        = 80;
            barcode.Text.Enabled  = true;
            barcode.Text.FontName = "Univers";
            barcode.Text.Height   = 8;

            barcode.BarWidthWide       = 3;
            barcode.BarWidthNarrow     = 1;
            barcode.WidthMagnification = 1;
            drawing += barcode;

            printControl.PrintFeed(drawing, CountSetter.count);

            printControl.Dispose();
            drawing.Dispose();

            return(0);
        }
Beispiel #3
0
 protected override object CreateControlCore()
 {
     _printControl = new PrintControl {
         Dock = DockStyle.Fill
     };
     _printControl.ParentChanged += OnControlParentChanged;
     return(_printControl);
 }
Beispiel #4
0
        protected PrintBarManager CreatePrintBarManager(PrintControl pc)
        {
            PrintBarManager printBarManager = new PrintBarManager();

            printBarManager.Form = printControl;
            printBarManager.Initialize(pc);
            printBarManager.MainMenu.Visible   = false;
            printBarManager.AllowCustomization = false;
            return(printBarManager);
        }
Beispiel #5
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            OrderReportPrintControl control = new OrderReportPrintControl(vm.Orders.ToList(), vm.DTStart, vm.DTStop);
            PrintControl            print   = new PrintControl();

            print.CloseClick += print_CloseClick;
            grdPrint.Children.Add(print);
            grdPrint.Visibility = Visibility.Visible;
            grdRoot.Visibility  = Visibility.Collapsed;
            print.AddPrinted(control);
        }
        private PrintBarManager CreatePrintBarManager(PrintControl pc)
        {
            PrintBarManager manager = new PrintBarManager {
                Form = this.printControl
            };

            manager.Initialize(pc);
            manager.MainMenu.Visible   = false;
            manager.AllowCustomization = false;
            return(manager);
        }
 protected override object CreateControlCore() {
     PrintControl = new PrintControl { Dock = DockStyle.Fill };
     PrintControl.ParentChanged += OnControlParentChanged;
     Type reportDataType = ReportsModule.FindReportsModule(_application.Modules).ReportDataType;
     var reportData = (IReportData)View.ObjectSpace.FindObject(reportDataType, CriteriaOperator.Parse("ReportName=?", Model.ReportName));
     if (reportData == null)
         throw new NullReferenceException(string.Format("Report {0} not found", Model.ReportName));
     _report = (XafReport)reportData.LoadReport(View.ObjectSpace);
     View.ControlsCreated += ViewOnControlsCreated;
     PrintControl.PrintingSystem = Report.PrintingSystem;
     return PrintControl;
 }
        private void NextPage_OnClick(object sender, RoutedEventArgs e)
        {
            var output = new List <Course>();

            foreach (var year in semestersLabels)
            {
                foreach (var semester in year)
                {
                    foreach (var course in semester)
                    {
                        output.Add(CourseHandler.GetCourseFromId(course.Content.ToString()));
                    }
                }
            }

            PrintControl.Save(output.ToArray());
        }
        protected override object CreateControlCore()
        {
            PrintControl = new PrintControl {
                Dock = DockStyle.Fill
            };
            PrintControl.ParentChanged += OnControlParentChanged;
            Type reportDataType = ReportsModule.FindReportsModule(_application.Modules).ReportDataType;
            var  reportData     = (IReportData)View.ObjectSpace.FindObject(reportDataType, CriteriaOperator.Parse("ReportName=?", Model.ReportName));

            if (reportData == null)
            {
                throw new NullReferenceException(string.Format("Report {0} not found", Model.ReportName));
            }
            _report = (XafReport)reportData.LoadReport(View.ObjectSpace);
            View.ControlsCreated       += ViewOnControlsCreated;
            PrintControl.PrintingSystem = Report.PrintingSystem;
            return(PrintControl);
        }
Beispiel #10
0
        static void Main(string[] args)
        {
            TestCommunicationUSBHost.Test(args);
            return;

            // Set up print control and drawing
            PrintControl printControl = new PrintControl();
            Drawing      drawing      = new Drawing();

            // Perform test feed
            State state = printControl.TestFeed();

            // Print Hello World (if testfeed was OK)
            if (state == State.NoError)
            {
                Drawing.Text text = new Drawing.Text();
                text.Point  = new Point(100, 100);
                text.Data   = "Hello World";
                text.Height = 36;

                drawing += text;
                drawing.PartialRendering = true;

                state = printControl.PrintFeed(drawing, 1);

                if (state != State.NoError)
                {
                    Log.d(String.Format("PrintFeed failed: {0}", state.ToString()));
                }
            }
            else
            {
                Log.d(String.Format("TestFeed failed: {0}", state.ToString()));
            }

            Log.d("Exit");
        }
        private void BtnGenerarReporte_Click(object sender, EventArgs e)
        {
            try
            {
                if (LookUpMeses.Text.Equals("Seleccione"))
                {
                    XtraMessageBox.Show("Por favor seleccione mes.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    mes = LookUpMeses.EditValue.ToString();
                }
                if (LookUpAño.Text.Equals("Seleccione"))
                {
                    XtraMessageBox.Show("Por favor seleccione año.", "Mensaje", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                else
                {
                    año = LookUpAño.EditValue.ToString();
                }
                splash.ShowWaitForm();
                splash.SetWaitFormCaption("Generando Reporte..");
                XtraReport reporte;
                reporte = new Reports.RepNomina(mes, año);
                ReportPrintTool printTool    = new ReportPrintTool(reporte);
                PrintControl    printControl = printTool.PreviewForm.PrintControl;
                //PrintControl printControl = printTool.PreviewRibbonForm.PrintControl;


                // Zoom the document, so that it fits the entire page into the Print Preview's dimensions.
                if (printControl.CanExecCommand(PrintingSystemCommand.ViewWholePage))
                {
                    printControl.ExecCommand(PrintingSystemCommand.ViewWholePage);
                }

                // Invoke the Hand tool to scroll the document using the mouse.
                if (printControl.CanExecCommand(PrintingSystemCommand.HandTool))
                {
                    printControl.ExecCommand(PrintingSystemCommand.HandTool, new object[] { true });
                }

                // Hide the Hand tool.
                //if (printControlCanExecCommand(PrintingSystemCommand.HandTool)) {
                //    printControl.ExecCommand(PrintingSystemCommand.HandTool, new object[] { false });
                //}

                // Show the report's Print Preview in a dialog window.
                printControl.Zoom = 1.2F;
                printTool.ShowPreview();
                splash.CloseWaitForm();
                //printTool.ShowPreviewDialog();
                //printTool.ShowRibbonPreviewDialog();
            }
            catch (Exception genRep)
            {
                splash.CloseWaitForm();
                XtraMessageBox.Show(genRep.Message + "mostrarReporte()", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void InitializeComponent()
        {
            ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(PrintForm));

            this.numericUpDown1 = new NumericUpDown();
            this.numericUpDown2 = new NumericUpDown();
            this.label1         = new Label();
            this.label2         = new Label();
            this.btn_PrintStart = new Button();
            this.btn_Cancel     = new Button();
            this.btn_SetPrint   = new Button();
            this.printDialog1   = new PrintDialog();
            this.printDocument1 = new PrintDocument();
            this.printControl1  = new PrintControl();
            this.numericUpDown1.BeginInit();
            this.numericUpDown2.BeginInit();
            this.SuspendLayout();
            componentResourceManager.ApplyResources((object)this.numericUpDown1, "numericUpDown1");
            this.numericUpDown1.Name = "numericUpDown1";
            componentResourceManager.ApplyResources((object)this.numericUpDown2, "numericUpDown2");
            this.numericUpDown2.Name = "numericUpDown2";
            componentResourceManager.ApplyResources((object)this.label1, "label1");
            this.label1.Name = "label1";
            componentResourceManager.ApplyResources((object)this.label2, "label2");
            this.label2.Name = "label2";
            componentResourceManager.ApplyResources((object)this.btn_PrintStart, "btn_PrintStart");
            this.btn_PrintStart.Name = "btn_PrintStart";
            this.btn_PrintStart.UseVisualStyleBackColor = true;
            this.btn_PrintStart.Click += new EventHandler(this.btn_PrintStart_Click);
            componentResourceManager.ApplyResources((object)this.btn_Cancel, "btn_Cancel");
            this.btn_Cancel.DialogResult            = DialogResult.Cancel;
            this.btn_Cancel.Name                    = "btn_Cancel";
            this.btn_Cancel.UseVisualStyleBackColor = true;
            this.btn_Cancel.Click                  += new EventHandler(this.btn_Cancel_Click);
            componentResourceManager.ApplyResources((object)this.btn_SetPrint, "btn_SetPrint");
            this.btn_SetPrint.Name = "btn_SetPrint";
            this.btn_SetPrint.UseVisualStyleBackColor = true;
            this.btn_SetPrint.Click       += new EventHandler(this.btn_SetPrint_Click);
            this.printDialog1.Document     = this.printDocument1;
            this.printDialog1.UseEXDialog  = true;
            this.printDocument1.PrintPage += new PrintPageEventHandler(this.printDocument1_PrintPage);
            componentResourceManager.ApplyResources((object)this, "$this");
            this.AutoScaleMode = AutoScaleMode.Font;
            this.CancelButton  = (IButtonControl)this.btn_Cancel;
            this.Controls.Add((Control)this.btn_SetPrint);
            this.Controls.Add((Control)this.btn_Cancel);
            this.Controls.Add((Control)this.btn_PrintStart);
            this.Controls.Add((Control)this.label2);
            this.Controls.Add((Control)this.label1);
            this.Controls.Add((Control)this.numericUpDown2);
            this.Controls.Add((Control)this.numericUpDown1);
            this.FormBorderStyle = FormBorderStyle.FixedSingle;
            this.MaximizeBox     = false;
            this.MinimizeBox     = false;
            this.Name            = nameof(PrintForm);
            this.ShowIcon        = false;
            this.numericUpDown1.EndInit();
            this.numericUpDown2.EndInit();
            this.ResumeLayout(false);
            this.PerformLayout();
        }
Beispiel #13
0
 protected PrintBarManager CreatePrintBarManager(PrintControl pc)
 {
     PrintBarManager printBarManager = new PrintBarManager();
     printBarManager.Form = printControl;
     printBarManager.Initialize(pc);
     printBarManager.MainMenu.Visible = false;
     printBarManager.AllowCustomization = false;
     return printBarManager;
 }
Beispiel #14
0
        private void RunSimulations()
        {
            try
            {
                Status       = "Status: Running simulations";
                PlotsEnabled = false;

                Internals = new TreeViewModel();
                Plots     = new TabsViewModel();
                Prints    = new ObservableCollection <UIElement>();

                var parseResult = SpiceHelper.GetSpiceSharpNetlist(Netlist, RandomSeed, HasTitle, Encoding);

                if (parseResult != null)
                {
                    var model = new SpiceSharpParser.SpiceSharpReader().Read(parseResult.FinalModel);


                    if (model == null)
                    {
                        Logs += $"Errors in lexing: {parseResult.ValidationResult.HasError}\n";
                    }
                    else
                    {
                        SaveExportsToFile(model);
                        Logs += $"Simulations found: {model.Simulations.Count}\n";
                        Logs += "Errors and warnings: \n";

                        foreach (var log in model.ValidationResult)
                        {
                            Logs += log.Message + ", line =" + log.LineInfo.LineNumber + "\n";
                        }

                        int simulationNo = 0;

                        Stopwatch simulationsWatch = new Stopwatch();
                        simulationsWatch.Start();
                        System.Threading.Tasks.Parallel.ForEach <Simulation>(
                            model.Simulations,
                            new ParallelOptions()
                        {
                            MaxDegreeOfParallelism = MaxDegreeOfParallelism
                        }, simulation => RunSimulation(model, (Simulation)simulation, Interlocked.Increment(ref simulationNo)));
                        simulationsWatch.Stop();

                        // Generate summary statistics
                        Dispatcher.Invoke(() =>
                        {
                            var summary = new SummarySimulationStatistics();

                            foreach (var stat in Stats)
                            {
                                summary.BehaviorCreationTime += stat.BehaviorCreationTime;
                                summary.FinishTime           += stat.FinishTime;
                                summary.ExecutionTime        += stat.ExecutionTime;
                                summary.SetupTime            += stat.SetupTime;
                                summary.ValidationTime       += stat.ValidationTime;
                            }
                            summary.TotalSimulationsTime = simulationsWatch.ElapsedMilliseconds;

                            SummaryStats.Add(summary);
                        });

                        // Generate plots
                        if (model.XyPlots.Count > 0)
                        {
                            PlotsEnabled = true;

                            Logs += $"Creating plots: {model.XyPlots.Count}\n";

                            if (model.XyPlots.Count > 0)
                            {
                                foreach (var plot in model.XyPlots)
                                {
                                    Dispatcher.Invoke(() =>
                                    {
                                        Plots.Items.Add(new TabItem()
                                        {
                                            Header = plot.Name, Content = new XyPlotControl()
                                            {
                                                Plot = plot
                                            }
                                        });
                                    });
                                }
                            }
                        }

                        // Generate plots
                        if (model.MonteCarloResult.Enabled)
                        {
                            PlotsEnabled = true;

                            Logs += $"Creating monte carlo plot\n";

                            Dispatcher.Invoke(() =>
                            {
                                var plot = new HistogramPlotControl()
                                {
                                    Data = model.MonteCarloResult
                                };
                                plot.DataBind();
                                Plots.Items.Add(new TabItem()
                                {
                                    Header = "Monte Carlo", Content = plot
                                });
                            });
                        }

                        Logs += $"Prints found: {model.Prints.Count}\n";

                        if (model.Prints.Count > 0)
                        {
                            foreach (var print in model.Prints)
                            {
                                Dispatcher.Invoke(() =>
                                {
                                    PrintControl control = new PrintControl(print);
                                    control.DataBind();
                                    Prints.Add(control);
                                });
                            }
                        }
                    }
                    Status = "Status: Finished";
                }
            }
            catch (Exception ex)
            {
                Logs  += ex.ToString();
                Status = "Status: Error";
            }
        }
        private void InitializeComponent()
        {
            this.components = new Container();
            ComponentResourceManager manager = new ComponentResourceManager(typeof(XucBaseReportControls));
            SuperToolTip             tip     = new SuperToolTip();
            ToolTipItem      item            = new ToolTipItem();
            SuperToolTip     tip2            = new SuperToolTip();
            ToolTipTitleItem item2           = new ToolTipTitleItem();
            ToolTipItem      item3           = new ToolTipItem();

            this.imageCollection2 = new DevExpress.Utils.ImageCollection(this.components);
            this.plButton         = new PanelControl();
            this.plReportControl  = new PanelControl();
            this.printControl     = new PrintControl();
            this.printingSystem   = new PrintingSystem(this.components);
            this.plTop            = new PanelControl();
            this.bm   = new BarManager(this.components);
            this.bar1 = new Bar();
            this.barDockControlTop    = new BarDockControl();
            this.barDockControlBottom = new BarDockControl();
            this.barDockControlLeft   = new BarDockControl();
            this.barDockControlRight  = new BarDockControl();
            this.btnPreviewForm       = new BarButtonItem();
            this.bbiDesign            = new BarButtonItem();
            this.ac = new AlertControl(this.components);
            this.imageCollection2.BeginInit();
            this.plButton.BeginInit();
            this.plReportControl.BeginInit();
            this.plReportControl.SuspendLayout();
            ((ISupportInitialize)this.printingSystem).BeginInit();
            this.plTop.BeginInit();
            this.bm.BeginInit();
            base.SuspendLayout();
            this.imageCollection2.ImageStream = (ImageCollectionStreamer)manager.GetObject("imageCollection2.ImageStream");
            this.plButton.Dock     = DockStyle.Bottom;
            this.plButton.Location = new Point(0, 0x1fc);
            this.plButton.Name     = "plButton";
            this.plButton.Size     = new Size(0x39d, 0x1c);
            this.plButton.TabIndex = 80;
            this.plButton.Visible  = false;
            this.plReportControl.Controls.Add(this.printControl);
            this.plReportControl.Dock              = DockStyle.Fill;
            this.plReportControl.Location          = new Point(0, 60);
            this.plReportControl.Name              = "plReportControl";
            this.plReportControl.Size              = new Size(0x39d, 0x1c0);
            this.plReportControl.TabIndex          = 0x51;
            this.printControl.BackColor            = Color.Empty;
            this.printControl.Dock                 = DockStyle.Fill;
            this.printControl.ForeColor            = Color.Empty;
            this.printControl.IsMetric             = false;
            this.printControl.Location             = new Point(2, 2);
            this.printControl.Name                 = "printControl";
            this.printControl.PageBorderVisibility = PageBorderVisibility.AllWithoutSelection;
            this.printControl.PrintingSystem       = this.printingSystem;
            this.printControl.Size                 = new Size(0x399, 0x1bc);
            this.printControl.TabIndex             = 2;
            this.printControl.TabStop              = false;
            this.printControl.TooltipFont          = new Font("Tahoma", 8.25f);
            this.plTop.Dock            = DockStyle.Top;
            this.plTop.Location        = new Point(0, 0x18);
            this.plTop.Name            = "plTop";
            this.plTop.Size            = new Size(0x39d, 0x24);
            this.plTop.TabIndex        = 0x4f;
            this.plTop.Visible         = false;
            this.bm.AutoSaveInRegistry = true;
            this.bm.Bars.AddRange(new Bar[] { this.bar1 });
            this.bm.DockControls.Add(this.barDockControlTop);
            this.bm.DockControls.Add(this.barDockControlBottom);
            this.bm.DockControls.Add(this.barDockControlLeft);
            this.bm.DockControls.Add(this.barDockControlRight);
            this.bm.Form   = this;
            this.bm.Images = this.imageCollection2;
            this.bm.Items.AddRange(new BarItem[] { this.btnPreviewForm, this.bbiDesign });
            this.bm.LargeImages         = this.imageCollection2;
            this.bm.MaxItemId           = 2;
            this.bm.RegistryPath        = @"HKEY_CURRENT_USER\Software\Perfect Software\Perfect Stock Management";
            this.bar1.BarName           = "Custom 2";
            this.bar1.DockCol           = 0;
            this.bar1.DockRow           = 0;
            this.bar1.DockStyle         = BarDockStyle.Top;
            this.bar1.Text              = "Custom 2";
            this.bar1.Visible           = false;
            this.btnPreviewForm.Caption = "T\x00e1ch Ra";
            this.btnPreviewForm.Glyph   = (Image)manager.GetObject("btnPreviewForm.Glyph");
            this.btnPreviewForm.Id      = 0;
            this.btnPreviewForm.Name    = "btnPreviewForm";
            item.Text = "Chức năng n\x00e0y gi\x00fap bạn t\x00e1ch b\x00e1o c\x00e1o đang xem ra một cửa sổ kh\x00e1c.";
            tip.Items.Add(item);
            this.btnPreviewForm.SuperTip   = tip;
            this.btnPreviewForm.ItemClick += new ItemClickEventHandler(this.BtnPreviewFormItemClick);
            this.bbiDesign.Caption         = "Thiết Kế";
            this.bbiDesign.Id              = 1;
            this.bbiDesign.ImageIndex      = 5;
            this.bbiDesign.Name            = "bbiDesign";
            item2.Text       = "Thiết Kế";
            item3.LeftIndent = 6;
            item3.Text       = "Đ\x00e2y l\x00e0 chức năng gi\x00fap ch\x00fang ta tự thiết kế lại trang b\x00e1o c\x00e1o hiện tại, bạn c\x00f3 thể lưu lại v\x00e0 bạn c\x00f3 thể sử dụng b\x00e1o c\x00e1o cho c\x00f4ng việc sau n\x00e0y. ";
            tip2.Items.Add(item2);
            tip2.Items.Add(item3);
            this.bbiDesign.SuperTip                = tip2;
            this.bbiDesign.ItemClick              += new ItemClickEventHandler(this.BbiDesignItemClick);
            this.ac.AllowHtmlText                  = true;
            this.ac.AppearanceText.Font            = new Font("Tahoma", 9.75f, FontStyle.Bold, GraphicsUnit.Point, 0);
            this.ac.AppearanceText.Options.UseFont = true;
            this.ac.AutoFormDelay                  = 0x1388;
            this.ac.FormLocation     = AlertFormLocation.TopLeft;
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.AutoScaleMode       = AutoScaleMode.Font;
            base.Controls.Add(this.plReportControl);
            base.Controls.Add(this.plButton);
            base.Controls.Add(this.plTop);
            base.Controls.Add(this.barDockControlLeft);
            base.Controls.Add(this.barDockControlRight);
            base.Controls.Add(this.barDockControlBottom);
            base.Controls.Add(this.barDockControlTop);
            base.Name = "XucBaseReportControls";
            base.Size = new Size(0x39d, 0x218);
            this.imageCollection2.EndInit();
            this.plButton.EndInit();
            this.plReportControl.EndInit();
            this.plReportControl.ResumeLayout(false);
            ((ISupportInitialize)this.printingSystem).EndInit();
            this.plTop.EndInit();
            this.bm.EndInit();
            base.ResumeLayout(false);
        }
Beispiel #16
0
        private void RunSimulations()
        {
            try
            {
                Status       = "Status: Running simulations";
                PlotsEnabled = false;

                Internals = new TreeViewModel();
                Plots     = new TabsViewModel();
                Prints    = new ObservableCollection <UIElement>();

                var model = SpiceHelper.GetSpiceSharpNetlist(Netlist, Mode, RandomSeed, HasTitle);

                SaveExportsToFile(model);

                Logs += $"Simulations found: {model.Simulations.Count}\n";
                int simulationNo = 0;

                Stopwatch simulationsWatch = new Stopwatch();
                simulationsWatch.Start();
                Parallel.ForEach <Simulation>(
                    model.Simulations,
                    new ParallelOptions()
                {
                    MaxDegreeOfParallelism = MaxDegreeOfParallelism
                }, simulation => RunSimulation(model, (BaseSimulation)simulation, Interlocked.Increment(ref simulationNo)));
                simulationsWatch.Stop();

                // Generate summary statistics
                Dispatcher.Invoke(() =>
                {
                    var summary = new SummarySimulationStatistics();

                    foreach (var stat in Stats)
                    {
                        summary.Iterations           += stat.Iterations;
                        summary.SolveTime            += stat.SolveTime;
                        summary.LoadTime             += stat.LoadTime;
                        summary.ReorderTime          += stat.ReorderTime;
                        summary.BehaviorCreationTime += stat.BehaviorCreationTime;
                        summary.Timepoints           += stat.Timepoints;
                        summary.TransientIterations  += stat.TransientIterations;
                        summary.TransientTime        += stat.TransientTime;
                        summary.AcceptedTimepoints   += stat.AcceptedTimepoints;
                        summary.RejectedTimepoints   += stat.RejectedTimepoints;
                    }
                    summary.TotalSimulationsTime = simulationsWatch.ElapsedMilliseconds;

                    SummaryStats.Add(summary);
                });

                // Generate plots
                if (model.XyPlots.Count > 0)
                {
                    PlotsEnabled = true;

                    Logs += $"Creating plots: {model.XyPlots.Count}\n";

                    if (model.XyPlots.Count > 0)
                    {
                        foreach (var plot in model.XyPlots)
                        {
                            Dispatcher.Invoke(() =>
                            {
                                Plots.Items.Add(new TabItem()
                                {
                                    Header = plot.Name, Content = new XyPlotControl()
                                    {
                                        Plot = plot
                                    }
                                });
                            });
                        }
                    }
                }

                // Generate plots
                if (model.MonteCarloResult.Enabled)
                {
                    PlotsEnabled = true;

                    Logs += $"Creating monte carlo plot\n";

                    Dispatcher.Invoke(() =>
                    {
                        var plot = new HistogramPlotControl()
                        {
                            Data = model.MonteCarloResult
                        };
                        plot.DataBind();
                        Plots.Items.Add(new TabItem()
                        {
                            Header = "Monte Carlo", Content = plot
                        });
                    });
                }

                Logs += $"Prints found: {model.Prints.Count}\n";

                if (model.Prints.Count > 0)
                {
                    foreach (var print in model.Prints)
                    {
                        Dispatcher.Invoke(() =>
                        {
                            PrintControl control = new PrintControl(print);
                            control.DataBind();
                            Prints.Add(control);
                        });
                    }
                }

                foreach (var warning in model.Warnings)
                {
                    Dispatcher.Invoke(() =>
                    {
                        Logs += "Warning: " + warning + "\n";
                    });
                }

                Status = "Status: Finished";
            }
            catch (Exception ex)
            {
                Logs  += ex.ToString();
                Status = "Status: Error";
            }
        }
Beispiel #17
0
 public void SetData(PrintControl control)
 {
     this.checkBox1.Checked = control.isSelected;
     this.chkbxTitleOnMap.Checked = control.isOnMap;
     this.cmbxMapTitleVert.SelectedItem = control.posVert;
     this.cmbxMapTitleHori.SelectedItem = control.posHori;
     if (!this.m_picture)
     {
         this.tbxContent.Text = this.m_control.property.comment;
         this.tbxContent.Font = this.m_control.property.font;
     }
 }
        public void InitPrintControl(PrjAmountRpt DataSource)
        {
            PrintTitleForm              reportTitlePrint              = new PrintTitleForm();
            PrintPrjAmountPayRptForm    reportPrjAmountPayRptPrint    = new PrintPrjAmountPayRptForm();
            PrintPrjAmountPayRptFormOld reportPrjAmountPayRptPrintOld = new PrintPrjAmountPayRptFormOld();
            PrintListPayForm            listPayFormPrint              = new PrintListPayForm();
            PrintTotalForm              totalFormPrint = new PrintTotalForm();

            reportTitlePrint.Datasource = DataSource;
            PrintControl printControl1 = new PrintControl();

            PrintBarManager printBarManager = new PrintBarManager();

            printBarManager.Form = printControl1;
            printBarManager.Initialize(printControl1);
            printBarManager.MainMenu.Visible   = false;
            printBarManager.AllowCustomization = false;


            MeteringPayRptRoot root = new MeteringPayRptRoot();

            root.Header     = DataSource;
            root.AllList    = DataSource.lstPayRpt;
            root.BoiDetails = DataSource.lstBoiPayRpt.FindAll(m => m.EndingQty.HasValue && m.EndingQty != 0 && !m.ItemName.Contains("合计") || m.ItemName.Contains("合计") && m.Sequence == 9999);  //清单支付——details


            root.WbsBoiRptDetails = DataSource.lstWbsBoiRpt;    //中间计量支付汇总表——details

            //中间支付
            if (DataSource.IsNewData)
            {
                reportPrjAmountPayRptPrint.Root = root;
            }
            else
            {
                reportPrjAmountPayRptPrintOld.Root = root;
            }
            //清单支付
            listPayFormPrint.Root = root;

            //中间计量支付汇总表
            totalFormPrint.Root = root;
            this.PrintContainer.Controls.Add(printControl1);
            switch (PrintType)
            {
            case 0:
            case 1: printControl1.PrintingSystem = reportTitlePrint.PrintingSystem; break;

            case 2: printControl1.PrintingSystem = DataSource.IsNewData?reportPrjAmountPayRptPrint.PrintingSystem: reportPrjAmountPayRptPrintOld.PrintingSystem; break;

            case 3: printControl1.PrintingSystem = listPayFormPrint.PrintingSystem; break;

            case 4: printControl1.PrintingSystem = totalFormPrint.PrintingSystem; break;
            }
            //操作要显示什么按钮
            printControl1.PrintingSystem.SetCommandVisibility(new PrintingSystemCommand[] {
                PrintingSystemCommand.ClosePreview,
                PrintingSystemCommand.Customize,
                PrintingSystemCommand.SendCsv,
                PrintingSystemCommand.SendFile,
                PrintingSystemCommand.SendGraphic,
                PrintingSystemCommand.SendMht,
                PrintingSystemCommand.SendPdf,
                PrintingSystemCommand.SendRtf,
                PrintingSystemCommand.SendTxt,
                PrintingSystemCommand.SendXlsx,
                PrintingSystemCommand.SendXls,
                //PrintingSystemCommand.ExportCsv,
                //PrintingSystemCommand.ExportFile,
                //PrintingSystemCommand.ExportGraphic,
                //PrintingSystemCommand.ExportHtm,
                //PrintingSystemCommand.ExportMht,
                //PrintingSystemCommand.ExportPdf,
                //PrintingSystemCommand.ExportRtf,
                //PrintingSystemCommand.ExportTxt,
                //PrintingSystemCommand.ExportXlsx,
                PrintingSystemCommand.ExportXls,
                //PrintingSystemCommand.ExportXps
            }, CommandVisibility.None);

            reportTitlePrint.CreateDocument();
            if (DataSource.IsNewData)
            {
                reportPrjAmountPayRptPrint.CreateDocument();
            }
            else
            {
                reportPrjAmountPayRptPrintOld.CreateDocument();
            }
            listPayFormPrint.CreateDocument();
            totalFormPrint.CreateDocument();
            if (PrintType == 0)
            {
                reportTitlePrint.Pages.AddRange(DataSource.IsNewData? reportPrjAmountPayRptPrint.Pages: reportPrjAmountPayRptPrintOld.Pages);
                reportTitlePrint.Pages.AddRange(listPayFormPrint.Pages);
                reportTitlePrint.Pages.AddRange(totalFormPrint.Pages);
            }

            printControl1.Dock = DockStyle.Fill;
        }