private async void updateRunningStatus(TrackSourceInfo source) { try { TrackType type = (TrackType)Enum.Parse(typeof(TrackType), source.Type); int index = (int)type; if (index >= _trackSources.Length) { return; } await System.Threading.Tasks.Task.Yield(); if (!source.IsEnable) { removeTrackSource(index); } else { UpdateTrackSource(source, type, index); } } catch (Exception ex) { LogService.Error(ex.ToString()); } }
void updateSource(TrackSourceInfo source) { if (OnSourceChanged != null) { OnSourceChanged(source); } }
private void updateShowFromSource(TrackSourceInfo source) { if (updateSourceData(source)) { updateRunningStatus(source); } }
private void updateSubRpcFromSource(TrackSourceInfo source, string defaultConfig = "") { string config = string.IsNullOrWhiteSpace(source.Setting) ? defaultConfig : source.Setting; string[] datas = config.Split(','); RadarMuxerClient client = new RadarMuxerClient(datas[0], datas[1]); if (client.ShowDialog().Value) { source.Setting = client.SubEndpoint + "," + client.RpcEndpoint; if (source.IsEnable) { updateSource(source); } } }
private bool updateSourceData(TrackSourceInfo source) { var s = _sources[source.Uid - 1]; if (s.Type != source.Type)//类型不同 { return(false); } bool canUpdateShow = s.Setting != source.Setting || s.IsEnable != source.IsEnable || s.IsVisible != source.IsVisible; if (!s.AreEqual(source)) { _sources[source.Uid - 1] = source.Clone(); saveConfig(); } return(canUpdateShow); }
private void updateUrlFromSource(TrackSourceInfo source, string defaultConfig = "") { string config = source.Setting; if (string.IsNullOrWhiteSpace(config)) { config = defaultConfig; } StringSettingClient menu = new StringSettingClient(config, "Url配置:"); if (menu.ShowDialog().Value) { source.Setting = menu.Data; if (source.IsEnable) { updateSource(source); } } }
private void UpdateTrackSource(TrackSourceInfo source, TrackType type, int index) { try { if (_trackSources[index] == null) { _trackSources[index] = TrackDrawerSource.NewTrackDrawer(type, _locatorAndLimit); this.Children.Add(_trackSources[index]); if (type == TrackType.视酷VTS) { Canvas.SetZIndex(_trackSources[index], 100); } } _trackSources[index].SetSetting(source.Setting); _trackSources[index].IsVisibility = source.IsVisible; } catch (Exception ex) { LogService.Error(ex.ToString()); } }
private void updateIpPortFromSource(TrackSourceInfo source, ConfigBase defaultConfig) { string config = string.IsNullOrWhiteSpace(source.Setting) ? defaultConfig.ToString() : source.Setting; string[] datas = config.Split(','); System.Windows.Interop.HwndSource winformWindow = (System.Windows.Interop.HwndSource.FromDependencyObject(this) as System.Windows.Interop.HwndSource); var client = new IpPortSettingClient(datas[0], datas[1], source.Type + "配置"); if (client.ShowDialog().Value&& source.Setting != client.Ip + "," + client.Port) { source.Setting = client.Ip + "," + client.Port; if (string.IsNullOrWhiteSpace(client.Ip) || string.IsNullOrWhiteSpace(client.Port)) { source.IsEnable = false; } if (string.IsNullOrWhiteSpace(client.Ip) && string.IsNullOrWhiteSpace(client.Port)) { source.Setting = null; } updateSource(source); } }
public bool AreEqual(TrackSourceInfo source) { return(source != null && Type == source.Type && Setting == source.Setting && IsEnable == source.IsEnable && Remarks == source.Remarks && IsVisible == source.IsVisible); }