public void RefreshTree() { TypesSource.Clear(); InstancesSource.Clear(); List <Workflow_Activity_Instance> instances = null; Manager.UI.RunAsync(delegate() { try { var processes = ARM_Service.WWF_Get_Processes(isAlarms); types = processes.Key; instances = processes.Value; } catch (Exception) { Manager.UI.ShowMessage("Не удалось получить список процессов!"); } }, delegate() { if (types != null) { TypesSource.AddRange(types); } if (instances != null) { InstancesSource.AddRange(instances); } }); }
private void RefreshDisplayedData(bool full) { IEdition editionSelected = EditionSelected; if (full) { foreach (CardCollectionInputGraphicViewModel c in _cards) { c.PropertyChanged -= ItemChanged; } _cards.Clear(); } if (editionSelected == null) { return; } List <CardCollectionInputGraphicViewModel> toSort = new List <CardCollectionInputGraphicViewModel>(); if (full) { foreach (ICardAllDbInfo cardInfo in _allCardInfos.Where(cadi => cadi.Edition == editionSelected)) { CardCollectionInputGraphicViewModel newCard = new CardCollectionInputGraphicViewModel(new CardViewModel(cardInfo)); newCard.PropertyChanged += ItemChanged; toSort.Add(newCard); } } else { toSort.AddRange(_cards); _cards.Clear(); } foreach (CardCollectionInputGraphicViewModel ccigvm in toSort) { CardViewModel card = ccigvm.Card; _allCardTranslation.TryGetValue(card.Card, out string name); int count = 0; foreach (ICardInCollectionCount cardInCollectionCount in _magicDatabase.GetCollectionStatisticsForCard(CardCollection, card.Card) .Where(cicc => cicc.IdLanguage == InputLanguage.Id && _magicDatabase.GetEdition(cicc.IdGatherer).Id == editionSelected.Id)) { if (AltArt) { count += Foil ? cardInCollectionCount.FoilAltArtNumber : cardInCollectionCount.AltArtNumber; } else { count += Foil ? cardInCollectionCount.FoilNumber : cardInCollectionCount.Number; } } ccigvm.SetInfo(name, count); } toSort.Sort(CardCollectionInputGraphicViewModel.GetComparer(DisplayOrder)); _cards.AddRange(toSort); }
public void RemoveAllWidgets() { foreach (IWidgetPropertyData item in _widgtes) { INotifyPropertyChanged vm = item as INotifyPropertyChanged; vm.PropertyChanged -= WdgPropertyChangedHandler; } _widgtes.Clear(); }
public void SetJobs(List <Job> jobs) { _jobs.Clear(); List <Job> j1 = jobs.Where(p => p.Name.StartsWith("Baby ")).ToList(); List <Job> j2 = jobs.Where(p => !p.Name.StartsWith("Baby ")).ToList(); _jobs.AddRange(j2); _jobs.AddRange(j1); }
public NumberSetNumbersViewModel() { List <NumberSetNumber> data = new List <NumberSetNumber>(); if (_numberSet != null) { _numbrTumblrBusiness.GetNumberSetNumbersByNumberSetId(_numberSet.NumberSetID); } _numberSetNumbers.Clear(); _numberSetNumbers.AddRange(data); }
public ShuffleNumbersViewModel() { List <ShuffleNumber> data = new List <ShuffleNumber>(); if (_shuffle != null) { _numbrTumblrBusiness.GetShuffleNumbersByShuffleId(_shuffle.ShuffleID); } _shuffleNumbers.Clear(); _shuffleNumbers.AddRange(data); }
private async void ReloadReviews() { var cancellationTokenSource = _reviewsCancellationTokenSource = new CancellationTokenSource(); try { var result = await ApiClient.GetCriticReviews(_itemId, cancellationTokenSource.Token); _listItems.Clear(); _listItems.AddRange(result.Items.Where(i => !string.IsNullOrEmpty(i.Caption)).Select(i => new ItemReviewViewModel { Review = i })); } catch (Exception) { PresentationManager.ShowDefaultErrorMessage(); } finally { cancellationTokenSource.Dispose(); if (cancellationTokenSource == _reviewsCancellationTokenSource) { _reviewsCancellationTokenSource = null; } } }
private void ReloadList() { foreach (var s in _listItems) { s.PropertyChanged -= SelectableMediaStream_PropertyChanged; } _listItems.Clear(); var player = _playbackManager.MediaPlayers .OfType <IVideoPlayer>() .FirstOrDefault(i => i.PlayState != PlayState.Idle); if (player == null) { return; } _listItems.AddRange(player.SelectableStreams.Where(i => i.Type == Type)); foreach (var s in _listItems) { s.PropertyChanged += SelectableMediaStream_PropertyChanged; } }
private async void ReloadList() { try { var packages = await _installationManager.GetAvailablePackagesWithoutRegistrationInfo(CancellationToken.None); packages = packages.Where(i => i.versions != null && i.versions.Count > 0); _listItems.Clear(); var categories = packages .Where(i => i.type == PackageType.UserInstalled && i.targetSystem == PackageTargetSystem.MBTheater) .OrderBy(i => string.IsNullOrEmpty(i.category) ? "General" : i.category) .GroupBy(i => string.IsNullOrEmpty(i.category) ? "General" : i.category) .ToList(); _listItems.AddRange(categories.Select(i => new PluginCategoryViewModel(_presentationManager, _installationManager, _nav, _appHost) { Name = i.Key, Packages = i.Select(p => new PackageInfoViewModel(_installationManager, _nav) { PackageInfo = p }).ToList() })); } catch (Exception) { _presentationManager.ShowDefaultErrorMessage(); } }
private void GetItems() { var items = _provider.GetItems().Select(_mapper.MapToSampleModel); _items.Clear(); _items.AddRange(items); }
private void ReloadItems(bool isInitialLoad) { // Record the current item var currentItem = _listCollectionView.CurrentItem as ServerInfoViewModel; int?selectedIndex = null; if (isInitialLoad) { selectedIndex = 0; } else if (currentItem != null) { var index = Array.FindIndex(_servers.ToArray(), i => string.Equals(i.Id, currentItem.Server.Id)); if (index != -1) { selectedIndex = index; } } _listItems.Clear(); _listItems.AddRange(_servers.Select(i => new ServerInfoViewModel() { Server = i })); if (selectedIndex.HasValue) { ListCollectionView.MoveCurrentToPosition(selectedIndex.Value); } }
private void Method() { var warehouseItems = _warehouseProvider.GetWarehouseItems().Select(_warehouseMapper.MapToWarehouseItem); _warehouseItems.Clear(); _warehouseItems.AddRange(warehouseItems); }
public void SourceManipulation() { var numbers = new RangeObservableCollection <int>(System.Linq.Enumerable.Range(1, 3)); using (var expr = numbers.ActiveSingleOrDefault(i => i % 3 == 0)) { Assert.IsNull(expr.OperationFault); Assert.AreEqual(3, expr.Value); numbers.RemoveAt(2); Assert.IsNull(expr.OperationFault); Assert.AreEqual(0, expr.Value); numbers.Add(3); Assert.IsNull(expr.OperationFault); Assert.AreEqual(3, expr.Value); numbers.Add(5); Assert.IsNull(expr.OperationFault); Assert.AreEqual(3, expr.Value); numbers.Add(6); Assert.IsNotNull(expr.OperationFault); Assert.AreEqual(0, expr.Value); numbers.Clear(); Assert.IsNull(expr.OperationFault); Assert.AreEqual(0, expr.Value); } }
private void _shop_TextChanged(object sender, EventArgs eventArgs) { if (!_enableEvents) { return; } try { _enableEvents = false; _primaryShop = new Shop(_shop, _shop.Text); _shopItems.Clear(); foreach (var shopItem in _primaryShop.ShopItems) { _shopItems.Add(shopItem.GetShopItem()); } _tbNpcViewId.Text = _primaryShop.NpcViewId; _tbNpcPosition.Text = _primaryShop.ShopLocation; _tbNpcDisplayName.Text = _primaryShop.NpcDisplayName; _comboBoxShopType.SelectedIndex = _primaryShop.ShopType == "trader" ? 1 : 0; var currency = _primaryShop.ShopCurrency.ToString(CultureInfo.InvariantCulture); _tbNpcShopCurrency.Text = (currency == "0" || currency == "") ? "Zeny" : currency; _updateViewShop(); } catch { } finally { _enableEvents = true; } }
private void GetItems() { var items = _sampleProvider.GetItems().Select(_sampleMapper.MapToSampleItem); _items.Clear(); _items.AddRange(items); }
private async void UpdateViewModel() { var profile = AppState.Data.Profile; if (!AppState.Data.DefinitionsLoaded || profile == null) { return; } viewIsUpdating = true; triumphs.Clear(); PresentationNodeDef = await Definitions.GetPresentationNode(presentationNodeHash); if (PresentationNodeDef == null) { return; } foreach (var childRecord in PresentationNodeDef.Children.Records) { var recordDefinition = await Definitions.GetRecord(childRecord.RecordHash); var triumph = new Triumph { Definition = recordDefinition, Hash = childRecord.RecordHash, Objectives = new List <Objective>(), Record = Triumph.FindRecordInProfileOrDefault(childRecord.RecordHash.ToString(), profile) }; if (triumph.Record == null) { Log.Info($"Triumph {childRecord.RecordHash} is missing its record from profile data"); } foreach (var objectiveProgress in triumph.ObjectiveProgresses) { if (objectiveProgress == null) { continue; } var obj = new Objective { Progress = objectiveProgress }; await obj.PopulateDefinition(); triumph.Objectives.Add(obj); } triumphs.Add(triumph); } viewIsUpdating = false; UpdateSelection(); }
private async Task GetWarehouseItemsInternal() { var warehouseItems = (await _warehouseProvider.GetWarehouseItems()).Select(WarehouseMapper.MapToWarehouseItem); _warehouseItems.Clear(); _warehouseItems.AddRange(warehouseItems); }
private void DisposeOfTabs() { var copy = _tabs.ToArray(); _tabs.Clear(); copy.ForEach(x => x.Dispose()); }
public void Clear() { foreach (var child in children) { RemoveChild(child, false); } children.Clear(); }
private void DisposeOfMetadata() { var items = _metadata.ToArray(); _metadata.Clear(); items.ForEach(x => x.Dispose()); }
private async Task GetWarehouseItemsInternal() { await ServiceRunner.RunAsync(() => { var warehouseItems = _storage.GetWarehouseItems(); _warehouseItems.Clear(); _warehouseItems.AddRange(warehouseItems); }); }
private async Task ReloadSections() { var views = await GetSections(); _sectionNames.Clear(); _sectionNames.AddRange(views); Sections.MoveCurrentToPosition(0); }
public DiagnosticsViewModel(IDiagnosticsService diagnosticsService, ISchedulerService schedulerService) { Id = string.Format("Identifier: {0}", Guid.NewGuid()); Rps = Constants.DefaultRpsString; Cpu = Constants.DefaultCpuString; ManagedMemory = Constants.DefaultManagedMemoryString; TotalMemory = Constants.DefaultTotalMemoryString; _log = new RangeObservableCollection <string>(); _disposable = new CompositeDisposable { diagnosticsService.Log .ObserveOn(schedulerService.Dispatcher) .Subscribe(x => _log.Add(x), e => { Logger.Error(e); _log.Clear(); }), diagnosticsService.Rps .Select(FormatRps) .ObserveOn(schedulerService.Dispatcher) .Subscribe(x => Rps = x, e => { Logger.Error(e); Rps = Constants.DefaultRpsString; }), diagnosticsService.Cpu .Select(FormatCpu) .ObserveOn(schedulerService.Dispatcher) .Subscribe(x => Cpu = x, e => { Logger.Error(e); Cpu = Constants.DefaultCpuString; }), diagnosticsService.Memory .Select(FormatMemory) .ObserveOn(schedulerService.Dispatcher) .Subscribe(x => { ManagedMemory = x.ManagedMemory; TotalMemory = x.TotalMemory; }, e => { Logger.Error(e); ManagedMemory = Constants.DefaultManagedMemoryString; TotalMemory = Constants.DefaultTotalMemoryString; }) }; }
public void RefreshData() { List <NumberSet> data = _numbrTumblrBusiness.GetNumberSets(); if (data != null) { _numberSets.Clear(); _numberSets.AddRange(data); NumberSetNameLabel = string.Empty; } }
private void AddPoints(List <double> times, List <double> sigmas, RangeObservableCollection <DataPoint> collection) { List <DataPoint> temp = new List <DataPoint>(); collection.Clear(); for (int i = 0; i < sigmas.Count; i++) { temp.Add(new DataPoint(times[i], sigmas[i])); } collection.AddRange(temp); }
public void RefreshData() { //if we were doing paging we would of course do that there List <StateProvince> data = _numbrTumblrBusiness.GetStateProvinces(); if (data != null) { _stateProvinces.Clear(); _stateProvinces.AddRange(data); } }
private void ReloadPlugins() { _listItems.Clear(); _listItems.AddRange(_appHost.Plugins.Select(i => new InstalledPluginViewModel(_appHost, _nav, _installationManager, _presentationManager) { Plugin = i })); OnPropertyChanged("PluginCount"); }
private void ReloadList(BaseItemDto item) { if (item == null) { _listItems.Clear(); return; } // Record the current item var currentItem = _listCollectionView.CurrentItem as ItemPersonViewModel; var people = item.People ?? new BaseItemPerson[] { }; people = people.Where(i => i.HasPrimaryImage).ToArray(); int?selectedIndex = null; if (currentItem != null) { var index = Array.FindIndex(people, i => string.Equals(i.Name, currentItem.Name, StringComparison.OrdinalIgnoreCase)); if (index != -1) { selectedIndex = index; } } _listItems.Clear(); _listItems.AddRange(people.Select(i => new ItemPersonViewModel(i, _apiClient, _imageManager) { ImageWidth = ImageWidth, ImageHeight = ImageHeight })); if (selectedIndex.HasValue) { ListCollectionView.MoveCurrentToPosition(selectedIndex.Value); } }
public void RefreshData() { //if we were doing paging we would of course do that there List <Lottery> data = _numbrTumblrBusiness.GetLotteries(); if (data != null) { _lotteries.Clear(); _lotteries.AddRange(data); //just to initiate the processing for a dynamic name LotteryNameLabel = string.Empty; } }
public void ResetStatisticCollection() { try { syncLock.EnterWriteLock(); statisticCollection.Clear(); UpdateFilteredStatistics(); } finally { syncLock.ExitWriteLock(); } }