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); }
public RadarSettingInfo(RadarConnection radar) { _radar = radar; RadarAddressEve = new RadarAddressEvent(RadarAddress); _regionSettingInfo = PlottingAreaSettingInfomation.Instance; _regionSettingInfo.PropertyChanged += _regionSettingInfo_PropertyChanged; IsEnable = radar.IsEnable; }
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; } }
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"); }
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("雷达配置保存失败!"); } }
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); }
public RadarAddressEvent(RadarConnection radar) : base(radar) { }