本文整理汇总了C#中HttpServer.init方法的典型用法代码示例。如果您正苦于以下问题:C# HttpServer.init方法的具体用法?C# HttpServer.init怎么用?C# HttpServer.init使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类HttpServer
的用法示例。
在下文中一共展示了HttpServer.init方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_Loaded
private async void Page_Loaded(object sender, RoutedEventArgs e)
{
// declare connection port
const int port = 8001;
// create new server instance
HttpServer server = new HttpServer(port);
// remove login function
server.removeLogin = true;
// Made some operation on server connected
server.Connected += Server_Connected;
// Create a custom page interface for virtual page
server.customPageInterface = new CustomPage();
// define a default page
HttpServerPage defPage = new HttpServerPage("index.html", null);
// Add to pages map
server.pagesMap.Add(defPage);
// Add other dynamic page to list, page with only html page not need to add
server.pagesMap.Add(new HttpServerPage("login.html", new login()));
server.pagesMap.Add(new HttpServerPage("settings.html", new settings()));
//set the default page
server.defaultpage = defPage;
// init server
await server.init();
}