/* ----------------------------------------------------------------- */ /// /// Invoke /// /// <summary> /// Invokes the specified action. /// </summary> /// /* ----------------------------------------------------------------- */ private void Invoke(Action <SpoolerService> action) { var service = new SpoolerService { Timeout = Timeout }; service.Reset(); try { action(service); } finally { service.Start(); } }
/* ----------------------------------------------------------------- */ /// /// Uninstall /// /// <summary> /// Uninstalls all of the specified devices. /// </summary> /// /* ----------------------------------------------------------------- */ private void Uninstall(DeviceConfig src, SpoolerService service) { var cp = new DeviceConfig { PortMonitors = src.PortMonitors.ToList(), Ports = src.Ports.ToList(), PrinterDrivers = src.PrinterDrivers.ToList(), Printers = src.Printers.ToList(), }; if (Recursive) { ResolveDependencies(cp); } var monitors = cp.PortMonitors.Convert().ToList(); var ports = cp.Ports.Convert().ToList(); var drivers = cp.PrinterDrivers.Convert().ToList(); var printers = cp.Printers.Convert().ToList(); Uninstall(printers, drivers, ports); service.Reset(); Uninstall(monitors); }