public async void Sync(object input = null) { try { string destination = _browserService.OpenFolderDialog(); if (destination == null) { return; } if ( !Directory.Exists(Path.Combine(destination, "Files")) || !File.Exists(Path.Combine(destination, "log.json")) ) { _dialogService.OpenDialog(new DialogOkViewModel("Please select a valid folder", "Sync", DialogType.Error)); return; } _workStatus(true); LogReader reader = new LogReader(Path.Combine(destination, "Files")); await Task.Run(() => { reader.GetLogs(destination); reader.Sync(); }); _workStatus(false); // Show messagebox regarding errors if (reader.NoErrors) { _dialogService.OpenDialog(new DialogOkViewModel("Synchronisation successful", "Synchronisation", DialogType.Success)); } else { _dialogService.OpenDialog(new DialogOkViewModel("Something went wrong, see logs for more information", "Synchronisation", DialogType.Error)); } } catch (Exception e) { new BugTracker().Track("App", "Sync", e.Message, e.StackTrace); _dialogService.OpenDialog(new DialogOkViewModel("Something went wrong.", "Error", DialogType.Error)); } finally { _workStatus(false); } }