Esempio n. 1
0
        /// <summary>
        /// 服务器端不停的接受客户端发送过来的消息
        /// </summary>
        /// <param name="o"></param>
        public void Recive(object o)
        {
            Socket socketSend = o as Socket;

            while (true)
            {
                //客户端连接成功后,服务器应该接受客户端发来的消息
                byte[] buffer = new byte[1024];
                //实际接受到的有效字节数
                int r = socketSend.Receive(buffer);
                DeviceParameterInfo deviceParameter = new DeviceParameterInfo
                {
                    DeviceInfoId   = buffer[0],
                    NowOutput      = buffer[1],
                    TargetOutput   = buffer[2],
                    SingleProgress = buffer[3],
                    StatusFlag     = "1",
                    StartTime      = DateTime.Now,
                    StopTime       = DateTime.Now,
                    SubTime        = DateTime.Now
                };
                //通过容器创建一个对象。
                IApplicationContext         ctx = ContextRegistry.GetContext();
                IDeviceParameterInfoService DeviceParameterInfoService = ctx.GetObject("DeviceParameterInfoService") as IDeviceParameterInfoService;
                DeviceParameterInfoService.Add(deviceParameter);

                if (r == 0)
                {
                    break;
                }
            }
        }
        public DataCurveChartViewModel(Prism.Events.IEventAggregator eventAggregator, IDeviceParameterInfoService deviceParameterInfoService)
        {
            _eventAggregator            = eventAggregator;
            _deviceParameterInfoService = deviceParameterInfoService;
            _dateConfig = Mappers.Xy <DateModel>()
                          .X(m => (double)m.DateTime.Ticks / TimeSpan.FromHours(1).Ticks)
                          .Y(m => m.Value);

            SeriesCollection = new SeriesCollection(_dateConfig);

            _eventAggregator.GetEvent <HistoryDataUpdatedEvent>().Subscribe(UpdateHistoryDataSeriesCollection);
            _eventAggregator.GetEvent <SelectedEquipmentChangedEvent>().Subscribe(ResetHistoryDataSeriesCollection);
        }
Esempio n. 3
0
 public AnalysisParameterSettingViewModel(IEventAggregator eventAggregator, IDeviceParameterInfoService deviceParameterInfoService, IHistoryDataService historyDataService)
 {
     _eventAggregator            = eventAggregator;
     _deviceParameterInfoService = deviceParameterInfoService;
     _historyDataService         = historyDataService;
 }