public MainWindow()
        {
            InitializeComponent();
            ProgressSpinner.IsActive = true;

            ThemeManager.AddAccent("CustomAccentUMN", new Uri("pack://application:,,,/UMN-SCCMApplicationCategorization;component/Styles/CustomAccentUMN.xaml"));

            SmsProvider smsProvider = new SmsProvider();

            if (smsProvider.TestConnection(Properties.Settings.Default.CMSiteServer))
            {
                cmAppCategories = cmHandler.GetCMApplicationCategories(true);

                var categories = new ObservableCollection <string>(cmAppCategories.Select(c => c.LocalizedCategoryInstanceName).OrderBy(c => c).ToList());

                CategoriesListBox.DataContext = categories;
            }
            else
            {
                MessageBox.Show("Issue connecting to site server: " + Properties.Settings.Default.CMSiteServer + Environment.NewLine + "Go to File->Settings to update site server address.");
            }

            if (Properties.Settings.Default.DarkTheme)
            {
                ThemeManager.ChangeAppStyle(this, ThemeManager.GetAccent("CustomAccentUMN"), ThemeManager.GetAppTheme("BaseDark"));
                DarkThemeSlider.IsChecked = true;
            }
            else
            {
                ThemeManager.ChangeAppStyle(this, ThemeManager.GetAccent("CustomAccentUMN"), ThemeManager.GetAppTheme("BaseLight"));
                DarkThemeSlider.IsChecked = false;
            }

            ProgressSpinner.IsActive = false;
        }
Ejemplo n.º 2
0
        public CategoryChooser()
        {
            InitializeComponent();

            cmAppCategories = cmHandler.GetCMApplicationCategories(false);

            var categories = new ObservableCollection <string>(cmAppCategories.Select(c => c.LocalizedCategoryInstanceName).OrderBy(c => c).ToList());

            CategoriesListBox.DataContext = categories;
        }
        private void SettingsFlyout_ClosingFinished(object sender, RoutedEventArgs e)
        {
            ProgressSpinner.IsActive = true;

            Properties.Settings.Default.CMSiteServer = CMSiteServerTextBox.Text;
            Properties.Settings.Default.Save();

            cmHandler       = new CMHandler(Properties.Settings.Default.CMSiteServer);
            cmAppCategories = cmHandler.GetCMApplicationCategories(true);

            var categories = new ObservableCollection <string>(cmAppCategories.Select(c => c.LocalizedCategoryInstanceName).OrderBy(c => c).ToList());

            CategoriesListBox.DataContext = categories;

            ProgressSpinner.IsActive = false;
        }
        private void MenuFileChangeSiteServer_Click(object sender, RoutedEventArgs e)
        {
            ProgressSpinner.IsActive = true;
            Settings settings = new Settings();

            settings.ShowDialog();

            Properties.Settings.Default.Save();

            cmHandler       = new CMHandler(Properties.Settings.Default.CMSiteServer);
            cmAppCategories = cmHandler.GetCMApplicationCategories(true);

            var categories = new ObservableCollection <string>(cmAppCategories.Select(c => c.LocalizedCategoryInstanceName).OrderBy(c => c).ToList());

            CategoriesListBox.DataContext = categories;
            ProgressSpinner.IsActive      = false;
        }