Esempio n. 1
0
        /// <summary>
        /// Upgrades the driver.
        /// </summary>
        /// <param name="driver">The driver.</param>
        /// <param name="queueName">Name of the queue.</param>
        public void UpgradeDriver(PrintDeviceDriver driver, string queueName)
        {
            if (driver == null)
            {
                throw new ArgumentNullException("driver");
            }

            DateTime start = DateTime.Now;
            DateTime end   = DateTime.Now;

            InstallStatusData status = _installStatus.Create(queueName);

            lock (_driverLock)
            {
                UpdateStatus("Upgrading print driver... " + driver.Name);
                status.Record("DRIVER UPGRADE START", out start);

                // Upgrade the driver, but do not check to see if the driver is installed,
                // this has already been done.
                DriverInstaller.Upgrade(driver.CreateDetail(), queueName);

                status.Record("DRIVER UPGRADE END", out end);
                status.Record("DRIVER UPGRADE TOTAL", end.Subtract(start));
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Installs the designated driver.
        /// </summary>
        /// <param name="driver">The driver.</param>
        /// <param name="forceInstall">if set to <c>true</c> then an install is forced.</param>
        public void InstallDriver(PrintDeviceDriver driver, bool forceInstall = false)
        {
            if (driver == null)
            {
                throw new ArgumentNullException("driver");
            }

            DateTime start = DateTime.Now;
            DateTime end   = DateTime.Now;

            InstallStatusData status = _installStatus.Create(driver.Name);

            lock (_driverLock)
            {
                UpdateStatus("Installing print driver... " + driver.Name);
                status.Record("DRIVER INSTALL START", out start);
                DriverInstaller.Install(driver.CreateDetail(), forceInstall);
                status.Record("DRIVER INSTALL END", out end);
                _installedDrivers.Add(driver.Name);
                status.Record("DRIVER INSTALL TOTAL", end.Subtract(start));
            }
        }