public ResourceKeysViewModel()

in WindowsSmartInk/SmartInkLaboratory/ViewModels/ResourceKeysViewModel.cs [135:181]


        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();
        }