Exemplo n.º 1
0
        public MainViewModel()
        {
            _viewManager = new ViewManager();


            _authManager = Externals.Resolve <IAuthManager>();
            _dialog      = Externals.Resolve <IDialog>();
            _persister   = new RemotePersister(_authManager);
            _refresher   = new Timer(x =>
            {
                var safeUI = Externals.Resolve <ISafeUI>();
                safeUI.Invoke(new Action(async() =>
                {
                    if (!ViewManager.IsReady)
                    {
                        return;
                    }

                    _syncCounter++;

                    var interval = Settings.RefreshInterval;

                    if (_syncCounter > 0 && _syncCounter % interval.Seconds == 0)
                    {
                        await Watcher.RestoreStateAsync();
                    }

                    RaiseAllPropertyChanged();
                }));
            },
                                     null, 0, 1000);

            Watcher = new InOutWatcher(_authManager, _dialog, _persister);
        }
Exemplo n.º 2
0
 public AuthViewModel()
 {
     _viewManager = new ViewManager();
     _authManager = Externals.Resolve <IAuthManager>();
 }