protected void QueryAndAddMissingPrinters(List <string> missingPrinters)
        {
            var text = Translation.AskAddMissingPrinters + "\n\n" + string.Join("\n", missingPrinters);

            var interaction = new MessageInteraction(text, Translation.MissingPrinters, MessageOptions.YesNo, MessageIcon.Question);

            InteractionInvoker.Invoke(interaction);

            if (interaction.Response == MessageResponse.Yes)
            {
                _uacAssistant.AddPrinters(missingPrinters.ToArray());
            }
        }
Ejemplo n.º 2
0
        public override Task <ExitCode> Run()
        {
            try
            {
                var missingPrinters = FindMissingPrinters(GetMappingsFromRegistry());
                _uacAssistant.AddPrinters(missingPrinters.ToArray());
            }
            catch (Exception)
            {
                return(Task.FromResult(ExitCode.Unknown));
            }

            return(Task.FromResult(ExitCode.Ok));
        }
Ejemplo n.º 3
0
        public override Task <ExitCode> Run()
        {
            try
            {
                var allMissingPrinters = new List <string>();
                allMissingPrinters.AddRange(FindMissingPrinters(_sharedSettingsLoader.GetSharedPrinterMappings()));

                var missingPrinters = FindMissingPrinters(GetMappingsFromRegistry());
                allMissingPrinters.AddRange(missingPrinters.Except(allMissingPrinters));
                _uacAssistant.AddPrinters(allMissingPrinters.ToArray());
            }
            catch (Exception)
            {
                return(Task.FromResult(ExitCode.Unknown));
            }

            return(Task.FromResult(ExitCode.Ok));
        }