public WatchNotification(IncidentItem inciItem, IWatchList parent, CFAIncidentSourceOptions progOptions, CFAIncidentSource ParentSource) { InitializeComponent(); mIncidentItem = inciItem; mParent = parent; mProgramOptions = progOptions; mParentSource = ParentSource; mfFadeOut = true; if (inciItem.Responsible == "DSE") { //Swap the background image this.BackgroundImage = dseImageDummy.BackgroundImage; } //Check if a stream exists for this region if (String.IsNullOrEmpty(mProgramOptions.GetRegionStream(mIncidentItem.Region)) == true || String.IsNullOrEmpty(mParentSource.GetIncidentWatcher().GetStreamListenerPath()) == true) { btn2.Visible = false; } else { btn2.Visible = true; //If we have it set to open the stream if (mParentSource.GetIncidentWatcher().GetAutoOpenStreamOnWatch() == true) { OpenStream(); } } }
public static bool CheckAppliances(IncidentItem newIncident,CFAIncidentSource ParentSource, CFAIncidentSourceOptions progOptions) { if (progOptions.AutoWatchApplianceCount == 0) return false; //Get the integer of the Appliance Setting if (newIncident.ApplianceCount >= progOptions.AutoWatchApplianceCount) return true; return false; }
public static bool CheckAddress(IncidentItem newIncident, CFAIncidentSource ParentSource, CFAIncidentSourceOptions progOptions) { //Check for empty or null list of string if (progOptions.AutoWatchAddresses == null) return false; if (progOptions.AutoWatchAddresses.Count == 0) return false; //Compare each string, taking into account wildcards foreach (string address in progOptions.AutoWatchAddresses) { bool fStartWild = false, fEndWild = false; string compString = address; if (address.StartsWith("*") == true) { compString = address.Remove(0, 1); fStartWild = true; } if (address.EndsWith("*") == true) { compString = compString.TrimEnd('*'); fEndWild = true; } if (fStartWild == false && fEndWild == false) { //Complete compare if (compString.ToLower() == newIncident.Location.ToLower()) return true; } else if (fStartWild == true && fEndWild == false) { //Ends with suburb if (newIncident.Location.ToLower().EndsWith(compString.ToLower()) == true) return true; } else if (fStartWild == true && fEndWild == true) { //Has suburb in it if (newIncident.Location.ToLower().Contains(compString.ToLower()) == true) return true; } else if (fStartWild == false && fEndWild == true) { //Starts with suburb if (newIncident.Location.ToLower().StartsWith(compString.ToLower()) == true) return true; } } return false; }
private void InciTypeChanged(IncidentItem incidentItem, IncidentItem.IncidentType oldValue) { UpdateDialog(); }
private void InciSuburbChanged(IncidentItem incidentItem, string oldValue) { UpdateDialog(); }
private void InciStatusChanged(IncidentItem incidentItem, IncidentItem.IncidentStatus oldValue) { //Is it now safe?? if (incidentItem.Status == IncidentItem.IncidentStatus.Safe) { //Do we want to auto close? if (mParentSource.GetIncidentWatcher().GetAutoCloseWatchOnSafe() == true) { //Is there a time delay if (mParentSource.GetIncidentWatcher().GetAutoCloseWatchOnSafeDelay() > 0) { //Start the timer tmrNotification.Interval = mParentSource.GetIncidentWatcher().GetAutoCloseWatchOnSafeDelay() * 1000; tmrNotification.Start(); } else { //Otherwise Remove this incident item from watch /*if (mParent.IsKeyBeingWatched(mIncidentItem.ID_GENERIC) == true) { mParent.Remove(mIncidentItem.ID_GENERIC); }*/ } } } UpdateDialog(); }
private void InciLocationChanged(IncidentItem incidentItem, string oldValue) { UpdateDialog(); }
private void InciLastUpdateChanged(IncidentItem incidentItem, DateTime oldValue) { UpdateDialog(); }
private void InciApplianceChanged( IncidentItem incidentItem, int oldValue ) { UpdateDialog(); }
public String ReplaceInciWatchVarsInString(String oldString, IncidentItem incidentItem) { String returnString; returnString = oldString; //Do Replaces //ID returnString = returnString.Replace("%ID%", incidentItem.ID); //SUBURB returnString = returnString.Replace("%SUBURB%", incidentItem.Suburb); //REGION returnString = returnString.Replace("%REGION%", incidentItem.Region.ToString()); //ADDR returnString = returnString.Replace("%ADDR%", incidentItem.Location); //TYPE returnString = returnString.Replace("%TYPE%", incidentItem.Type.ToString()); //STREAM returnString = returnString.Replace("%STREAM%", this.GetRegionStream(incidentItem.Region)); //STATUS returnString = returnString.Replace("%STATUS%", incidentItem.Status.ToString()); //SIZE returnString = returnString.Replace("%SIZE%", incidentItem.Size.ToString()); //LAST Updated returnString = returnString.Replace("%LASTUP%", incidentItem.LastUpdate.ToString("yyyy-MM-dd_HH-mm-ss")); //APPLIANCE returnString = returnString.Replace("%APPLIANCES%", incidentItem.ApplianceCount.ToString()); //CURTIME returnString = returnString.Replace("%CURTIME%", DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss")); //Return adjusted string return returnString; }
public static bool CheckRegion(IncidentItem newIncident,CFAIncidentSource ParentSource, CFAIncidentSourceOptions progOptions) { if (progOptions.AutoWatchRegions == null) return false; if (progOptions.AutoWatchRegions.Count == 0) return false; //Get the list of regions foreach (string region in progOptions.AutoWatchRegions) { if (region == newIncident.Region) { //Its a match return true return true; } } return false; }
public static bool ShouldWeAutoWatch(IncidentItem checkIncident, CFAIncidentSource ParentSource, CFAIncidentSourceOptions progOptions) { //If any of the conditions hold true add the watch bool fAddWatch = false; //Suburb if (fAddWatch != true) { fAddWatch = CheckSuburb(checkIncident,ParentSource,progOptions); } //Address if (fAddWatch != true) { fAddWatch = CheckAddress(checkIncident, ParentSource, progOptions); } //Types if (fAddWatch != true) { fAddWatch = CheckTypes(checkIncident, ParentSource, progOptions); } //Status if (fAddWatch != true) { fAddWatch = CheckStatus(checkIncident, ParentSource, progOptions); } //Region if (fAddWatch != true) { fAddWatch = CheckRegion(checkIncident, ParentSource, progOptions); } //Appliances if (fAddWatch != true) { fAddWatch = CheckAppliances(checkIncident, ParentSource, progOptions); } //Size if (fAddWatch != true) { fAddWatch = CheckSize(checkIncident, ParentSource, progOptions); } if (checkIncident.Status == IncidentItem.IncidentStatus.Safe) { //Force Dont Watch fAddWatch = false; } //Return the detail return fAddWatch; }
public static bool CheckTypes(IncidentItem newIncident, CFAIncidentSource ParentSource, CFAIncidentSourceOptions progOptions) { //Check for null and empty list if (progOptions.AutoWatchTypes == null) return false; if (progOptions.AutoWatchTypes.Count == 0) return false; //Compare each item foreach (string inciType in progOptions.AutoWatchTypes) { if (IncidentItem.ParseIncidentType(inciType) == newIncident.Type) return true; } return false; }
public static bool CheckStatus(IncidentItem newIncident, CFAIncidentSource ParentSource, CFAIncidentSourceOptions progOptions) { //Check for null list or empty list if (progOptions.AutoWatchStatuses == null) return false; if (progOptions.AutoWatchStatuses.Count == 0) return false; //Compare all the strings foreach (string status in progOptions.AutoWatchStatuses) { if (IncidentItem.ParseIncidentStatus(status) == newIncident.Status) return true; } return false; }
public static bool CheckSize(IncidentItem newIncident, CFAIncidentSource ParentSource, CFAIncidentSourceOptions progOptions) { //Get the Size if (String.IsNullOrEmpty(progOptions.AutoWatchIncidentSize) == true) return false; if (progOptions.AutoWatchIncidentSize == "Ignore") return false; //Get the incident size IncidentItem.IncidentSize inciSize = IncidentItem.ParseIncidentSize(progOptions.AutoWatchIncidentSize); //Compare if (IncidentItem.ParseIncidentSize(newIncident.Size) == inciSize) return true; return false; }