예제 #1
0
        private MultiJobControlViewModel SetSelectedFullOverlays(MultiJobControlViewModel viewModel)
        {
            if (viewModel.IsFrontSideFullOverlay)
            {
                if (viewModel.FrontSideGraphicFilenames.ContainsKey(PrintType.Overlay))
                {
                    viewModel.FrontSideGraphicFilenames.Remove(PrintType.Overlay);
                }

                viewModel.FrontSideGraphicFilenames.Add(PrintType.Overlay, null);
            }
            else if (viewModel.FrontSideGraphicFilenames.ContainsKey(PrintType.Overlay) && viewModel.FrontSideGraphicFilenames[PrintType.Overlay] == null)
            {
                viewModel.FrontSideGraphicFilenames.Remove(PrintType.Overlay);
            }

            if (viewModel.IsBackSideFullOverlay)
            {
                if (viewModel.BackSideGraphicFilenames.ContainsKey(PrintType.Overlay))
                {
                    viewModel.BackSideGraphicFilenames.Remove(PrintType.Overlay);
                }

                viewModel.BackSideGraphicFilenames.Add(PrintType.Overlay, null);
            }
            else if (viewModel.BackSideGraphicFilenames.ContainsKey(PrintType.Overlay) && viewModel.BackSideGraphicFilenames[PrintType.Overlay] == null)
            {
                viewModel.BackSideGraphicFilenames.Remove(PrintType.Overlay);
            }
            return(viewModel);
        }
예제 #2
0
        private int PrintAndMagEncode(ZebraCardPrinter zebraCardPrinter, MultiJobControlViewModel jobViewModel)
        {
            using (ZebraGraphics graphics = new ZebraCardGraphics(zebraCardPrinter)) {
                List <GraphicsInfo> graphicsInfoList = new List <GraphicsInfo>();

                if (jobViewModel.HasValidFrontSide)
                {
                    foreach (GraphicsInfo graphicsInfo in CreateGraphicsInfo(graphics, jobViewModel.FrontSideGraphicFilenames, CardSide.Front))
                    {
                        graphicsInfoList.Add(graphicsInfo);
                    }
                }

                if (jobViewModel.HasValidBackSide)
                {
                    foreach (GraphicsInfo graphicsInfo in CreateGraphicsInfo(graphics, jobViewModel.BackSideGraphicFilenames, CardSide.Back))
                    {
                        graphicsInfoList.Add(graphicsInfo);
                    }
                }

                int jobId;
                if (jobViewModel.HasValidMagEncodeJob)
                {
                    jobId = zebraCardPrinter.PrintAndMagEncode(jobViewModel.SelectedQuantity, graphicsInfoList, jobViewModel.Track1Data, jobViewModel.Track2Data, jobViewModel.Track3Data);
                }
                else
                {
                    jobId = zebraCardPrinter.Print(jobViewModel.SelectedQuantity, graphicsInfoList);
                }
                return(jobId);
            }
        }
예제 #3
0
        private bool IsJobValid(MultiJobControlViewModel jobViewModel)
        {
            // Check if print optimization mode is set if print optimization is available on the printer
            bool hasValidPrintOptimization = viewModel.IsPrintOptimizationAvailable ? jobViewModel.SelectedPrintOptimization != null : true;

            return(jobViewModel.SelectedSource != null &&
                   jobViewModel.SelectedDestination != null &&
                   hasValidPrintOptimization &&
                   jobViewModel.SelectedQuantity > 0 &&
                   jobViewModel.HasValidJob);
        }
예제 #4
0
        private void SetUpAndSendJob(ZebraCardPrinter zebraCardPrinter, MultiJobControlViewModel jobViewModel)
        {
            SetJobSettings(zebraCardPrinter, jobViewModel);

            int?jobId = null;

            if (jobViewModel.HasValidFrontSide || jobViewModel.HasValidBackSide)
            {
                jobId = PrintAndMagEncode(zebraCardPrinter, jobViewModel);
            }
            else if (jobViewModel.HasValidMagEncodeJob)
            {
                jobId = MagEncode(zebraCardPrinter, jobViewModel);
            }

            if (jobId.HasValue)
            {
                jobViewModel.JobId = jobId.Value;
            }
        }
예제 #5
0
        private void SetJobSettings(ZebraCardPrinter zebraCardPrinter, MultiJobControlViewModel jobViewModel)
        {
            zebraCardPrinter.SetJobSetting(ZebraCardJobSettingNames.CARD_SOURCE, jobViewModel.SelectedSource.ToString());
            zebraCardPrinter.SetJobSetting(ZebraCardJobSettingNames.CARD_DESTINATION, jobViewModel.SelectedDestination.ToString());

            if (viewModel.IsPrintOptimizationAvailable)
            {
                zebraCardPrinter.SetJobSetting(ZebraCardJobSettingNames.PRINT_OPTIMIZATION, jobViewModel.SelectedPrintOptimization.ToString());
            }

            if (viewModel.HasMagneticEncoder)
            {
                zebraCardPrinter.SetJobSetting(ZebraCardJobSettingNames.MAG_ENCODING_TYPE, MagEncodingType.ISO.ToString());

                if (jobViewModel.MagneticEncode)
                {
                    zebraCardPrinter.SetJobSetting(ZebraCardJobSettingNames.MAG_COERCIVITY, jobViewModel.SelectedCoercivityType);
                }
            }
        }
예제 #6
0
 private int MagEncode(ZebraCardPrinter zebraCardPrinter, MultiJobControlViewModel jobViewModel)
 {
     return(zebraCardPrinter.MagEncode(jobViewModel.SelectedQuantity, jobViewModel.Track1Data, jobViewModel.Track2Data, jobViewModel.Track3Data));
 }