private void InitializeAppContextComponent() { _components = new System.ComponentModel.Container(); _contextMenu = new ContextMenuStrip(); _btnMainUI = new ToolStripMenuItem() { Text = "打开Web控制台" }; _btnMainUI.Click += BtnMainUI_Click; _contextMenu.Items.Add(_btnMainUI); _btnExit = new ToolStripMenuItem { Text = "退出", }; _btnExit.Click += BtnExit_Click; _contextMenu.Items.Add(_btnExit); _notifyIcon = new NotifyIcon(_components) { Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location), ContextMenuStrip = _contextMenu, Text = "巨应壁纸", Visible = true }; _notifyIcon.MouseClick += new MouseEventHandler(NotifyIcon_MouseClick); WallpaperApi.Initlize(Dispatcher.CurrentDispatcher); Task.Run(() => { int port = GetPort(); ServerWrapper.Start(port); }); }
public static void Start() { if (Server.Listening) { return; } Server.Start(); Log.Information($"Server started at port {Port}."); }
public AppContext() { _uiDispatcher = Dispatcher.CurrentDispatcher; InitializeUI(); WallpaperApi.Initlize(_uiDispatcher); AppManager.CultureChanged += LanService_CultureChanged; SetMenuText(); _ = Task.Run(() => { int port = GetPort(); ServerWrapper.Start(port); }); CheckMutex(); }