public AddDefenceWindow(Camera cam, Channel ch) { this.DataContext = this; this.InitializeComponent(); this.Loaded += new RoutedEventHandler(AddDefenceWindow_Loaded); dm = this.FindResource("DefenceViewModelDataSource") as DefenceViewModel; selectedChannel = ch; selectedCamera = cam; WeekList = new ObservableCollection<string>(); TimeList = new ObservableCollection<string>(); // 在此点之下插入创建对象所需的代码。 }
public Defence queryDefenceByChannel(Camera cam, Channel ch) { DefencePara dp = new DefencePara(); dp.vsId = cam.id.ToString(); dp.behId = ch.Id.ToString(); string jsonStr = JsonConvert.SerializeObject(dp); string jsonResult = sDefence.findByParams(jsonStr); JObject jo = (JObject)JsonConvert.DeserializeObject(jsonResult); JToken jt = jo["retObj"]; foreach (JToken bToken in jt) { Defence d = JsonConvert.DeserializeObject<Defence>(bToken.ToString()); return d; } return null; }
public Behaviour queryBehaviourByChannel(Channel channel) { string retStr = sBehaviour.findByCcId(channel.Id.ToString()); System.Diagnostics.Debug.WriteLine(retStr); JObject jo = (JObject)JsonConvert.DeserializeObject(retStr); JToken jt = jo["retObj"]; Behaviour beh = JsonConvert.DeserializeObject<Behaviour>(jt.ToString()); if (beh != null) { //beh.chn = channel; } return beh; }