예제 #1
0
        public bool Add(RadarConnection radar)
        {
            for (int i = 0; i < _radars.Count; i++)
            {
                if (_radars[i].RadarAddress.IsSquels(radar))
                {
                    DialogResult msgBox = MessageBox.Show("已包含相同的数据来源,是否继续?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button2);
                    if (msgBox == DialogResult.Yes)
                    {
                        break;
                    }
                    if (msgBox == DialogResult.No)
                    {
                        return(false);
                    }
                }
            }
            RadarSettingInfo info = new RadarSettingInfo(radar);

            _radars.Add(info);
            ChangedMuster.Add(new OperatingQueue()
            {
                Status = RadarChangedStatus.新增, Id = _radars.Count - 1
            });
            FirePropertyChanged("AddRadar");
            return(true);
        }
예제 #2
0
 public RadarSettingInfo(RadarConnection radar)
 {
     _radar             = radar;
     RadarAddressEve    = new RadarAddressEvent(RadarAddress);
     _regionSettingInfo = PlottingAreaSettingInfomation.Instance;
     _regionSettingInfo.PropertyChanged += _regionSettingInfo_PropertyChanged;
     IsEnable = radar.IsEnable;
 }
예제 #3
0
        private void btAdd_Click(object sender, RoutedEventArgs e)
        {
            var winAdd = new ConfigConnectionSettingClient("新增雷达设置", new RadarConnection());

            if (winAdd.ShowDialog().Value)
            {
                RadarConnection radarConnection = new RadarConnection()
                {
                    Ip = winAdd.Config.Ip, Port = winAdd.Config.Port, RpcEndPoint = winAdd.Config.RpcEndPoint
                };
                _radarsInfo.Add(radarConnection);
                _radarsInfo.Save();
                radarsListView.SelectedIndex = _radarsInfo.Count - 1;
            }
        }
예제 #4
0
        public void Reset()
        {
            ChangedMuster.Clear();
            _radars.Clear();
            var config = ConfigFile <RadarConnection[]> .FromFile(ConfigPath);

            if (config == null)
            {
                config = new RadarConnection[0];
            }
            for (int i = 0; i < config.Length; i++)
            {
                RadarSettingInfo radar = new RadarSettingInfo(config[i]);
                _radars.Add(radar);
            }
            FirePropertyChanged("ReadAllConfig");
        }
예제 #5
0
        public void Save()
        {
            try
            {
                RadarConnection[] config = new RadarConnection[_radars.Count];
                for (int i = 0; i < _radars.Count; i++)
                {
                    config[i] = _radars[i].RadarAddress;
                }
                ConfigFile <RadarConnection[]> .SaveToFile(ConfigPath, config);

                LogService.InfoFormat("雷达配置保存成功");
            }
            catch (Exception ex)
            {
                LogService.Error(ex.ToString());
                MessageBox.Show("雷达配置保存失败!");
            }
        }
예제 #6
0
        bool isChangedRadarAddress()
        {
            var config = ConfigFile <RadarConnection[]> .FromFile(ConfigPath);

            if (config == null)
            {
                config = new RadarConnection[0];
            }
            if (config.Length != _radars.Count)
            {
                return(true);
            }
            for (int i = 0; i < _radars.Count; i++)
            {
                if (!_radars[i].RadarAddress.IsSquels(config[i]))
                {
                    return(true);
                }
            }
            return(false);
        }
예제 #7
0
 public RadarAddressEvent(RadarConnection radar)
     : base(radar)
 {
 }