Esempio n. 1
0
 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     host = new WebHost();
     host.Setting(o =>
     {
         o.SetDebug();
         o.Port         = 8082;
         o.LogLevel     = EventArgs.LogType.Error;
         o.WriteLog     = true;
         o.LogToConsole = true;
     })
     .Initialize(s =>
     {
         //注册程序集中所有控制器
         //s.Register(typeof(MainWindow).Assembly);
         //把当前窗体注册为​控制器
         s.ActionFactory.Register(this);
         //注册Vue文件资源
         s.GetWebFamily().AddAssemblies(typeof(MainWindow).Assembly);
         //s.GetWebFamily().AddScript("echarts.js"); //添加javascript文件
         //s.GetWebFamily().AddCss("website.css"); //添加css文件
         s.Vue().Debug();
     }).Completed(s =>
     {
         this.Dispatcher.Invoke(() =>
         {
             if (webView != null && webView.CoreWebView2 != null)
             {
                 webView.CoreWebView2.Navigate("http://localhost:8082/");
             }
         });
     });
     host.Run(true);
 }
Esempio n. 2
0
        static void Main(string[] args)
        {
            WebHost host = new WebHost();

            host.IsWindowsServices = true;
            WebHost.Title          = "Service Management";
            WebHost.HeaderModel    = "beetlex-process-header";
            WebHost.HomeModel      = "beetlex-process-home";
            WebHost.TabsEnabled    = false;
            host.RegisterComponent <Program>();
            host.RegisterComponent <BeetleX.ServicesProcess.ProcessCenter>();
            host.UseFontawesome();
            host.UseElement(PageStyle.Element);
            host.Setting(o =>
            {
                o.SetDebug();
                o.Port     = 80;
                o.LogLevel = LogType.Info;
            });
            host.Initialize((http, vue, rec) =>
            {
                BeetleX.ServicesProcess.WebController controller = new BeetleX.ServicesProcess.WebController();
                controller.Init(new logHandler(http));
                http.ActionFactory.Register(controller, new BeetleX.FastHttpApi.ControllerAttribute {
                    BaseUrl = "process"
                });
                rec.AddCss("website.css");
                vue.Debug();
            });
            host.Run();
        }
Esempio n. 3
0
        static void Main(string[] args)
        {
            WebHost host = new WebHost();

            host.Setting(o =>
            {
                o.SetDebug();
                o.Port         = 80;
                o.LogLevel     = EventArgs.LogType.Info;
                o.LogToConsole = true;
            })
            .RegisterComponent <Program>()
            .Run();
        }
Esempio n. 4
0
        static void Main(string[] args)
        {
            WebHost host = new WebHost();

            host.RegisterComponent <Program>();
            host.UserElasticSearch("test_query_string", "http://192.168.2.19:9200");
            host.UseEFCore <BlogDBContext>();
            host.Setting(o =>
            {
                o.Port         = 80;
                o.LogLevel     = EventArgs.LogType.Info;
                o.LogToConsole = true;
            })
            .Run();
        }
Esempio n. 5
0
        static void Main(string[] args)
        {
            var host = new WebHost();

            host.Setting(o =>
            {
                o.SetDebug();
            })
            .UseFontawesome()
            .Initialize((http, vue, rec) =>
            {
                rec.AddAssemblies(typeof(Program).Assembly);
                vue.Debug();
            });
            host.Run();
        }
Esempio n. 6
0
        static void Main(string[] args)
        {
            WebHost host = new WebHost();

            WebHost.Title     = "Beetlex WebFamily";
            WebHost.HomeModel = "webfamily-md";
            WebHost.HomeName  = "Markdown";
            WebHost.Login     = false;
            host.RegisterComponent <Program>();
            host.UseToastUIEditor();
            host.Setting(o =>
            {
                o.SetDebug();
                o.Port         = 80;
                o.LogLevel     = EventArgs.LogType.Info;
                o.LogToConsole = true;
            })
            .UseElement(PageStyle.Element)
            .Initialize((http, vue, resoure) =>
            {
                resoure.AddCss("website.css");
                vue.Debug();
            }).Run();
        }
Esempio n. 7
0
        static void Main(string[] args)
        {
            WebHost host = new WebHost();

            WebHost.HomeModel = "webfamily-files";


            host.Setting(o =>
            {
                o.SetDebug();
                o.Port         = 80;
                o.LogLevel     = EventArgs.LogType.Info;
                o.LogToConsole = true;
            })
            .UseFileManager(o =>
            {
                o.MaxSize = 1024 * 1024 * 1024;
            })
            .UseElement(PageStyle.Element)
            .Initialize((http, vue, resoure) =>
            {
                vue.Debug();
            }).Run();
        }
Esempio n. 8
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            host = new WebHost();
            host.Setting(o =>
            {
                o.SetDebug();
                o.Port         = 8082;
                o.LogLevel     = EventArgs.LogType.Error;
                o.WriteLog     = true;
                o.LogToConsole = true;
            })
            .UseEFCore <NorthwindContext>()
            .UseJWT()
            .Initialize(s =>
            {
                s.ActionFactory.Register(this);
                s.GetWebFamily().AddScript("echarts.js");
                s.GetWebFamily().AddCss("website.css");
                s.Vue().Debug();
                WebHost.LoginHandler = (user, pwd, context) =>
                {
                    context.SetJwtToken(user, "user", 60 * 60);
                    return(Task.CompletedTask);
                };
                WebHost.Title       = "Northwind";
                WebHost.HeaderModel = "myheader";
                WebHost.MustLogin   = true;
                WebHost.HomeModel   = "home";

                WebHost.GetMenus = (user, role, context) =>
                {
                    List <Menu> menus = new List <Menu>();
                    var item          = new Menu();
                    item.ID           = "home";
                    item.Name         = "主页";
                    item.Img          = "/images/home.png";
                    item.Model        = "home";
                    menus.Add(item);

                    item       = new Menu();
                    item.ID    = "product";
                    item.Name  = "产品";
                    item.Img   = "/images/product.png";
                    item.Model = "products";
                    menus.Add(item);

                    item       = new Menu();
                    item.ID    = "order";
                    item.Name  = "订单";
                    item.Img   = "/images/order.png";
                    item.Model = "orders";
                    menus.Add(item);

                    item       = new Menu();
                    item.ID    = "customer";
                    item.Name  = "客户";
                    item.Img   = "/images/customer.png";
                    item.Model = "customers";
                    menus.Add(item);

                    item       = new Menu();
                    item.ID    = "employee";
                    item.Name  = "雇员";
                    item.Img   = "/images/employee.png";
                    item.Model = "employees";
                    menus.Add(item);

                    return(Task.FromResult(menus));
                };
            }).Completed(s =>
            {
                this.Dispatcher.Invoke(() =>
                {
                    if (webView != null && webView.CoreWebView2 != null)
                    {
                        webView.CoreWebView2.Navigate("http://localhost:8082/");
                    }
                });
            });
            host.Run(true);
        }
Esempio n. 9
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            host = new WebHost();
            host.Setting(o =>
            {
                o.SetDebug();
                o.Port         = 8082;
                o.LogLevel     = EventArgs.LogType.Error;
                o.WriteLog     = true;
                o.LogToConsole = true;
            })
            .UseEFCore <NorthwindContext>()
            .UseJWT()
            .UseFontawesome()
            .UseElement(PageStyle.ElementDashboard)
            .Initialize((http, vue, rec) =>
            {
                rec.AddAssemblies(typeof(MainWindow).Assembly);
                http.ActionFactory.Register(this);
                rec.AddScript("echarts.js");
                rec.AddCss("website.css");
                vue.Debug();
                WebHost.LoginHandler = (user, pwd, context) =>
                {
                    object token = context.SetJwtToken(user, "user", 60 * 60);
                    return(Task.FromResult(token));
                };
                WebHost.Title       = "Northwind";
                WebHost.HeaderModel = "myheader";
                WebHost.Login       = true;
                WebHost.HomeModel   = "home";

                WebHost.GetMenus = (user, role, context) =>
                {
                    List <Menu> menus = new List <Menu>();
                    var item          = new Menu();
                    item.ID           = "home";
                    item.Name         = "主页";
                    item.Img          = "fas fa-home";
                    item.Model        = "home";
                    menus.Add(item);

                    item       = new Menu();
                    item.ID    = "product";
                    item.Name  = "产品";
                    item.Img   = "fas fa-box";
                    item.Model = "products";
                    menus.Add(item);

                    item       = new Menu();
                    item.ID    = "order";
                    item.Name  = "订单";
                    item.Img   = "fas fa-shopping-cart";
                    item.Model = "orders";
                    menus.Add(item);

                    item       = new Menu();
                    item.ID    = "customer";
                    item.Name  = "客户";
                    item.Img   = "fas fa-hospital-user";
                    item.Model = "customers";
                    menus.Add(item);

                    item       = new Menu();
                    item.ID    = "employee";
                    item.Name  = "雇员";
                    item.Img   = "fas fa-users";
                    item.Model = "employees";
                    menus.Add(item);

                    return(Task.FromResult(menus));
                };
            }).Completed(s =>
            {
                this.Dispatcher.Invoke(() =>
                {
                    if (webView != null && webView.CoreWebView2 != null)
                    {
                        webView.CoreWebView2.Navigate("http://localhost:8082/");
                    }
                });
            });
            host.Run(true);
        }