コード例 #1
0
        public void Initialize(PluginConfigurationData configuration, PluginEnvironment environment)
        {
            _activityData      = configuration.GetMetadata <ePrintAdminActivityData>();
            _selectedAssetList = ConfigurationServices.AssetInventory.GetAssets(configuration.Assets.SelectedAssets);
            if (_selectedAssetList != null && _selectedAssetList.Any())
            {
                deviceId_TextBox.Text = _selectedAssetList.First().AssetId;
            }
            _selectedServer = configuration.Servers.SelectedServers.FirstOrDefault();
            ePrintServer_ComboBox.Initialize(_selectedServer, "ePrint");

            adminUser_textBox.Text     = _activityData.ePrintAdminUser;
            adminPassword_textBox.Text = _activityData.ePrintAdminPassword;

            tasks_dataGridView.DataSource = _activityData.ePrintAdminTasks;
        }
コード例 #2
0
        private void quickEntry_ToolStripButton_Click(object sender, EventArgs e)
        {
            bool changeMade = false;

            var currentAssetIds = _assetRows.Select(n => n.AssetId);

            using (AssetQuickEntryForm form = new AssetQuickEntryForm(currentAssetIds))
            {
                if (form.ShowDialog(this) == DialogResult.OK)
                {
                    // Determine which assets were added and which were removed
                    List <string> addedAssetIds   = form.EnteredAssetIds.Where(n => !currentAssetIds.Contains(n)).ToList();
                    List <string> removedAssetIds = currentAssetIds.Where(n => !form.EnteredAssetIds.Contains(n)).ToList();
                    changeMade = addedAssetIds.Any() || removedAssetIds.Any();

                    // Retrieve asset information for all added assets that meet the attribute requirements
                    AssetInfoCollection assetsWithAttribute = ConfigurationServices.AssetInventory.GetAssets(_assetAttributes);
                    AssetInfoCollection filteredAssets      = ApplySelectionFilter(assetsWithAttribute);
                    AssetInfoCollection requestedAssets     = ConfigurationServices.AssetInventory.GetAssets(addedAssetIds);
                    var allowedAssets = requestedAssets.Where(n => filteredAssets.Any(m => m.AssetId == n.AssetId));

                    // Add new assets and remove old ones
                    allowedAssets.ToList().ForEach(n => _assetRows.Add(new AssetSelectionRow(n)));
                    _assetRows.Where(n => removedAssetIds.Contains(n.AssetId)).ToList().ForEach(n => _assetRows.Remove(n));

                    // Show a dialog box if there are any that could not be added
                    var notAdded = addedAssetIds.Where(n => !_assetRows.Any(m => m.AssetId == n));
                    if (notAdded.Any())
                    {
                        MessageBox.Show($"The following asset(s) could not be added, either because they were not found " +
                                        $"or do not have the capabilities required for this activity:{Environment.NewLine}" +
                                        string.Join(Environment.NewLine, notAdded),
                                        "Devices Not Added", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }

            asset_GridView.Refresh();
            if (changeMade)
            {
                OnSelectionChanged();
                OnDisplayedAssetsChanged();
            }
        }
コード例 #3
0
        private void ePrintAdminConfigurationControl_Load(object sender, EventArgs e)
        {
            if (_selectedServer == Guid.Empty)
            {
                ePrintServer_ComboBox.Initialize("ePrint");
            }
            else
            {
                ePrintServer_ComboBox.Initialize(_selectedServer, "ePrint");
            }

            if (_selectedAssetList != null && _selectedAssetList.Any())
            {
                deviceId_TextBox.Text = _selectedAssetList.First().AssetId;
            }

            hpacServer_ComboBox.Initialize("HPAC");
            ePrintServer_ComboBox.SelectionChanged += ePrintserverselectionchanged;
            hpacServer_ComboBox.SelectionChanged   += HPACServerselectionchanged;
        }
コード例 #4
0
 /// <summary>
 /// Called when there is a change in the displayed assets in this control.
 /// Can be overridden by inheriting classes to customize behavior.
 /// </summary>
 /// <param name="displayedAssets">The displayed assets.</param>
 protected override void OnDisplayedAssetsChanged(AssetInfoCollection displayedAssets)
 {
     // Only display the simulator configuration options if at least one simulator is selected.
     simulatorConfiguration_LinkLabel.Visible = displayedAssets.Any(n => n is DeviceSimulatorInfo);
 }