async void ReadContentFromFile(string fileName) { if (Designer.IsInDesignMode()) { return; } var uri = new Uri(fileName); StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(uri); DocumentContent = await FileIO.ReadTextAsync(file); }
async void OnLoadDocumentCommand() { CanStartLoading = false; IsLoading = true; bool error = false; try { EndpointAddress endPoint = new EndpointAddress("http://demos.devexpress.com/DemoCenter/Silverlight/DemoReportService.svc"); var facade = new ReportServiceFacade(endPoint); Document = await facade.ExportToPdfAsync(selectedReport.Parameters.ReportParameters, SelectedReport.ReportName); } catch { IsLoading = false; error = true; } if (error && !Designer.IsInDesignMode()) { await new MessageDialog("An error occurred while loading the report.").ShowAsync(); } CanStartLoading = true; }
async void ReadContentFromFile(string filePath, string fileName) { if (Designer.IsInDesignMode()) { return; } var uri = new Uri(filePath); StorageFile file = await StorageFile.GetFileFromApplicationUriAsync(uri); CurrentDocumentText = await FileIO.ReadTextAsync(file); if (string.IsNullOrEmpty(fileName)) { DocumentName = file.DisplayName; } else { DocumentName = fileName; } }