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); }
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); } } }
public void ChangeViewItems(string viewOption) { ViewItems.Clear(); switch (viewOption) { case "Prediction": ViewItems.AddRange("True Positive", "True Negative", "False Positive", "False Negative"); break; case "Reference": ViewItems.AddRange("Classification 0", "Classification 1"); break; case "Observation": ViewItems.AddRange("Observation 0", "Observation 1"); break; default: break; } ViewOptionIndex = ViewOptions.IndexOf(viewOption); }
internal void OnSearchTextChanged() { IsBusy = true; var dispatcher = Application.Current.Dispatcher; var dItems = DataItems; var vItems = new DataItemCollection(); Task.Factory.StartNew(() => { foreach (DataItem dItem in dItems) { if (Regex.IsMatch(dItem.Description, NameSearch == null ? "" : NameSearch, RegexOptions.IgnoreCase)) { vItems.Add(dItem); } } dispatcher.Invoke(() => { ViewItems.Clear(); ViewItems = vItems; IsBusy = 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; }