private void Window_Loaded(object sender, RoutedEventArgs e) { SystemDefaultConfig.IsCS = true; SystemDefaultConfig.DataUpdateFlag = 3; //显示托盘。 SetNotifyIcon(); JudgeProcessExist(); var _startTime = DateTime.Now; //状态定时器 DispatcherTimer dt = new DispatcherTimer(); dt.Interval = TimeSpan.FromSeconds(1); dt.Tick += (obj, args) => { tbRunTime.Text = GetTimeString((int)(DateTime.Now - _startTime).TotalSeconds); }; dt.Start(); _basicHttpPort = OptionHelper.ReadInt("CenterServer", "BasicHttpPort", 80); _netTcpPort = OptionHelper.ReadInt("CenterServer", "NetTcpPort", 4508); _isBasicHttpOnly = OptionHelper.ReadBool("CenterServer", "IsBasicHttpOnly", false); this.Title = OptionHelper.ReadString("CenterServer", "Title", "智慧云平台服务"); _ServerIP = OptionHelper.ReadString("CenterServer", "ServerIP", ""); SystemInfo.ImgPath = OptionHelper.ReadString("CenterServer", "ImgPath", ""); SystemDefaultConfig.ReadConnectionString = new ConnectionStringSettings("ReadConnectionString", "data source=" + OptionHelper.DataSource + ";database=" + OptionHelper.Database + ";user id=" + OptionHelper.LoginName + ";password="******"", "System.Data.SqlClient").ToString(); SystemDefaultConfig.WriteConnectionString = new ConnectionStringSettings("ConnectionString", "data source=" + OptionHelper.DataSource + ";database=" + OptionHelper.Database + ";user id=" + OptionHelper.LoginName + ";password="******"", "System.Data.SqlClient").ToString(); ThreadPool.QueueUserWorkItem(_ => TestDBConnectionState()); LoadExtendConfig(); foreach (var assembly in ExtendAssemblys.Where(a => a.IsEnabled)) { StartAssembly(assembly); } lvservers.ItemsSource = ExtendAssemblys[0].ServiceHosts; PlatformWcfServers.WXServiceCallback.HeartChanged += WXServiceCallback_HeartChanged; PlatformWcfServers.WXServiceCallback.HeartdelteChanged += WXServiceCallback_HeartdelteChanged; lvconnection.ItemsSource = PlatformClientes; PlatformDownloadData.StartDownload(); }
public FrmConfig() { InitializeComponent(); txtDataSource.Text = OptionHelper.DataSource; txtDatabase.Text = OptionHelper.Database; txtLoginName.Text = OptionHelper.LoginName; pbPassword.Password = OptionHelper.Password; try { txtBasicHttpPort.Text = OptionHelper.ReadString("CenterServer", "BasicHttpPort", "80"); txtNetTcpPort.Text = OptionHelper.ReadString("CenterServer", "NetTcpPort", "4508"); txtIP.Text = OptionHelper.ReadString("CenterServer", "ServerIP", "proxy-callback.spsing.cn"); txtOnlineIP.Text = OptionHelper.ReadString("CenterServer", "OnlineIP", ""); txtImgPath.Text = OptionHelper.ReadString("CenterServer", "ImgPath", ""); txtzx.Text = OptionHelper.ReadString("CenterServer", "ZXAddr", ""); } catch (Exception) { } }