public void RefreshServer(DataSourceServer server) { _serverIsRuning = server.IsRunning; OnPropertyChanged("ServerIsRunning"); OnPropertyChanged("ServerIsRunningImage"); if (server.DataService != null) { ClientCount = server.DataService.Clients.Count; SubCount = server.DataService.Codes.Count; _serverBootTime = server.BootTime; OnPropertyChanged("ServerBootTime"); } if (server.PubService != null) { SendDataCount = server.PubService.PubCount; } if (server.DataSource != null) { RecvDataCount = server.DataSource.RecvDataCount; CacheCount = server.DataSource.CacheCount; } }
public void RefreshClient(DataSourceServer server) { if (server.DataService != null) { List <UserClient> clients = server.DataService.Clients.Values.ToList <UserClient>(); ClientList = new ObservableCollection <UserClient>(clients); } }
public void RefreshStockCode(DataSourceServer server) { if (MarketCodeList.Count == 0) { List <StockCode> codes = StockCodeManager.GetInstance.CodeList; MarketCodeList = new ObservableCollection <StockCode>(codes); } }
public void RefreshSubCode(DataSourceServer server) { if (server.DataService != null) { List <SubCode> codes = server.DataService.Codes.Values.ToList <SubCode>(); SubCodeList = new ObservableCollection <SubCode>(codes); } }
public virtual object ConnectionTest(HttpContext context) { YZRequest request = new YZRequest(context); string serverType = request.GetString("serverType"); JsonSerializer serializer = new JsonSerializer(); StreamReader reader = new StreamReader(context.Request.InputStream); using (JsonTextReader streamReader = new JsonTextReader(reader)) { JArray @params = serializer.Deserialize(streamReader) as JArray; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); string message; bool result; switch (serverType) { case "BPMServer": { BPMServer server = @params[0].ToObject <BPMServer>(serializer); result = server.ConnectTest(cn, out message); break; } case "DataSourceServer": { DataSourceServer server = @params[0].ToObject <DataSourceServer>(serializer); result = server.ConnectTest(cn, out message); break; } case "FTPServer": { FTPServer server = @params[0].ToObject <FTPServer>(serializer); result = server.ConnectTest(cn, out message); break; } default: result = false; message = null; break; } return(new { success = true, result = result, message = result ? "" : message }); } } }
public virtual DataSourceServer GetDataSourceServerDefine(HttpContext context) { YZRequest request = new YZRequest(context); string path = request.GetString("path", null); string serverName = request.GetString("serverName"); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); DataSourceServer server = DataSourceServer.Open(cn, path, serverName); return(server); } }
public virtual void SaveDataSourceServer(HttpContext context) { YZRequest request = new YZRequest(context); string mode = request.GetString("mode"); string path = request.GetString("path", null); string serverName = request.GetString("serverName", mode == "new", null); JsonSerializer serializer = new JsonSerializer(); StreamReader reader = new StreamReader(context.Request.InputStream); using (JsonTextReader streamReader = new JsonTextReader(reader)) { JArray @params = serializer.Deserialize(streamReader) as JArray; DataSourceServer server = @params[0].ToObject <DataSourceServer>(serializer); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); if (mode == "edit") { if (serverName != server.Name) { ExtServer.Rename(cn, path, serverName, server.Name); } server.Save(cn, path, true); } else { server.Save(cn, path, false); } } } }
private void ViewMain_Loaded(object sender, RoutedEventArgs e) { try { _server = new DataSourceServer(); //设置行情源 cbServer_DataType.SelectedIndex = 0; IDataAdapter ds = new TDFDataAdapter(); ds.Setting = SettingManager.GetInstance.RealTimeAdapterSetting; _server.Init(ds); _timer = new DispatcherTimer(); _timer.Tick += new EventHandler(TimerTick); _timer.Interval = TimeSpan.FromMilliseconds(1000); _timer.Start(); } catch (Exception ex) { _logger.Error("系统初始化失败!", ex); MessageBox.Show("系统初始化失败:" + ex.Message); Close(); } }