public MainWindow()
        {
            InitializeComponent();
            this.SetOnScreen();
            client = new WSClient();
            windowOpen = true;

            double screenHeight = SystemParameters.PrimaryScreenHeight;
            double screenWidth = SystemParameters.PrimaryScreenWidth;
            client.SetScreenResolution((int)screenWidth, (int)screenHeight);
            client.Error += new WSClient.ErrorEventHandler(OnError);
            client.ConnectionChange += new WSClient.ConnectionChangedHandler(OnConnectionChanged);
        }
        ///<summary>
        /// Button OK: validates the new WebSocket address.
        /// </summary>
        private void Rectangle_MouseLeftButtonUp_1(object sender, MouseButtonEventArgs e)
        {
            try
            {
                var r = new Regex("^(wss?)://(.*)\\:([0-9]*)/(.*)$");
                var matches = r.Match(TextBoxSetupAddress.Text);

                var host = matches.Groups[2].Value;
                var port = Int32.Parse(matches.Groups[3].Value);
                var path = matches.Groups[4].Value;
            }
            catch (FormatException ex)
            {
                MessageBox.Show("Formato indirizzo errato");
                return;
            }
            client = new WSClient(TextBoxSetupAddress.Text);
            client.Error += new WSClient.ErrorEventHandler(OnError);

            LabelSetupAddress.Visibility = Visibility.Hidden;
            TextBoxSetupAddress.Visibility = Visibility.Hidden;
            ButtonOKAddress.Visibility = Visibility.Hidden;
            for (int i = 0; i <= 70; i++)
            {
                SlideSetup.Height -= 1;
                GridControls.Height -= 1;
                UpGrid.Height -= 1;
                GazeClientWindow.Height -= 1;
            }
            slideIsOpen = false;
        }