public PublicKeySettingsViewModel()
        {
            if (this.IsInDesignMode || IsInDesignModeStatic)
            {
                this.PublicKeys = new ObservableCollection <EcKeyPairInfoViewModel>()
                {
                    new EcKeyPairInfoViewModel()
                    {
                        KeyPairInfos = DesignDataFactory.CreateDesignData <EcKeyPairInfo>("My Key #1", "Token White", "DENK0100123"),
                        IsSelected   = true,
                        Description  = "My buisness token"
                    },
                    new EcKeyPairInfoViewModel()
                    {
                        KeyPairInfos = DesignDataFactory.CreateDesignData <EcKeyPairInfo>("My Key #2", "Token White", "DENK0100123"),
                        IsSelected   = false,
                        Description  = "My private token"
                    },
                    new EcKeyPairInfoViewModel()
                    {
                        KeyPairInfos = DesignDataFactory.CreateDesignData <EcKeyPairInfo>("My Key #3", "Token Black", "DENK0100321"),
                        IsSelected   = false,
                        Description  = "My private backup token"
                    },
                };
            }
            else
            {
                this.LoadPublicKeysFromHSMCommand = new RelayCommand(this.LoadPublicKeysFromHSMCommandHandling);
                this.SaveCommand  = new RelayCommand(this.SaveCommandHandling);
                this.CloseCommand = new RelayCommand(this.CloseCommandHandling);

                this.ExportCommand = new RelayCommand <ExportType>(this.ExportCommandHandling);
                this.LoadedCommand = new RelayCommand(this.LoadedCommandHandling);

                this.RemoveCommand = new RelayCommand(this.RemoveCommandHandling);
            }
        }
        public MainViewModel()
        {
            if (this.IsInDesignMode || IsInDesignModeStatic)
            {
                #region Design Data

                this.FilePath   = @"C:\temp\document.docx";
                this.Progress   = 80;
                this.PublicKeys = new ObservableCollection <EcKeyPairInfoViewModel>()
                {
                    new EcKeyPairInfoViewModel()
                    {
                        KeyPairInfos = DesignDataFactory.CreateDesignData <EcKeyPairInfo>("My Key #1", "Token White", "DENK0100123"),
                        IsSelected   = true,
                        Description  = "My buisness token"
                    },
                    new EcKeyPairInfoViewModel()
                    {
                        KeyPairInfos = DesignDataFactory.CreateDesignData <EcKeyPairInfo>("My Key #2", "Token White", "DENK0100123"),
                        IsSelected   = false,
                        Description  = "My private token"
                    },
                    new EcKeyPairInfoViewModel()
                    {
                        KeyPairInfos = DesignDataFactory.CreateDesignData <EcKeyPairInfo>("My Key #3", "Token Black", "DENK0100321"),
                        IsSelected   = false,
                        Description  = "My private backup token"
                    },
                };
                this.AvailableHardwareTokens = new List <EcKeyPairInfo>()
                {
                    DesignDataFactory.CreateDesignData <EcKeyPairInfo>("My Key #1", "Token White", "DENK0100123"),
                    DesignDataFactory.CreateDesignData <EcKeyPairInfo>("My Key #3", "Token Black", "DENK0100321"),
                };
                this.SelectedAvailableHardwareToken = this.AvailableHardwareTokens.First();

                #endregion
            }
            else
            {
                this.LoadedEvent = new RelayCommand(this.LoadedEventHandling);

                this.PublicKeySettingsCommand = new RelayCommand(this.PublicKeySettingsCommandHandling);
                this.EncryptCommand           = new RelayCommand(this.EncryptCommandHandling, this.EncryptCommandCanExecute);
                this.DecryptCommand           = new RelayCommand(this.DecryptCommandHandling, this.DecryptCommandCanExecute);
                this.CancelCommand            = new RelayCommand(this.CancelCommandHandling, this.CancelCommandCanExecute);
                this.RefreshHsmListCommand    = new RelayCommand(this.RefreshHsmListCommandHandling);
                this.HelpCommand     = new RelayCommand(this.HelpCommandHandling);
                this.SettingsCommand = new RelayCommand(this.SettingsCommandHandling);
                this.LoadFileCommand = new RelayCommand(this.LoadFileCommandHandling);
                this.AvailableHardwareTokensIsBusy = true;
                this.PublicKeysIsBusy = true;

                base.MessengerInstance.Register <Messages.StorageChange>(this, change =>
                {
                    switch (change.StorageName)
                    {
                    case StorageNames.PublicKeys:
                        this.RefreshPublicKeys();
                        break;

                    case StorageNames.State:
                        this.SaveState();
                        break;

                    default:
                        throw new ArgumentOutOfRangeException();
                    }
                    change.CompletedCallback();
                });
            }
        }
Пример #3
0
 public DesignDataProvider()
 {
     df = new DesignDataFactory();
 }