コード例 #1
0
        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();
                }
            }
        }
コード例 #2
0
        public IncidentItemList(Gatherer infoGatherer, CFAIncidentSource ParentSource, CFAIncidentSourceOptions ProgOptions)
        {
            mToolTipString = "";
            mInfoGatherer = infoGatherer;

            mParentSource = ParentSource;

            mProgramOptions = ProgOptions;
        }
コード例 #3
0
        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;
        }
コード例 #4
0
        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;
        }
コード例 #5
0
        public IncidentItem(string Region, string Suburb, string Location, DateTime LastUpdate,
            IncidentType Type, IncidentStatus Status, int ApplianceCount, string Size,
            string ID, string Latitude, string Longitude, string AgencyResponsible, CFAIncidentSource parent, CFAIncidentSourceOptions options)
        {
            mRegion = Region;
            Region_GENERIC = Region.ToString();

            mSuburb = Suburb;
            Suburb_GENERIC = Suburb;

            mLocation = Location;
            Location_GENERIC = Location;

            mLatitude = Latitude;
            mLongitude = Longitude;

            mLastUpdate = LastUpdate;
            LastUpdate_GENERIC = LastUpdate;

            mResponsible = AgencyResponsible;

            mIncidentType = Type;
            Type_GENERIC = IncidentItem.IncidentTypeToString(Type);

            mIncidentStatus = Status;
            Status_GENERIC = IncidentItem.IncidentStatusToString(Status);

            mApplianceCount = ApplianceCount;
            ApplianceCount_GENERIC = ApplianceCount;

            mIncidentSize = Size;
            Size_GENERIC = Size;

            mIncidentID = ID;
            ID_GENERIC = SourceConstants.ID_PREFIX + ID;

            mParent = parent;
            mOptions = options;
        }
コード例 #6
0
 public Gatherer( CFAIncidentSourceOptions progOpts, CFAIncidentSource parent)
 {
     mProgramOptions = progOpts;
     mParent = parent;
 }
コード例 #7
0
        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;
        }
コード例 #8
0
        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;
        }
コード例 #9
0
        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;
        }
コード例 #10
0
        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;
        }
コード例 #11
0
        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;
        }