Пример #1
0
        private void InitializeForm()
        {
            LiveboxAdapter a = CreateLiveboxAdapter();

            if (a == null)
            {
                return;
            }

            Log("Connecting to Livebox Router at " + a.Origin);
            scMain.Enabled = true;

            a.LoginAsync().OnSuccess((t, o) =>
            {
                a.GetDeviceInfo().OnSuccess((t2, o2) =>
                {
                    _deviceInfo = t2.Result;
                    if (_deviceInfo == null)
                    {
                        Log("Error: No Device info data returned");
                    }
                    else
                    {
                        StringBuilder sb = new StringBuilder();
                        foreach (var p in _deviceInfo.Parameters)
                        {
                            sb.AppendLine(p.Name + ": " + p.Value);
                        }

                        Log("Device info:");
                        Log(sb.ToString());
                    }
                }, _uiScheduler);

                a.GetNetworkStatus().OnSuccess((t2, o2) =>
                {
                    _WANInfo = t2.Result;
                    if (_WANInfo == null)
                    {
                        Log("Error: No Network information found");
                    }
                    else
                    {
                        Log("Network: ");
                        Log(_WANInfo.ConnectionState
                            + " : " + _WANInfo.IPAddress
                            + " : " + _WANInfo.LinkState);
                    }
                }, _uiScheduler);

                a.GetFirewallLevel().OnSuccess(GetFirewallLevelSuccessHandler(), _uiScheduler);
            });
        }
Пример #2
0
        private void btnGetWANStatus_Click(object sender, EventArgs e)
        {
            Log("Getting NETWORK status");

            LiveboxAdapter a = CreateLiveboxAdapter();

            a.LoginAsync().OnSuccess((t, o) =>
            {
                a.GetNetworkStatus().OnSuccess((t2, o2) =>
                {
                    var res = t2.Result;
                    if (res == null)
                    {
                        Log("Error: NO data returned");
                    }
                    else
                    {
                        Log("Success: " + res.ConnectionState + " : " + res.IPAddress + " : " + res.LinkState);
                    }
                }, _uiScheduler);
            });
        }