private void _wanServer_PropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            WanServer wanServer = sender as WanServer;

            if (wanServer == null)
            {
                return;
            }
            string propertyName = e.PropertyName;

            if (propertyName == "UserSettings")
            {
                WanUserSettings wanUserSettings = (WanUserSettings)wanServer.UserSettings.Clone();
                bool            flag            = false;
                if (string.IsNullOrEmpty(wanUserSettings.FirstName))
                {
                    wanUserSettings.FirstName = this._auth0LVM.GivenName;
                    if (!string.IsNullOrEmpty(wanUserSettings.FirstName))
                    {
                        flag = true;
                    }
                }
                if (string.IsNullOrEmpty(wanUserSettings.LastName))
                {
                    wanUserSettings.LastName = this._auth0LVM.FamilyName;
                    if (!string.IsNullOrEmpty(wanUserSettings.LastName))
                    {
                        flag = true;
                    }
                }
                this.UserSettingsEditor = (WanUserSettings)wanUserSettings.Clone();
                this.UserSettingsServer = (WanUserSettings)wanUserSettings.Clone();
                if (flag)
                {
                    this._wanServer.SendSetUserInfoToServer(this._auth0LVM.GetFreshJwt(), this._userSettingsEditor);
                }
                this.SaveUserTitle = "Save";
            }
            else if (propertyName == "SslClientPublicIp")
            {
                this.ApplicationPublicIp = wanServer.SslClientPublicIp;
            }
            else if (propertyName == "IsConnected")
            {
                this.IsWanServerConnected = wanServer.IsConnected;
                if (!wanServer.IsConnected)
                {
                    RadioList.RemoveAllWanRadios();
                    _wanConnectARE.Set();
                    return;
                }
                this._wanServer.SendRegisterApplicationMessageToServer(API.ProgramName, "Windows", this._auth0LVM.GetFreshJwt());
            }
        }
Beispiel #2
0
        public SmartLinkRadioChooser(RadioChooserData radioChooserData, WanServer wanserver)
        {
            InitializeComponent();
            _wanServer = wanserver;
            _wanServer.WanRadioConnectReady += this._wanServer_WanRadioConnectReady;
            Closing          += this.RadioChooser_Closing;
            Deactivated      += this.RadioView_Deactivated;
            _radioChooserData = radioChooserData;
            ListBox.Items.SortDescriptions.Add(new SortDescription("Serial", ListSortDirection.Ascending));
            ListBox.MouseDoubleClick += this.ListBox_MouseDoubleClick;
            ListBox.SelectionChanged += this.ListBox_SelectionChanged;
            SourceInitialized        += this.RadioChooser_SourceInitialized;

            DataContext = _radioChooserData;
        }
        public SmartLinkSettings(WanServer wanServer, FlexRadioList radioListVm)
        {
            string domain   = "frtest.auth0.com";
            string clientId = "4Y9fEIIsVYyQo5u6jr7yBWc4lV5ugC2m";

            Auth0LVM = new Auth0Model(new Auth0Client(domain, clientId, 900, 630, false));
            this._auth0LVM.PropertyChanged += this._auth0LVM_PropertyChanged;

            this._wanServer = wanServer;
            this._wanServer.PropertyChanged += this._wanServer_PropertyChanged;
            this._wanServer.WanApplicationRegistrationInvalid += this._wanServer_WanApplicationRegistrationInvalid;

            this.RadioList = radioListVm;
            Task.Factory.StartNew(delegate
            {
                this._auth0LVM.LoginWithRefreshTokenNoUI();
            }, TaskCreationOptions.LongRunning);

            Task.Factory.StartNew(delegate
            {
                this.WanServerConnectThread();
            }, TaskCreationOptions.LongRunning);
        }
Beispiel #4
0
 public SmartLinkWan()
 {
     RadioList = new FlexRadioList();
     wanServer = new WanServer();
 }