Ejemplo n.º 1
0
        public void SetUp()
        {
            var resolver = new ServiceLocator();

            this.filter = resolver.GetCustomFiltersDataProcessor <AllTypesModel>();
            this.data   = DataGenerator.GenerateSimpleData(5000, RangeConstant);
        }
Ejemplo n.º 2
0
        public void SaveTask(IDataProcess process, bool haveui)
        {
            var task = CurrentProject.Tasks.FirstOrDefault(d => d.Name == process.Name);

            if (haveui == false ||
                MessageBox.Show(
                    GlobalHelper.Get("key_311") +
                    (task == null ? GlobalHelper.Get("key_312") : GlobalHelper.Get("key_313")),
                    GlobalHelper.Get("key_99"),
                    MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                configDocument = (process as IDictionarySerializable).DictSerialize();
                if (task == null)
                {
                    task = new ProcessTask
                    {
                        Name        = process.Name,
                        Description = GlobalHelper.Get("key_314")
                    };

                    CurrentProject.Tasks.Add(task);
                }

                task.ProcessToDo = configDocument;
                // XLogSys.Print.Warn(string.Format(GlobalHelper.Get("key_315"),task.Name));
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 查找引用该模块的所有任务
        /// </summary>
        /// <param name="obj"></param>
        private void PrintReferenced(IDataProcess obj)
        {
            if (obj is SmartETLTool)
            {
                var tool     = obj as SmartETLTool;
                var oldtools = CurrentProcessCollections.OfType <SmartETLTool>().SelectMany(d => d.CurrentETLTools).OfType <ETLBase>().Where(d => d.ETLSelector.SelectItem == tool.Name).ToList();
                XLogSys.Print.Info("====================" + GlobalHelper.Get("smartetl_name") + "===================");
                foreach (var oldtool in oldtools)
                {
                    XLogSys.Print.Info(string.Format("{0} :{1}", oldtool.Father.Name, oldtool.ObjectID));
                }
            }
            if (obj is SmartCrawler)
            {
                var tool       = obj as SmartCrawler;
                var _name      = tool.Name;
                var oldCrawler = CurrentProcessCollections.OfType <SmartCrawler>()
                                 .Where(d => d.ShareCookie.SelectItem == _name).ToList();
                var oldEtls = CurrentProcessCollections.OfType <SmartETLTool>()
                              .SelectMany(d => d.CurrentETLTools).OfType <ResponseTF>()
                              .Where(d => d.CrawlerSelector.SelectItem == _name).ToList();
                XLogSys.Print.Info("====================" + GlobalHelper.Get("smartcrawler_name") + "=================");

                foreach (var oldtool in oldCrawler)
                {
                    XLogSys.Print.Info(string.Format("\t{0}", oldtool.Name));
                }
                XLogSys.Print.Info(GlobalHelper.Get("smartetl_name"));
                foreach (var oldtool in oldEtls)
                {
                    XLogSys.Print.Info(string.Format("{0} :{1}", oldtool.Father.Name, oldtool.ObjectID));
                }
            }
            XLogSys.Print.Info("======================================================================");
        }
Ejemplo n.º 4
0
        //
        //根据通道编号获取传感器信息
        public static IDataProcess GetDataProcess(string data, out string dataType)
        {
            try
            {
                string tdno   = common.GetTdno(data);
                Device device = common.GetDeviceByTdno(tdno);
                dataType = device.type;

                IDataProcess dataProcess = null;
                switch (device.type)
                {
                //震弦式
                case "轴力-单弦":
                case "土压":
                case "轴力-三弦":
                case "锚索-三弦":
                case "表面应变":
                case "钢筋":
                case "渗压":
                    dataProcess = new DataProcessZX(); break;

                    //485式
                }
                return(dataProcess);
            }
            catch (Exception ex)
            {
                FileOperation.WriteAppenFile("判断传感器类型失败," + ex.Message);
                throw ex;
            }
        }
Ejemplo n.º 5
0
 public QueueDataProcess(IDataProcess iDataProcess)
 {
     System.Diagnostics.Debug.Assert(iDataProcess != null);
     m_iDataProcess = iDataProcess;
     m_bRunning     = false;
     m_queue        = new Queue <T>();
 }
Ejemplo n.º 6
0
        public void ReceiveMessageWithCallBack(IDataProcess process)
        {
            while (true)
            {
                try
                {
                    ipEndPoint = null;
                    using (UdpClient udpClient = new UdpClient(MulticastPort))
                    {
                        udpClient.JoinMulticastGroup(_ip, TTL);

                        while (true)
                        {
                            Thread.Sleep(ReceptionDelayInMiliseconds);

                            List <byte> data = new List <byte>();
                            while (udpClient.Available > 0)
                            {
                                data.AddRange(udpClient.Receive(ref ipEndPoint));
                            }
                            new Thread(() => process.OnReceivingData(data)).Start();
                        }
                    }
                }

                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                    Thread.Sleep(5000);
                }
            }
        }
 private int GetRecordsFiltered(IDataProcess <T> dataProcessChain)
 {
     return
         (((IDataProcessChain <T>)dataProcessChain)
          .DataProcessors
          .Last(p => typeof(IDataFilter).IsAssignableFrom(p.GetType()))
          .ProcessedData.Count());
 }
        public void SetUp()
        {
            var resolver = new ServiceLocator();

            this.filter        = resolver.GetSortDataProcessor <AllTypesModel>();
            this.complexFilter = new SortDataProcessor <ComplexModel>();
            this.data          = DataGenerator.GenerateSimpleData(500, 500);
            this.complexData   = new List <ComplexModel>().AsQueryable();
        }
Ejemplo n.º 9
0
        public void SetUp()
        {
            var resolver = new ServiceLocator();

            this.filterSimpleModelProcessor  = resolver.GetColumnsFilterDataProcessor <AllTypesModel>();
            this.filterComplexModelProcessor = resolver.GetColumnsFilterDataProcessor <ComplexModel>();
            this.simpleData  = new List <AllTypesModel>().AsQueryable();
            this.complexData = new List <ComplexModel>().AsQueryable();
        }
Ejemplo n.º 10
0
        private void LoadProcessView(IDataProcess rc)
        {
            var view    = PluginManager.AddCusomView(MainFrmUI as IDockableManager, rc.TypeName, rc as IView);
            var control = view as UserControl;

            if (control != null)
            {
                control.DataContext = rc;
            }
        }
Ejemplo n.º 11
0
 /// <summary>
 /// 显示结果
 /// </summary>
 /// <param name="window"></param>
 public void DisplayResult(HWindow_Final window)
 {
     for (int i = 0; i < measuringUnits.Count; i++)
     {
         IDataProcess item = (IDataProcess)measuringUnits[i];
         if (item.MeasureDone)
         {
             if (item is TranslationTracking)
             {
                 (item as TranslationTracking).line.DisplayResult(window); //新加的
             }
             item.DisplayResult(window);                                   //显示简单信息
         }
     }
 }
Ejemplo n.º 12
0
        public virtual IDataProcess Load(bool addui)
        {
            IDataProcess process = ProcessManager.GetTask(this.TaskType, this.Name);

            if (process != null)
            {
                return(process);
            }
            ControlExtended.SafeInvoke(() =>
            {
                process = ProcessManager.GetOneInstance(this.TaskType, newOne: true, addUI: addui);
                ProcessToDo.DictCopyTo(process as IDictionarySerializable);
                process.Init();
                EvalScript();
            }, LogType.Important, string.Format(GlobalHelper.Get("key_327"), Name), MainDescription.IsUIForm);
            return(process);
        }
Ejemplo n.º 13
0
        //根据端口号确定传感器以及数据类型
        public static IDataProcess GetDataProcess(int port, out string dataType, out int xmno)
        {
            try
            {
                IDataProcess      dataProcess       = null;
                DataProcessCommon dataProcessCommon = new DataProcessCommon();

                //根据端口号获取项目编号
                //string xmno = dataProcessCommon.GetXmno(port);
                //根据端口号判断数据类型
                dataType = null;
                xmno     = 0;
                dataProcessCommon.GetDataType(port, out dataType, out xmno);
                Console.WriteLine("收到来自端口{0}的{1}数据", port.ToString(), dataType);

                string info = string.Format("收到来自端口{0}的{1}数据", port.ToString(), dataType);
                FileOperation.WriteAppenFile(info);

                switch (dataType)
                {
                //震弦式
                case "应变":
                case "土压":
                case "锚索":
                case "钢筋":
                case "轴力":
                case "水压":
                    dataProcess = new DataProcessZX(); break;

                    //485式

                    //    dataProcess = new DataProcess485(); break;
                }
                return(dataProcess);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 14
0
        private void SaveTask(IDataProcess process, bool haveui)
        {
            var task = CurrentProject.Tasks.FirstOrDefault(d => d.Name == process.Name);

            if (haveui == false || MessageBox.Show("是否确定保存任务?" + (task == null ? "将新建任务" : "存在同名任务,将覆盖该任务"), "提示信息",
                                                   MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                configDocument = (process as IDictionarySerializable).DictSerialize();
                if (task == null)
                {
                    task = new ProcessTask
                    {
                        Name        = process.Name,
                        Description = "任务描述",
                    };

                    CurrentProject.Tasks.Add(task);
                }

                task.ProcessToDo = configDocument;
            }
        }
Ejemplo n.º 15
0
 public void RemoveOperation(IDataProcess process)
 {
     dockableManager.RemoveDockableContent(process);
     process.Close();
 }
Ejemplo n.º 16
0
 public RoadStatusService(IDataProcess dataProcess,
                          IHelperClass helperClass)
 {
     _dataProcess = dataProcess;
     _helperClass = helperClass;
 }
Ejemplo n.º 17
0
 public InputAccept(IDataProcess dataprocess)
 {
     _dataProcess = dataprocess;
 }
Ejemplo n.º 18
0
 public DataProcess(IDataProcess dataProcess) => _dataProcess = dataProcess;
Ejemplo n.º 19
0
 public void RemoveOperation(IDataProcess process)
 {
     dockableManager.RemoveDockableContent(process);
     process.Close();
 }
Ejemplo n.º 20
0
 /// <summary>
 /// Adds a data processor to the execution chain.
 /// </summary>
 /// <param name="dataProcessor">The data processor.</param>
 public void AddDataProcessor(IDataProcess <T> dataProcessor)
 {
     this.dataProcessors.Add(dataProcessor);
 }
Ejemplo n.º 21
0
 private void LoadProcessView(IDataProcess rc)
 {
     var view = PluginManager.AddCusomView(MainFrmUI as IDockableManager, rc.TypeName, rc as IView);
     var control = view as UserControl;
     if (control != null)
     {
         control.DataContext = rc;
     }
 }
Ejemplo n.º 22
0
        private void SaveTask(IDataProcess process, bool haveui)
        {
            var task = CurrentProject.Tasks.FirstOrDefault(d => d.Name == process.Name);

            if (haveui == false || MessageBox.Show("是否确定保存任务?" + (task == null ? "将新建任务" : "存在同名任务,将覆盖该任务"), "提示信息",
                MessageBoxButton.OKCancel) == MessageBoxResult.OK)
            {
                configDocument = (process as IDictionarySerializable).DictSerialize();
                if (task == null)
                {
                    task = new ProcessTask
                    {
                        Name = process.Name,
                        Description = "任务描述",
                        CreateTime = DateTime.Now
                    };

                    CurrentProject.Tasks.Add(task);
                }

                task.ProcessToDo = configDocument;
            }
        }