예제 #1
0
        public void Setup()
        {
            _printerHelper      = Substitute.For <IPrinterHelper>();
            _uacAssistant       = Substitute.For <IUacAssistant>();
            _interactionRequest = Substitute.For <IInteractionRequest>();

            PrinterActionsAssistant = new PrinterActionsAssistant(_printerHelper, _uacAssistant, new DesignTimeTranslationUpdater(), _interactionRequest);
            ;
        }
예제 #2
0
        private string AddPrinterAction()
        {
            var helper = new PrinterActionsAssistant();

            string printerName;

            helper.AddPrinter(out printerName);

            return(printerName);
        }
예제 #3
0
        private void DeletePrinterAction(PrinterMappingWrapper printerMapping)
        {
            var helper  = new PrinterActionsAssistant();
            var success = helper.DeletePrinter(printerMapping.PrinterName, ViewModel.PdfCreatorPrinters.Count);

            if (success)
            {
                ViewModel.PrinterMappings.Remove(printerMapping);
                ViewModel.PdfCreatorPrinters    = _printerHelper.GetPDFCreatorPrinters();
                PrimaryPrinterBox.SelectedValue = ViewModel.PrimaryPrinter;
            }
        }
예제 #4
0
        private void RenamePrinterAction(PrinterMappingWrapper printerMapping)
        {
            var    helper            = new PrinterActionsAssistant();
            var    wasPrimaryPrinter = printerMapping.IsPrimaryPrinter;
            string newPrinterName;
            var    success = helper.RenamePrinter(printerMapping.PrinterName, out newPrinterName);

            if (success)
            {
                ViewModel.PdfCreatorPrinters = _printerHelper.GetPDFCreatorPrinters();
                printerMapping.PrinterName   = newPrinterName;
                if (wasPrimaryPrinter)
                {
                    ViewModel.PrimaryPrinter = newPrinterName;
                }
            }
        }