示例#1
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);
            }
        }