Exemple #1
0
        private void OnStart(object arg)
        {
            if (arg is Model.RemoteDeviceType type)
            {
                if (server != null)
                {
                    StopServer();
                }
                Model.IDeviceOption option = null;
                if (type == Model.RemoteDeviceType.Bluetooth)
                {
                    option = new Model.BluetoothOption
                    {
                        ServiceClass = ServiceClass.Information,
                        ServiceName  = "RemoteController",
                    };
                }
                else
                {
                    option = new Model.SocketOption()
                    {
                        EndPoint = new IPEndPoint(IPAddress.Any, 40580)
                    };
                }

                server = new RemoteServer(option);
                ScreenConfiguration screens = server.Screens.ScreenConfiguration;
                screens.Added   += ScreensAdded;
                screens.Removed += ScreensRemoved;
                server.Start();
            }
        }
 public BluetoothListener(Model.BluetoothOption option) : this(option.ServiceId)
 {
     ServiceClass = option.ServiceClass;
     ServiceName  = option.ServiceName;
 }