Ejemplo n.º 1
0
        private void ConnectClick(object sender, RoutedEventArgs e)
        {
            try
            {
                tcpConn   = new TcpConn(IpAddress.Text, 7331);
                connected = tcpConn.Connect();

                if (!connected)
                {
                    LogError(new Exception("Failed to connect to your Wii U. Is TcpGecko running?"));
                    TabControl.SelectedIndex = 14;
                    TabControl.IsEnabled     = false;
                    return;
                }

                // init gecko
                gecko = new Gecko(tcpConn, this);

                if (connected)
                {
                    var status = gecko.GetServerStatus();
                    if (status == 0)
                    {
                        return;
                    }

                    Settings.Default.IpAddress = IpAddress.Text;
                    Settings.Default.Save();

                    Controller.SelectedValue = Settings.Default.Controller;

                    GetNonItemData();

                    ToggleControls("Connected");
                }
            }
            catch (System.Net.Sockets.SocketException)
            {
                connected = false;

                MessageBox.Show("Wrong IP");
            }
            catch (Exception ex)
            {
                LogError(ex);
            }
        }
Ejemplo n.º 2
0
        private void ConnectClick(object sender, RoutedEventArgs e)
        {
            try
            {
                this.tcpConn   = new TcpConn(this.IpAddress.Text, 7331);
                this.connected = this.tcpConn.Connect();

                if (!this.connected)
                {
                    this.LogError(new Exception("Failed to connect"));
                    return;
                }

                // init gecko
                this.gecko = new Gecko(this.tcpConn, this);

                if (this.connected)
                {
                    var status = this.gecko.GetServerStatus();
                    if (status == 0)
                    {
                        return;
                    }

                    this.GetNonItemData();

                    Settings.Default.IpAddress = IpAddress.Text;
                    Settings.Default.Save();

                    Controller.SelectedValue = Settings.Default.Controller;

                    this.ToggleControls("Connected");
                }
            }
            catch (System.Net.Sockets.SocketException)
            {
                this.connected = false;

                MessageBox.Show("Wrong IP");
            }
            catch (Exception ex)
            {
                this.LogError(ex);
            }
        }