/// <summary>
        /// Gathers informations for each CMInfo derived Class and puts them to a related Grid
        /// </summary>
        /// <param name="wqlHelper"></param>
        /// <returns></returns>
        private async Task GatherInformation(WQLHelper wqlHelper)
        {
            _logger.WriteLog("Loading Applicationinformation");
            List <CMApplication> apps = await CMInfoCollector.GetSMSObjectInformation <CMApplication>(wqlHelper, "SMS_Applicationlatest");

            GrdApplication.ItemsSource = apps;
            _logger.WriteLog("Applicationinformation successfully loaded");

            _logger.WriteLog("Loading Collectioninformation");
            List <CMCollection> colls = await CMInfoCollector.GetSMSObjectInformation <CMCollection>(wqlHelper, "SMS_Collection");

            GrdCollection.ItemsSource = colls;
            _logger.WriteLog("Collectioninformation successfully loaded");

            _logger.WriteLog("Loading Packageinformation");
            List <CMPackage> pkgs = await CMInfoCollector.GetSMSObjectInformation <CMPackage>(wqlHelper, "SMS_Package");

            GrdPackage.ItemsSource = pkgs;
            _logger.WriteLog("Packageinformation successfully loaded");


            _logger.WriteLog("Loading Softwareupdateinformation");
            List <CMSoftwareupdate> sus = await CMInfoCollector.GetSMSObjectInformation <CMSoftwareupdate>(wqlHelper, "SMS_Softwareupdate");

            GrdSoftwareupdate.ItemsSource = sus.Take(MAX_SOFTWAREUPDATECOUNT);
            _logger.WriteLog("Softwareupdateinformation successfully loaded");

            _logger.WriteLog("Loading Tasksequenceinformation");
            List <CMTasksequence> ts = await CMInfoCollector.GetSMSObjectInformation <CMTasksequence>(wqlHelper, "SMS_TaskSequencePackage");

            GrdTasksequence.ItemsSource = ts;
            _logger.WriteLog("Tasksequenceinformation successfully loaded");
        }
        /// <summary>
        /// Connects to the SMSProvider and gathers some informations regarding Applications, Collections, Softwareupdates,
        /// Drivers, Tasksequences , Packaages
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void BtnConnect_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(TxtSiteServer.Text))
            {
                _logger.WriteLog("Siteserver Textbox is empty. Please provide a valid Siteserver name");
                System.Windows.Forms.MessageBox.Show("Please enter a SiteServer Name!", "Information", MessageBoxButtons.OK);
            }
            else
            {
                var siteServer = TxtSiteServer.Text;
                _logger.WriteLog($"Siteserver={siteServer}");
                //Find SiteCode Information for given SiteServer
                string siteCode = await CMInfoCollector.GetSiteCodeAsync(siteServer);

                if (!String.IsNullOrEmpty(siteCode))
                {
                    txtblcSiteCode.Text = siteCode;
                    _logger.WriteLog($"SiteCode = {siteCode}");
                }
                else
                {
                    _logger.WriteLog($"SiteCode could not be found");
                    return;
                }

                WQLHelper helper = new WQLHelper(siteServer);
                await GatherInformation(helper);
            }
        }
        /// <summary>
        /// Connects to the SMSProvider and gathers some informations regarding Applications, Collections, Softwareupdates,
        /// Drivers, Tasksequences , Packages, Devices, Users
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private async void BtnConnect_Click(object sender, RoutedEventArgs e)
        {
            if (string.IsNullOrEmpty(TxtSiteServer.Text))
            {
                _logger.WriteLog("Siteserver Textbox is empty. Please provide a valid Siteserver name");
                System.Windows.Forms.MessageBox.Show("Please enter a SiteServer Name!", "Information", MessageBoxButtons.OK);
            }
            else
            {
                var siteServer = TxtSiteServer.Text;
                _logger.WriteLog($"Siteserver={siteServer}");
                //Find SiteCode Information for given SiteServer
                string siteCode = await CMInfoCollector.GetSiteCodeAsync(siteServer);

                if (!String.IsNullOrEmpty(siteCode))
                {
                    TxtblcSiteCode.Text = siteCode;
                    _logger.WriteLog($"SiteCode = {siteCode}");
                    _connectedSite = siteServer;
                    SetConnectButton("Connected", false);
                    _logger.WriteLog($"Connected as ({Environment.UserDomainName}\\{Environment.UserName})");
                    TabMenu.IsEnabled = true;
                }
                else
                {
                    _logger.WriteLog($"SiteCode could not be found");
                    TabMenu.IsEnabled = false;
                    _connectedSite    = siteServer;
                    return;
                }
                using (WQLHelper helper = new WQLHelper(siteServer))
                {
                    await GatherInformation(helper);
                }
            }
        }
        /// <summary>
        /// Gathers informations for each CMInfo derived Class and puts them to a related Grid
        /// </summary>
        /// <param name="wqlHelper"></param>
        /// <returns></returns>
        private async Task GatherInformation(WQLHelper wqlHelper)
        {
            _logger.WriteLog("===== Start loading Informations =====");
            _logger.WriteLog("Loading Applicationinformation");
            List <CMApplication> apps = await CMInfoCollector.GetSMSObjectInformation <CMApplication>(wqlHelper, "SMS_Applicationlatest");

            GrdApplication.ItemsSource = apps.ToArray();
            _logger.WriteLog("Applicationinformation successfully loaded");

            _logger.WriteLog("Loading Deviceinformation");
            List <CMDevice> devices = await CMInfoCollector.GetSMSObjectInformation <CMDevice>(wqlHelper, "SMS_CombinedDeviceResources");

            GrdDevices.ItemsSource = devices.ToArray();
            _logger.WriteLog("Deviceinformation successfully loaded");

            _logger.WriteLog("Loading Userinformation");
            List <CMUser> user = await CMInfoCollector.GetSMSObjectInformation <CMUser>(wqlHelper, "SMS_CombinedUserResources");

            GrdUser.ItemsSource = user.ToArray();
            _logger.WriteLog("Userinformation successfully loaded");

            _logger.WriteLog("Loading Collectioninformation");
            List <CMCollection> colls = await CMInfoCollector.GetSMSObjectInformation <CMCollection>(wqlHelper, "SMS_Collection");

            GrdCollection.ItemsSource = colls.ToArray();
            _logger.WriteLog("Collectioninformation successfully loaded");

            _logger.WriteLog("Loading Packageinformation");
            List <CMPackage> pkgs = await CMInfoCollector.GetSMSObjectInformation <CMPackage>(wqlHelper, "SMS_Package");

            GrdPackage.ItemsSource = pkgs.ToArray();
            _logger.WriteLog("Packageinformation successfully loaded");

            _logger.WriteLog("Loading Softwareupdateinformation");
            List <CMSoftwareupdate> sus = await CMInfoCollector.GetSMSObjectInformation <CMSoftwareupdate>(wqlHelper, "SMS_Softwareupdate");

            GrdSoftwareupdate.ItemsSource = sus.Take(MAX_SOFTWAREUPDATECOUNT)
                                            .ToArray();
            _logger.WriteLog("Softwareupdateinformation successfully loaded");

            _logger.WriteLog("Loading SoftwareupdateGroupinformation");
            List <CMSoftwareupdateGroup> sugs = await CMInfoCollector.GetSMSObjectInformation <CMSoftwareupdateGroup>(wqlHelper, "SMS_AuthorizationList");

            GrdSoftwareupdateGroup.ItemsSource = sugs.ToArray();
            _logger.WriteLog("Softwareupdateinformation successfully loaded");

            _logger.WriteLog("Loading Tasksequenceinformation");
            List <CMTasksequence> ts = await CMInfoCollector.GetSMSObjectInformation <CMTasksequence>(wqlHelper, "SMS_TaskSequencePackage");

            GrdTasksequence.ItemsSource = ts.ToArray();
            _logger.WriteLog("Tasksequenceinformation successfully loaded");

            _logger.WriteLog("Loading Deploymenttypeinformation");
            List <CMDeploymenttype> dt = await CMInfoCollector.GetSMSObjectInformation <CMDeploymenttype>(wqlHelper, "SMS_Deploymenttype");

            GrdDeploymenttype.ItemsSource = dt.Where(d => d.IsLatest == "True")
                                            .ToArray();
            _logger.WriteLog("Deploymenttypeinformation successfully loaded");

            _logger.WriteLog("Loading Bootimageinformation");
            List <CMBootimage> bi = await CMInfoCollector.GetSMSObjectInformation <CMBootimage>(wqlHelper, "SMS_BootimagePackage");

            GrdBootimage.ItemsSource = bi.ToArray();
            _logger.WriteLog("Bootimageinformation successfully loaded");

            _logger.WriteLog("Loading Operatingsystemimageinformation");
            List <CMOSImage> oi = await CMInfoCollector.GetSMSObjectInformation <CMOSImage>(wqlHelper, "SMS_ImagePackage");

            GrdOSImage.ItemsSource = oi.ToArray();
            _logger.WriteLog("Operatingsystemimageinformation successfully loaded");

            _logger.WriteLog("===== Finished Informationloading =====");
        }