コード例 #1
0
        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;
            }
        }
コード例 #2
0
 public void RefreshClient(DataSourceServer server)
 {
     if (server.DataService != null)
     {
         List <UserClient> clients = server.DataService.Clients.Values.ToList <UserClient>();
         ClientList = new ObservableCollection <UserClient>(clients);
     }
 }
コード例 #3
0
 public void RefreshStockCode(DataSourceServer server)
 {
     if (MarketCodeList.Count == 0)
     {
         List <StockCode> codes = StockCodeManager.GetInstance.CodeList;
         MarketCodeList = new ObservableCollection <StockCode>(codes);
     }
 }
コード例 #4
0
 public void RefreshSubCode(DataSourceServer server)
 {
     if (server.DataService != null)
     {
         List <SubCode> codes = server.DataService.Codes.Values.ToList <SubCode>();
         SubCodeList = new ObservableCollection <SubCode>(codes);
     }
 }
コード例 #5
0
        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
                    });
                }
            }
        }
コード例 #6
0
        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);
            }
        }
コード例 #7
0
        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);
                    }
                }
            }
        }
コード例 #8
0
        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();
            }
        }