/// <summary> /// Constructor /// </summary> /// <param name="MPythonLibrary"> The python library class</param> public ConfigReader(IPythonLibrary pythonLibrary) { try { //assign by ref the class level variable from the argument variable MPythonLibrary = pythonLibrary; } catch (Exception) { throw;//In case of an error then throws it up the stack trace } }
/// <summary> /// Method: OnStart /// Triggers when the windows service starts /// </summary> /// <param name="args"></param> protected override void OnStart(string[] args) { try { //Initialize anew instance of the timer class mTimer = new Timer(); //Get timer interval from app.config double timerInterval; timerInterval = Convert.ToDouble(ConfigurationManager.AppSettings["timer_interval"].ToString()); this.mTimer.Interval = timerInterval; /* * Wire timer elapsed event to the timer tick handler * Occurs when the interval elapses */ this.mTimer.Elapsed += new System.Timers.ElapsedEventHandler(this.mTimer_Tick); //Enable the timer to whether to raise the elapsed event mTimer.Enabled = true; /* * Get instance of IPythonLibrary class * Contains propoerties and methods to help with execution */ MPythonLibrary = new PythonLibrary(); //Write to log file indicating GIS service has started successfully. iPythonLibrary.WriteErrorLog("ULIMS GIS Synchonization Service started"); } catch (Exception ex) { iPythonLibrary.WriteErrorLog(ex);//Write error to log file } }