private void OnChoiceExecute(IMatchVw chosenEntity) { SelectedMatch = chosenEntity; MyRegionManager.NavigateUsingViewModel <BetDomainsViewModel>(RegionNames.ContentRegion); }
private void OnChoiceExecute(IMatchVw chosenEntity) { SelectedMatch = chosenEntity; MyRegionManager.NavigateUsingViewModel <BetDomainsViewModel>(RegionNames.ContentRegion); VisualEffectsHelper.Singleton.LiveSportMatchDetailsIsOpened = true; }
private void OnCameraClicked(IMatchVw match) { if (!match.StreamStarted) { return; } Mediator.SendMessage(match, MsgTag.ShowStream); }
public static int Comparison(IMatchVw m1, IMatchVw m2) { if (m1.StartDate == m2.StartDate) { return(m2.TournamentView.LineObject.GroupId.CompareTo(m1.TournamentView.LineObject.GroupId)); } return(m1.StartDate.CompareTo(m2.StartDate)); }
private void ShowStream(IMatchVw match) { if (FirstStart) { //https://lbc.betradar.com/screen/#/terminal/76/4900522/656 StreamWebAddress = "https://lbc.betradar.com/"; WebBrowserVisibility = Visibility.Visible; FirstStart = false; return; } //add timers logic SelectedMatch = match; if (DateTime.Now < SelectedMatch.LastPlayedStreamAt.AddSeconds(ChangeTracker.VideoWarningBefore)) { ShowError(TranslationProvider.Translate(MultistringTags.TERMINAL_STREAM_BLOCKED).ToString()); return; } SelectedMatch.LastPlayedStreamAt = DateTime.Now; WebBrowserVisibility = Visibility.Visible; StopTimer(); bool res = DeleteUrlCacheEntry("https://lbc.betradar.com/screen/jwplayer.flash.swf"); StreamWebAddress = "https://lbc.betradar.com/screen/#/terminal/76/" + SelectedMatch.LineObject.BtrMatchId.ToString() + "/" + SelectedMatch.StreamID.ToString(); Random random = new Random(); int randomNumber = (random.Next(ChangeTracker.VideoTimePeriodMin, ChangeTracker.VideoTimePeriodMax) - ChangeTracker.VideoWarningBefore) * 1000; StreamTimer = new System.Timers.Timer(); StreamTimer.Interval = randomNumber; StreamTimer.Elapsed += NotifyUserOfStreamEnding; StreamTimer.Start(); }
public int Comparison(IMatchVw m1, IMatchVw m2) { //if (ChangeTracker.SelectedSportFilter.Id == "999") //{ // if (m1.StartDate == m2.StartDate) // return m1.Name.CompareTo(m2.Name); // return m1.StartDate.CompareTo(m2.StartDate); //} var sSportName1 = m1.SportView.LineObject.Sort.Value; var sSportName2 = m2.SportView.LineObject.Sort.Value; if ((!m1.IsLiveBet || m1.LiveBetStatus == eMatchStatus.NotStarted) && (!m2.IsLiveBet || m2.LiveBetStatus == eMatchStatus.NotStarted)) { if (m1.LineObject.MatchExternalState.VirtualSeason.Value == m2.LineObject.MatchExternalState.VirtualSeason.Value) { if (m1.StartDate == m2.StartDate) { return(m1.Name.CompareTo(m2.Name)); } return(m1.StartDate.CompareTo(m2.StartDate)); } return(m1.LineObject.MatchExternalState.VirtualSeason.Value.CompareTo(m2.LineObject.MatchExternalState.VirtualSeason.Value)); } if (!m1.IsLiveBet || m1.LiveBetStatus == eMatchStatus.NotStarted) { return(1); } if (!m2.IsLiveBet || m2.LiveBetStatus == eMatchStatus.NotStarted) { return(-1); } var dd = m1.LiveBetStatus.CompareTo(m2.LiveBetStatus); return(dd); }
public int Sort(IMatchVw m1, IMatchVw m2) { return(0); }
private void OnOutrightChoiceExecute(IMatchVw chosenMatch) { SelectedMatch = chosenMatch; MyRegionManager.NavigateUsingViewModel <OutrightViewModel>(RegionNames.ContentRegion); }
public int Comparison(IMatchVw m1, IMatchVw m2) { if (ChangeTracker.LiveSelectedMode == 3) { if (m1.StartDate == m2.StartDate) { return(m1.Name.CompareTo(m2.Name)); } return(m1.StartDate.CompareTo(m2.StartDate)); } if (ChangeTracker.LiveSelectedMode == 4 && sortingIsWorking) { if (m1.SportView.Sort == m2.SportView.Sort) { if (m1.TournamentView.Sort == m2.TournamentView.Sort) { if (m1.LineObject.Sort == m2.LineObject.Sort) { if (m1.LineObject.StartDate.Value.UtcDateTime.Equals(m2.LineObject.StartDate.Value.UtcDateTime)) { var id1 = -m1.LineObject.MatchId; var id2 = -m2.LineObject.MatchId; var value = id1.CompareTo(id2); return(value); } return(m1.LineObject.StartDate.Value.UtcDateTime.CompareTo(m2.LineObject.StartDate.Value.UtcDateTime)); } return(m1.LineObject.Sort.CompareTo(m2.LineObject.Sort)); } return(m1.TournamentView.Sort.CompareTo(m2.TournamentView.Sort)); } return(m1.SportView.Sort.CompareTo(m2.SportView.Sort)); } var sSportSort1 = m1.DefaultSorting; var sSportSort2 = m2.DefaultSorting; if ((m1.IsLiveBet && m1.LiveBetStatus != eMatchStatus.NotStarted) && (m2.IsLiveBet && m2.LiveBetStatus != eMatchStatus.NotStarted)) { if ((m1.LiveBetStatus != eMatchStatus.NotStarted && m2.LiveBetStatus != eMatchStatus.NotStarted) || m1.LiveBetStatus.Equals(m2.LiveBetStatus)) { if (sSportSort1.Equals(sSportSort2)) { if (m1.LiveMatchMinuteEx == m2.LiveMatchMinuteEx) { if (m1.SportDescriptor == SportSr.SPORT_DESCRIPTOR_SOCCER && m2.SportDescriptor == SportSr.SPORT_DESCRIPTOR_SOCCER) { if (m1.LivePeriodInfo.Equals(m2.LivePeriodInfo)) { if (m1.StartDate == m2.StartDate) { return(m1.Name.CompareTo(m2.Name)); } return(m1.StartDate.CompareTo(m2.StartDate)); } return(m1.LivePeriodInfo.CompareTo(m2.LivePeriodInfo)); } else { if (m1.LivePeriodInfo.Equals(m2.LivePeriodInfo)) { if (m1.StartDate == m2.StartDate) { return(m1.Name.CompareTo(m2.Name)); } return(m1.StartDate.CompareTo(m2.StartDate)); } return(m2.LivePeriodInfo.CompareTo(m1.LivePeriodInfo)); } } return(m2.LiveMatchMinuteEx.CompareTo(m1.LiveMatchMinuteEx)); } return(sSportSort1.CompareTo(sSportSort2)); } } if ((!m1.IsLiveBet || m1.LiveBetStatus == eMatchStatus.NotStarted) && (!m2.IsLiveBet || m2.LiveBetStatus == eMatchStatus.NotStarted)) { if (sSportSort1.Equals(sSportSort2)) { if (m1.StartDate == m2.StartDate) { return(m1.Name.CompareTo(m2.Name)); } return(m1.StartDate.CompareTo(m2.StartDate)); } return(sSportSort1.CompareTo(sSportSort2)); } if (!m1.IsLiveBet || m1.LiveBetStatus == eMatchStatus.NotStarted) { return(1); } if (!m2.IsLiveBet || m2.LiveBetStatus == eMatchStatus.NotStarted) { return(-1); } var dd = m1.LiveBetStatus.CompareTo(m2.LiveBetStatus); return(dd); }
public static int Comparison(IMatchVw m1, IMatchVw m2) { var sSportSort1 = m1.DefaultSorting; var sSportSort2 = m2.DefaultSorting; if ((m1.IsLiveBet && m1.LiveBetStatus != eMatchStatus.NotStarted) && (m2.IsLiveBet && m2.LiveBetStatus != eMatchStatus.NotStarted)) { if ((m1.LiveBetStatus != eMatchStatus.NotStarted && m2.LiveBetStatus != eMatchStatus.NotStarted) || m1.LiveBetStatus.Equals(m2.LiveBetStatus)) { if (sSportSort1.Equals(sSportSort2)) { if (m1.LiveMatchMinuteEx == m2.LiveMatchMinuteEx) { if (m1.SportDescriptor == SportSr.SPORT_DESCRIPTOR_SOCCER && m2.SportDescriptor == SportSr.SPORT_DESCRIPTOR_SOCCER) { if (m1.LivePeriodInfo.Equals(m2.LivePeriodInfo)) { if (m1.StartDate == m2.StartDate) { return(m1.Name.CompareTo(m2.Name)); } return(m1.StartDate.CompareTo(m2.StartDate)); } return(m1.LivePeriodInfo.CompareTo(m2.LivePeriodInfo)); } else { if (m1.LivePeriodInfo.Equals(m2.LivePeriodInfo)) { if (m1.StartDate == m2.StartDate) { return(m1.Name.CompareTo(m2.Name)); } return(m1.StartDate.CompareTo(m2.StartDate)); } return(m2.LivePeriodInfo.CompareTo(m1.LivePeriodInfo)); } } return(m2.LiveMatchMinuteEx.CompareTo(m1.LiveMatchMinuteEx)); } return(sSportSort1.CompareTo(sSportSort2)); } } if ((!m1.IsLiveBet || m1.LiveBetStatus == eMatchStatus.NotStarted) && (!m2.IsLiveBet || m2.LiveBetStatus == eMatchStatus.NotStarted)) { if (sSportSort1.Equals(sSportSort2)) { if (m1.StartDate == m2.StartDate) { return(m1.Name.CompareTo(m2.Name)); } return(m1.StartDate.CompareTo(m2.StartDate)); } return(sSportSort1.CompareTo(sSportSort2)); } if (!m1.IsLiveBet || m1.LiveBetStatus == eMatchStatus.NotStarted) { return(1); } if (!m2.IsLiveBet || m2.LiveBetStatus == eMatchStatus.NotStarted) { return(-1); } var dd = m1.LiveBetStatus.CompareTo(m2.LiveBetStatus); return(dd); }
public void Rotate() { if (ChangeTracker.LiveMonitors.Count <= 0) { return; } if (this.rotationCounter >= 1000) { rotationCounter = 0; } this.rotationCounter++; LiveMonitorViewModel lmvm = null; SyncList <IMatchVw> lMatches = Matches.ToSyncList(); for (int i = 0; i < LiveMonitorsCollectionList.Count; i++) { if (!lmViewModels[i].rotating || lmViewModels[i].LiveOddsVisibility == Visibility.Collapsed) { continue; } //check interval if (this.rotationCounter % lmViewModels[i].rotationInterval != 0 && this.rotationCounter != 0) { continue; } lmvm = ChangeTracker.LiveMonitors[i].DataContext as LiveMonitorViewModel; Debug.Assert(lmvm != null); double dblItemHeight = lmvm != null && lmvm.ItemHeight > 0.0d ? lmvm.ItemHeight : ITEM_DEFAULT_HEIGHT; double dblHeaderItemHeight = lmvm != null && lmvm.HeaderItemHeight > 0.0d ? lmvm.HeaderItemHeight : ITEM_WITH_HEADER_DEFAULT_HEIGHT; if (LiveMonitorRotationCounters[i] >= lMatches.Count) { LiveMonitorRotationCounters[i] = LiveMonitorRotationCounters[i] - lMatches.Count; } int iMatchIdx = LiveMonitorRotationCounters[i]; if (iMatchIdx >= lMatches.Count) { iMatchIdx = 0; } IMatchVw matchVw = lMatches.Count > iMatchIdx ? lMatches[iMatchIdx] : null; SyncObservableCollection <IMatchVw> socMonitor = LiveMonitorsCollectionList[i]; double dblCurrentMonitorFilledHeight = 0; SyncList <IMatchVw> lMatchesTemp = new SyncList <IMatchVw>(); string oldSport = ""; bool isPreLiveOld = false; while (matchVw != null) { if (matchVw == null || lMatchesTemp.Contains(matchVw)) { break; } string currentSport = matchVw.SportDescriptor; var isPreLive = matchVw.LiveBetStatus == eMatchStatus.NotStarted || !matchVw.IsLiveBet; if (!string.IsNullOrEmpty(currentSport)) { if (currentSport != oldSport) { matchVw.IsHeaderForRotation = true; } else if (isPreLive && !isPreLiveOld) { matchVw.IsHeaderForRotation = true; } else { matchVw.IsHeaderForRotation = false; } oldSport = currentSport; isPreLiveOld = isPreLive; } dblCurrentMonitorFilledHeight += matchVw.IsHeaderForRotation ? dblHeaderItemHeight : dblItemHeight; if (dblCurrentMonitorFilledHeight > lmViewModels[i].LiveOddsHeight) //lmViewModels[i].LiveOddsHeight) { break; } else { lMatchesTemp.Add(matchVw); } iMatchIdx++; if (iMatchIdx >= lMatches.Count) { iMatchIdx = 0; } matchVw = lMatches.Count > iMatchIdx ? lMatches[iMatchIdx] : null; LiveMonitorRotationCounters[i]++; } Dispatcher.Invoke(() => { socMonitor.ApplyChanges(lMatchesTemp); //damn thing does not applay normally changes for collections with duplicate matches with it... }); } }
private void SplitCollection() { if (ChangeTracker.LiveMonitors.Count <= 0) { return; } SyncList <IMatchVw> lMatches = Matches.ToSyncList(); int iMatchIdx = 0; int page = -1; for (int i = 0; i < LiveMonitorsCollectionList.Count; i++) { if (lmViewModels[i].rotating || lmViewModels[i].LiveOddsVisibility == Visibility.Collapsed) { continue; } LiveMonitorViewModel lmvm = null; Dispatcher.Invoke(() => { lmvm = ChangeTracker.LiveMonitors[i].Window.DataContext as LiveMonitorViewModel; }); Debug.Assert(lmvm != null); double dblItemHeight = lmvm != null && lmvm.ItemHeight > 0.0d ? lmvm.ItemHeight : ITEM_DEFAULT_HEIGHT; double dblHeaderItemHeight = lmvm != null && lmvm.HeaderItemHeight > 0.0d ? lmvm.HeaderItemHeight : ITEM_WITH_HEADER_DEFAULT_HEIGHT; Dispatcher.Invoke(() => { SyncObservableCollection <IMatchVw> socMonitor = LiveMonitorsCollectionList[i]; double dblCurrentMonitorFilledHeight = 0; SyncList <IMatchVw> lMatchesTemp = new SyncList <IMatchVw>(); IMatchVw matchVw = lMatches.Count > iMatchIdx ? lMatches[iMatchIdx] : null; string currentSport = ""; bool isPreLiveOld = false; while (matchVw != null) { var isPreLive = matchVw.LiveBetStatus == eMatchStatus.NotStarted || !matchVw.IsLiveBet; if (matchVw.SportDescriptor != currentSport) { matchVw.IsHeaderForLiveMonitor = true; currentSport = matchVw.SportDescriptor; } else if (page != i) { matchVw.IsHeaderForLiveMonitor = true; page = i; } else if (isPreLive && !isPreLiveOld) { matchVw.IsHeaderForLiveMonitor = true; isPreLiveOld = isPreLive; } else { if (dblCurrentMonitorFilledHeight + dblItemHeight <= LiveMonitorHeights[i]) { matchVw.IsHeaderForLiveMonitor = false; } } currentSport = matchVw.SportDescriptor; page = i; isPreLiveOld = isPreLive; dblCurrentMonitorFilledHeight += matchVw.IsHeaderForLiveMonitor ? dblHeaderItemHeight : dblItemHeight; if (dblCurrentMonitorFilledHeight > LiveMonitorHeights[i]) { page = i; break; } else { lMatchesTemp.Add(matchVw); } iMatchIdx++; matchVw = lMatches.Count > iMatchIdx ? lMatches[iMatchIdx] : null; } //Debug.Assert(ChangeTracker.LiveMonitors[i].threadId == socMonitor.threadid); //Debug.Assert(Thread.CurrentThread == socMonitor.threadid); socMonitor.ApplyChanges(lMatchesTemp); }); } }
private void OnOutrightChoiceExecute(IMatchVw chosenMatch) { WaitOverlayProvider.ShowWaitOverlay(); SelectedMatch = chosenMatch; MyRegionManager.NavigateUsingViewModel <OutrightViewModel>(RegionNames.ContentRegion); }
public int Comparison(IMatchVw m1, IMatchVw m2) { //if (ChangeTracker.SelectedSportFilter.Id == "999") //{ // if (m1.StartDate == m2.StartDate) // return m1.Name.CompareTo(m2.Name); // return m1.StartDate.CompareTo(m2.StartDate); //} var sSportName1 = m1.SportView.LineObject.Sort.Value; var sSportName2 = m2.SportView.LineObject.Sort.Value; if ((m1.IsLiveBet && m1.LiveBetStatus != eMatchStatus.NotStarted) && (m2.IsLiveBet && m2.LiveBetStatus != eMatchStatus.NotStarted)) { if ((m1.LiveBetStatus != eMatchStatus.NotStarted && m2.LiveBetStatus != eMatchStatus.NotStarted) || m1.LiveBetStatus.Equals(m2.LiveBetStatus)) { if (sSportName1.Equals(sSportName2)) { //if (m1.LivePeriodInfo.Equals(m2.LivePeriodInfo) || sSportDescroptor == SportSr.SPORT_DESCRIPTOR_TENNIS) //{ if (m1.LiveMatchMinuteEx == m2.LiveMatchMinuteEx) { if (m1.LivePeriodInfo.Equals(m2.LivePeriodInfo)) { if (m1.StartDate == m2.StartDate) { return(m1.Name.CompareTo(m2.Name)); } return(m1.StartDate.CompareTo(m2.StartDate)); } return(m2.LivePeriodInfo.CompareTo(m1.LivePeriodInfo)); } return(m2.LiveMatchMinuteEx.CompareTo(m1.LiveMatchMinuteEx)); } return(sSportName1.CompareTo(sSportName2)); } } if ((!m1.IsLiveBet || m1.LiveBetStatus == eMatchStatus.NotStarted) && (!m2.IsLiveBet || m2.LiveBetStatus == eMatchStatus.NotStarted)) { if (sSportName1.Equals(sSportName2)) { if (m1.StartDate == m2.StartDate) { return(m1.Name.CompareTo(m2.Name)); } return(m1.StartDate.CompareTo(m2.StartDate)); } return(sSportName1.CompareTo(sSportName2)); } if (!m1.IsLiveBet || m1.LiveBetStatus == eMatchStatus.NotStarted) { return(1); } if (!m2.IsLiveBet || m2.LiveBetStatus == eMatchStatus.NotStarted) { return(-1); } var dd = m1.LiveBetStatus.CompareTo(m2.LiveBetStatus); return(dd); }
public void SearchMatches(SyncList <IMatchVw> lMatchesToSync, string sSearch, string sLanguage, DelegateFilterMatches dfm) { CheckTime ct = new CheckTime(false, "SearchMatches('{0}', '{1}') entered", sSearch, sLanguage); lock (m_oReadLocker) { if (lMatchesToSync != null) { HashSet <IMatchVw> hsMatches = new HashSet <IMatchVw>(); SyncList <MatchLn> lAllMatches = m_diAll.Matches.ToSyncList(); if (!string.IsNullOrEmpty(sSearch)) { ct.AddEvent("Search by string in {0} matches", lAllMatches.Count); IdentityList ilGroups = new IdentityList(); IdentityList ilCompetitors = new IdentityList(); m_diAll.TaggedStrings.SearchRelatedStrings(sSearch, sLanguage, ilGroups, ilCompetitors); int iCode = 0; bool bIsNumber = int.TryParse(sSearch, out iCode) && 0 < iCode && iCode < MAX_MATCH_CODE; if (ilCompetitors.Count > 0 || bIsNumber) { foreach (var mtch in lAllMatches) { #if DEBUG || TRACE_ID_FROM_FILE if (TraceHelper.TraceFromFileLongValues("MatchIds.txt", (long)mtch.MatchId, new TraceHelper.DelegateLongFromRegistryFound(MatchIdFromFileFound), mtch)) { // Put breakpoint here to catch certain match by mtch.MatchId } #endif string sCode = mtch.Code.Value.ToString("G"); if (sCode.IndexOf(sSearch, StringComparison.OrdinalIgnoreCase) >= 0 || ilCompetitors.Contains(mtch.HomeCompetitorId.Value) || ilCompetitors.Contains(mtch.AwayCompetitorId.Value)) { SearchMatchImp(hsMatches, lMatchesToSync, mtch, dfm); } //else //{ // SyncList<GroupLn> lGroups = LineSr.Instance.AllObjects.MatchesToGroups.GetMatchGroups(mtch.MatchId); // foreach (GroupLn group in lGroups) // { // if (ilGroups.Contains(group.GroupId)) // { // SearchMatchImp(hsMatches, lMatchesToSync, mtch, dfm); // } // } //} } } } else { ct.AddEvent("Search directly in {0} matches", lAllMatches.Count); foreach (var mtch in lAllMatches) { #if DEBUG || TRACE_ID_FROM_FILE if (TraceHelper.TraceFromFileLongValues("MatchIds.txt", (long)mtch.MatchId, new TraceHelper.DelegateLongFromRegistryFound(MatchIdFromFileFound), mtch)) { // Put breakpoint here to catch certain match by mtch.MatchId } #endif SearchMatchImp(hsMatches, lMatchesToSync, mtch, dfm); } } ct.AddEvent("Search Completed"); for (int i = 0; i < lMatchesToSync.Count;) { IMatchVw matchView = lMatchesToSync[i]; if (!hsMatches.Contains(matchView)) { lMatchesToSync.RemoveAt(i); } else { i++; } } ct.AddEvent("Remove Completed"); } } ct.AddEvent("Completed (Found {0} match(es))", lMatchesToSync.Count); ct.Info(m_logger); }