private void Update() { if (LiveMonitorsCollectionList.Count == 0 || !StationRepository.IsLiveMatchEnabled) { return; } Repository.FindMatches(Matches, "", SelectedLanguage, MatchFilter, Comparison); SplitCollection(); foreach (var match in Matches.OfType <MatchVw>()) { switch (match.SportDescriptor) { case SportSr.SPORT_DESCRIPTOR_SOCCER: match.SportIcon = ResolveImagePath.ResolvePath("LiveView/socker-ball.png").ToString(); match.BackgroundImage = ResolveImagePath.ResolvePath("LiveView/socker-fon.png").ToString(); break; case SportSr.SPORT_DESCRIPTOR_TENNIS: match.SportIcon = ResolveImagePath.ResolvePath("LiveView/tennis-ball.png").ToString(); match.BackgroundImage = ResolveImagePath.ResolvePath("LiveView/tennis-fon.png").ToString(); break; case SportSr.SPORT_DESCRIPTOR_BASKETBALL: match.SportIcon = ResolveImagePath.ResolvePath("LiveView/Basket-ball.png").ToString(); match.BackgroundImage = ResolveImagePath.ResolvePath("LiveView/Basketball-fon.png").ToString(); break; case SportSr.SPORT_DESCRIPTOR_ICE_HOCKEY: match.SportIcon = ResolveImagePath.ResolvePath("LiveView/hockey-ball.png").ToString(); match.BackgroundImage = ResolveImagePath.ResolvePath("LiveView/Hokkey-fon.png").ToString(); break; case SportSr.SPORT_DESCRIPTOR_RUGBY: match.SportIcon = ResolveImagePath.ResolvePath("LiveView/rugby-ball.png").ToString(); match.BackgroundImage = ResolveImagePath.ResolvePath("LiveView/rugby-fon.png").ToString(); break; case SportSr.SPORT_DESCRIPTOR_HANDBALL: match.SportIcon = ResolveImagePath.ResolvePath("LiveView/hand-ball.png").ToString(); match.BackgroundImage = ResolveImagePath.ResolvePath("LiveView/handball-fon.png").ToString(); break; case SportSr.SPORT_DESCRIPTOR_VOLLEYBALL: match.SportIcon = ResolveImagePath.ResolvePath("LiveView/volley-ball.png").ToString(); match.BackgroundImage = ResolveImagePath.ResolvePath("LiveView/volleyball-fon.png").ToString(); break; } } }
//private static readonly ILog Log = LogManager.GetLogger(typeof(App)); /// <summary> /// Raises the <see cref="E:System.Windows.Application.Startup"/> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.StartupEventArgs"/> that contains the event data.</param> protected override void OnStartup(StartupEventArgs e) { int id = 0; Int32.TryParse(e.Args.FirstOrDefault(), out id); //var id = Convert.ToInt32(e.Args.FirstOrDefault()); Log.Debug("start terminalwindow"); // Check how many total processes have the same name as the current one if (!IsSingleInstance()) { Environment.Exit(1); } AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; ControlAero(false); IoCContainer.Kernel = new StandardKernel(); IoCContainer.Kernel.Bind <IRepository>().To <Repository>().InSingletonScope(); IoCContainer.Kernel.Bind <IMessageStorage>().To <MessageStorage>().InSingletonScope(); IoCContainer.Kernel.Bind <IStationRepository>().To <StationRepository>().InSingletonScope(); IoCContainer.Kernel.Bind <ILineProvider>().To <OldLineProvider>().InSingletonScope(); //IoCContainer.Kernel.Bind<IWsdlRepository>().To<WcfService.WsdlRepository>().InSingletonScope(); IoCContainer.Kernel.Bind <IChangeTracker>().To <ChangeTracker>().InSingletonScope(); IoCContainer.Kernel.Bind <ILanguageRepository>().To <LanguageRepository>().InSingletonScope(); IoCContainer.Kernel.Bind <IMediator>().To <MyMessageMediator>().InSingletonScope(); IoCContainer.Kernel.Bind <IDatabaseManager>().To <DbManager>().InSingletonScope(); IoCContainer.Kernel.Bind <IWaitOverlayProvider>().To <WaitOverlayProvider>().InSingletonScope(); IoCContainer.Kernel.Bind <ISelectDate>().To <DateHelper>().InSingletonScope(); IoCContainer.Kernel.Bind <IErrorWindowService>().To <ErrorWindowService>().InSingletonScope(); IoCContainer.Kernel.Bind <IQuestionWindowService>().To <QuestionWindowService>().InSingletonScope(); IoCContainer.Kernel.Bind <ITicketHandler>().To <TicketHandler>().InSingletonScope(); IoCContainer.Kernel.Bind <ITicketActions>().To <TicketActions>().InSingletonScope(); IoCContainer.Kernel.Bind <IPrinterHandler>().To <PrinterHandler>().InSingletonScope(); IoCContainer.Kernel.Bind <IMyRegionManager>().To <MyRegionManager>().InSingletonScope(); IoCContainer.Kernel.Bind <IBusinessPropsHelper>().To <BusinessPropsHelper>().InSingletonScope(); IoCContainer.Kernel.Bind <IDataBinding>().To <DataBinding>().InSingletonScope(); IoCContainer.Kernel.Bind <IEnterPinWindowService>().To <EnterPinWindowService>().InSingletonScope(); IoCContainer.Kernel.Bind <ILiveStreamService>().To <LiveStreamService>().InSingletonScope(); IoCContainer.Kernel.Bind <ILineSr>().To <SharedLineSr>().InSingletonScope(); IoCContainer.Kernel.Bind <IConfidenceFactor>().To <ConfidenceFactor>().InSingletonScope(); IoCContainer.Kernel.Bind <ITransactionQueueHelper>().To <TransactionQueueHelper>().InSingletonScope(); IoCContainer.Kernel.Bind <ITicketSaveHandler>().To <TicketSaveHandler>().InSingletonScope(); IoCContainer.Kernel.Bind <INDEServer>().ToConstant(new NDEServer("terminal")).InSingletonScope(); IoCContainer.Kernel.Bind <IProcessExecutor>().To <ProcessExecutor>().InSingletonScope(); IoCContainer.Kernel.Bind <IStationSettings>().To <StationSettings>().InSingletonScope(); if (e.Args.Contains("testmode")) { StationRepository.IsTestMode = true; IoCContainer.Kernel.Bind <IWsdlRepository>().To <WcfService.TestWsdlRepository>().InSingletonScope(); IoCContainer.Kernel.Bind <ITranslationProvider>().To <TestDBTranslationProvider>().InSingletonScope(); DbManager.Instance.DropDatabase(true); } else { IoCContainer.Kernel.Bind <IWsdlRepository>().To <WcfService.WsdlRepository>().InSingletonScope(); IoCContainer.Kernel.Bind <ITranslationProvider>().To <DBTranslationProvider>().InSingletonScope(); } if (!Debugger.IsAttached) { Process proc2 = new Process(); // clear internet explorer cache proc2.StartInfo.FileName = "RunDll32.exe"; proc2.StartInfo.Arguments = "InetCpl.cpl,ClearMyTracksByProcess 255"; proc2.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; proc2.Start(); } //StyleHelper.CreateStyleForwardersForDefaultStyles(); var mainScreen = Screen.AllScreens.First(s => s.Primary); if (mainScreen.WorkingArea.Width < 1920) { ChangeTracker.Screen2WindowScale = (double)mainScreen.WorkingArea.Width / 1920.0d / 1.08d; } _startWindow = new StartWindow(); _startWindow.Topmost = !Debugger.IsAttached; _startWindow.Show(); if (StationRepository.StationNumber != "0000" && StationRepository.LayoutName == null) { StationRepository.Refresh(); } var LayoutName = MyRegionManager.DefaultLayout; if (!string.IsNullOrEmpty(StationRepository.LayoutName)) { LayoutName = StationRepository.LayoutName; } // TODO: Using a custom IoC container like Unity? Register it here: // Catel.IoC.ServiceLocator.Default.RegisterExternalContainer(MyUnityContainer); var foo = new Uri("pack://application:,,,/" + LayoutName + ";component/Resources/CommonStyles.xaml", UriKind.Absolute); Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = foo }); var foo2 = new Uri("pack://application:,,,/" + LayoutName + ";component/Resources/DataTemplates.xaml", UriKind.Absolute); Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = foo2 }); var foo3 = new Uri("pack://application:,,,/" + LayoutName + ";component/Resources/LiveDataTemplates.xaml", UriKind.Absolute); Application.Current.Resources.MergedDictionaries.Add(new ResourceDictionary() { Source = foo3 }); try { ResolveImagePath resolveImagePath = new ResolveImagePath(); var images = Directory.GetFiles(WorkingDirectory + ImageRelativePath + LayoutName, "*.png"); foreach (var image in images) { resolveImagePath.Path = Path.GetFileName(image); resolveImagePath.ProvideValue(null); } } catch (Exception ex) { Log.Error(ex.Message, ex); } if (id != 0) { Process[] processlist = Process.GetProcesses(); foreach (Process theprocess in processlist) { if (theprocess.Id == id) { theprocess.Kill(); break; } } } base.OnStartup(e); _startWindow.SetMessage("Initializing..."); Log.Debug("start window show"); // AppDomain.CurrentDomain.UnhandledException += AppDomainUnhandledException; try { Log.Debug("IOC kernel start"); var dispatcher = new MyDispatcher(Dispatcher.CurrentDispatcher); IoCContainer.Kernel.Bind <IDispatcher>().ToConstant <IDispatcher>(dispatcher).InSingletonScope(); if (GetRestartErrorsNumber() >= _iErrorFileMaximumEntries) { Thread.Sleep(2000); var f = new FatalCrashWindow(); f.ShowDialog(); } //STARTING IN TEST MODE Log.Debug("IOC kernel end"); //if (!System.Diagnostics.Debugger.IsAttached) //{ // SetTimeZone(0, false); //} //SetTimeZone(0, false); //_startWindow.SetMessage("Clearing Database..."); Log.Debug("clear updater files"); // check if we still have to finish Update if (File.Exists(Directory.GetCurrentDirectory().ToString() + "\\SportBetting.Updater1.exe")) { try { File.Delete(Directory.GetCurrentDirectory().ToString() + "\\SportBetting.Updater.exe"); File.Move(Directory.GetCurrentDirectory().ToString() + "\\SportBetting.Updater1.exe", Directory.GetCurrentDirectory().ToString() + "\\SportBetting.Updater.exe"); File.Delete(Directory.GetCurrentDirectory().ToString() + "\\SportBetting.Updater.pdb"); File.Move(Directory.GetCurrentDirectory().ToString() + "\\SportBetting.Updater1.pdb", Directory.GetCurrentDirectory().ToString() + "\\SportBetting.Updater.pdb"); } catch (Exception) { // } } //if (Convert.ToBoolean(ConfigurationManager.AppSettings["DoAutoUpdate"])) //{ string sVersion = string.Empty; Updater up = new Updater(); up.IsError = false; Log.Debug("updater start"); string sProcessName = System.Diagnostics.Process.GetCurrentProcess().ProcessName; string sAssemblyName = "SportBetting.WPF.Prism.exe"; if (!Debugger.IsAttached && up.DoBinariesUpdate(out sVersion, ref _autoEvent, ref _startWindow) == 1) //if (up.DoBinariesUpdate(out sVersion, ref _autoEvent, ref _startWindow) == 1) { _startWindow.SetMessage("Clearing Database..."); Log.Debug("clear db start"); Log.Debug("clear db end"); if (_autoEvent.WaitOne(420000)) //wait download complete for 60 seconds { if (!up.IsError) { // continue if there're no errors during directories copy and extraction zip file // start updater Process proc = new Process(); proc.StartInfo.FileName = Directory.GetCurrentDirectory() + "\\SportBetting.Updater.exe"; proc.StartInfo.Arguments = " " + sProcessName + "|" + sAssemblyName + "|" + sVersion; proc.StartInfo.WindowStyle = ProcessWindowStyle.Hidden; proc.Start(); Environment.Exit(0); } else { // log error while copy / extract _startWindow.SetMessage("Error while copy / extract files"); } } else { // log timeout issue // update wasn't downloaded. _startWindow.SetMessage("Update downloading timed out. Will try next time."); } } //} _startWindow.SetMessage("Starting Station. Please wait..."); Log.Debug("init db end"); //DbManager.Instance.DeleteOldObjects(); if (!InitDatabase()) { return; } Log.Debug("show wait window"); IoCContainer.Kernel.Get <IStationRepository>().LastPrintedObjects = string.Empty; var myRegionManager = IoCContainer.Kernel.Get <IMyRegionManager>(); var waitOverlay = new WaitOverlayProvider(); waitOverlay.ShowWaitOverlay(); //var mainScreen = Screen.AllScreens.First(s => s.Primary); Log.Debug("checking mode. Monitor width = " + mainScreen.WorkingArea.Width.ToString()); if ((ConfigurationManager.AppSettings["Is34Mode"] ?? string.Empty).Trim().ToLowerInvariant() == "true") { ChangeTracker.Is34Mode = true; } else if ((ConfigurationManager.AppSettings["Is34Mode"] ?? string.Empty).Trim().ToLowerInvariant() == "false") { ChangeTracker.Is34Mode = false; } else { Log.Debug("checking mode. Is34Mode not found in config"); if (mainScreen.WorkingArea.Width == 1280 && mainScreen.WorkingArea.Width > mainScreen.WorkingArea.Height) { ChangeTracker.Is34Mode = true; } else { ChangeTracker.Is34Mode = false; } } if (!ChangeTracker.Is34Mode) { if ((ConfigurationManager.AppSettings["landscape_mode"] ?? string.Empty).Trim().ToLowerInvariant() == "true") { ChangeTracker.IsLandscapeMode = true; } else if ((ConfigurationManager.AppSettings["landscape_mode"] ?? string.Empty).Trim().ToLowerInvariant() == "false") { ChangeTracker.IsLandscapeMode = false; } else { Log.Debug("checking mode. landscape_mode not found in config"); if (mainScreen.WorkingArea.Width > mainScreen.WorkingArea.Height) { ChangeTracker.IsLandscapeMode = true; } } } Log.Debug("init main window"); var mainWindowView = myRegionManager.FindWindowByViewModel <MainViewModel>(); ChangeTracker.MainWindow = mainWindowView; MaximizeWindow(ChangeTracker.MainWindow, mainScreen); //if (!bool.Parse(ConfigurationManager.AppSettings["fullscreen"])) SetWindowSettings(ChangeTracker.MainWindow); Current.MainWindow = ChangeTracker.MainWindow; Current.ShutdownMode = ShutdownMode.OnMainWindowClose; ViewObjectBase.Dispatcher = Current.MainWindow.Dispatcher; Log.Debug("close start window"); _startWindow.Close(); Current.MainWindow.Show(); Log.Debug("show main window"); // close starter window } catch (Exception ex) { HandleException(ex); } }
private void FillMatches() { lock (_locker) { FillSportsBar(); Matches = Repository.FindMatches(Matches, "", SelectedLanguage, MatchFilter, Comparison); long oldSportId = 0; for (int i = 0; i < Matches.Count; i++) { long currentSportId = Matches.ElementAt(i).TournamentView.LineObject.GroupId; if (currentSportId != oldSportId) { Matches.ElementAt(i).IsHeaderForPreMatch = true; oldSportId = currentSportId; } else { Matches.ElementAt(i).IsHeaderForPreMatch = false; } } } if (Matches.Count > 0 && MainElementsVisibility == Visibility.Visible) { switch (Matches.First().SportDescriptor) { case SportSr.SPORT_DESCRIPTOR_SOCCER: SportIcon = new ResolveImagePath("LiveView/socker-ball.png").ProvideValue(null); BackgroundImage = new ResolveImagePath("LiveView/socker-fon.png").ProvideValue(null); SportColor = new LinearGradientBrush() { StartPoint = new System.Windows.Point(0, 0), EndPoint = new System.Windows.Point(0, 1) }; SportColor.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#FF3F8145"), 1)); SportColor.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#FF90C696"), 0)); SportColor.Freeze(); SportName = string.Format("{0} / {1}", TranslationProvider.Translate(MultistringTags.TERMINAL_FORM_SOCCER) as string, Matches.First().TournamentNameToShow); break; case SportSr.SPORT_DESCRIPTOR_BASKETBALL: SportIcon = new ResolveImagePath("LiveView/Basket-ball.png").ProvideValue(null); BackgroundImage = new ResolveImagePath("LiveView/Basketball-fon.png").ProvideValue(null); SportColor = new LinearGradientBrush() { StartPoint = new System.Windows.Point(0, 0), EndPoint = new System.Windows.Point(0, 1) }; SportColor.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#AF6828"), 1)); SportColor.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#D8A362"), 0)); SportColor.Freeze(); SportName = string.Format("{0} / {1}", TranslationProvider.Translate(MultistringTags.TERMINAL_FORM_BASKETBALL) as string, Matches.First().TournamentNameToShow); break; case SportSr.SPORT_DESCRIPTOR_ICE_HOCKEY: SportIcon = new ResolveImagePath("LiveView/hockey-ball.png").ProvideValue(null); BackgroundImage = new ResolveImagePath("LiveView/Hokkey-fon.png").ProvideValue(null); SportColor = new LinearGradientBrush() { StartPoint = new System.Windows.Point(0, 0), EndPoint = new System.Windows.Point(0, 1) }; SportColor.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#1A5181"), 1)); SportColor.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#73B0D8"), 0)); SportColor.Freeze(); SportName = string.Format("{0} / {1}", TranslationProvider.Translate(MultistringTags.TERMINAL_FORM_ICEHOCKEY) as string, Matches.First().TournamentNameToShow); break; case SportSr.SPORT_DESCRIPTOR_TENNIS: SportIcon = new ResolveImagePath("LiveView/tennis-ball.png").ProvideValue(null); BackgroundImage = new ResolveImagePath("LiveView/tennis-fon.png").ProvideValue(null); SportColor = new LinearGradientBrush() { StartPoint = new System.Windows.Point(0, 0), EndPoint = new System.Windows.Point(0, 1) }; SportColor.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#979F0D"), 1)); SportColor.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#DDE04A"), 0)); SportColor.Freeze(); SportName = string.Format("{0} / {1}", TranslationProvider.Translate(MultistringTags.TERMINAL_FORM_TENNIS) as string, Matches.First().TournamentNameToShow); break; case SportSr.SPORT_DESCRIPTOR_HANDBALL: SportIcon = new ResolveImagePath("LiveView/hand-ball.png").ProvideValue(null); BackgroundImage = new ResolveImagePath("LiveView/handball-fon.png").ProvideValue(null); SportColor = new LinearGradientBrush() { StartPoint = new System.Windows.Point(0, 0), EndPoint = new System.Windows.Point(0, 1) }; SportColor.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#C8C8CA"), 1)); SportColor.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#F4F4F4"), 0)); SportColor.Freeze(); SportName = string.Format("{0} / {1}", "Handball", Matches.First().TournamentNameToShow); //SportName = TranslationProvider.Translate(MultistringTags.TERMINAL_FORM_HANDBALL) as string; break; case SportSr.SPORT_DESCRIPTOR_RUGBY: SportIcon = new ResolveImagePath("LiveView/rugby-ball.png").ProvideValue(null); BackgroundImage = new ResolveImagePath("LiveView/rugby-fon.png").ProvideValue(null); SportColor = new LinearGradientBrush() { StartPoint = new System.Windows.Point(0, 0), EndPoint = new System.Windows.Point(0, 1) }; SportColor.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#963D2D"), 1)); SportColor.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#989E98"), 0)); SportColor.Freeze(); //SportName = TranslationProvider.Translate(MultistringTags.TERMINAL_FORM_RUGBY) as string; SportName = string.Format("{0} / {1}", "Rugby", Matches.First().TournamentNameToShow); break; case SportSr.SPORT_DESCRIPTOR_VOLLEYBALL: SportIcon = new ResolveImagePath("LiveView/volley-ball.png").ProvideValue(null); BackgroundImage = new ResolveImagePath("LiveView/volleyball-fon.png").ProvideValue(null); SportColor = new LinearGradientBrush() { StartPoint = new System.Windows.Point(0, 0), EndPoint = new System.Windows.Point(0, 1) }; SportColor.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#3685D3"), 1)); SportColor.GradientStops.Add(new GradientStop((Color)ColorConverter.ConvertFromString("#FDC903"), 0)); SportColor.Freeze(); //SportName = TranslationProvider.Translate(MultistringTags.TERMINAL_FORM_VOLLEYBALL) as string; SportName = string.Format("{0} / {1}", "Volleyball", Matches.First().TournamentNameToShow); break; } } SoccerMatches = new SortableObservableCollection <IMatchVw>(Matches.Where(a => a.SportDescriptor == SportSr.SPORT_DESCRIPTOR_SOCCER)); TennisMatches = new SortableObservableCollection <IMatchVw>(Matches.Where(a => a.SportDescriptor == SportSr.SPORT_DESCRIPTOR_TENNIS)); BasketballMatches = new SortableObservableCollection <IMatchVw>(Matches.Where(a => a.SportDescriptor == SportSr.SPORT_DESCRIPTOR_BASKETBALL)); HockeyMatches = new SortableObservableCollection <IMatchVw>(Matches.Where(a => a.SportDescriptor == SportSr.SPORT_DESCRIPTOR_ICE_HOCKEY)); RugbyMatches = new SortableObservableCollection <IMatchVw>(Matches.Where(a => a.SportDescriptor == SportSr.SPORT_DESCRIPTOR_RUGBY)); VolleyballMatches = new SortableObservableCollection <IMatchVw>(Matches.Where(a => a.SportDescriptor == SportSr.SPORT_DESCRIPTOR_VOLLEYBALL)); HandballMatches = new SortableObservableCollection <IMatchVw>(Matches.Where(a => a.SportDescriptor == SportSr.SPORT_DESCRIPTOR_HANDBALL)); SoccerVisibility = SoccerMatches.Count == 0 ? Visibility.Collapsed : Visibility.Visible; TennisVisibility = TennisMatches.Count == 0 ? Visibility.Collapsed : Visibility.Visible; BasketballVisibility = BasketballMatches.Count == 0 ? Visibility.Collapsed : Visibility.Visible; HockeyVisibility = HockeyMatches.Count == 0 ? Visibility.Collapsed : Visibility.Visible; RugbyVisibility = RugbyMatches.Count == 0 ? Visibility.Collapsed : Visibility.Visible; VolleyballVisibility = VolleyballMatches.Count == 0 ? Visibility.Collapsed : Visibility.Visible; HandballVisibility = HandballMatches.Count == 0 ? Visibility.Collapsed : Visibility.Visible; }
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { object image = null; if (parameter != null) { if (parameter.ToString() == SportSr.SPORT_DESCRIPTOR_ICE_HOCKEY) { image = ResolveImagePath.ResolvePath("IceHockey2.png"); } if (parameter.ToString() == SportSr.SPORT_DESCRIPTOR_SOCCER) { image = ResolveImagePath.ResolvePath("Soccer.png"); } if (parameter.ToString() == SportSr.SPORT_DESCRIPTOR_BASKETBALL) { image = ResolveImagePath.ResolvePath("Basketball.png"); } if (parameter.ToString() == SportSr.SPORT_DESCRIPTOR_BASEBALL) { image = ResolveImagePath.ResolvePath("Baseball.png"); } if (parameter.ToString() == SportSr.SPORT_DESCRIPTOR_MIXED) { image = ResolveImagePath.ResolvePath("MixedSports.png"); } if (parameter.ToString() == SportSr.SPORT_DESCRIPTOR_TENNIS) { image = ResolveImagePath.ResolvePath("Tennis.png"); } if (parameter.ToString() == SportSr.SPORT_DESCRIPTOR_RUGBY) { image = ResolveImagePath.ResolvePath("Rugby_new.png"); } if (parameter.ToString() == SportSr.SPORT_DESCRIPTOR_HANDBALL) { image = ResolveImagePath.ResolvePath("Handball.png"); } if (parameter.ToString() == SportSr.SPORT_DESCRIPTOR_VOLLEYBALL) { image = ResolveImagePath.ResolvePath("Volleyball.png"); } if (parameter.ToString() == SportSr.SPORT_DESCRIPTOR_FOOTBALL) { image = ResolveImagePath.ResolvePath("AmericanFootball.png"); } if (parameter.ToString() == SportSr.SPORT_DESCRIPTOR_MOTOSPORT) { image = ResolveImagePath.ResolvePath("MotoSport.png"); } if (parameter.ToString() == SportSr.SPORT_DESCRIPTOR_WINTERSPORTS) { image = ResolveImagePath.ResolvePath("winter_sports_icon.png"); } if (parameter.ToString() == SportSr.SPORT_DESCRIPTOR_DARTS) { image = ResolveImagePath.ResolvePath("Darts.png"); } if (parameter.ToString() == SportSr.SPORT_DESCRIPTOR_OLYMPICS) { image = ResolveImagePath.ResolvePath("olympics-icon.png"); } if (parameter.ToString() == SportSr.SPORT_DESCRIPTOR_SNOOKER) { image = ResolveImagePath.ResolvePath("Snooker.png"); } } else { if (value != null) { if (value.ToString() == SportSr.SPORT_DESCRIPTOR_ICE_HOCKEY) { image = ResolveImagePath.ResolvePath("IceHockey2.png"); } if (value.ToString() == SportSr.SPORT_DESCRIPTOR_SOCCER) { image = ResolveImagePath.ResolvePath("Soccer.png"); } if (value.ToString() == SportSr.SPORT_DESCRIPTOR_BASKETBALL) { image = ResolveImagePath.ResolvePath("Basketball.png"); } if (value.ToString() == SportSr.SPORT_DESCRIPTOR_BASEBALL) { image = ResolveImagePath.ResolvePath("Baseball.png"); } if (value.ToString() == SportSr.SPORT_DESCRIPTOR_MIXED) { image = ResolveImagePath.ResolvePath("MixedSports.png"); } if (value.ToString() == SportSr.SPORT_DESCRIPTOR_TENNIS) { image = ResolveImagePath.ResolvePath("Tennis.png"); } if (value.ToString() == SportSr.SPORT_DESCRIPTOR_RUGBY) { image = ResolveImagePath.ResolvePath("Rugby_new.png"); } if (value.ToString() == SportSr.SPORT_DESCRIPTOR_HANDBALL) { image = ResolveImagePath.ResolvePath("Handball.png"); } if (value.ToString() == SportSr.SPORT_DESCRIPTOR_VOLLEYBALL) { image = ResolveImagePath.ResolvePath("Volleyball.png"); } if (value.ToString() == SportSr.SPORT_DESCRIPTOR_FOOTBALL) { image = ResolveImagePath.ResolvePath("AmericanFootball.png"); } if (value.ToString() == SportSr.SPORT_DESCRIPTOR_MOTOSPORT) { image = ResolveImagePath.ResolvePath("MotoSport.png"); } if (value.ToString() == SportSr.SPORT_DESCRIPTOR_WINTERSPORTS) { image = ResolveImagePath.ResolvePath("winter_sports_icon.png"); } if (value.ToString() == SportSr.SPORT_DESCRIPTOR_DARTS) { image = ResolveImagePath.ResolvePath("Darts.png"); } if (value.ToString() == SportSr.SPORT_DESCRIPTOR_OLYMPICS) { image = ResolveImagePath.ResolvePath("olympics-icon.png"); } if (value.ToString() == SportSr.SPORT_DESCRIPTOR_SNOOKER) { image = ResolveImagePath.ResolvePath("Snooker.png"); } } } return(image); }
private void OnSearchExecute(string searchString) { Log.Info(String.Format("Search string: {0}", ChangeTracker.SearchString)); var sport = ChangeTracker.SearchSelectedSport; var tournament = ChangeTracker.SearchSelectedTournament; PleaseWaitSearch(); SportName = Sports.FirstOrDefault().Name; TournamentName = Tournaments.FirstOrDefault().Name; if (Matches.Count > 0) { ResultsVisibility = Visibility.Visible; var match = (MatchVw)Matches.FirstOrDefault(); LiveColor = match.LiveColor; LiveGradientColor = match.LiveGradientColor; switch (match.SportDescriptor) { case SportSr.SPORT_DESCRIPTOR_SOCCER: SportIcon = new ResolveImagePath("LiveView/socker-ball.png").ProvideValue(null); BackgroundImage = new ResolveImagePath("LiveView/socker-fon.png").ProvideValue(null); break; case SportSr.SPORT_DESCRIPTOR_BASKETBALL: SportIcon = new ResolveImagePath("LiveView/Basket-ball.png").ProvideValue(null); BackgroundImage = new ResolveImagePath("LiveView/Basketball-fon.png").ProvideValue(null); break; case SportSr.SPORT_DESCRIPTOR_ICE_HOCKEY: SportIcon = new ResolveImagePath("LiveView/hockey-ball.png").ProvideValue(null); BackgroundImage = new ResolveImagePath("LiveView/Hokkey-fon.png").ProvideValue(null); break; case SportSr.SPORT_DESCRIPTOR_TENNIS: SportIcon = new ResolveImagePath("LiveView/tennis-ball.png").ProvideValue(null); BackgroundImage = new ResolveImagePath("LiveView/tennis-fon.png").ProvideValue(null); break; case SportSr.SPORT_DESCRIPTOR_HANDBALL: SportIcon = new ResolveImagePath("LiveView/hand-ball.png").ProvideValue(null); BackgroundImage = new ResolveImagePath("LiveView/handball-fon.png").ProvideValue(null); break; case SportSr.SPORT_DESCRIPTOR_RUGBY: SportIcon = new ResolveImagePath("LiveView/rugby-ball.png").ProvideValue(null); BackgroundImage = new ResolveImagePath("LiveView/rugby-fon.png").ProvideValue(null); break; case SportSr.SPORT_DESCRIPTOR_VOLLEYBALL: SportIcon = new ResolveImagePath("LiveView/volley-ball.png").ProvideValue(null); BackgroundImage = new ResolveImagePath("LiveView/volleyball-fon.png").ProvideValue(null); break; } } else { ResultsVisibility = Visibility.Collapsed; } if (searchString == "Back") { SelectedSport = Sports.FirstOrDefault(x => x.Id.Equals(sport.Id)); SelectedTournament = Tournaments.FirstOrDefault(x => x.Id.Equals(tournament.Id)); } }