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); } } }
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(); }
protected virtual void ModifyComposerWindow(ComposerViewModel vm) { }
public ComposerWindow(ComposerViewModel vm, StartFocus focus) { InitializeComponent(); DataContext = vm; Loaded += (s,e) => ComposerWindow_Loaded(focus); }