/// <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); }
/// <inheritdoc/> public override void ShowInView(IHtmlView htmlView, KeyValueList <string, string> variables, Navigation redirectedFrom) { base.ShowInView(htmlView, variables, redirectedFrom); View.NavigationCompleted += NavigationCompletedEventHandler; IRepositoryStorageService repositoryService = Ioc.GetOrCreate <IRepositoryStorageService>(); _scrollToNote = variables?.GetValueOrDefault(ControllerParameters.NoteId); RepositoryStorageLoadResult loadResult = repositoryService.LoadRepositoryOrDefault(out _); if (loadResult != RepositoryStorageLoadResult.InvalidRepository) { _viewModel = new NoteRepositoryViewModel( Ioc.GetOrCreate <INavigationService>(), Ioc.GetOrCreate <ILanguageService>(), Ioc.GetOrCreate <ISvgIconService>(), Ioc.GetOrCreate <IThemeService>(), Ioc.GetOrCreate <IBaseUrlService>(), Ioc.GetOrCreate <IStoryBoardService>(), Ioc.GetOrCreate <IFeedbackService>(), Ioc.GetOrCreate <ISettingsService>(), Ioc.GetOrCreate <IEnvironmentService>(), Ioc.GetOrCreate <ICryptoRandomService>(), repositoryService); Bindings.BindCommand("NewNote", _viewModel.NewNoteCommand); Bindings.BindCommand("NewChecklist", _viewModel.NewChecklistCommand); Bindings.BindCommand("Synchronize", _viewModel.SynchronizeCommand); Bindings.BindCommand("ShowTransferCode", _viewModel.ShowTransferCodeCommand); Bindings.BindCommand("ShowRecycleBin", _viewModel.ShowRecycleBinCommand); Bindings.BindCommand("ShowSettings", _viewModel.ShowSettingsCommand); Bindings.BindCommand("ShowInfo", _viewModel.ShowInfoCommand); Bindings.BindCommand("OpenSafe", _viewModel.OpenSafeCommand); Bindings.BindCommand("CloseSafe", _viewModel.CloseSafeCommand); Bindings.BindCommand("ChangeSafePassword", _viewModel.ChangeSafePasswordCommand); Bindings.BindCommand("FilterButtonCancel", _viewModel.ClearFilterCommand); Bindings.BindText("TxtFilter", () => _viewModel.Filter, (value) => _viewModel.Filter = value, _viewModel, nameof(_viewModel.Filter), HtmlViewBindingMode.TwoWay); Bindings.BindVisibility("FilterButtonMagnifier", () => string.IsNullOrEmpty(_viewModel.Filter), _viewModel, nameof(_viewModel.FilterButtonMagnifierVisible), HtmlViewBindingMode.OneWayToView); Bindings.BindVisibility("FilterButtonCancel", () => !string.IsNullOrEmpty(_viewModel.Filter), _viewModel, nameof(_viewModel.FilterButtonCancelVisible), HtmlViewBindingMode.OneWayToView); Bindings.BindGeneric <object>( NotesChangedEventHandler, null, null, null, new HtmlViewBindingViewmodelNotifier(_viewModel, "Notes"), HtmlViewBindingMode.OneWayToView); Bindings.UnhandledViewBindingEvent += UnhandledViewBindingEventHandler; // Load html page and content (notes) string html = _viewService.GenerateHtml(_viewModel); string htmlNotes = _viewContentService.GenerateHtml(_viewModel); html = html.Replace("<ul id=\"note-repository\"></ul>", htmlNotes); // Replace node "note-repository" with content View.LoadHtml(html); } else { // Show error message and stop loading the application _stopViewModel = new StopViewModel( Ioc.GetOrCreate <INavigationService>(), Ioc.GetOrCreate <ILanguageService>(), Ioc.GetOrCreate <ISvgIconService>(), Ioc.GetOrCreate <IThemeService>(), Ioc.GetOrCreate <IBaseUrlService>()); string html = _viewStop.GenerateHtml(_stopViewModel); View.LoadHtml(html); } }