예제 #1
0
    protected override void ModifyComposerWindow(ComposerViewModel vm)
    {
      JToken jsonFile = OriginalJsonValue[MasonProperties.ControlProperties.JsonFile];
      if (jsonFile != null)
        vm.JsonPartName = jsonFile.Value<string>();

      JArray files = OriginalJsonValue[MasonProperties.ControlProperties.Files] as JArray;
      if (files != null)
      {
        foreach (JObject file in files.OfType<JObject>())
        {
          ComposerFileViewModel fileVm = new ComposerFileViewModel(vm);
          fileVm.Name = GetValue<string>(file, MasonProperties.ControlPartProperties.Name);
          fileVm.Title = GetValue<string>(file, MasonProperties.ControlPartProperties.Title);
          fileVm.Description = GetValue<string>(file, MasonProperties.ControlPartProperties.Description);
          vm.Files.Add(fileVm);
        }
      }
    }
예제 #2
0
    public static void OpenComposerWindow(
      Window owner, 
      ViewModel parent, 
      string method, 
      string url, 
      bool? isHrefTemplate = null,
      string body = null,
      string actionType = null,
      string description = null,
      string title = null,
      Action<ComposerViewModel> modifier = null,
      StartFocus focus = StartFocus.Method)
    {
      ComposerViewModel vm = new ComposerViewModel(parent);
      if (method != null)
        vm.Method = method;
      if (url != null)
        vm.Url = url;
      if (isHrefTemplate != null)
        vm.IsHRefTemplate = isHrefTemplate.Value;
      if (body != null)
        vm.Body = body;
      if (actionType != null)
        vm.SelectedType = actionType;
      if (description != null)
        vm.Description = description;
      if (title != null)
        vm.Title = title;

      vm.WindowTitle = title ?? "Request composer";

      if (modifier != null)
        modifier(vm);

      ComposerWindow w = new ComposerWindow(vm, focus);
      w.Owner = owner;
      w.ShowDialog();
    }
예제 #3
0
 protected virtual void ModifyComposerWindow(ComposerViewModel vm)
 {
 }
예제 #4
0
 public ComposerWindow(ComposerViewModel vm, StartFocus focus)
 {
   InitializeComponent();
   DataContext = vm;
   Loaded += (s,e) => ComposerWindow_Loaded(focus);
 }