Beispiel #1
0
        public void UpdateSettings(string deviceId, HandyHost host, string localIp, int localPort)
        {
            if (HandyHelper.DeviceId != deviceId || !Connected)
            {
                HandyHelper.DeviceId = deviceId;
                UpdateConnectionStatus();
            }

            _host = host;

            switch (_host)
            {
            case HandyHost.Local:
            {
                if (LocalScriptServer == null)
                {
                    LocalScriptServer = new HandyScriptServer(this);
                }

                if (LocalScriptServer.HttpServerRunning)
                {
                    if (LocalScriptServer.LocalIp != localIp || LocalScriptServer.ServeScriptPort != localPort)
                    {
                        LocalScriptServer.Exit();
                    }
                }

                LocalScriptServer.LocalIp         = localIp;
                LocalScriptServer.ServeScriptPort = localPort;

                if (!LocalScriptServer.HttpServerRunning)
                {
                    LocalScriptServer.Start();
                }

                break;
            }

            case HandyHost.HandyfeelingCom:
            {
                if (LocalScriptServer != null && LocalScriptServer.HttpServerRunning)
                {
                    LocalScriptServer.Exit();
                    LocalScriptServer = null;
                }

                break;
            }
            }
        }
 public void StartLocalHttpServer() => LocalScriptServer?.Start();