public MainControl() { long time = 50; this.InitializeComponent(); Logger.Source = "Shotclock"; string configFileName = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + "\\Shotclock.config"; try { Configuration myConfig = new Configuration(configFileName); theUrl = myConfig["URL"]; time = Int64.Parse(myConfig["refreshTime"]); theAttentionTime = Int64.Parse(myConfig["attentionTime"]); } catch(Exception e) { Logger.Log("Could not read config file or property not present'" + configFileName + "': " + e.Message, EventLogEntryType.Error, Logger.Type.InitFailure); } //create a new thread theRetriever = new ShotclockRetriever(this.Dispatcher, Update, time, theUrl); URL.Text = theUrl; }
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 = ""; 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"]; } 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"; } if (zeroSubstitutionImageFile == "") { zeroSubstitutionImageFile = baseFolder + @"/Images/s0.png"; } // Initialise source InitImageSource(BGIMG, backgroundImageFile ); InitImageSource(HOME_SUBSTITUTE_IMAGE, zeroSubstitutionImageFile); InitImageSource(GUEST_SUBSTITUTE_IMAGE, zeroSubstitutionImageFile); BitmapImage mySource = new BitmapImage(); }