Esempio n. 1
0
 public SecureKeyViewModel(ISecureKeyService secureKeyService)
 {
     HideSecureKey         = true;
     this.secureKeyService = secureKeyService;
     SecureKey             = secureKeyService.SecureKey;
     SaveCommand           = new RelayCommand(() => SaveExcute());
 }
Esempio n. 2
0
 private void Initialize()
 {
     SecureKeyService    = Locator.GetService <ISecureKeyService>();
     GuestureLockService = Locator.GetService <IGuestureLockService>();
     alertService        = Locator.GetService <IAlertService>();
     appIconService      = Locator.GetService <IAppIconService>();
     themeService        = Locator.GetService <IThemeService>();
     languageService     = Locator.GetService <ILanguageService>();
 }
Esempio n. 3
0
        public ResourceKeysViewModel(IClassifierService classifier, ISecureKeyService keys, SmartInkLaboratory.Services.UX.IDialogService dialog, IAppStateService state, INavigationService nav)
        {
            _classifier = classifier;
            _keyService = keys;
            _dialog     = dialog;
            _state      = state;
            _nav        = nav;

            this.ShowKeys = new RelayCommand(() => { IsOpen = true; });

            this.SelectKey = new RelayCommand <string>((resource) => {
                if (string.IsNullOrWhiteSpace(resource))
                {
                    return;
                }

                if (!_keys.ContainsKey(resource))
                {
                    throw new InvalidOperationException("Resource not found");
                }

                var key            = SetKeys(resource);
                _state.CurrentKeys = key;
            });

            this.SaveKeys = new RelayCommand(() => {
                _keyService.SaveKeys(Resource, TrainingKey, PredictionKey);
                ApplicationData.Current.LocalSettings.Values["LastResource"] = Resource;
                _state.CurrentKeys = (new ResourceKeys {
                    Resource = Resource, TrainingKey = TrainingKey, PredicationKey = PredictionKey
                });
                IsOpen             = false;
            },
                                             () => {
                return(!string.IsNullOrWhiteSpace(Resource) &&
                       !string.IsNullOrWhiteSpace(TrainingKey) &&
                       !string.IsNullOrWhiteSpace(PredictionKey) &&
                       _isDirty);
            });

            this.More = new RelayCommand(async() => {
                await _dialog.OpenAsync <ResourceKeysViewModel>(DialogKeys.ResourceList, this);
            });

            this.DeleteKey = new RelayCommand <string>((key) => {
                _keyService.DeleteKey(key);
                KeyList.Remove(key);
            });

            Load();
        }
 public ChangeSecureKeyViewModel(IDataBaseService dataBaseService, ISecureKeyService secureKeyService)
 {
     this.dataBaseService  = dataBaseService;
     this.secureKeyService = secureKeyService;
     SaveCommand           = new RelayCommand(() => SaveExcuteAsync());
 }