示例#1
0
 private void RefreshTargetList(string targetJsonStr)
 {
     using (var memStream = new MemoryStream(Encoding.UTF8.GetBytes(targetJsonStr)))
     {
         var serializer = new DataContractJsonSerializer(typeof(HashSet <WOLTarget>));
         var targets    = serializer.ReadObject(memStream) as HashSet <WOLTarget>;
         WOLTargets.Clear();
         foreach (var m in targets)
         {
             WOLTargets.Add(m);
         }
         RaisePropertyChanged(nameof(WOLTargets));
     }
 }
        private void OnModelPropertyChanged(object sender, PropertyChangedEventArgs args)
        {
            switch (args.PropertyName)
            {
            case nameof(StatusMessage):
                StatusMessage = EditorModel.StatusMessage;
                break;

            case nameof(WOLTargets):
                WOLTargets.Clear();
                foreach (var m in EditorModel.WOLTargets)
                {
                    WOLTargets.Add(m);
                }
                RaisePropertyChanged(nameof(WOLTargets));
                break;

            default:
                break;
            }
        }