/// <summary> /// Constructor to start the datafile selector /// </summary> public UseDatafileContentDialogViewModel() { SecretService = App.Current.Container.Resolve <ISecretService>(); FileService = App.Current.Container.Resolve <IFileService>(); NewtonsoftJSONService = App.Current.Container.Resolve <INewtonsoftJSONService>(); ConfirmErrorCommand = new DelegateCommand(() => { ShowError = false; }); UseDatafileCommand = new DelegateCommand(async() => { await SetLocalFile(true); //change path is true }); ChooseWebDAVCommand = new DelegateCommand(() => { }); }
/// <summary> /// Constructor to start the datafile selector /// </summary> public UseDataFilePageViewModel( IFileService fileService, INewtonsoftJSONService newtonsoftJSONService, INetworkService networkService, INavigationService navigationService, IDialogService dialogService) { NaviationService = navigationService; DialogService = dialogService; NetworkService = networkService; NewtonsoftJSONService = newtonsoftJSONService; FileService = fileService; ConfirmErrorCommand = new DelegateCommand(() => { ShowError = false; }); WebDAVLoginCommand = new DelegateCommand(() => { }); #pragma warning disable AsyncFixer03 // Fire-and-forget async-void methods or delegates UseDatafileCommand = new DelegateCommand(async() => { await SetLocalFile(true); //change path is true }); #pragma warning restore AsyncFixer03 // Fire-and-forget async-void methods or delegates #pragma warning disable AsyncFixer03 // Fire-and-forget async-void methods or delegates SetAndCheckLocalDatafileCommand = new DelegateCommand(async() => { if (await TestPassword()) { await CreateLocalFileDB(false); await NaviationService.NavigateAsync("/" + nameof(AccountCodePage)); } else { //error Message } }); //#pragma warning restore AsyncFixer03 // Fire-and-forget async-void methods or delegates // ChooseWebDAVCommand = new DelegateCommand(() => // { // SelectedIndex = 1; // var secretService = App.Current.Container.Resolve<ISecretService>(); // if (secretService.Helper.ReadSecret(Constants.ContainerName, "WDServerAddress") != string.Empty) // { // ServerAddress = secretService.Helper.ReadSecret(Constants.ContainerName, "WDServerAddress"); // Password = secretService.Helper.ReadSecret(Constants.ContainerName, "WDPassword"); // Username = secretService.Helper.ReadSecret(Constants.ContainerName, "WDUsername"); // } // }); //#pragma warning disable AsyncFixer03 // Fire-and-forget async-void methods or delegates WebDAVLoginCommand = new DelegateCommand(async() => { (bool success, Status result) = await CheckServerStatus(); if (success) { if (ServerAddress != string.Empty && Username != string.Empty && Password != string.Empty) { if (await CheckLoginAsync()) { var dialog = new WebViewDatafileContentDialog(false, result); var dialogresult = await DialogService.ShowAsync(dialog); if (dialogresult == Windows.UI.Xaml.Controls.ContentDialogResult.Primary) { var test = dialog.ViewModel.ChoosenOneDatafile; } } else { //TODO error Message } } else { //TODO error Message } } else { //TODO error Message } }); #pragma warning restore AsyncFixer03 // Fire-and-forget async-void methods or delegates #pragma warning disable AsyncFixer03 // Fire-and-forget async-void methods or delegates SetAndCheckWebDAVDatafileCommand = new DelegateCommand(async() => { if (await TestPassword()) { await CreateLocalFileDB(true); await NaviationService.NavigateAsync("/" + nameof(AccountCodePage)); } else { //TODO error Message } }); #pragma warning restore AsyncFixer03 // Fire-and-forget async-void methods or delegates }