public RootViewModel(IClient isopClient = null, Isop.Client.Transfer.Root root = null) { this.isopClient = isopClient; this.root = root = root ?? new Isop.Client.Transfer.Root(); GlobalParameters = new ObservableCollection<ParamViewModel>((root.GlobalParameters ?? new Isop.Client.Transfer.Param[0]).Select(Map)); Controllers = new ObservableCollection<ControllerViewModel>((root.Controllers ?? new Isop.Client.Transfer.Controller[0]).Select(Map)); singleEventHandlerScope = new SingleScopeOnly(); GlobalParameters.RegisterPropertyChanged(globalValueChanged); }
private static Method Method(Build that, Isop.Domain.Controller type, Isop.Domain.Method m) { var @params = m.GetArguments().Select(p => new Param(p.Type, p.Name, p.Required)).ToArray(); var help = that.Controller(type.Name).Action(m.Name).Help(); return new Method(m.Name, type.Name, help) { Parameters = new List<Param>(@params.ToArray()) }; }
public void Accept(Isop.Client.Transfer.Root res) { root = res; foreach (var pvm in res.GlobalParameters.Select(Map)) { GlobalParameters.Add(pvm); } foreach (var cvm in res.Controllers.Select(Map)) { Controllers.Add(cvm); } }
private async Task<JsonResponse> Invoke(Isop.Client.Transfer.Method method, Dictionary<string, string> form, Func<Request.Configure, Request.Configure> action) { var uri = new Uri(BasePath); var url = uri.Scheme + "://" + uri.Host + (uri.IsDefaultPort ? "" : ":" + uri.Port); return await JsonClient.Request(new Request(url + method.Url, r => action(r.Post().Form(form)))); }
private static ParamViewModel Map(Isop.Client.Transfer.Param p) { return new ParamViewModel(p); }
private ControllerViewModel Map(Isop.Client.Transfer.Controller c) { return new Isop.Gui.ViewModels.ControllerViewModel() { Name = c.Name, Methods = c.Methods.Select(m => new MethodViewModel(m)).ToArray() }; }
private static Isop.Server.Models.Controller Controller(Build that, Isop.Domain.Controller type) { return new Isop.Server.Models.Controller(type.Name, type.GetControllerActionMethods().Select(m => Method(that, type, m)).ToArray()); }
private static Type GetType(Isop.Client.Transfer.Param p) { return Type.GetType(p.Type); }
public ParamViewModel(Isop.Client.Transfer.Param param) { Parameter = param; Index = counter++; Type = GetType(Parameter); }
public MethodViewModel(Isop.Client.Transfer.Method m) { Method = m; Parameters = m.Parameters.Select(p => new ParamViewModel(p)).ToArray(); }
private static Controller Controller(Build that, Isop.Domain.Controller type) { return new Controller { Name = type.Name, Methods = type.GetControllerActionMethods().Select(m => Method(that, type, m)).ToArray() }; }
private static Method Method(Build that, Isop.Domain.Controller type, Isop.Domain.Method m) { var @params = m.GetArguments().Select(p => new Param { Type = typeof(string).FullName, Name = p.Name, Required = p.Required }).ToArray(); return new Method { Name = m.Name, ClassName = type.Name, Help = that.Controller(type.Name).Action(m.Name).Help(), Parameters = new List<Param>(@params.ToArray()) }; }