示例#1
0
 private static void AddStonehengeInternalProperties(ICollection <string> data, ActiveViewModel activeVm)
 {
     if (!string.IsNullOrEmpty(activeVm.MessageBoxTitle) || !string.IsNullOrEmpty(activeVm.MessageBoxText))
     {
         var title  = activeVm.MessageBoxTitle;
         var text   = activeVm.MessageBoxText;
         var script = $"alert('{HttpUtility.JavaScriptStringEncode(title)}\\r\\n{HttpUtility.JavaScriptStringEncode(text)}');";
         data.Add($"\"StonehengeEval\":{JsonSerializer.SerializeObjectString(null, script)}");
         activeVm.MessageBoxTitle = null;
         activeVm.MessageBoxText  = null;
     }
     if (!string.IsNullOrEmpty(activeVm.NavigateToRoute))
     {
         var route = activeVm.NavigateToRoute;
         data.Add($"\"StonehengeNavigate\":{JsonSerializer.SerializeObjectString(null, route)}");
         activeVm.NavigateToRoute = null;
     }
     else if (!string.IsNullOrEmpty(activeVm.ClientScript))
     {
         var script = activeVm.ClientScript;
         data.Add($"\"StonehengeEval\":{JsonSerializer.SerializeObjectString(null, script)}");
         activeVm.ClientScript = null;
     }
 }
示例#2
0
 // ReSharper disable once MemberCanBePrivate.Global
 public Notify(ActiveViewModel viewModel, string name, T value)
 {
     _viewModel = viewModel;
     _name      = name;
     _value     = value;
 }
 protected void SetParent(ActiveViewModel parent)
 {
     PropertyChanged += (sender, args) => parent.NotifyPropertyChanged(args.PropertyName);
 }
示例#4
0
 // ReSharper disable once UnusedMember.Global
 public Notify(ActiveViewModel viewModel, string name)
 // ReSharper disable once IntroduceOptionalParameters.Global
     : this(viewModel, name, default)
 {
 }