Ejemplo n.º 1
0
        /// <summary>
        /// loads the domain information
        /// </summary>
        private void LoadDomainInfo()
        {
            var localSetting = GetStorageSetting();

            CurrentDomain = null;
            try
            {
                if (localSetting.Values.ContainsKey(GatewayHttpInterface.DomainKey))
                {
                    var buf = localSetting.Values[GatewayHttpInterface.DomainKey] as byte[];
                    CurrentDomain       = GatewayHttpInterface.DecodeFromBytes <RecogInstance>(buf);
                    VMHub.CurrentDomain = CurrentDomain;
                }
                else
                {
                    CurrentDomain       = null;
                    VMHub.CurrentDomain = null;
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine("LoadDomainInfo fails with exception {0}", e);
                // Swallow exception if the store can not be used.
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Load information of gateway for Local Storage
        /// </summary>
        public void LoadGatewayInfo()
        {
            var localSetting = GetStorageSetting();

            try
            {
                if (localSetting.Values.ContainsKey(GatewayHttpInterface.GatewayCollectionKey))
                {
                    var buf = localSetting.Values[GatewayHttpInterface.GatewayCollectionKey] as byte[];
                    var gatewayCollection = GatewayHttpInterface.DecodeFromBytes <OneServerInfo[]>(buf);
                    foreach (var info in gatewayCollection)
                    {
                        GatewayCollection.GetOrAdd(info.HostName, info.HostInfo);
                    }
                }
            }
            catch (Exception e)
            {
                Debug.WriteLine("LoadGatewayInfo fails with exception {0}", e);
                // Swallow exception if the store can not be used.
            }

            if (localSetting.Values.ContainsKey(GatewayHttpInterface.GatewayKey))
            {
                CurrentGateway = localSetting.Values[GatewayHttpInterface.GatewayKey].ToString();
            }
            else
            {
                CurrentGateway = App.DefaultGateway;
            }
            GatewayCollection.GetOrAdd(this.CurrentGateway, "Default");
            VMHub.CurrentGateway = this.CurrentGateway;
        }