public SuperexpressDrawsDesign() : base(null, null) { var items = new ObservableCollection <SuperexpressDrawInfoModel>(); Draws = new System.Windows.Data.ListCollectionView(items); for (int i = 0; i < 12; i++) { var draw = new SuperexpressDrawInfoModel { BaseAmount = 10 + i * 4, Code = $"FD9J", Id = i * 132 + 9541, MinBetAmount = 1.5m * (10 + i * 4), Name = $"Футбол. Лига Европы.", Number = i + 7 * 81, SuperexpressId = i + 8, EventCount = i * 2 + 6, StartBetsDate = new DateTime(2018, 09, 17).AddDays(i).AddHours(-i).AddMinutes(i * 17), EndBetsDate = new DateTime(2018, 11, 17).AddDays(-i).AddHours(+i).AddMinutes(-i * 17), }; items.Add(draw); } }
private void SelectedDrawAction(SuperexpressDrawInfoModel drawInfo) { if (!(SelectedItem is SuperexpressBetViewModel)) { CreateNewSuperexpressBet(); } var curentBet = SelectedItem as SuperexpressBetViewModel; curentBet.HandleDrawInfo(drawInfo); }
private void Fill(SuperexpressDrawModel draw, SuperexpressDrawInfoModel drawInfo) { Headers.Clear(); Events.Clear(); var outcomesIds = draw.Events .SelectMany(x => x.Coefficients) .Select(x => x.Outcome) .Select(x => x.Id) .Distinct(); foreach (var outcome in outcomesIds) { var outcomeName = draw.Events.SelectMany(x => x.Coefficients).FirstOrDefault(x => x.Outcome.Id == outcome).Outcome.Name; Headers.Add(outcomeName); } foreach (var item in draw.Events) { var ev = new EventViewModel { Id = item.ID, Name = item.Name, Path = item.BranchPathName }; foreach (var outcome in outcomesIds) { var coefficient = item.Coefficients .Where(x => x.Outcome.Id == outcome) .Select(x => new CoefficientViewModel { Id = x.Id, Name = x.Outcome.Name, IsSelected = false }) .FirstOrDefault(); if (coefficient != null) { coefficient.SelectedChanged += CoefficientSelectedChanged; } ev.Coefficients.Add(coefficient); } Events.Add(ev); } CalculateVariantsAmount(); DrawChanged?.Invoke(this); }
internal void HandleDrawInfo(SuperexpressDrawInfoModel drawInfo) { if (_info?.Id == drawInfo.Id) { return; } if (_subscription != null) { _subscription.Dispose(); } //create work _info = drawInfo; _subscription = _dataService.SubscribeOnDraw(drawInfo.Id, this); }