/// <summary>
        /// Creates and returns a <see cref="PluginConfigurationData" /> instance containing the
        /// configuration data from this control.
        /// </summary>
        /// <returns>The configuration data.</returns>
        public PluginConfigurationData GetConfiguration()
        {
            ContentionData data = new ContentionData()
            {
                SelectedControlPanelActivities = GetControlPanelData(),
                SelectedContentionActivities   = GetContentionActivityData()
            };

            LocalPrintQueueInfo     queue = null;
            PrintQueueSelectionData localQueueSelectionData = null;

            if (data.SelectedContentionActivities.OfType <PrintActivityData>().Any())
            {
                PrintActivityData printData = data.SelectedContentionActivities.OfType <PrintActivityData>().Single();
                queue = string.IsNullOrEmpty(printData.QueueName) ? null : new LocalPrintQueueInfo(printData.QueueName);
                localQueueSelectionData = (queue == null) ? null : new PrintQueueSelectionData(queue);
            }

            return(new PluginConfigurationData(data, Version)
            {
                Assets = assetSelectionControl.AssetSelectionData,
                Documents = documentSelectionControl.DocumentSelectionData,
                PrintQueues = localQueueSelectionData
            });
        }
Exemple #2
0
 private void EditLocalQueue(LocalPrintQueueRow row, LocalPrintQueueInfo localQueue)
 {
     using (ExistingQueueForm form = new ExistingQueueForm(localQueue))
     {
         if (form.ShowDialog(this) == DialogResult.OK)
         {
             _printQueueRows.Remove(row);
             _printQueues.Remove(localQueue);
             _printQueues.Add(form.PrintQueue);
             _printQueueRows.Add(new LocalPrintQueueRow(form.PrintQueue));
         }
     }
 }
        private void edit_ToolStripButton_Click(object sender, EventArgs e)
        {
            var selectedRow = printQueue_GridView.SelectedRows.FirstOrDefault();

            if (selectedRow != null)
            {
                LocalPrintQueueRow row = selectedRow.DataBoundItem as LocalPrintQueueRow;
                if (row != null)
                {
                    LocalPrintQueueInfo localQueue = row.PrintQueueInfo as LocalPrintQueueInfo;
                    if (localQueue != null)
                    {
                        EditLocalQueue(row, localQueue);
                    }
                }
            }
        }
Exemple #4
0
 private void ok_Button_Click(object sender, EventArgs e)
 {
     if (string.IsNullOrEmpty(localQueue_comboBox.Text))
     {
         MessageBox.Show("A queue name must be specified.", "Validation Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     else
     {
         if (string.IsNullOrEmpty(assetId_TextBox.Text))
         {
             PrintQueue = new LocalPrintQueueInfo(localQueue_comboBox.Text);
         }
         else
         {
             PrintQueue = new LocalPrintQueueInfo(localQueue_comboBox.Text, assetId_TextBox.Text);
         }
         DialogResult = DialogResult.OK;
     }
 }
        /// <summary>
        /// Creates and returns a <see cref="PluginConfigurationData" /> instance containing the
        /// configuration data from this control.
        /// </summary>
        /// <returns>The configuration data.</returns>
        public PluginConfigurationData GetConfiguration()
        {
            _activityData.LockTimeouts = lockTimeoutControl.Value;
            _activityData.DeviceMemoryProfilerConfig = deviceMemoryProfilerControl.SelectedData;
            _activityData.HPRoamAuthentication       = radioButton_RoamApp.Checked;
            _activityData.AuthProvider          = (AuthenticationProvider)comboBox_AuthProvider.SelectedValue;
            _activityData.DocumentProcessAction = GetPullPrintAction();
            _activityData.DelayBeforePullPrint  = (int)numericUpDown_PullPrintDelay.Value;

            _activityData.ShuffleDocuments       = shuffle_CheckBox.Checked;
            _activityData.PhoneDocumentPush      = radioButton_PullPrintPhone.Checked;
            _activityData.PhoneDocument          = textBox_PhoneDocument.Text;
            _activityData.RoamDocumentSendAction = GetDocumentSendAction();

            AssetSelectionData assetSelectionData = assetSelectionControl.AssetSelectionData;

            if (radioButton_PullPrintPhone.Checked)
            {
                assetSelectionData.SelectedAssets.Add(_mobileAsset.AssetId);
                _activityData.MobileEquipmentId = _mobileAsset.MobileEquipmentId;
            }
            _activityData.AndroidDocumentAction = GetAndroidDocAction();

            LocalPrintQueueInfo info = new LocalPrintQueueInfo("HP Roam");

            _printQueues.Add(info);
            _activityData.DelayAfterPrint            = GetDelayAfterPrint();
            _activityData.UsePrintServerNotification = printServerNotificationcheckBox.Checked;

            int count = documentSelectionControl.DocumentSelectionData.SelectedDocuments.Count();

            return(new PluginConfigurationData(_activityData, Version)
            {
                Assets = assetSelectionData,
                Documents = documentSelectionControl.DocumentSelectionData,
                PrintQueues = new PrintQueueSelectionData(_printQueues)
            });
        }
Exemple #6
0
 public ExistingQueueForm(LocalPrintQueueInfo printQueue)
     : this()
 {
     localQueue_comboBox.Text = printQueue.QueueName;
     assetId_TextBox.Text     = printQueue.AssociatedAssetId;
 }
Exemple #7
0
        private static PrintQueue GetCitrixPrintQueue(PrintQueueInfo printQueueInfo)
        {
            // Special handling for Citrix session queues - they are connections to a remote server,
            // but don't show up when querying the local server for a list of queues.
            // Connect to the queue directly by parsing the queue name
            LocalPrintQueueInfo localPrintQueueInfo = printQueueInfo as LocalPrintQueueInfo;

            if (localPrintQueueInfo != null)
            {
                LogDebug("Attempting to parse Citrix session queue.");
                var match = Regex.Match(localPrintQueueInfo.QueueName, @"^\\\\([\S\s]+)\\([\S\s]+)$");
                if (match.Success)
                {
                    LogDebug("Parse success.");
                    var serverName = match.Groups[1];
                    var queueName  = match.Groups[2];

                    LogDebug($"Server Name: {serverName}");
                    LogDebug($"Queue Name: {queueName}");

                    PrintServer server = new PrintServer($@"\\{serverName}");
                    return(new PrintQueue(server, localPrintQueueInfo.QueueName));
                }
                else
                {
                    LogDebug("Parse failure.");
                }
            }

            // When Citrix auto-generates a print queue on the Citrix server, it creates a queue with the
            // same name as the local print queue on the client machine, but appends some session information
            // to the end.  To find the real name of the print queue on the Citrix server, we need to
            // find a print queue installed on the system that starts with the same text generated by the base class.
            LogDebug($"Looking for {printQueueInfo.QueueName}");

            List <string> queueNames = PrintQueueController.GetPrintQueues().Select(n => n.FullName).ToList();
            string        clientName = Environment.GetEnvironmentVariable("CLIENTNAME");

            RemotePrintQueueInfo remotePrintQueueInfo = printQueueInfo as RemotePrintQueueInfo;

            if (remotePrintQueueInfo != null)
            {
                string citrixQueueName = queueNames.FirstOrDefault(
                    n => n.StartsWith(remotePrintQueueInfo.QueueName, StringComparison.OrdinalIgnoreCase) &&
                    n.Contains(remotePrintQueueInfo.ServerHostName, StringComparison.OrdinalIgnoreCase) &&
                    n.Contains(clientName, StringComparison.OrdinalIgnoreCase));

                if (citrixQueueName != null)
                {
                    LogDebug($"Found Citrix queue {citrixQueueName}");
                    return(PrintQueueController.GetPrintQueue(citrixQueueName));
                }
                else
                {
                    LogDebug($"Did not find mapped queue.  Looking for directly attached queue.");
                    return(PrintQueueController.GetPrintQueue(remotePrintQueueInfo.GetPrinterName()));
                }
            }

            DynamicLocalPrintQueueInfo dynamicPrintQueueInfo = printQueueInfo as DynamicLocalPrintQueueInfo;

            if (dynamicPrintQueueInfo != null)
            {
                string citrixQueueName = queueNames.FirstOrDefault(
                    n => n.StartsWith(dynamicPrintQueueInfo.QueueName, StringComparison.OrdinalIgnoreCase) &&
                    n.Contains(clientName, StringComparison.OrdinalIgnoreCase));
                if (citrixQueueName != null)
                {
                    LogDebug($"Found Citrix queue {citrixQueueName}");
                    return(PrintQueueController.GetPrintQueue(citrixQueueName));
                }
                else
                {
                    throw new PrintQueueNotFoundException($"Could not find mapped queue for {dynamicPrintQueueInfo.QueueName}");
                }
            }

            // Default to the usual behavior
            return(PrintQueueController.Connect(printQueueInfo));
        }
Exemple #8
0
 public LocalPrintQueueRow(LocalPrintQueueInfo queue)
     : this((PrintQueueInfo)queue)
 {
     QueueName = queue.QueueName;
     QueueType = "Existing";
 }