Ejemplo n.º 1
0
        private async void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            RegistryCommon.Instance.MainProgressBar.Text = StatusBarState.Loading;

            _allResources = await _resourceService.GetAllResources();

            foreach (var res in _allResources)
            {
                ResourcesListBox.Items.Add(new ResourceItem(res, _allResources));
            }

            ResourcesListBox.SelectionChanged += ResourcesListBoxOnSelectionChanged;

            _allGroups = await _resourceGroupService.GetAllResourceGroups();

            GroupsListBox.ItemsSource = _allGroups.Select(g => g.Name).ToArray();

            GetAllCategoriesResult[] allCategories = await _categoryService.GetAllCategories();

            var baseItem    = allCategories.Single(item => item.ParentId == null);
            var newTreeItem = new TreeViewItem
            {
                Header     = baseItem.Name,
                Uid        = baseItem.Id.ToString(),
                IsExpanded = true
            };

            CategoriesTree.Items.Add(newTreeItem);
            FillCategories(CategoriesTree.Items[0] as TreeViewItem, baseItem, allCategories);

            RegistryCommon.Instance.MainProgressBar.Text = StatusBarState.Ready;
        }
Ejemplo n.º 2
0
        private async void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            RegistryCommon.Instance.MainProgressBar.Text = StatusBarState.Loading;

            GetAllCategoriesResult[] result = await _categoryService.GetAllCategories();

            var baseItem    = result.Single(item => item.ParentId == null);
            var newTreeItem = new TreeViewItem
            {
                Header     = baseItem.Name,
                Uid        = baseItem.Id.ToString(),
                IsExpanded = true
            };

            CategoriesTree.Items.Add(newTreeItem);
            FillCategories(CategoriesTree.Items[0] as TreeViewItem, baseItem, result);

            _allGroups = await _resourceGroupService.GetAllResourceGroups();

            for (int i = 0; i < _allGroups.Length; i++)
            {
                GroupsListBox.Items.Add(new CheckBox
                {
                    Content = _allGroups[i].Name,
                    Uid     = _allGroups[i].Id.ToString()
                });
            }

            RegistryCommon.Instance.MainProgressBar.Text = StatusBarState.Ready;
        }
Ejemplo n.º 3
0
        private async void UserControl_Loaded(object sender, RoutedEventArgs e)
        {
            RegistryCommon.Instance.MainProgressBar.Text = StatusBarState.Loading;

            _allGroups = await _resourceGroupService.GetAllResourceGroups();

            GroupsListBox.ItemsSource = _allGroups;

            RegistryCommon.Instance.MainProgressBar.Text = StatusBarState.Ready;
        }
Ejemplo n.º 4
0
        private async void UpdateResource_OnLoaded(object sender, RoutedEventArgs e)
        {
            RegistryCommon.Instance.MainProgressBar.Text = StatusBarState.Loading;

            GetAllCategoriesResult[] result = await _categoryService.GetAllCategories();

            var baseItem        = result.Single(item => item.ParentId == null);
            var resourceDetails = await _resourceService.GetResourceDetails(_selectedResource.Id);

            var newTreeItem = new TreeViewItem
            {
                Header     = baseItem.Name,
                Uid        = baseItem.Id.ToString(),
                IsExpanded = true,
                IsSelected = resourceDetails.Category == baseItem.Id
            };

            CategoriesTree.Items.Add(newTreeItem);
            FillCategories(CategoriesTree.Items[0] as TreeViewItem, baseItem, result, resourceDetails.Category);

            _allGroups = await _resourceGroupService.GetAllResourceGroups();

            for (int i = 0; i < _allGroups.Length; i++)
            {
                GroupsListBox.Items.Add(new CheckBox
                {
                    Content   = _allGroups[i].Name,
                    Uid       = _allGroups[i].Id.ToString(),
                    IsChecked = resourceDetails.ResourceGroups.Contains(_allGroups[i].Id)
                });
            }

            ResourceDescription.Text = _selectedResource.Description;
            ResourceTitle.Text       = _selectedResource.Name;
            ResourceTags.Text        = string.Join(", ", resourceDetails.Tags);

            RegistryCommon.Instance.MainProgressBar.Text = StatusBarState.Ready;
        }