コード例 #1
0
        /// <inheritdoc/>
        public override void ShowInView(IHtmlView htmlView, KeyValueList <string, string> variables, Navigation redirectedFrom)
        {
            base.ShowInView(htmlView, variables, redirectedFrom);
            _viewModel = new SettingsViewModel(
                Ioc.GetOrCreate <INavigationService>(),
                Ioc.GetOrCreate <ILanguageService>(),
                Ioc.GetOrCreate <ISvgIconService>(),
                Ioc.GetOrCreate <IThemeService>(),
                Ioc.GetOrCreate <IBaseUrlService>(),
                Ioc.GetOrCreate <ISettingsService>(),
                Ioc.GetOrCreate <IStoryBoardService>());

            Bindings.BindCommand("GoBack", _viewModel.GoBackCommand);
            Bindings.BindCommand("ChangeCloudSettingsCommand", _viewModel.ChangeCloudSettingsCommand);
            Bindings.BindCommand("ClearCloudSettingsCommand", _viewModel.ClearCloudSettingsCommand);
            Bindings.BindDropdown("SelectedEncryptionAlgorithm", null, SetEncryptionAlgorithmToViewmodel, null, null, HtmlViewBindingMode.OneWayToViewmodel);
            Bindings.BindDropdown("SelectedAutoSyncMode", null, (string value) => _viewModel.SelectedAutoSyncMode = value, null, null, HtmlViewBindingMode.OneWayToViewmodel);
            Bindings.BindText("CloudStorageSettings", () => _viewModel.AccountSummary, null, _viewModel, nameof(_viewModel.AccountSummary), HtmlViewBindingMode.OneWayToView);
            Bindings.BindBackgroundImage("SelectedTheme", () => _viewModel.SelectedTheme.Image, _viewModel, nameof(_viewModel.SelectedTheme), HtmlViewBindingMode.OneWayToView);
            Bindings.BindCheckbox("UseSolidColorTheme", null, (bool value) => _viewModel.UseSolidColorTheme                       = value, null, null, HtmlViewBindingMode.OneWayToViewmodel);
            Bindings.BindText("ColorForSolidThemeHex", null, (string value) => _viewModel.ColorForSolidThemeHex                   = value, null, null, HtmlViewBindingMode.OneWayToViewmodel);
            Bindings.BindDropdown("SelectedThemeMode", null, (string value) => _viewModel.SelectedThemeMode                       = value, null, null, HtmlViewBindingMode.OneWayToViewmodel);
            Bindings.BindDropdown("SelectedNoteInsertionMode", null, (string value) => _viewModel.SelectedNoteInsertionMode       = value, null, null, HtmlViewBindingMode.OneWayToViewmodel);
            Bindings.BindCheckbox("UseColorForAllNotesInDarkMode", null, (bool value) => _viewModel.UseColorForAllNotesInDarkMode = value, null, null, HtmlViewBindingMode.OneWayToViewmodel);
            Bindings.BindText("ColorForAllNotesInDarkModeHex", null, (string value) => _viewModel.ColorForAllNotesInDarkModeHex   = value, null, null, HtmlViewBindingMode.OneWayToViewmodel);
            Bindings.UnhandledViewBindingEvent += UnhandledViewBindingEventHandler;

            string html = _viewService.GenerateHtml(_viewModel);

            View.LoadHtml(html);
        }
コード例 #2
0
        /// <inheritdoc/>
        public override void ShowInView(IHtmlView htmlView, KeyValueList <string, string> variables, Navigation redirectedFrom)
        {
            base.ShowInView(htmlView, variables, redirectedFrom);
            IStoryBoardService storyBoardService             = Ioc.GetOrCreate <IStoryBoardService>();
            SerializeableCloudStorageCredentials credentials = storyBoardService.ActiveStory.LoadFromSession <SerializeableCloudStorageCredentials>(SynchronizationStorySessionKey.CloudStorageCredentials);

            _viewModel = new CloudStorageAccountViewModel(
                Ioc.GetOrCreate <INavigationService>(),
                Ioc.GetOrCreate <ILanguageService>(),
                Ioc.GetOrCreate <ISvgIconService>(),
                Ioc.GetOrCreate <IThemeService>(),
                Ioc.GetOrCreate <IBaseUrlService>(),
                storyBoardService,
                Ioc.GetOrCreate <IFeedbackService>(),
                Ioc.GetOrCreate <ICloudStorageClientFactory>(),
                credentials);

            Bindings.BindCommand("GoBack", _viewModel.GoBackCommand);
            Bindings.BindCommand("OkCommand", _viewModel.OkCommand);
            Bindings.BindCommand("CancelCommand", _viewModel.CancelCommand);
            Bindings.BindText("Url", null, (v) => _viewModel.Url           = v, null, null, HtmlViewBindingMode.OneWayToViewmodel);
            Bindings.BindText("Username", null, (v) => _viewModel.Username = v, null, null, HtmlViewBindingMode.OneWayToViewmodel);
            Bindings.BindText("Password", () => SecureStringExtensions.SecureStringToString(_viewModel.Password), (v) => _viewModel.Password = SecureStringExtensions.StringToSecureString(v), _viewModel, nameof(_viewModel.Password), HtmlViewBindingMode.TwoWayPlusOneTimeToView);
            Bindings.BindCheckbox("Secure", null, (v) => _viewModel.Secure = v, null, null, HtmlViewBindingMode.OneWayToViewmodel);

            string html = _viewService.GenerateHtml(_viewModel);

            View.LoadHtml(html);
        }
コード例 #3
0
        /// <inheritdoc/>
        public override void ShowInView(IHtmlView htmlView, KeyValueList <string, string> variables)
        {
            base.ShowInView(htmlView, variables);
            _viewModel = new SettingsViewModel(
                Ioc.GetOrCreate <INavigationService>(),
                Ioc.GetOrCreate <ILanguageService>(),
                Ioc.GetOrCreate <ISvgIconService>(),
                Ioc.GetOrCreate <IBaseUrlService>(),
                Ioc.GetOrCreate <ISettingsService>(),
                Ioc.GetOrCreate <IThemeService>(),
                Ioc.GetOrCreate <IStoryBoardService>());

            Bindings.BindCommand("GoBack", _viewModel.GoBackCommand);
            Bindings.BindCommand("ChangeCloudSettingsCommand", _viewModel.ChangeCloudSettingsCommand);
            Bindings.BindCommand("ClearCloudSettingsCommand", _viewModel.ClearCloudSettingsCommand);
            Bindings.BindDropdown("SelectedEncryptionAlgorithm", null, SetEncryptionAlgorithmToViewmodel, null, null, HtmlViewBindingMode.OneWayToViewmodel);
            Bindings.BindCheckbox("AdoptCloudEncryptionAlgorithm", null, (value) => _viewModel.AdoptCloudEncryptionAlgorithm = value, null, null, HtmlViewBindingMode.OneWayToViewmodel);
            Bindings.BindDropdown("SelectedAutoSyncMode", null, (string value) => _viewModel.SelectedAutoSyncMode            = value, null, null, HtmlViewBindingMode.OneWayToViewmodel);
            Bindings.BindText("CloudStorageSettings", () => _viewModel.AccountSummary, null, _viewModel, nameof(_viewModel.AccountSummary), HtmlViewBindingMode.OneWayToView);
            Bindings.BindCheckbox("ShowCursorArrowKeys", null, (value) => _viewModel.ShowCursorArrowKeys = value, null, null, HtmlViewBindingMode.OneWayToViewmodel);
            Bindings.BindBackgroundImage("SelectedTheme", () => _viewModel.SelectedTheme.Image, _viewModel, nameof(_viewModel.SelectedTheme), HtmlViewBindingMode.OneWayToView);
            Bindings.UnhandledViewBindingEvent += UnhandledViewBindingEventHandler;

            string html = _viewService.GenerateHtml(_viewModel);

            View.LoadHtml(html);
        }