Exemple #1
0
        /// <summary>
        /// Prompt user for items to be deployed to the device.
        /// </summary>
        /// <param name="targetDevice"></param>
        private async Task ChooseDeployments(Device targetDevice)
        {
            using (var newDialog = new Dialog(parentForm))
            {
                newDialog.Text     = "Select Installs";
                newDialog.AutoSize = false;
                newDialog.Height   = 500;
                newDialog.Width    = 260;

                var selectListBox = new CheckedListBox();
                selectListBox.CheckOnClick  = true;
                selectListBox.Size          = new System.Drawing.Size(300, 250);
                selectListBox.DisplayMember = nameof(TaskInfo.TaskName);

                var depList = await GetModules();

                foreach (var d in depList)
                {
                    selectListBox.Items.Add(d, false);
                }
                // Add deployment selection list.
                newDialog.AddCustomControl("TaskList", "Select items to install:", selectListBox);

                // Add a 'Select None' button with lamba action.
                var selectNone = newDialog.AddButton("selectNoneButton", "Select None", () =>
                {
                    for (int i = 0; i < selectListBox.Items.Count; i++)
                    {
                        selectListBox.SetItemChecked(i, false);
                    }
                });
                selectNone.Width = 200;

                // Add a 'Select All' button with lamba action.
                var selectAll = newDialog.AddButton("selectAllButton", "Select All", () =>
                {
                    for (int i = 0; i < selectListBox.Items.Count; i++)
                    {
                        selectListBox.SetItemChecked(i, true);
                    }
                });
                selectAll.Width = 200;

                newDialog.ShowDialog();
                if (newDialog.DialogResult == DialogResult.OK)
                {
                    foreach (TaskInfo task in selectListBox.CheckedItems)
                    {
                        deployments.Enqueue(task);
                    }
                }
            }
        }
        private string SelectConfigFile()
        {
            var configFiles = GetConfigFiles();

            var fileCombo = new ComboBox();

            fileCombo.Name       = "fileCombo";
            fileCombo.DataSource = configFiles;
            fileCombo.Width      = 250;

            using (var selectDialog = new Dialog(deploy.ParentForm))
            {
                selectDialog.Text = "Choose Install Configuration File";
                selectDialog.AddCustomControl("fileCombo", "Config Files:", fileCombo);
                selectDialog.ShowDialog();
                if (selectDialog.DialogResult == DialogResult.OK)
                {
                    return(fileCombo.SelectedValue.ToString());
                }
            }
            return(string.Empty);
        }
Exemple #3
0
        /// <summary>
        /// Prompts user for a new form label/title text, sets the form text, and refreshes window lists.
        /// </summary>
        private void ReLabelGridForm()
        {
            using (var renameDialog = new Dialog(this))
                using (var nameTextBox = new TextBox())
                {
                    nameTextBox.Visible = true;
                    nameTextBox.Width   = 100;

                    renameDialog.Text = "Grid Form Label";
                    renameDialog.AddCustomControl("nameTextBox", "Enter New Label:", nameTextBox);
                    renameDialog.ShowDialog();

                    if (renameDialog.DialogResult == DialogResult.OK)
                    {
                        var newName = nameTextBox.Text.Trim();
                        if (!string.IsNullOrEmpty(newName))
                        {
                            this.Text = titlePrefix + newName;
                            this.RefreshData();
                        }
                    }
                }
        }
        private AcroFields TransferFormFields(Device device, PdfStamper pdfStamper)
        {
            AcroFields tmpFields = pdfStamper.AcroFields;

            using (var newDialog = new Dialog(parentForm))
            {
                newDialog.Text = "Additional Input Required";

                ComboBox cmbFrom = new ComboBox();
                cmbFrom.FillComboBox(Attributes.DeviceAttributes.Locations);
                newDialog.AddCustomControl("cmbFromLoc", "Transfer FROM:", (Control)cmbFrom);

                ComboBox cmbTo = new ComboBox();
                cmbTo.FillComboBox(Attributes.DeviceAttributes.Locations);
                newDialog.AddCustomControl("cmbToLoc", "Transfer TO:", (Control)cmbTo);

                newDialog.AddLabel("Reason For Transfer-Check One:", true);
                newDialog.AddCheckBox("chkBetterU", "Better Use of asset:");
                newDialog.AddCheckBox("chkTradeIn", "Trade-in or exchange:");
                newDialog.AddCheckBox("chkExcess", "Excess assets:");
                newDialog.AddCheckBox("chkOther", "Other:");
                newDialog.AddRichTextBox("rtbOther", "If Other, Please explain:");
                newDialog.ShowDialog();
                if (newDialog.DialogResult != DialogResult.OK)
                {
                    return(null);
                }

                string fromLocationCode   = cmbFrom.SelectedValue.ToString();
                string fromLocDescription = cmbFrom.Text;
                string toLocationCode     = cmbTo.SelectedValue.ToString();
                string toLocDescription   = cmbTo.Text;

                tmpFields.SetField("topmostSubform[0].Page1[0].AssetTag_number[0]", device.AssetTag);
                tmpFields.SetField("topmostSubform[0].Page1[0].Serial_number[0]", device.Serial);
                tmpFields.SetField("topmostSubform[0].Page1[0].Description_of_asset[0]", device.Description);
                tmpFields.SetField("topmostSubform[0].Page1[0].Department[0]", AttributeFunctions.DepartmentOf(fromLocationCode));
                tmpFields.SetField("topmostSubform[0].Page1[0].Location[0]", fromLocDescription);
                tmpFields.SetField("topmostSubform[0].Page1[0].Department_2[0]", AttributeFunctions.DepartmentOf(toLocationCode));
                tmpFields.SetField("topmostSubform[0].Page1[0].Location_2[0]", toLocDescription);
                tmpFields.SetField("topmostSubform[0].Page1[0].Better_utilization_of_assets[0]", CheckValueToString(System.Convert.ToBoolean(newDialog.GetControlValue("chkBetterU"))));
                tmpFields.SetField("topmostSubform[0].Page1[0].Trade-in_or_exchange_with_Other_Departments[0]", CheckValueToString(System.Convert.ToBoolean(newDialog.GetControlValue("chkTradeIn"))));
                tmpFields.SetField("topmostSubform[0].Page1[0].Excess_assets[0]", CheckValueToString(System.Convert.ToBoolean(newDialog.GetControlValue("chkExcess"))));
                tmpFields.SetField("topmostSubform[0].Page1[0].undefined[0]", CheckValueToString(System.Convert.ToBoolean(newDialog.GetControlValue("chkOther"))));
                tmpFields.SetField("topmostSubform[0].Page1[0].Other__Please_explain_1[0]", newDialog.GetControlValue("rtbOther").ToString());
                //key
                //topmostSubform[0].Page1[0].AssetTag_number[0]
                //topmostSubform[0].Page1[0].Serial_number[0]
                //topmostSubform[0].Page1[0].Description_of_asset[0]
                //topmostSubform[0].Page1[0].Department[0]
                //topmostSubform[0].Page1[0].Location[0]
                //topmostSubform[0].Page1[0].Department_2[0]
                //topmostSubform[0].Page1[0].Location_2[0]
                //topmostSubform[0].Page1[0].Better_utilization_of_assets[0]
                //topmostSubform[0].Page1[0].Trade-in_or_exchange_with_Other_Departments[0]
                //topmostSubform[0].Page1[0].Excess_assets[0]
                //topmostSubform[0].Page1[0].undefined[0]
                //topmostSubform[0].Page1[0].Other__Please_explain_1[0]
                //topmostSubform[0].Page1[0].Other__Please_explain_2[0]
                //topmostSubform[0].Page1[0].Method_of_Delivery_or_Shipping_Please_Check_One[0]
                //topmostSubform[0].Page1[0].Hand-carried_by[0]
                //topmostSubform[0].Page1[0].undefined_2[0]
                //topmostSubform[0].Page1[0].Carrier_company[0]
                //topmostSubform[0].Page1[0].US_Mail[0]
                //topmostSubform[0].Page1[0].Shipping_receipt_number[0]
                //topmostSubform[0].Page1[0].Date_of_shipment_or_transfer[0]
                //topmostSubform[0].Page1[0].Signature_of_SENDING_official[0]
                //topmostSubform[0].Page1[0].Department_3[0]
                //topmostSubform[0].Page1[0].Date[0]
                //topmostSubform[0].Page1[0].Signature_of_RECEIVING_official[0]
                //topmostSubform[0].Page1[0].Department_4[0]
                //topmostSubform[0].Page1[0].Date_2[0]
                //topmostSubform[0].Page1[0].PrintButton1[0]
            }

            return(tmpFields);
        }