public MainControl() { long aTime = 50; this.InitializeComponent(); Logger.Source = "Scoreboard"; string configFilename = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Scoreboard.config"; try { Configuration configuration = new Configuration(configFilename); this.theScoreboardUrl = configuration["ScoreboardURL"]; this.theTimeclockUrl = configuration["TimeclockURL"]; this.theShotclockUrl = configuration["ShotclockURL"]; aTime = long.Parse(configuration["refreshTime"]); this.theAttentionTime = long.Parse(configuration["attentionTime"]); this.homePrimaryColor = configuration[nameof(homePrimaryColor)]; this.homeSecundaryColor = configuration[nameof(homeSecundaryColor)]; this.guestPrimaryColor = configuration[nameof(guestPrimaryColor)]; this.guestSecundaryColor = configuration[nameof(guestSecundaryColor)]; } catch (Exception ex) { Logger.Log("Could not read config file or property not present'" + configFilename + "': " + ex.Message, EventLogEntryType.Error, 1); } if (this.theScoreboardUrl != "") { this.theScoreboardRetriever = new ScoreboardRetriever(this.Dispatcher, new Action <ScoreboardResponse>(this.ScoreboardUpdate), aTime, this.theScoreboardUrl); } if (this.theTimeclockUrl != "") { this.theTimeclockRetriever = new TimeclockRetriever(this.Dispatcher, new Action <TimeclockResponse>(this.TimeclockUpdate), aTime, this.theTimeclockUrl); } if (this.theShotclockUrl != "") { this.theShotclockRetriever = new ShotclockRetriever(this.Dispatcher, new Action <ShotclockResponse>(this.ShotclockUpdate), aTime, this.theShotclockUrl); } if (this.homePrimaryColor != "") { this.HOMETEAMCOLOR.Fill = (Brush) new BrushConverter().ConvertFrom((object)this.homePrimaryColor); } if (this.homeSecundaryColor != "") { this.HOMETEAM2NDCOLOR.Background = (Brush) new BrushConverter().ConvertFrom((object)this.homeSecundaryColor); } if (this.guestPrimaryColor != "") { this.GUESTTEAMCOLOR.Fill = (Brush) new BrushConverter().ConvertFrom((object)this.guestPrimaryColor); } if (!(this.guestSecundaryColor != "")) { return; } this.GUESTTEAM2NDCOLOR.Background = (Brush) new BrushConverter().ConvertFrom((object)this.guestSecundaryColor); }
public MainControl() { long time = 50; this.InitializeComponent(); Logger.Source = "Scoreboard"; string baseFolder = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string configFileName = baseFolder + "\\Scoreboard.config"; string backgroundImageFile = ""; // string zeroSubstitutionImageFile = ""; string substitutionInfo = "yes"; try { Configuration myConfig = new Configuration(configFileName); theScoreboardUrl = myConfig["ScoreboardURL"]; theTimeclockUrl = myConfig["TimeclockURL"]; theShotclockUrl = myConfig["ShotclockURL"]; time = Int64.Parse(myConfig["refreshTime"]); theAttentionTime = Int64.Parse(myConfig["attentionTime"]); backgroundImageFile = myConfig["backgroundImageFile"]; // zeroSubstitutionImageFile = myConfig["zeroSubstitutionImageFile"]; substitutionInfo = myConfig["substitutionInfo"]; } catch(Exception e) { Logger.Log("Could not read config file or property not present'" + configFileName + "': " + e.Message, EventLogEntryType.Error, Logger.Type.InitFailure); } if (theScoreboardUrl != "") { theScoreboardRetriever = new ScoreboardRetriever(this.Dispatcher, ScoreboardUpdate, time, theScoreboardUrl); } if (theTimeclockUrl != "") { theTimeclockRetriever = new TimeclockRetriever(this.Dispatcher, TimeclockUpdate, time, theTimeclockUrl); } if (theShotclockUrl != "") { theShotclockRetriever = new ShotclockRetriever(this.Dispatcher, ShotclockUpdate, time, theShotclockUrl); } if (backgroundImageFile == "") { backgroundImageFile = baseFolder + @"/Images/scoreboard.png"; } // Initialise source InitImageSource(BGIMG, backgroundImageFile ); BitmapImage mySource = new BitmapImage(); theShotclockStdColor = SHOTCLOCK.Fill; }