public Json(IFileSave filesave, ISettingsManager settingsManager, bool usesImages) { UsesImages = usesImages; SettingsManager = settingsManager; FileSave = filesave; if (!Directory.Exists(System.IO.Path.Combine(filesave.DefaultSaveLocation, "Default Project"))) { Directory.CreateDirectory(System.IO.Path.Combine(filesave.DefaultSaveLocation, "Default Project")); } Path = System.IO.Path.Combine(System.IO.Path.Combine(filesave.DefaultSaveLocation, "Default Project"), "ProjectData.json"); Refresh(); }
private async Task GetUserData(string fileName) { try { SetWaiting(true); IFolder folder = PCLStorage.FileSystem.Current.LocalStorage; if (!(await PCLHelper.IsFolderExistAsync("UserXML", folder))) { UserDialogs.Instance.Alert(Language.txtUserDataNoDataUploaded, Language.txtErrorTitle); } else { IFolder destFolder = await folder.GetFolderAsync("UserXML"); if (!await PCLHelper.IsFileExistAsync(fileName, destFolder)) { UserDialogs.Instance.Alert(Language.txtUserDataNoDataUploaded + " " + fileName, Language.txtErrorTitle); } else { string fileContent = await PCLHelper.ReadAllTextAsync(fileName, destFolder); IFileSave DocLibrary = DependencyService.Get <IFileSave>(); bool res = await DocLibrary.SaveXml(fileContent, fileName); if (res) { UserDialogs.Instance.Alert(Language.txtUserDataLoaded + " " + fileName, Language.txtDictOk); } else { UserDialogs.Instance.Alert(Language.txtErrLoadingUserData + " " + fileName, Language.txtDictOk); } } } SetWaiting(false); } catch (Exception ex) { SetWaiting(false); UserDialogs.Instance.Alert(Language.txtErrLoadingUserData + " " + ex.Message, Language.txtErrorTitle); } finally { await Task.CompletedTask; } }
public InspectionSaveData(string sector, string cablelocation, string colorpairletter, string sxdx, string end, string comment, bool passFail, string filesavename, int fiberID, IFileSave AppSpecificFileSave, string iecSpecApplied, bool NeedsImage, bool analysisApplied) { AnalysisApplied = analysisApplied; FiberID = fiberID; Sector = sector; GroupingColor = cablelocation; IndividualColor = colorpairletter; CoreNumber = sxdx; End = end; Comment = comment; PassFail = passFail; FileSaveName = filesavename; IECSpecApplied = iecSpecApplied; try { if (NeedsImage) { Image = AppSpecificFileSave.SKImageFromFile(filesavename); } } catch (Exception ex) { Console.WriteLine(ex); } }