public void ShowMultiplePublishers(List <InstalledApplication> installedApplications) { // Get the work item controller ApplicationsWorkItemController wiController = _tabView.WorkItem.Controller as ApplicationsWorkItemController; // ...and from there settings which alter what we display in this view bool showIncluded = wiController.ShowIncludedApplications; bool showIgnored = wiController.ShowIgnoredApplications; // Initialize the tab view now that we know what we are displaying InitializeTabView(); // set the header _tabView.HeaderText = "Multiple Selection"; _tabView.HeaderImage = Properties.Resources.application_publisher_72; // JML TODO - when we ignore/include multiple apps we end up here // each application needs to be refreshed so that the correct ignore flag is displayed... foreach (InstalledApplication app in installedApplications) { // Read instances/licenses of this application app.LoadData(); // ...and add to the tab view _tabView.AddApplication(app); } _installedApplications = installedApplications; }
/// <summary> /// This is the tool click handler for the Applications>Licensing ribbon group /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void licensing_ToolClick(object sender, ToolClickEventArgs e) { ApplicationsWorkItemController controller = workItem.Controller as ApplicationsWorkItemController; switch (e.Tool.SharedProps.Caption) { case ToolNames.SetIgnored: controller.SetIgnored(); break; case ToolNames.SetIncluded: controller.SetIncluded(); break; case ToolNames.NewLicense: controller.NewLicense(); break; case ToolNames.EditLicense: controller.EditLicense(); break; case ToolNames.DeleteLicense: controller.DeleteLicense(); break; default: break; } }
protected void DeleteLicense() { // Sanity check ensure only row selected if (licensesGridView.Selected.Rows.Count == 0) { return; } foreach (UltraGridRow selectedRow in this.licensesGridView.Selected.Rows) { //...and get the license object //UltraGridRow selectedRow = this.licensesGridView.Selected.Rows[0]; ApplicationLicense theLicense = selectedRow.Cells[0].Value as ApplicationLicense; // Get our controller ApplicationsWorkItemController wiController = WorkItem.Controller as ApplicationsWorkItemController; // ...and request it to delete the currently selected license wiController.DeleteLicense(theLicense); } // refresh the tab view ApplicationsWorkItem appWorkItem = WorkItem as ApplicationsWorkItem; appWorkItem.ExplorerView.RefreshView(); appWorkItem.GetActiveTabView().RefreshView(); }
/// <summary> /// Called to create a new license for this application /// </summary> protected void NewLicense() { // Get our controller ApplicationsWorkItemController wiController = WorkItem.Controller as ApplicationsWorkItemController; wiController.NewLicense(); }
/// <summary> /// Initialize the 'All Publishers' node of the applications tree /// </summary> private void InitializeAllPublishers() { Infragistics.Win.Appearance ignoredAppearance = new Infragistics.Win.Appearance(); ignoredAppearance.ForeColor = System.Drawing.Color.Gray; // Add the publishers to the tree try { ApplicationsWorkItemController wiController = explorerView.WorkItem.Controller as ApplicationsWorkItemController; bool showIncluded = wiController.ShowIncludedApplications; bool showIgnored = wiController.ShowIgnoredApplications; ApplicationsDAO lApplicationsDAO = new ApplicationsDAO(); DataTable dt = lApplicationsDAO.GetAllPublisherNamesAsDataTable(wiController.PublisherFilter, showIncluded, showIgnored); UltraTreeNode[] publisherNodes = new UltraTreeNode[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { string lPublisher = dt.Rows[i][0].ToString(); UltraTreeNode publisherNode = new UltraTreeNode(lPublisher, lPublisher); publisherNode.Tag = "PUBLISHER"; publisherNode.Override.ShowExpansionIndicator = ShowExpansionIndicator.CheckOnExpand; publisherNodes[i] = publisherNode; } explorerView.AllPublishersNode.Nodes.AddRange(publisherNodes); } catch (Exception ex) { logger.Error(ex.Message); } }
/// <summary> /// Called to show the list of Operating Systems (or details of a specific one) /// </summary> /// <param name="forPublisher"></param> public void ShowOS(InstalledOS forOS) { // Get the work item controller ApplicationsWorkItemController wiController = _tabView.WorkItem.Controller as ApplicationsWorkItemController; // ...and from there settings which alter what we display in this view bool showHidden = wiController.ShowIgnoredApplications; // Are we displaying all OS's or a specific one as we need to save this state _isAllOSDisplayed = (forOS == null); // clear the existing view _tabView.Clear(); // Set the header text and image for the tab view based on whether we are displaying // all (possibly filtered) publishers or a sepcific publisher _tabView.HeaderText = (forOS == null) ? MiscStrings.OperatingSystems : forOS.Name; _tabView.HeaderImage = Properties.Resources.os_96; // If we have not been supplied a specific OS to display then flag that we are not displaying // an OS at this time but save the supplied OS regardless if (_isAllOSDisplayed) { // Displaying all Operating Systems // Call database function to return list of Operating Systems ApplicationsDAO lwDataAccess = new ApplicationsDAO(); DataTable OSTable = lwDataAccess.GetOperatingSystems(); // ...and add these to the tab view foreach (DataRow row in OSTable.Rows) { InstalledOS thisOS = new InstalledOS(row); // Read instances/licenses of this OS thisOS.LoadData(); if (thisOS.Instances.Count == 0) { continue; } // ...and add to the tab view _tabView.AddOS(thisOS); } } else { // Displaying a specific OS _currentOS = forOS; _tabView.AddOS(_currentOS); } }
private void setIncludedToolStripMenuItem_Click(object sender, EventArgs e) { // Create a list of the selected applications List <InstalledApplication> listApplications = GetSelectedApplications(); ApplicationsWorkItemController wiController = WorkItem.Controller as ApplicationsWorkItemController; if (wiController != null) { wiController.SetIncluded(listApplications); } WorkItem.ExplorerView.RefreshView(); }
/// <summary> /// Alias Publishers /// </summary> public void AliasPublishers() { ApplicationsWorkItemController wiController = workItem.Controller as ApplicationsWorkItemController; FormAliasPublishers form = new FormAliasPublishers(); form.ShowIgnored = wiController.ShowIgnoredApplications; form.ShowIncluded = wiController.ShowIncludedApplications; form.PublisherFilter = wiController.PublisherFilter; form.ShowDialog(); workItem.GetActiveTabView().RefreshView(); WorkItem.ExplorerView.RefreshView(); }
public void ExpandApplications(UltraTreeNode node) { Infragistics.Win.Appearance ignoredAppearance = new Infragistics.Win.Appearance(); ignoredAppearance.ForeColor = System.Drawing.Color.Gray; ApplicationsWorkItemController wiController = explorerView.WorkItem.Controller as ApplicationsWorkItemController; bool showIncluded = wiController.ShowIncludedApplications; bool showIgnored = wiController.ShowIgnoredApplications; InstalledApplication theApplication; string publisher; string key; publisher = node.FullPath.Substring(20); UltraTreeNode applicationNode; DataTable dt = new ApplicationsDAO().GetApplicationsByPublisher(publisher, showIncluded, showIgnored); UltraTreeNode[] applicationNodes = new UltraTreeNode[dt.Rows.Count]; for (int j = 0; j < dt.Rows.Count; j++) { theApplication = new InstalledApplication(dt.Rows[j]); key = publisher + "|" + theApplication.Name + "|" + theApplication.ApplicationID; if (theApplication.Version == String.Empty || theApplication.Name.EndsWith(theApplication.Version)) { applicationNode = new UltraTreeNode(key, theApplication.Name); } else { applicationNode = new UltraTreeNode(key, theApplication.Name + " (" + theApplication.Version + ")"); } applicationNode.Tag = theApplication; applicationNode.Override.ShowExpansionIndicator = ShowExpansionIndicator.CheckOnExpand; if (theApplication.IsIgnored) { applicationNode.Override.NodeAppearance = ignoredAppearance; } applicationNodes[j] = applicationNode; } node.Nodes.AddRange(applicationNodes); }
/// <summary> /// This is the tool click handler for the Applications>Aliasing ribbon group /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void aliasing_ToolClick(object sender, ToolClickEventArgs e) { ApplicationsWorkItemController controller = workItem.Controller as ApplicationsWorkItemController; switch (e.Tool.SharedProps.Caption) { case ToolNames.AliasApplications: controller.AliasApplications(); break; case ToolNames.AliasPublishers: controller.AliasPublishers(); break; default: break; } }
/// <summary> /// Called to edit the currently selected license (if any) /// </summary> protected void EditLicense() { // Sanity check ensure only row selected if (licensesGridView.Selected.Rows.Count != 1) { return; } //...and get the license object UltraGridRow selectedRow = this.licensesGridView.Selected.Rows[0]; ApplicationLicense theLicense = selectedRow.Cells[0].Value as ApplicationLicense; // Get our controller ApplicationsWorkItemController wiController = WorkItem.Controller as ApplicationsWorkItemController; // ...and request it to edit the currently selected license wiController.EditLicense(theLicense); }
/// <summary> /// This is the tool click handler for the Filters ribbon group /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void filter_ToolClick(object sender, ToolClickEventArgs e) { Cursor.Current = Cursors.WaitCursor; StateButtonTool sbt = null; ApplicationsWorkItemController controller = workItem.Controller as ApplicationsWorkItemController; switch (e.Tool.SharedProps.Caption) { case CommonToolNames.ViewIncluded: sbt = e.Tool as StateButtonTool; controller.ShowIncludedApplications = sbt.Checked; // Ensure that at least one option is selected StateButtonTool sbtShowIgnored = filtersRibbonGroup.Tools["applications" + CommonToolNames.ViewIgnored] as StateButtonTool; if (!sbt.Checked && !sbtShowIgnored.Checked) { sbtShowIgnored.Checked = true; } break; case CommonToolNames.ViewIgnored: sbt = e.Tool as StateButtonTool; controller.ShowIgnoredApplications = sbt.Checked; // Ensure that at least one option is selected StateButtonTool sbtShowIncluded = filtersRibbonGroup.Tools["applications" + CommonToolNames.ViewIncluded] as StateButtonTool; if (!sbt.Checked && !sbtShowIncluded.Checked) { sbtShowIncluded.Checked = true; } break; case CommonToolNames.FilterPublishers: controller.FilterPublishers(); break; default: break; } Cursor.Current = Cursors.Default; }
/// <summary> /// This is the tool click handler for the Applications>Export ribbon group /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void export_ToolClick(object sender, ToolClickEventArgs e) { ApplicationsWorkItemController controller = workItem.Controller as ApplicationsWorkItemController; switch (e.Tool.SharedProps.Caption) { case CommonToolNames.ExportPDF: controller.ExportToPDF(); break; case CommonToolNames.ExportXLS: controller.ExportToXLS(); break; case CommonToolNames.ExportXPS: controller.ExportToXPS(); break; default: break; } }
/// <summary> /// Called to show the list of Actions /// </summary> public void ShowAlerts() { // Get the work item controller ApplicationsWorkItemController wiController = _tabView.WorkItem.Controller as ApplicationsWorkItemController; // clear the existing view _tabView.Clear(); // Call database function to return list of Alerts DateTime dtYearAgo = DateTime.Now.AddYears(-1); AlertsDAO lwDataAccess = new AlertsDAO(); DataTable alertsTable = lwDataAccess.EnumerateAlerts(dtYearAgo); // ...and add these to the tab view foreach (DataRow row in alertsTable.Rows) { Alert alert = new Alert(row); // ...and add to the tab view _tabView.AddAlert(alert); } }
/// <summary> /// Called to show the list of applications for a specific publisher /// </summary> /// <param name="forPublisher"></param> public void ShowPublisher(string forPublisher) { // JML_LINDE if (forPublisher == null) { return; } try { _tabView.SuspendLayout(); DataRow[] dataRows; // Get the work item controller ApplicationsWorkItemController wiController = _tabView.WorkItem.Controller as ApplicationsWorkItemController; // ...and from there settings which alter what we display in this view bool showIncluded = wiController.ShowIncludedApplications; bool showIgnored = wiController.ShowIgnoredApplications; string publisherFilter = wiController.PublisherFilter; // If we have not been supplied a publisher to display then flag that we are not displaying // a publisher at this time, regardless save the supplied publisher if (forPublisher == null) { _isPublisherDisplayed = false; // OK there is no explicit publisher but is there a general publisher filter that we // will need to supply to reduce the number of Publishers reported? if (wiController.PublisherFilter != "") { publisherFilter = wiController.PublisherFilter; } } else { _isPublisherDisplayed = true; _currentPublisher = forPublisher; publisherFilter = forPublisher; } // Initialize the tab view now that we know what we are displaying InitializeTabView(); // Call database function to return list of applications (for the specified publisher) ApplicationsDAO lwDataAccess = new ApplicationsDAO(); DataTable applicationsTable = lwDataAccess.GetApplications(forPublisher, showIncluded, showIgnored); // Set the header text and image for the tab view based on whether we are displaying // all (possibly filtered) publishers or a sepcific publisher _tabView.HeaderText = (forPublisher == null) ? MiscStrings.AllPublishers : forPublisher; _tabView.HeaderImage = Properties.Resources.application_publisher_72; DataTable applicationInstancesTable = new ApplicationInstanceDAO().GetApplicationInstances(forPublisher); DataTable applicationLicensesTable = new LicensesDAO().GetApplicationLicenses(); // get a list of aliased applications - will save processing time later List <int> aliasedToApplicationsList = new List <int>(); foreach (DataRow dataRow in lwDataAccess.GetAliasedToApplications().Rows) { aliasedToApplicationsList.Add(Convert.ToInt32(dataRow[0])); } // ...the create InstalledApplication objects for each returned and add to the view foreach (DataRow row in applicationsTable.Rows) { InstalledApplication thisApplication = new InstalledApplication(row); // Read instances/licenses of this application dataRows = applicationInstancesTable.Select("_APPLICATIONID = " + thisApplication.ApplicationID); thisApplication.LoadInstances1(dataRows); dataRows = applicationLicensesTable.Select("_APPLICATIONID = " + thisApplication.ApplicationID); thisApplication.LoadLicenses1(dataRows); // find any applications which are aliased to this application as we also need their licenses if (aliasedToApplicationsList.Contains(thisApplication.ApplicationID)) { foreach (DataRow dataRow in lwDataAccess.GetAliasedApplicationsByApplicationId(thisApplication.ApplicationID).Rows) { dataRows = applicationLicensesTable.Select("_APPLICATIONID = " + dataRow[0]); thisApplication.LoadLicenses1(dataRows); } } // ...and add to the tab view _tabView.AddApplication(thisApplication); } } catch (Exception ex) { logger.Error("Error in ShowPublisher()", ex); } finally { _tabView.ResumeLayout(); } }
public void ShowPublisher(int aCompliantType) { try { // Get the work item controller ApplicationsWorkItemController wiController = _tabView.WorkItem.Controller as ApplicationsWorkItemController; // ...and from there settings which alter what we display in this view bool showIncluded = wiController.ShowIncludedApplications; bool showIgnored = wiController.ShowIgnoredApplications; string publisherFilter = wiController.PublisherFilter; _isPublisherDisplayed = false; _currentPublisher = null; // Initialize the tab view now that we know what we are displaying InitializeTabView(); // Call database function to return list of applications (for the specified publisher) ApplicationsDAO lwDataAccess = new ApplicationsDAO(); DataTable applicationsTable = lwDataAccess.GetApplications(publisherFilter, showIncluded, showIgnored); // Set the header text and image for the tab view based on whether we are displaying // all (possibly filtered) publishers or a sepcific publisher _tabView.HeaderText = "Generating report data, please wait..."; _tabView.HeaderImage = Properties.Resources.application_publisher_72; _tabView.Refresh(); DataTable applicationInstancesTable = new ApplicationInstanceDAO().GetApplicationInstances(); DataTable applicationLicensesTable = new LicensesDAO().GetApplicationLicenses(); // get a list of aliased applications - will save processing time later List <int> aliasedToApplicationsList = new List <int>(); foreach (DataRow dataRow in lwDataAccess.GetAliasedToApplications().Rows) { aliasedToApplicationsList.Add(Convert.ToInt32(dataRow[0])); } // ...the create InstalledApplication objects for each returned and add to the view foreach (DataRow row in applicationsTable.Rows) { InstalledApplication thisApplication = new InstalledApplication(row); // Read instances/licenses of this application DataRow[] dataRows = applicationInstancesTable.Select("_APPLICATIONID = " + thisApplication.ApplicationID); thisApplication.LoadInstances1(dataRows); dataRows = applicationLicensesTable.Select("_APPLICATIONID = " + thisApplication.ApplicationID); thisApplication.LoadLicenses1(dataRows); // find any applications which are aliased to this application as we also need their licenses if (aliasedToApplicationsList.Contains(thisApplication.ApplicationID)) { foreach (DataRow dataRow in lwDataAccess.GetAliasedApplicationsByApplicationId(thisApplication.ApplicationID).Rows) { dataRows = applicationLicensesTable.Select("_APPLICATIONID = " + dataRow[0]); thisApplication.LoadLicenses1(dataRows); } } //thisApplication.LoadData(); if (CheckApplicationState(aCompliantType, thisApplication)) { // ...and add to the tab view _tabView.AddApplication(thisApplication); } } switch (aCompliantType) { case 1: _tabView.HeaderText = "Compliant Applications"; break; case 2: _tabView.HeaderText = "Non-compliant Applications"; break; default: _tabView.HeaderText = "All Applications"; break; } } catch (Exception ex) { logger.Error("Error in ShowPublisher()", ex); } }