示例#1
0
        public async Task Save()
        {
            StorageFile file = await ApplicationData.Current.LocalFolder.CreateFileAsync(
                FileName,
                CreationCollisionOption.ReplaceExisting);

            // Create a duplicate because this might be a ServiceInfoProxy
            // and you can't serialize internal classes.
            ServiceInfo duplicate = new ServiceInfo()
            {
                ServiceUrl = this.ServiceUrl,
                ShellUrl = this.ShellUrl
            };

            // We should have a lock around reads/writes, but you can't await inside a lock.
            await FileIO.WriteTextAsync(file, duplicate.ToXml());
        }
        private void UpdateServiceInfo(ServiceInfo serviceInfo)
        {
            // Setting ServiceInfo updates m_client.ServiceInfo too
            ServiceInfo = new ServiceInfoProxy()
            {
                ServiceUrl = serviceInfo.ServiceUrl,
                ShellUrl = serviceInfo.ShellUrl
            };

            m_appSettings.ServiceUrl = ServiceInfo.ServiceUrl;
            m_appSettings.ShellUrl = ServiceInfo.ShellUrl;
        }