コード例 #1
0
 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);
 }
コード例 #2
0
            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())
                };
            }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
 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))));
 }
コード例 #5
0
 private static ParamViewModel Map(Isop.Client.Transfer.Param p)
 {
     return new ParamViewModel(p);
 }
コード例 #6
0
 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()
     };
 }
コード例 #7
0
 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());
 }
コード例 #8
0
 private static Type GetType(Isop.Client.Transfer.Param p)
 {
     return Type.GetType(p.Type);
 }
コード例 #9
0
 public ParamViewModel(Isop.Client.Transfer.Param param)
 {
     Parameter = param;
     Index = counter++;
     Type = GetType(Parameter);
 }
コード例 #10
0
 public MethodViewModel(Isop.Client.Transfer.Method m)
 {
     Method = m;
     Parameters = m.Parameters.Select(p => new ParamViewModel(p)).ToArray();
 }
コード例 #11
0
ファイル: BuildClient.cs プロジェクト: wallymathieu/isop-wpf
 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()
     };
 }
コード例 #12
0
ファイル: BuildClient.cs プロジェクト: wallymathieu/isop-wpf
            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())
                };
            }