Exemplo n.º 1
0
        private void bt_AppReload_Click(object sender, RoutedEventArgs e)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                if (!CMAgent.isConnected)
                {
                    CMAgent.connect();
                }

                lApplications = CMAgent.Client.AppV4.Appv4ApplicationsList(true, new TimeSpan(0, 0, 60));

                AppGrid1.BeginInit();
                AppGrid1.ItemsSource = lApplications;
                AppGrid1.EndInit();
            }
            catch { }

            Mouse.OverrideCursor = Cursors.Arrow;
        }
Exemplo n.º 2
0
        private void bt_Click(object sender, RoutedEventArgs e)
        {
            Mouse.OverrideCursor = Cursors.Wait;
            try
            {
                if (sender.GetType() == typeof(RibbonButton))
                {
                    RibbonButton BT = (RibbonButton)sender;
                    foreach (TabItem ti in tabNavigationPanels.Items)
                    {
                        if (ti.Header.ToString() == BT.Label.ToString())
                        {
                            ti.IsSelected = true;
                            if (ti.Header.ToString() == "Applications")
                            {
                                if (!CMAgent.isConnected)
                                {
                                    CMAgent.connect();
                                }

                                if (lApplications.Count == 0)
                                {
                                    lApplications = CMAgent.Client.AppV4.Appv4Applications;
                                }

                                AppGrid1.BeginInit();
                                AppGrid1.ItemsSource = lApplications;
                                AppGrid1.EndInit();
                            }

                            if (ti.Header.ToString() == "Packages")
                            {
                                if (!CMAgent.isConnected)
                                {
                                    CMAgent.connect();
                                }

                                if (lPackages.Count == 0)
                                {
                                    lPackages = CMAgent.Client.AppV4.Appv4Packages;
                                }

                                PkgGrid1.BeginInit();
                                PkgGrid1.ItemsSource = lPackages;
                                PkgGrid1.EndInit();
                            }

                            if (ti.Header.ToString() == "Cache")
                            {
                                if (!CMAgent.isConnected)
                                {
                                    CMAgent.connect();
                                }

                                try
                                {
                                    if (CMAgent.Client.Inventory.isx64OS)
                                    {
                                        tbCacheSize.Text = CMAgent.Client.GetStringFromPS(@"(get-item hklm:\SOFTWARE\Wow6432Node\Microsoft\SoftGrid\4.5\Client\AppFS).GetValue('FileSize')");
                                        tbDrive.Text     = CMAgent.Client.GetStringFromPS(@"(get-item hklm:\SOFTWARE\Wow6432Node\Microsoft\SoftGrid\4.5\Client\AppFS).GetValue('DriveLetter')");
                                    }
                                    else
                                    {
                                        tbCacheSize.Text = CMAgent.Client.GetStringFromPS(@"(get-item hklm:\SOFTWARE\Microsoft\SoftGrid\4.5\Client\AppFS).GetValue('FileSize')");
                                        tbDrive.Text     = CMAgent.Client.GetStringFromPS(@"(get-item hklm:\SOFTWARE\Microsoft\SoftGrid\4.5\Client\AppFS).GetValue('DriveLetter')");
                                    }
                                }
                                catch { }
                            }
                        }
                    }
                }
            }
            catch { }
            Mouse.OverrideCursor = Cursors.Arrow;
        }