예제 #1
0
        private void btnGetDeviceInfo_Click(object sender, EventArgs e)
        {
            Log("Getting Device INFO");

            LiveboxAdapter a = CreateLiveboxAdapter();

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

                        Log(sb.ToString());
                    }
                }, _uiScheduler);
            });
        }
예제 #2
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);
            });
        }