public MainApplicationContext(int port) { // init tray icon var menuItems = new MenuItem[] { new MenuItem("Exit", Exit), }; trayIcon = new NotifyIcon() { Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location), ContextMenu = new ContextMenu(menuItems), Visible = true, Text = "Remote Desktop Server v0.1.0" }; // init input simulation input = new InputSimulator(); // star socket dispatcher = Dispatcher.CurrentDispatcher; socket = new DataSocket(NetworkTypes.Server); socket.ConnectedCallback += Socket_ConnectedCallback; socket.DisconnectedCallback += Socket_DisconnectedCallback; socket.ConnectionFailedCallback += Socket_ConnectionFailedCallback; socket.DataRecievedCallback += Socket_DataRecievedCallback; socket.StartDataRecievedCallback += Socket_StartDataRecievedCallback; socket.EndDataRecievedCallback += Socket_EndDataRecievedCallback; socket.Listen(IPAddress.Any, port); // start network discovery networkDiscovery = new NetworkDiscovery(NetworkTypes.Server); networkDiscovery.Register("SimpleRemoteDesktop", port); }
public MainApplicationContext() { // init tray icon var menuItems = new MenuItem[] { new MenuItem("Exit", Exit), }; trayIcon = new NotifyIcon() { Icon = Icon.ExtractAssociatedIcon(Assembly.GetExecutingAssembly().Location), ContextMenu = new ContextMenu(menuItems), Visible = true, Text = "Remote Desktop Server v0.1.0" }; dispatcher = Dispatcher.CurrentDispatcher; // 重複するコードがあとで実行されるかひとまず置いておく // get screen to catpure var screens = Screen.AllScreens; var screen = (screenIndex < screens.Length) ? screens[screenIndex] : screens[0]; screenRect = screen.Bounds; if (GlobalConfiguration.isStdOutOff) { Utils.setStdoutOff(); } if (GlobalConfiguration.isUseFFMPEG) { kickFFMPEG(); } if (GlobalConfiguration.isEnableImageStreaming || GlobalConfiguration.isEnableInputDeviceController) { //// start TCP socket listen for image server socket = new DataSocket(NetworkTypes.Server); socket.ConnectedCallback += Socket_ConnectedCallback; socket.DisconnectedCallback += Socket_DisconnectedCallback; socket.ConnectionFailedCallback += Socket_ConnectionFailedCallback; socket.DataRecievedCallback += Socket_DataRecievedCallback; socket.StartDataRecievedCallback += Socket_StartDataRecievedCallback; socket.EndDataRecievedCallback += Socket_EndDataRecievedCallback; //socket.Listen(IPAddress.Parse(GlobalConfiguration.ServerAddress), GlobalConfiguration.ImageAndInputServerPort); socket.Listen(IPAddress.Any, GlobalConfiguration.ImageAndInputServerPort); if (GlobalConfiguration.isEnableInputDeviceController) { input = new InputSimulator(); } } // 音声配信サーバ if (GlobalConfiguration.isEnableSoundStreaming) { cap_streamer = new CaptureSoundStreamer(); } }