예제 #1
0
        private async Task <string> GetAFDatabaseWebID()
        {
            string webId = AppSettingsManager.Instance.LocalSettings.Containers["ServerSettings"].GetValueOrDefault("WebId_AFDatabase", "");

            if (!string.IsNullOrEmpty(webId))
            {
                return(webId);
            }

            HttpResponseMessage responseGetDatabase = await _efClient.GetDatabaseByPath(@"\\jupiter001\pifitness2.0");

            dynamic valueResult;

            using (StreamReader sr = new StreamReader((await responseGetDatabase.Content.ReadAsInputStreamAsync()).AsStreamForRead()))
            {
                using (JsonTextReader jReader = new JsonTextReader(sr))
                {
                    valueResult = JObject.ReadFrom(jReader);
                }
            }

            string newWebId = valueResult["WebId"];

            if (!string.IsNullOrEmpty(newWebId))
            {
                AppSettingsManager.Instance.LocalSettings.Containers["ServerSettings"].AddOrUpdateValue("WebId_AFDatabase", newWebId);
            }

            return(newWebId);
        }