public Shell(IEventAggregator eventAggregator, IModuleManager moduleManager) { InitializeComponent(); this.receive_Aggregator = eventAggregator; this.send_Aggregator = eventAggregator; this.moduleManager = moduleManager; //定义消息结构 receiveMsgOrder = new ReceiveMsgOrder(); //获取服务器端参数 configModel = ConfigAccess.GetConfig(); //获取客户端版本信息 versionModel = VersionAccess.GetConfig(); //获取连接信息类的单例 connectParam = ConnectParam.GetInstance(); //获取日志记录实例 this.ilogger = ILogger.GetInstance(); //订阅接收信息事件 RequestEvent(); //定义接收消息线程 connectParam.ListenerMsgThread = new Thread(ListenerMsgThreadMethod); connectParam.ListenerMsgThread.IsBackground = true; //先建立连接及SSL通道,再发送 ConnectToServer(MessageTypes.UPD + versionModel.AppVs + MessageTypes.NSP + versionModel.UpdateTime, //确认更新 configModel.LoginIP, int.Parse(configModel.LoginPort)); }
private void updateWindow_Loaded(object sender, RoutedEventArgs e) { viewModel.ConnectStatus = "获得服务器参数..."; configModel = ConfigAccess.GetConfig(); viewModel.ConnectStatus = "连接服务器..."; ConnectToServer(configModel.UpdateIP, configModel.UpdatePort); }
public DownView(DownViewModel _downViewModel, IEventAggregator addgame_Aggregator) { InitializeComponent(); this.DataContext = _downViewModel; this.addgame_Aggregator = addgame_Aggregator; configModel = ConfigAccess.GetConfig(); downViewModel = _downViewModel; DeleteTemp(); }
/// <summary> /// Url 地址重写 /// </summary> public void UrlRewrite_BeginRequest(object sender, EventArgs e) { HttpContext context = ((HttpApplication)sender).Context; string requestPath = context.Request.Path.ToLower(); string appPath = ConfigAccess <AppConfigInfo> .GetConfig().AppPath; if (requestPath.StartsWith(appPath)) { requestPath = requestPath.Substring(appPath.Length); if (requestPath.IndexOf("/") == -1) //访问路径在网站根目录下 { return; } else { if (requestPath.StartsWith("admin/") || requestPath.StartsWith("user/")) { return; } if (requestPath.EndsWith("index.aspx") || requestPath.EndsWith("/")) { string query = requestPath.Substring(0, requestPath.IndexOf("/")); context.RewritePath(appPath + "index.aspx?city=" + query); return; } else { UrlRewriteInfo urls = ConfigAccess <UrlRewriteInfo> .GetConfig(); foreach (UrlRewrite url in urls.UrlRewrite) { if (Regex.IsMatch(requestPath, url.Pattern, RegexOptions.None)) { string query = Regex.Replace(requestPath, url.Pattern, url.QueryString, RegexOptions.None); context.RewritePath(appPath + url.Page, string.Empty, string.Concat(query, "&", context.Request.QueryString)); return; } } } } } }
public static IDataProvider Create() { if (_instance == null) { lock (lockHelper) { try { string dbType = ConfigAccess <AppConfigInfo> .GetConfig().DbType; _instance = (IDataProvider)Activator.CreateInstance(Type.GetType(string.Format("Tuan.Data.{0}.DataProvider, Tuan.Data.{0}", dbType), true, true)); } catch { throw new Exception("请检查App.config中Dbtype节点数据库类型是否正确,例如:SqlServer、Access、MySql"); } } } return(_instance); }
/// <summary> /// Creates a new instance of <see cref="MefLocator"/> using the default configuration. /// </summary> public MefLocator() : this(ConfigAccess.GetConfig <MefSettings>("Mef")) { }