Esempio n. 1
0
        /// <summary>
        ///     инициализация визарда
        /// </summary>
        /// <param name="id"></param>
        /// <param name="cryptxService"></param>
        /// <param name="authService"></param>
        /// <param name="token"></param>
        public WizardModel(Guid id, CryptxServiceClient cryptxService, AuthorizeServiceClient authService, Guid token)
        {
            ProfileSelect            = new ProfileSelect();
            CanBack                  = true;
            CanNext                  = true;
            CanmakeOperation         = false;
            ProfileSelect.UseDefault = false;
            ProfileResponse userDefaultResponse = cryptxService.GetDefaultProfile(token);

            if (userDefaultResponse.Exception == null)
            {
                if (userDefaultResponse.Settings.Id == Guid.Empty)
                {
                    ProfileResponse response = cryptxService.GetBlankProfile();
                    if (response.Exception == null)
                    {
                        ProfileSelect.UseDefault = true;
                        Settings = response.Settings;
                    }
                    else
                    {
                        throw new Exception("Ошибка при получении настроек по умолчанию");
                    }
                }
                else
                {
                    Settings = userDefaultResponse.Settings;
                }
            }
            else
            {
                throw new Exception("Ошибка при получении ваших настроек по умолчанию");
            }
            //зануляем пароли
            Settings._SignatureSettings.KeysetPassword  = "";
            Settings._DecryptionSettings.KeysetPassword = "";

            //Settings = _cryptxService.GetDefaultProfile();// SettingInitializer.InitializeSettings();
            UserInfo = new UserInfoW();
            UserInfoResponse userInfo = authService.GetUserData(token);

            DownloadedFiles        = new List <DownloadedFile>();
            UserInfo.WebDavRootDir = userInfo.WebDavRootDir;
            UserInfo.User          = userInfo.User;
            Id           = id;
            CreationTime = DateTime.Now;
        }