private void definePhysicalQueues_Button_Click(object sender, EventArgs e)
        {
            if (!_control.ValidatePackageLoaded())
            {
                return;
            }

            Cursor.Current = Cursors.WaitCursor;
            using (AssetSelectionForm printerSelectionForm = new AssetSelectionForm(AssetAttributes.Printer, true))
            {
                Cursor.Current = Cursors.Default;
                printerSelectionForm.ShowDialog(this);
                if (printerSelectionForm.DialogResult == DialogResult.OK)
                {
                    _selectedDevices.Clear();
                    foreach (string printerId in printerSelectionForm.SelectedAssets.Select(n => n.AssetId))
                    {
                        _selectedDevices.Add(printerId);
                    }
                    int queueCount = int.Parse(queueCount_TextBox.Text, CultureInfo.InvariantCulture);
                    //_manager.ConstructQueueDefinitions(printerSelectionForm.SelectedPrinterIds, queueCount);

                    pendingPhysicalQueues_TextBox.Text = "Queue definitions pending: {0}".FormatWith(_selectedDevices.Count * queueCount);
                    pendingPhysicalQueues_TextBox.Update();
                }
            }
        }
Example #2
0
        private void ok_Button_Click(object sender, EventArgs e)
        {
            DialogResult = System.Windows.Forms.DialogResult.OK;

            if (_control.ValidatePackageLoaded())
            {
                Close();
            }
        }
        private void upgrade_Button_Click(object sender, EventArgs e)
        {
            EnableControls(false);

            Cursor.Current = Cursors.WaitCursor;
            if (_control.ValidatePackageLoaded())
            {
                var driverName   = installedDrivers_ComboBox.SelectedData["Name"];
                var architecture = EnumUtil.Parse <ProcessorArchitecture>(installedDrivers_ComboBox.SelectedData["Architecture"]);

                if (architecture.ToDriverArchitecture() != _control.QueueManager.CurrentDriver.Architecture)
                {
                    MessageBox.Show
                    (
                        "Upgrading a {0} driver with a {1} driver is not allowed."
                        .FormatWith(architecture, _control.QueueManager.CurrentDriver.Architecture),
                        "Driver Architecture Mismatch",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Exclamation
                    );

                    EnableControls(true);
                    return;
                }

                if (driverName.Equals(_control.QueueManager.CurrentDriver.Name, StringComparison.OrdinalIgnoreCase))
                {
                    MessageBox.Show
                    (
                        "Because the driver model is the same, all queues using this driver will be updated automatically by the spooler, "
                        + "so there will be no queue specific data available.",
                        "Upgrading all Queues",
                        MessageBoxButtons.OK,
                        MessageBoxIcon.Information
                    );
                }

                try
                {
                    _manager_StatusChange(this, new StatusEventArgs(string.Empty, StatusEventType.Reset));
                    _upgradeManager.Upgrade(_targetQueues, _control.QueueManager.CurrentDriver);
                }
                catch (Exception ex)
                {
                    _upgradeManager.AbortUpgrade();
                    MessageBox.Show(ex.Message, "Failed to upgrade", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    EnableControls(true);
                }
            }
            else
            {
                EnableControls(true);
            }
            Cursor.Current = Cursors.Default;
        }