예제 #1
0
        private void SaleSta_MenuItem_Click(object sender, RoutedEventArgs e)
        {
            PrintWindow pw = new PrintWindow(_productManager.PrintSaleStatisticsInfo());

            pw.LabTitle.Content = "受欢迎商品单";
            pw.ShowDialog();
        }
        private void PrintCurrentLabel()
        {
            if (!CheckLicense())
            {
                return;
            }

            if (SelectedLabelView != null && SelectedLabelView.DataContext is LabelViewModel)
            {
                var pWin = new PrintWindow(RegionManager)
                {
                    Title = "Print Label"
                };

                var LVM = SelectedLabelView.DataContext as LabelViewModel;
                var pVM = pWin.DataContext as PrintWindowViewModel;
                if (pVM.Initialize(LVM.Label, LVM.ObjectList, LVM.RuleList))
                {
                    var pLV = new PrintLabelView()
                    {
                        DataContext = pVM
                    };
                    pWin.SetPrintLabelView(pLV);

                    pWin.Owner = Application.Current.MainWindow;
                    pWin.ShowDialog();
                }
                else
                {
                    DialogService.ShowSimpleTextDialog(Application.Current.MainWindow, "Warning", "2개 이상의 Sequential Number 규칙이 적용되었습니다.");
                }
            }
        }
 /// <summary>
 /// Function OpenPrintDialog to open the print window
 /// </summary>
 /// <param name="obj"></param>
 /// <returns>NA</returns>
 /// <createdBy></createdBy>
 /// <createdOn>May-11,2016</createdOn>
 public void OpenPrintDialog(object obj)
 {
     CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgStart, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
     try
     {
         DateoutProcessingModel objPrinModel = new DateoutProcessingModel();
         objPrinModel.Vin         = Vin;
         objPrinModel.VehiclesID  = string.Empty;
         objPrinModel.BayLocation = BayLocation;
         PrintWindow objPrint = new PrintWindow(objPrinModel);
         objPrint.ShowDialog();
     }
     catch (Exception ex)
     {
         LogHelper.LogErrorToDb(ex);
         bool displayErrorOnUI = false;
         CommonSettings.logger.LogError(this.GetType(), ex);
         if (displayErrorOnUI)
         {
             throw;
         }
     }
     finally
     {
         CommonSettings.logger.LogInfo(typeof(string), string.Format(CultureInfo.InvariantCulture, Resources.loggerMsgEnd, DateTime.Now.ToShortDateString(), DateTime.Now.ToShortTimeString(), MethodBase.GetCurrentMethod().Name));
     }
 }
예제 #4
0
        private void BookList_MenuItem_Click(object sender, RoutedEventArgs e)
        {
            PrintWindow pw = new PrintWindow(_productManager.PrintBookProductList());

            pw.LabTitle.Content = "订货单";
            pw.ShowDialog();
        }
예제 #5
0
        private void Printer_Click(object sender, RoutedEventArgs e)
        {
            PrintWindow printWindow = new PrintWindow()
            {
                QuotationData = QuotationData,
                UserData      = this.UserData,
            };

            printWindow.ShowDialog();
        }
예제 #6
0
 private void PrintPage_Executed(object sender, ExecutedRoutedEventArgs e)
 {
     using (PrintWindow window = new PrintWindow())
     {
         window.EnsureButtonClick += (sender1, e1) =>
         {
             PrintExecute(sender, window.IsRecursion);
             window.Close();
         };
         window.ShowDialog();
     }
 }
예제 #7
0
        private void btn_Print_Click(object sender, RoutedEventArgs e)
        {
            var dc = this.DataContext as SaleViewModel;

            dc.Sale.SalePrice    = dc.SumSalePrice;
            dc.Sale.ServicePrice = dc.SumServicePrice;
            dc.Sale.SumPrice     = dc.SumPrice;
            var data = new SaleData {
                Sale = dc.Sale, SaleItemCollection = dc.SaleItemCollection, ServiceItemCollection = dc.ServiceItemCollection
            };
            PrintWindow pw = new PrintWindow("print\\SaleFlowDocument.xaml", data, new SaleDocumentRenderer());

            pw.ShowDialog();
        }
예제 #8
0
        private void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            if (File.Exists("printPreview.xps"))
            {
                File.Delete("printPreview.xps");
            }
            var xpsDocument          = new XpsDocument("printPreview.xps", FileAccess.ReadWrite);
            XpsDocumentWriter writer = XpsDocument.CreateXpsDocumentWriter(xpsDocument);

            writer.Write(((IDocumentPaginatorSource)FD).DocumentPaginator);
            Document = xpsDocument.GetFixedDocumentSequence();
            xpsDocument.Close();
            var windows = new PrintWindow(Document);

            windows.ShowDialog();



            //PrintDialog printDialog = new PrintDialog();
            //if (printDialog.ShowDialog() == true)
            //{
            //    printDialog.PrintVisual(this, this.Title);
            //}
        }
예제 #9
0
        private void InitMessenger()
        {
            ServiceBus.Instance.Register <OpenNewCardOverViewMessage>(this, delegate()
            {
                CardOverviewWindow myWindow = new CardOverviewWindow();
                myWindow.ShowDialog();
            });

            ServiceBus.Instance.Register <OpenStatisticsWindowMessage>(this, delegate()
            {
                StatisticsWindow = new StatisticsWindow();
                StatisticsWindow.ShowDialog();
            });

            ServiceBus.Instance.Register <OpenLearningCardWindowMessage>(this, delegate()
            {
                LearningCardWindow = new LearningCardWindow();
                LearningCardWindow.ShowDialog();
            });

            ServiceBus.Instance.Register <OpenNewCardWindowMessage>(this, delegate()
            {
                NewCardWindow = new NewCardWindow();
                NewCardWindow.ShowDialog();
            });

            ServiceBus.Instance.Register <OpenNewTopicWindowMessage>(this, delegate()
            {
                NewTopicWindow = new NewTopicWindow();
                NewTopicWindow.ShowDialog();
            });

            Messenger.Instance.Register <OpenPrintWindowMessage>(this, delegate(OpenPrintWindowMessage message)
            {
                PrintWindow myPrintWindow       = new PrintWindow();
                myPrintWindow.Grid1.ItemsSource = ((DataGrid)message.Grid).ItemsSource;
                myPrintWindow.ShowDialog();
            });



            Messenger.Instance.Register <OpenStatisticsPanelMessage>(this, delegate(OpenStatisticsPanelMessage messageObject)
            {
                Frame statisticsFrame = StatisticsWindow.StatisticsFrame;
                switch (messageObject.PanelIndex)
                {
                case OpenStatisticsPanelMessage.HISTORY_PANEL:
                    statisticsFrame.Content = new StatisticsHistoryPanel();
                    break;

                case OpenStatisticsPanelMessage.TIME_PANEL:
                    statisticsFrame.Content = new StatisticsTimePanel();
                    break;

                case OpenStatisticsPanelMessage.QUALITY_PANEL:
                    statisticsFrame.Content = new StatisticsQualityPanel();
                    break;

                case OpenStatisticsPanelMessage.NO_PANEL:
                    statisticsFrame.Content = null;
                    break;
                }
            });

            Messenger.Instance.Register <OpenLearningCardPanelMessage>(this, delegate(OpenLearningCardPanelMessage messageObject)
            {
                Frame learningCardFrame = LearningCardWindow.LearningCardFrame;
                switch (messageObject.PanelIndex)
                {
                case OpenLearningCardPanelMessage.QUESTION_PANEL:
                    learningCardFrame.Content = new LearningCardQuestionPanel();
                    break;

                case OpenLearningCardPanelMessage.ANSWER_PANEL:
                    learningCardFrame.Content = new LearningCardAnswerPanel();
                    break;

                case OpenLearningCardPanelMessage.FINISH_PANEL:
                    learningCardFrame.Content = new LearningCardFinishPanel();
                    break;

                case OpenLearningCardPanelMessage.CLOSE_PANEL:
                    learningCardFrame.Content = "";
                    break;
                }
            });


            Messenger.Instance.Register <OpenTopicSelectionWindowMessage>(this, delegate(OpenTopicSelectionWindowMessage message)
            {
                StatisticsTopicSelectionWindow myWindow = new StatisticsTopicSelectionWindow();
                myWindow.ShowDialog();
            });

            Messenger.Instance.Register <SendAnswerMessage>(this, delegate(SendAnswerMessage message)
            {
            });
        }
예제 #10
0
        /// <summary>
        /// 打印学员信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CJDAExcl_Click(object sender, RoutedEventArgs e)
        {
            //点击选中的学员,按下打印学员信息的buttom按钮,这样就获取具体学员的信息了(用一个实体类接收一下在smDgStudentLsit里面数据,当点击时把所有的值用selectStu接收一下)
            selectStu = CjDataGrid.SelectedItem as StudentsExt;//(现在selectStu里面就装了点击时所包含的值)
            //当StudentsExt的值等于等于空值时,表示
            if (selectStu == null)
            {
                MessageBox.Show("请选择您要打印的学员", "提示");
                return;
            }
            //实例化放图片的空数据
            common.BitmapImg image = null;
            if (string.IsNullOrEmpty(selectStu.StuImage))
            {
                //最后在StudentsExt多添加了一个属性
                selectStu.ImgPath = "/img1/bg/zwzp.jpg";
            }
            //如果有图片执行下面获取的图片
            else
            {
                //(获取数据库中图片的反序列化)用空的图片类来接收数据库中的这个图片(当点击要打印学生信息就可以获取selectStu.StuImage的数据)
                image = BinaryStuObjcet.FBinaryForStu(selectStu.StuImage) as common.BitmapImg;
                //实例化BitmapImage用来封装序列化和反序列化的转换路径的*记录方式*
                BitmapImage bitmap = new BitmapImage();
                bitmap.BeginInit();//用信号通知BitmapImage初始化开始
                //图像流:  对象的集合编码为图像流(new无法自己出来,所以自己输入)
                BitmapEncoder encoder = new PngBitmapEncoder();

                /*1.向图像流中添加
                 * 2.BitmapFrame图像数据属于静态类
                 * 3.创建这个BitmapImage路径并添加给图像流
                 * 4.就相当于给这个图像流输入照片路径
                 * 总结:encoder.Frames.Add相当于给图像流中添加图片的路径
                 */
                encoder.Frames.Add(BitmapFrame.Create(bitmap));//把图片从数据库拿到的图片路径拿到,并创建

                //获取事件
                long sc = DateTime.Now.Ticks;
                //using表示方式这个流被其他替代,在using里绝对不会被替代相当一个封闭环境
                using (MemoryStream stream = new MemoryStream())
                {
                    //**encoder里面获取到的内容给了stream流**:将位图图像编码为指定的流;把
                    encoder.Save(stream);
                    //用一个byte数组来装这个流
                    byte[] buffer = stream.ToArray();

                    /*1.file是一个静态类可以直接使用里面的方法
                     * 2.使用WriteAllBytes这个方法创建一个新文件在其中写入指定的字节数组,然后关闭改文件。如果目标问价以存在,则覆盖改文件
                     * 3.AppDomain应用程序中独立执行的环境
                     * 4.CurrentDomain获取当前程序域
                     * 5.BaseDirectory获取基目录
                     * 6.sc表示当前时间
                     * 7.printImg文件名、
                     * 8.buffer表示记录stream流中的所有内容
                     * 总结创建了一个图片文件
                     */
                    File.WriteAllBytes(AppDomain.CurrentDomain.BaseDirectory + "/printImg/" + sc + ".png", buffer); //???
                    stream.Close();                                                                                 //关闭流
                }
                //获取学生图片的路径
                selectStu.ImgPath = AppDomain.CurrentDomain.BaseDirectory + "/printImg/" + sc + ".png";
            }

            /*1.创建打印学生信息界面
             * 2.参数1(PrintModel.xaml:框架形式是流文档所以创建流文档写打印界面):表示对打印界面的设计
             * 3.参数2(selectStu):表示获取学生的所有数据
             */
            View.PrintWindow frmPrint = new PrintWindow("PrintModel.xaml", selectStu);
            //获取或设置一个值,该值指示窗口是否具有任务栏按钮
            frmPrint.ShowInTaskbar = false;
            //打开打印学生窗口窗口
            frmPrint.ShowDialog();
        }