private void dtEditRadio_Click(object sender, RoutedEventArgs e)
        {
            FrameworkElement fe = sender as FrameworkElement;

            if (fe == null || fe.Tag == null)
            {
                return;
            }
            ViewModels.RadioSignalItemModel radioModel = fe.Tag as ViewModels.RadioSignalItemModel;
            if (radioModel == null)
            {
                return;
            }
            Windows.SingleRadioEditorWindow editor = new Windows.SingleRadioEditorWindow(radioModel);
            editor.ShowDialog();
        }
        public SingleRadioEditorViewModel(RadioSignalItemModel radioSignal)
        {
            if (radioSignal == null)
                throw new ArgumentNullException();

            _radioSignal = radioSignal;
            SignalingFormat = _radioSignal.SignalingFormat;
            SignalingUnitId = _radioSignal.UnitId;
            _unitName = _radioSignal.UnitName;
            _agencyName = _radioSignal.AgencyName;

            _radioTypes = new WPFCommon.ThreadSafeObservableCollection<SingleRadioEditorRadioType>();
            _radioTypes.Add(new SingleRadioEditorRadioType() { RadioType = Common.RadioTypeCode.Unknown, RadioTypeName = "<UNASSIGNED>" });
            _radioTypes.Add(new SingleRadioEditorRadioType() { RadioType = Common.RadioTypeCode.Mobile, RadioTypeName = "Mobile" });
            _radioTypes.Add(new SingleRadioEditorRadioType() { RadioType = Common.RadioTypeCode.Portable, RadioTypeName = "Portable" });
            _radioTypes.Add(new SingleRadioEditorRadioType() { RadioType = Common.RadioTypeCode.BaseStation, RadioTypeName = "Base Station" });

            _agencies = new WPFCommon.ThreadSafeObservableCollection<SingleRadioEditorAgency>();
            _agencies.Add(new SingleRadioEditorAgency() { AgencyId = Guid.Empty, AgencyName = "<UNASSIGNED>" });
            foreach (Common.AgencyInfo aInfo in RadioLog.Common.RadioInfoLookupHelper.Instance.AgencyList.OrderBy(a => a.AgencyName))
            {
                _agencies.Add(new SingleRadioEditorAgency() { AgencyId = aInfo.AgencyId, AgencyName = aInfo.AgencyName });
            }

            _units = new WPFCommon.ThreadSafeObservableCollection<SingleRadioEditorUnit>();
            _units.Add(new SingleRadioEditorUnit() { UnitId = Guid.Empty, AgencyId = Guid.Empty, UnitName = "<UNASSIGNED>" });
            foreach (Common.UnitInfo uInfo in RadioLog.Common.RadioInfoLookupHelper.Instance.UnitList.OrderBy(u => u.UnitName))
            {
                _units.Add(new SingleRadioEditorUnit() { UnitId = uInfo.UnitKeyId, AgencyId = uInfo.AgencyKeyId, UnitName = uInfo.UnitName });
            }

            if (!string.IsNullOrWhiteSpace(_radioSignal.SignalingFormat)&&!string.IsNullOrWhiteSpace(_radioSignal.UnitId))
            {
                Common.RadioInfo radioInfo = Common.RadioInfoLookupHelper.Instance.RadioList.FirstOrDefault(r => r.SignalingLookupKey == _radioSignal.SignalingLookupKey);
                if (radioInfo != null)
                {
                    _unitId = radioInfo.UnitKeyId;
                    _agencyId = radioInfo.AgencyKeyId;
                    _radioName = radioInfo.RadioName;
                    _roleName = radioInfo.RoleName;
                    _personnelName = radioInfo.PersonnelName;
                    _radioType = radioInfo.RadioType;
                    SignalingFormat = radioInfo.SignalingFormat;
                    SignalingUnitId = radioInfo.SignalingUnitId;
                }
            }
        }
        protected virtual void ProcessRadioSignalItem(RadioLog.Common.RadioSignalingItem sigItem)
        {
            if (sigItem == null)
            {
                return;
            }
            sigItem.Latitude  = Services.GeoService.Instance.CurrentLatitude;
            sigItem.Longitude = Services.GeoService.Instance.CurrentLongitude;
            Common.RadioInfoLookupHelper.Instance.PerformLookupsOnRadioSignalItem(sigItem);
            if (_loggingEnabled)
            {
                _logger.LogRadioSignal(sigItem);
            }
            RadioSignalItemModel mdl = new RadioSignalItemModel(sigItem);

            MainViewModel.ProcessRadioSignal(mdl);

            SourceTitle          = mdl.Description;
            LastValidSourceTitle = mdl.Description;
        }
Exemple #4
0
        internal static void StartMaydayForRadio(string signalingLookupKey)
        {
            if (string.IsNullOrWhiteSpace(signalingLookupKey))
            {
                return;
            }
            RadioSignalItemModel rItemModel = _radioLog.FirstOrDefault(r => r.SignalingLookupKey == signalingLookupKey);

            if (rItemModel == null)
            {
                return;
            }
            EmergencyRadioSignalItemModel mdl = _emergencyRadioLog.FirstOrDefault(r => r.SignalingLookupKey == signalingLookupKey);

            if (mdl != null)
            {
                mdl.EmergencyState = Common.EmergencyState.EmergencyActive;
                mdl.StartedDT      = DateTime.Now;
                mdl.EndedDT        = null;
            }
            else
            {
                mdl = new EmergencyRadioSignalItemModel(rItemModel.RawSignalItem);
                mdl.EmergencyState = Common.EmergencyState.EmergencyActive;
                mdl.StartedDT      = DateTime.Now;
                mdl.EndedDT        = null;
                if (_emergencyRadioLog.Count > 0)
                {
                    _emergencyRadioLog.Insert(0, mdl);
                }
                else
                {
                    _emergencyRadioLog.Add(mdl);
                }
            }
            foreach (RadioSignalItemModel rItem in _radioLog.Where(r => r.SignalingLookupKey == signalingLookupKey))
            {
                rItem.EmergencyState = Common.EmergencyState.EmergencyActive;
            }
        }
Exemple #5
0
        internal static void ProcessRadioSignal(RadioSignalItemModel mdl)
        {
            if (mdl == null)
            {
                return;
            }

            _rollCallService.HandleRadioCall(mdl);

            if (_radioLog.Count > 0)
            {
                _radioLog.Insert(0, mdl);
                while (_radioLog.Count > _maxLogDisplayItems)
                {
                    _radioLog.RemoveAt(_radioLog.Count - 1);
                }
            }
            else
            {
                _radioLog.Add(mdl);
            }
            if (mdl.EmergencyState == Common.EmergencyState.EmergencyActive)
            {
                StartMaydayForRadio(mdl.SignalingLookupKey);
                if (_emergencyAlarmSound != null)
                {
                    _emergencyAlarmSound.PlaySound();
                }
            }
            else
            {
                EmergencyRadioSignalItemModel eMdl = _emergencyRadioLog.FirstOrDefault(m => m.SignalingLookupKey == mdl.SignalingLookupKey);
                if (eMdl != null)
                {
                    mdl.EmergencyState = eMdl.EmergencyState;
                }
            }
        }
Exemple #6
0
        internal static void ProcessRadioSignal(RadioSignalItemModel mdl)
        {
            if (mdl == null)
                return;

            _rollCallService.HandleRadioCall(mdl);

            if(_radioLog.Count>0)
            {
                _radioLog.Insert(0, mdl);
                while (_radioLog.Count > _maxLogDisplayItems)
                {
                    _radioLog.RemoveAt(_radioLog.Count - 1);
                }
            }
            else
            {
                _radioLog.Add(mdl);
            }
            if (mdl.EmergencyState == Common.EmergencyState.EmergencyActive)
            {
                StartMaydayForRadio(mdl.SignalingLookupKey);
                if (_emergencyAlarmSound != null)
                {
                    _emergencyAlarmSound.PlaySound();
                }
            }
            else
            {
                EmergencyRadioSignalItemModel eMdl = _emergencyRadioLog.FirstOrDefault(m => m.SignalingLookupKey == mdl.SignalingLookupKey);
                if (eMdl != null)
                {
                    mdl.EmergencyState = eMdl.EmergencyState;
                }
            }
        }
        public SingleRadioEditorViewModel(RadioSignalItemModel radioSignal)
        {
            if (radioSignal == null)
            {
                throw new ArgumentNullException();
            }

            _radioSignal    = radioSignal;
            SignalingFormat = _radioSignal.SignalingFormat;
            SignalingUnitId = _radioSignal.UnitId;
            _unitName       = _radioSignal.UnitName;
            _agencyName     = _radioSignal.AgencyName;

            _radioTypes = new WPFCommon.ThreadSafeObservableCollection <SingleRadioEditorRadioType>();
            _radioTypes.Add(new SingleRadioEditorRadioType()
            {
                RadioType = Common.RadioTypeCode.Unknown, RadioTypeName = "<UNASSIGNED>"
            });
            _radioTypes.Add(new SingleRadioEditorRadioType()
            {
                RadioType = Common.RadioTypeCode.Mobile, RadioTypeName = "Mobile"
            });
            _radioTypes.Add(new SingleRadioEditorRadioType()
            {
                RadioType = Common.RadioTypeCode.Portable, RadioTypeName = "Portable"
            });
            _radioTypes.Add(new SingleRadioEditorRadioType()
            {
                RadioType = Common.RadioTypeCode.BaseStation, RadioTypeName = "Base Station"
            });

            _agencies = new WPFCommon.ThreadSafeObservableCollection <SingleRadioEditorAgency>();
            _agencies.Add(new SingleRadioEditorAgency()
            {
                AgencyId = Guid.Empty, AgencyName = "<UNASSIGNED>"
            });
            foreach (Common.AgencyInfo aInfo in RadioLog.Common.RadioInfoLookupHelper.Instance.AgencyList.OrderBy(a => a.AgencyName))
            {
                _agencies.Add(new SingleRadioEditorAgency()
                {
                    AgencyId = aInfo.AgencyId, AgencyName = aInfo.AgencyName
                });
            }

            _units = new WPFCommon.ThreadSafeObservableCollection <SingleRadioEditorUnit>();
            _units.Add(new SingleRadioEditorUnit()
            {
                UnitId = Guid.Empty, AgencyId = Guid.Empty, UnitName = "<UNASSIGNED>"
            });
            foreach (Common.UnitInfo uInfo in RadioLog.Common.RadioInfoLookupHelper.Instance.UnitList.OrderBy(u => u.UnitName))
            {
                _units.Add(new SingleRadioEditorUnit()
                {
                    UnitId = uInfo.UnitKeyId, AgencyId = uInfo.AgencyKeyId, UnitName = uInfo.UnitName
                });
            }

            if (!string.IsNullOrWhiteSpace(_radioSignal.SignalingFormat) && !string.IsNullOrWhiteSpace(_radioSignal.UnitId))
            {
                Common.RadioInfo radioInfo = Common.RadioInfoLookupHelper.Instance.RadioList.FirstOrDefault(r => r.SignalingLookupKey == _radioSignal.SignalingLookupKey);
                if (radioInfo != null)
                {
                    _unitId         = radioInfo.UnitKeyId;
                    _agencyId       = radioInfo.AgencyKeyId;
                    _radioName      = radioInfo.RadioName;
                    _roleName       = radioInfo.RoleName;
                    _personnelName  = radioInfo.PersonnelName;
                    _radioType      = radioInfo.RadioType;
                    SignalingFormat = radioInfo.SignalingFormat;
                    SignalingUnitId = radioInfo.SignalingUnitId;
                }
            }
        }
 public void HandleRadioCall(RadioSignalItemModel rsim)
 {
     if (!_firegroundEnabled)
         return;
     if (rsim == null || rsim.RawSignalItem == null)
         return;
     HandleRadioSignal(rsim.RawSignalItem, rsim.EmergencyState);
 }