Exemple #1
0
        /// <inheritdoc/>
        public override void ShowInView(IHtmlView htmlView, KeyValueList <string, string> variables, Navigation redirectedFrom)
        {
            base.ShowInView(htmlView, variables, redirectedFrom);
            _viewModel = new RecycleBinViewModel(
                Ioc.GetOrCreate <INavigationService>(),
                Ioc.GetOrCreate <ILanguageService>(),
                Ioc.GetOrCreate <ISvgIconService>(),
                Ioc.GetOrCreate <IThemeService>(),
                Ioc.GetOrCreate <IBaseUrlService>(),
                Ioc.GetOrCreate <IFeedbackService>(),
                Ioc.GetOrCreate <ISettingsService>(),
                Ioc.GetOrCreate <ICryptoRandomService>(),
                Ioc.GetOrCreate <IRepositoryStorageService>());

            VueBindingShortcut[] shortcuts = new[]
            {
                new VueBindingShortcut(VueBindingShortcut.KeyEscape, nameof(RecycleBinViewModel.GoBackCommand)),
            };
            VueBindings = new VueDataBinding(_viewModel, View, shortcuts);
            _viewModel.VueDataBindingScript = VueBindings.BuildVueScript();
            VueBindings.StartListening();

            string html      = _viewService.GenerateHtml(_viewModel);
            string htmlNotes = _viewContentService.GenerateHtml(_viewModel);

            html = html.Replace("<ul id=\"recycled-notes\"></ul>", htmlNotes);
            htmlView.LoadHtml(html);
        }
        /// <inheritdoc/>
        public override void ShowInView(IHtmlView htmlView, KeyValueList <string, string> variables, Navigation redirectedFrom)
        {
            base.ShowInView(htmlView, variables, redirectedFrom);
            _viewModel = new RecycleBinViewModel(
                Ioc.GetOrCreate <INavigationService>(),
                Ioc.GetOrCreate <ILanguageService>(),
                Ioc.GetOrCreate <ISvgIconService>(),
                Ioc.GetOrCreate <IThemeService>(),
                Ioc.GetOrCreate <IBaseUrlService>(),
                Ioc.GetOrCreate <IFeedbackService>(),
                Ioc.GetOrCreate <ISettingsService>(),
                Ioc.GetOrCreate <ICryptoRandomService>(),
                Ioc.GetOrCreate <IRepositoryStorageService>());

            Bindings.BindCommand("GoBack", _viewModel.GoBackCommand);
            Bindings.BindCommand("EmptyRecycleBin", _viewModel.EmptyRecycleBinCommand);
            Bindings.BindGeneric <object>(
                NotesChangedEventHandler,
                null,
                null,
                null,
                new HtmlViewBindingViewmodelNotifier(_viewModel, "Notes"),
                HtmlViewBindingMode.OneWayToViewPlusOneTimeToView);
            Bindings.UnhandledViewBindingEvent += BindingsEventHandler;

            string html = _viewService.GenerateHtml(_viewModel);

            htmlView.LoadHtml(html);
        }