public DialogResult ShowOptions(InciWatchOptions progOptions, CurrentIncidentsForm parentForm) { mProgramOptions = progOptions; mParentForm = parentForm; return this.ShowDialog(); }
//Events public CurrentIncidentsForm() { InitializeComponent(); //Create a new Options object mProgramOptions = new InciWatchOptions(); mWatchList = new WatchList(this, mProgramOptions); //Sources mIncidentSources = new List<IIncidentSource>(); //Load Sources LoadIncidentSourcesFromPath(); //If we have no sources it wont be very interesting if (mIncidentSources.Count == 0) { //hide and dispose the notification icon ntfyCurrentIncidents.Visible = false; ntfyCurrentIncidents.Dispose(); MessageBox.Show("No Incident Sources were able to be loaded. Please add some Incident Source Dlls into the program folder.", AppConstants.ApplicationFriendlyName, MessageBoxButtons.OK, MessageBoxIcon.Error); //Close us throw new ArgumentException("No Incident Sources Loaded"); } //Update incident Sources foreach (IIncidentSource inciSource in mIncidentSources) { if (inciSource.UpdateSource() == false) { //Should we show an error message? if (mProgramOptions.ShowCantUpdateMessage == true) { //Show Error Message Box MessageBox.Show("Error updating source " + inciSource.GetSourceName(), AppConstants.ApplicationFriendlyName, MessageBoxButtons.OK, MessageBoxIcon.Error); } } } //Update Notify Text ntfyCurrentIncidents.Text = "Incident Watcher - Updated " + DateTime.Now.ToLongTimeString(); this.Text = "Current Incidents - Updated " + DateTime.Now.ToLongTimeString(); //Set the timer interval refreshTimer.Interval = mProgramOptions.GathererRefreshInterval * 1000; }