예제 #1
0
 public async Task AddContent(string Token, string Studio, string NameContent)
 {
     if (await ModelContent.AddContent(Token, Studio, NameContent))
     {
         Response.StatusCode = Ok().StatusCode;
     }
     else
     {
         Response.StatusCode = BadRequest().StatusCode;
     }
 }
예제 #2
0
        /// <summary>
        /// Load the specified item.
        /// </summary>
        /// <param name="item">Item.</param>
        private void Load(PackageItem item)
        {
            if (!Content.CanResolve(item.Type))
            {
                throw new ContentLoadException(string.Format("No resolver for type : {0}", item.Type.FullName));
            }

            var resolver = Content.FindResolver(item.Type);
            var obj      = resolver.Load(item.ByteArray);

            if (obj == null)
            {
                throw new ContentLoadException(string.Format("Failed to load an item of the package : {0} - {1}", item.Key, item.Type.FullName));
            }

            Content.AddContent(item.Key, obj);
        }
        public HcduContent()
        {
            MainWindowPrototype     = new WindowPrototype();
            MainWindowPrototype.Url = "index.html";

            MenuPrototype toolsMenu = new MenuPrototype {
                Text = "Tools"
            };

            MainWindowPrototype.Menu.Add(toolsMenu);

            toolsMenu.Items.Add(new MenuPrototype {
                Text = "Home Page", OnAction = wh => { Container.NavigateTo(wh, MainWindowPrototype.Url); }
            });
            toolsMenu.Items.Add(new MenuPrototype {
                Text = "Angular Material Website", OnAction = wh => { Container.NavigateTo(wh, "https://material.angularjs.org"); }
            });
            toolsMenu.Items.Add(new MenuPrototype {
                Text = "Developer tools", OnAction = wh => { Container.ShowDevTools(wh); }
            });
            toolsMenu.Items.Add(new MenuPrototype {
                Text = "Reload", OnAction = wh => { Container.ReloadPage(wh); }
            });
            toolsMenu.Items.Add(new MenuPrototype {
                Text = "Resources List", OnAction = wh => { Container.NavigateTo(wh, DebugPages.ResourcesListUrl); }
            });

            Content.AddContent(typeof(HcduContent).Assembly, "HCDU.Content.Web");
            Content.AddMethod("rest/cars/boxter", () => new Car {
                Model = "Porsche Boxster", Year = 1996
            });
            Content.AddMethod <Car>("rest/exception", () => { throw new Exception("Test Exception"); });
            Content.AddMethod("rest/selectFolder", () => SelectFolder(false));
            Content.AddMethod("rest/selectNewFolder", () => SelectFolder(true));
            Content.AddMethod("rest/showCustomDialog", ShowCustomDialog);
            Content.AddMethod("rest/closeCustomDialog", CloseCustomDialog);
            Content.AddMethod("rest/backend-events/increment", BackendEventsIncrement);
            Content.AddMethod("rest/backend-events/increment5Sec", BackendEventsIncrement5Sec);

            Sockets.AddSocketProvider("ws/backend-events", stateSocket);
            stateSocket.State = backendEventsCounter;

            //todo: use more generic way of combining packages?
            DebugPages.AppendTo(Content);
        }