/// <summary> Load a data var as its restored as part of a project </summary> /// <param name="dvs"></param> /// <param name="index">index within the collection of dataVarUIHandlers at which to place the data var</param> /// <param name="newDataVar"></param> /// <returns></returns> public bool LoadDataVarFromStorage(DataVarStorage dvs, out DataVariable newDataVar) { //NOTE - probably will need to improve this for x-plat needs, although maybe not // since path is stored from local path anyway string path = dvs.pathOnly + "\\" + dvs.filename; string errorMsg; newDataVar = null; //make sure the file exists, so we can give a simpler error than we'd get otherwise when calling LoadAddFile if (!File.Exists(path)) { UIManager.I.ShowMessageDialog("File not found: " + path); return(false); } //Actually load it now if (!DataManager.I.LoadAddFile(path, dvs.hasRowHeaders, dvs.hasColumnHeaders, out newDataVar, out errorMsg)) { UIManager.I.ShowMessageDialog("Loading data failed.\n" + path + "\n" + errorMsg); return(false); } newDataVar.Label = dvs.label; DataVarUIHandler.SetDataVarAtIndex(newDataVar, dvs.UIindex); return(true); }
private bool DemoData_LoadSingleDataFile(string filename, out DataVariable dataVar, DataManager.Mapping mapping, int count) { string path = Application.streamingAssetsPath + "/sampleData/" + filename; string errorMsg; if (!DataManager.I.LoadAddFile(path, true, true, out dataVar, out errorMsg)) { UIManager.I.ShowMessageDialog("Loading sample data failed.\n" + filename + "\n" + errorMsg); return(false); } DataManager.I.AssignVariableMapping(mapping, dataVar); DataVarUIHandler.SetDataVarAtIndex(dataVar, count); return(true); }