示例#1
0
        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());
            }
        }
示例#2
0
 void updateSource(TrackSourceInfo source)
 {
     if (OnSourceChanged != null)
     {
         OnSourceChanged(source);
     }
 }
示例#3
0
 private void updateShowFromSource(TrackSourceInfo source)
 {
     if (updateSourceData(source))
     {
         updateRunningStatus(source);
     }
 }
示例#4
0
        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);
                }
            }
        }
示例#5
0
        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);
        }
示例#6
0
        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);
                }
            }
        }
示例#7
0
 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());
     }
 }
示例#8
0
        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);
            }
        }
示例#9
0
 public bool AreEqual(TrackSourceInfo source)
 {
     return(source != null && Type == source.Type && Setting == source.Setting && IsEnable == source.IsEnable && Remarks == source.Remarks && IsVisible == source.IsVisible);
 }