/// <summary> /// Update properties according to the config from server /// </summary> /// <param name="config">The config that had gotten from server</param> public void UpdateAppConfig(TCPEventArgs config) { string information = config.Args; JObject manager = JObject.Parse(information); string str = (string)manager["handlerPaths"]; List <string> str2 = JsonConvert.DeserializeObject <List <string> >(str); ThumbnailSize = (manager["thumbnailSize"]).ToString(); OutputDirectory = (string)manager["outputDir"]; LogName = (string)manager["logName"]; SourceName = (string)manager["eventSourceName"]; //This type of CollectionView does not support changes to its SourceCollection //from a thread different from the Dispatcher thread. App.Current.Dispatcher.Invoke(new Action(() => { foreach (string handler in str2) { Listhandlers.Add(handler); } })); }
/// <summary> /// Update properties according to the config from server /// </summary> /// <param name="config">The config that had gotten from server</param> public void UpdateAppConfig(TCPEventArgs config) { try { string information = config.Args; JObject manager = JObject.Parse(information); string str = (string)manager["handlerPaths"]; List <string> str2 = JsonConvert.DeserializeObject <List <string> >(str); ThumbnailSize = (manager["thumbnailSize"]).ToString(); OutputDirectory = (string)manager["outputDir"]; LogName = (string)manager["logName"]; SourceName = (string)manager["eventSourceName"]; foreach (string handler in str2) { Listhandlers.Add(handler); } alreadyGotConfig = true; } catch { } }