public async Task LoadContentAsync() { if (_backendAlbum != null) { var tempOrderedItem = new List <Tuple <int, int, DbMediaFile> >(); var dbFileAsyncEnumerator = _backendAlbum.MediaFiles.ToAsyncEnumerable().GetEnumerator(); if (dbFileAsyncEnumerator != null) { while (await dbFileAsyncEnumerator.MoveNext()) { var item = dbFileAsyncEnumerator.Current; int discNum = 0, trackNum = 0; int.TryParse(item.DiscNumber, out discNum); int.TryParse(item.TrackNumber, out trackNum); tempOrderedItem.Add(new Tuple <int, int, DbMediaFile>(discNum, trackNum, item)); } } // Disk and Track var sortedItem = tempOrderedItem.OrderBy(i => i.Item1) .ThenBy(i => i.Item2); // Add subitems to the ListView data entity set foreach (var s in sortedItem) { if (s == null) { continue; } ViewItems.Add(s.Item3); } } IsLoading = false; }
void DrawFrame() { if (planetDiameters == null) { return; } var state = CurFrame(); ComputeScale(); ViewItems.Clear(); var index = 0; foreach (var p in state.planets_) { double diameter = planetDiameters[index]; int player1FleetsEnRoute = state.FleetsEnRoute(Owner.Player1, p); int player2FleetsEnRoute = state.FleetsEnRoute(Owner.Player2, p); ViewItems.Add(new ViewablePlanet(p, diameter * 2, player1FleetsEnRoute, player2FleetsEnRoute)); ++index; } foreach (var f in state.fleets_) { ViewItems.Add(new ViewableFleet(state, f)); } DrawHistory(); Player1Text = FormatPlayerText(state, Owner.Player1); Player2Text = FormatPlayerText(state, Owner.Player2); }
public void AddPopupApplet <TContext>(TContext context) where TContext : MainContext, new() { // Получение названия попапа из up контрола, на котором произошло действие ControlUP UP = CurrentControl?.ControlUPs?.FirstOrDefault(n => n.Name == "Applet"); string popupName = UP == null ? string.Empty : UP.Value; Applet popup = context.Applets .AsNoTracking() .Include(b => b.BusComp) .Include(cntr => cntr.Controls) .ThenInclude(cntrUp => cntrUp.ControlUPs) .Include(cntr => cntr.Controls) .ThenInclude(f => f.Field) .FirstOrDefault(n => n.Name == popupName); // Добавление попапа и его маршрута в информацию о представлении if (!ViewApplets.Select(n => n.Name).ToList().Contains(popup.Name)) { // Установка этого попапа как текущего CurrentPopupApplet = popup; ViewApplets.Add(popup); ViewItem viewItem = new ViewItem() { Name = popup.Name, Applet = popup, AppletId = popup.Id, Autofocus = true, AutofocusRecord = 0, View = View, ViewId = View.Id }; ViewItems.Add(viewItem); View.ViewItems.Add(viewItem); } }
private void ModelPredict() { if (CheckImagePath()) { var output = yoloV5Onnx?.Predict(currentPreProcessing.ModelInput); currentParser = new OutputParser(output, currentPreProcessing); OutputSource = currentPreProcessing.outputBitmap.ToBitmapSource(); ViewItems.Clear(); foreach (var info in currentParser.boxesInfo) { ViewItems.Add(info); } } }
/// <summary> /// Load data from database. /// </summary> /// <returns>An awaitable task.</returns> public async Task LoadDataAsync() { var elem = await EntityRetrievalExtensions.GetAlbumByIdAsync(_itemId); if (elem != null) { _backendAlbum = elem; CoverImageTag = new ThumbnailTag { Fallback = "Album,AlbumPlaceholder", ArtistName = _backendAlbum.Artist, AlbumName = _backendAlbum.Title, ThumbnailPath = _backendAlbum.FirstFileInAlbum, }; #region Basic Info // Get album detailed information Title = elem.Title; Artist = elem.Artist; Year = DateTimeHelper.GetItemDateYearString(elem.Date); Intro = elem.Intro; Genre = elem.Genre; DesktopTitleViewConfiguration.SetTitleBarText(Title); #endregion #region Items var tempOrderedItem = new List <Tuple <int, int, DbMediaFile> >(); var dbFileAsyncEnumerator = elem.MediaFiles.ToAsyncEnumerable().GetEnumerator(); if (dbFileAsyncEnumerator != null) { while (await dbFileAsyncEnumerator.MoveNext()) { var item = dbFileAsyncEnumerator.Current; int discNum = 0, trackNum = 0; int.TryParse(item.DiscNumber, out discNum); int.TryParse(item.TrackNumber, out trackNum); tempOrderedItem.Add(new Tuple <int, int, DbMediaFile>(discNum, trackNum, item)); } } // Disk and Track var sortedItem = tempOrderedItem.OrderBy(i => i.Item1) .ThenBy(i => i.Item2); // Add subitems to the ListView data entity set foreach (var s in sortedItem) { if (s == null) { continue; } ViewItems.Add(s.Item3); } #endregion } // Mark complete IsLoading = false; }
private void LoadChildrenIconNode() { NavigationChildren.Clear(); ViewItems.Clear(); IDynamicPanel flicking = (_widget as IDynamicPanel); double activeWidth = ItemWidth * 0.01 * _widget.PanelWidth; double sideWidth = (ItemWidth - activeWidth - 2 * _widget.LineWith) / 2; int index = 0; foreach (IPage item in flicking.PanelStatePages) { DynamicPanelIconNode childVM = new DynamicPanelIconNode(item, _model.StyleGID); NavigationChildren.Add(childVM); if (flicking.StartPanelStatePage == item) { childVM.IsChecked = true; } switch (_widget.ViewMode) { case DynamicPanelViewMode.Full: if (index == 0) { childVM.PanelWidth = ItemWidth; childVM.LoadAllChildrenWidgets(true); ViewItems.Add(childVM); } break; case DynamicPanelViewMode.Card: if (index == 0) { childVM.PanelWidth = activeWidth;; // (ItemWidth - activeWidh) / 2; childVM.LineWidth = _widget.LineWith; childVM.LoadAllChildrenWidgets(true); ViewItems.Add(childVM); } else if (index == 1) { childVM.PanelWidth = sideWidth; childVM.LineWidth = _widget.LineWith; childVM.LoadAllChildrenWidgets(true); ViewItems.Add(childVM); } else if (item == flicking.PanelStatePages.Last()) { childVM.PanelWidth = ItemWidth; childVM.LineWidth = (ItemWidth - sideWidth) * (-1); childVM.LoadAllChildrenWidgets(true); ViewItems.Insert(0, childVM); } break; case DynamicPanelViewMode.Preview: if (index == 0) { childVM.PanelWidth = activeWidth; childVM.LoadAllChildrenWidgets(true); ViewItems.Add(childVM); } else if (index == 1) { childVM.PanelWidth = ItemWidth - activeWidth; childVM.LineWidth = _widget.LineWith; childVM.LoadAllChildrenWidgets(true); ViewItems.Add(childVM); } break; case DynamicPanelViewMode.Scroll: if (index != 0) { childVM.LineWidth = _widget.LineWith; } childVM.PanelWidth = activeWidth; childVM.LoadAllChildrenWidgets(true); ViewItems.Add(childVM); break; } index++; } ShowType = flicking.NavigationType; }