public void updateFieldDictionary() { var currentContexts = new List <BaseContextManager>(); var allContexts = new List <BaseContextManager>() { //new LspContextManager(null,null), new VmmcContextManager(null, null), new PpxContextManager(null, null) }; foreach (var projContext in allContexts) { if (projContext.FieldItems != null) { currentContexts.Add(projContext); } } foreach (var currCtxt in currentContexts) { var views = currCtxt.FieldItems.Select(t => t.pageName).Distinct().ToList(); foreach (var kind in currCtxt.KindDisplayNames.Keys) { var fieldDictionaryStore = new FieldDictionaryStore() { DatasetName = kind }; var kindSearchName = kind; if (currCtxt.KindToFieldTablename != null && currCtxt.KindToFieldTablename.ContainsKey(kind)) { kindSearchName = currCtxt.KindToFieldTablename[kind]; } fieldDictionaryStore.getFields(currCtxt.Name, currCtxt.FieldItems.Where(t => t.pageName.Contains(kindSearchName)).ToList()); fieldDictionaryStore.saveToDb(); } } }
public void InitialiseAppResources(AssetManager assetManager, Activity context) { //ContextManager = null; ModuleContext = null; _assetManager = assetManager; _mainContext = context; TemporalViewData = new Dictionary <int, List <FieldValuePair> >(); ApiAssets = new Dictionary <string, string>(); //we read the api key file var bytes = Properties.Resources.api_keys; var inputStream = new MemoryStream(bytes).toText(); //var keys = new Dictionary<string, string>(); var jObject = Newtonsoft.Json.JsonConvert.DeserializeObject(inputStream) as Newtonsoft.Json.Linq.JContainer; var tokens = jObject.ToList <JToken>(); foreach (var token in tokens) { var name = token.First(); var assetName = name.Path; var assetValue = name.Value <string>(); if (Constants.ASSET_LIST.Contains(assetName.ToLowerInvariant())) { ApiAssets[assetName] = assetValue; } } //initialise the data dictionary, if not yet var currentContexts = new List <BaseContextManager>(); var allContexts = new List <BaseContextManager>() { new LspContextManager(null, null), new VmmcContextManager(null, null), new PpxContextManager(null, null) }; foreach (var projContext in allContexts) { if (projContext.FieldItems != null) { currentContexts.Add(projContext); } } var saveDictionaryToDb = false; if (saveDictionaryToDb) { var fieldDictionaryStore = new FieldDictionaryStore(); foreach (var currCtxt in currentContexts) { fieldDictionaryStore.getFields(currCtxt.Name, currCtxt.FieldItems); } fieldDictionaryStore.saveToDb(); } CloudDbInstance = new CloudDb() { ApiAssets = ApiAssets }; var allTables = CloudDb.getAllKindNames(); foreach (var table in allTables) { new CloudLocalStore(table.toKind()).build(); //this creates a table used to store a decrypted set of similar data var dropAndRecreate = false; new CloudLocalStore(CloudDb.getLocalTableName(table).toKind()) .build(dropAndRecreate); new FieldValueStore(CloudDb.getTableFieldValueName(table)) .build(dropAndRecreate); } }