Example #1
0
        /// <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);
            }
        }
Example #2
0
        /// <summary>
        /// Constructor = this will populate the InstalledOSList
        /// </summary>
        public InstalledOSList()
        {
            // Now build the list of Operationg Systems
            ApplicationsDAO lwDataAccess = new ApplicationsDAO();
            DataTable       osTable      = lwDataAccess.GetOperatingSystems();

            // Iterate through the returned data
            foreach (DataRow row in osTable.Rows)
            {
                try
                {
                    InstalledOS theOS = new InstalledOS(row);
                    this.Add(theOS);

                    // Read instances of this OS
                    theOS.LoadData();
                }

                catch (Exception)
                {
                    // Just skip the OS as this points to an internal database consistency error
                }
            }
        }