コード例 #1
0
        /// <summary>
        /// Called as each row in the grid is initialized - we use this to set the appearance of the row
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void applicationsGridView_InitializeRow(object sender, InitializeRowEventArgs e)
        {
            // Get the application object being displayed
            UltraGridRow         thisRow         = e.Row;
            UltraGridCell        objectCell      = thisRow.Cells[0];
            InstalledApplication thisApplication = objectCell.Value as InstalledApplication;

            // Set the appearance and icon based on the compliancy status
            if (thisApplication.IsIgnored)
            {
                thisRow.Appearance = _ignoredAppearance;
            }
            else if (thisApplication.Licenses.Count == 0)
            {
                thisRow.Appearance = _notSpecifiedAppearance;
            }
            else if (thisApplication.IsCompliant())
            {
                thisRow.Appearance = _compliantAppearance;
            }
            else
            {
                thisRow.Appearance = _noncompliantAppearance;
            }

            // Set the 'application' image to either be a NotIgnore or non-NotIgnore application
            //UltraGridCell applicationCell = thisRow.Cells["Application Name"];
            //if (thisApplication.IsIgnored)
            //    applicationCell.Appearance.Image = Properties.Resources.application_hidden_16;
            //else
            //    applicationCell.Appearance.Image = Properties.Resources.application_16;
        }
コード例 #2
0
        private bool CheckApplicationState(int aCompliantType, InstalledApplication thisApplication)
        {
            switch (aCompliantType)
            {
            case 0:
                return(true);

            case 1:
                return(thisApplication.IsCompliant() && !thisApplication.IsIgnored);

            default:
                if (!thisApplication.IsCompliant())
                {
                    return(!thisApplication.IsIgnored && thisApplication.Licenses.Count > 0);
                }
                break;
            }

            return(false);
        }
コード例 #3
0
        /// <summary>
        /// Add a new application to the data set to be displayed
        /// </summary>
        /// <param name="thisComputer"></param>
        public void AddApplication(InstalledApplication thisApplication)
        {
            // Ensure that fields which may noit have a value have something to display
            string publisher   = (thisApplication.Publisher == "") ? "-" : thisApplication.Publisher;
            string isCompliant = (thisApplication.IsCompliant()) ? "Compliant" : "Non-Compliant";

            // Licenses count
            string licenses;
            string variance;
            int    installs;

            thisApplication.GetLicenseStatistics(out installs, out licenses, out variance);

            if (licenses == "None Specified")
            {
                isCompliant = licenses;
            }

            if (thisApplication.IsIgnored)
            {
                isCompliant = "Ignored";
            }

            // Add the row to the data set
            applicationsDataSet.Tables[0].Rows.Add(new object[]
                                                   { thisApplication,
                                                     publisher,
                                                     thisApplication.Name,
                                                     licenses,
                                                     installs,
                                                     variance,
                                                     isCompliant,
                                                     thisApplication.Version });

            //applicationsDataSet.Tables[0].Rows.Add(new object[]
            //    { thisApplication.ApplicationID
            //    , publisher
            //    , thisApplication.Name
            //    , licenses
            //    , installs
            //    , variance
            //    , isCompliant
            //    , thisApplication.Version});
        }