Esempio n. 1
0
        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);
            });
        }
Esempio n. 2
0
        public static void Start()
        {
            if (Server.Listening)
            {
                return;
            }

            Server.Start();
            Log.Information($"Server started at port {Port}.");
        }
Esempio n. 3
0
        public AppContext()
        {
            _uiDispatcher = Dispatcher.CurrentDispatcher;
            InitializeUI();

            WallpaperApi.Initlize(_uiDispatcher);
            AppManager.CultureChanged += LanService_CultureChanged;
            SetMenuText();
            _ = Task.Run(() =>
            {
                int port = GetPort();
                ServerWrapper.Start(port);
            });
            CheckMutex();
        }