예제 #1
0
        protected override void RelayMethod(object obj)
        {
            string command = obj.ToString();

            //  Do:应用
            if (command == "init")
            {
                //for (int i = 0; i < 4; i++)
                //{
                //    RowIdEntity vm = new RowIdEntity();
                //    vm.ID = "贵广线_上行_佛山站_肇庆站_" + i;
                //    this.RawIdCollection.Add(vm);
                //}
            }
            //  Do:取消
            else if (command == "btn_divied")
            {
                TaskAssignmentWindow window = new TaskAssignmentWindow();
                window.DataContext = this.Current.Model;

                Action <ObservableCollection <TaskModel> > action = l =>
                {
                    foreach (var item in l)
                    {
                        Debug.WriteLine(item.SeriaNumber);
                    }

                    window.Close();
                };
                this.Current.Model.SaveEvent += action;
                window.ShowDialog();
                this.Current.Model.SaveEvent -= action;
            }
            //  Do:取消
            else if (command == "btn_showTask")
            {
                TaskLookUpWindow window = new TaskLookUpWindow();
                window.DataContext = this.Current.Model;
                window.ShowDialog();
            }
            //  Do:取消
            else if (command == "btn_add")
            {
                RowIdEntity entity = new RowIdEntity();

                ObservableCollection <TyeBaseSiteEntity> stations = new ObservableCollection <TyeBaseSiteEntity>();

                stations.Add(new TyeBaseSiteEntity()
                {
                    ID = "1001", SiteName = "北京站"
                });
                stations.Add(new TyeBaseSiteEntity()
                {
                    ID = "1001", SiteName = "上海站"
                });
                stations.Add(new TyeBaseSiteEntity()
                {
                    ID = "1001", SiteName = "天津站"
                });
                stations.Add(new TyeBaseSiteEntity()
                {
                    ID = "1001", SiteName = "佛山站"
                });
                stations.Add(new TyeBaseSiteEntity()
                {
                    ID = "1001", SiteName = "广州站"
                });
                stations.Add(new TyeBaseSiteEntity()
                {
                    ID = "1001", SiteName = "肇庆站"
                });

                ObservableCollection <TyeAdminUserEntity> analysts = new ObservableCollection <TyeAdminUserEntity>();
                analysts.Add(new TyeAdminUserEntity()
                {
                    ID = "1001", Name = "刘德华"
                });
                analysts.Add(new TyeAdminUserEntity()
                {
                    ID = "1001", Name = "张国荣"
                });
                analysts.Add(new TyeAdminUserEntity()
                {
                    ID = "1001", Name = "贝克汉姆"
                });
                analysts.Add(new TyeAdminUserEntity()
                {
                    ID = "1001", Name = "齐达内"
                });
                analysts.Add(new TyeAdminUserEntity()
                {
                    ID = "1001", Name = "劳尔"
                });
                analysts.Add(new TyeAdminUserEntity()
                {
                    ID = "1001", Name = "马拉多纳"
                });
                analysts.Add(new TyeAdminUserEntity()
                {
                    ID = "1001", Name = "郝海东"
                });

                //entity.Model.RefreshConfig(task);

                entity.ID = Guid.NewGuid().ToString();

                entity.Model.SetTyeAdminUserEntity(analysts);
                entity.Model.SetTyeBaseSiteEntity(stations);

                entity.Model.SeletctSameSiteEvent += l =>
                {
                    MessageBox.Show("选择了相同站:" + l.SiteName);



                    ObservableCollection <TyeBasePillarEntity> _poles = new ObservableCollection <TyeBasePillarEntity>();
                    for (int i = 1; i < 10; i++)
                    {
                        _poles.Add(new TyeBasePillarEntity()
                        {
                            ID = i.ToString(), PoleCode = i.ToString()
                        });
                    }

                    entity.Model.SetTyeBasePillarEntity(_poles);
                };

                this.RawIdCollection.Add(entity);
            }
        }
예제 #2
0
        protected override void RelayMethod(object obj)
        {
            string command = obj.ToString();

            //  Do:应用
            if (command == "init")
            {
                RowIdEntity entity = new RowIdEntity();
                entity.ID = "初始化加载的任务列表示例";

                //  Message:设置站列表
                ObservableCollection <TyeLineEntity> stations = new ObservableCollection <TyeLineEntity>();

                stations.Add(new TyeLineEntity()
                {
                    ID = "1001", Name = "第1段"
                });
                stations.Add(new TyeLineEntity()
                {
                    ID = "1002", Name = "第2段"
                });
                stations.Add(new TyeLineEntity()
                {
                    ID = "1003", Name = "第3段"
                });
                stations.Add(new TyeLineEntity()
                {
                    ID = "1004", Name = "第4段"
                });
                stations.Add(new TyeLineEntity()
                {
                    ID = "1005", Name = "第5段"
                });
                stations.Add(new TyeLineEntity()
                {
                    ID = "1006", Name = "第6段"
                });
                stations.Add(new TyeLineEntity()
                {
                    ID = "1007", Name = "第7段"
                });
                stations.Add(new TyeLineEntity()
                {
                    ID = "1008", Name = "第8段"
                });
                stations.Add(new TyeLineEntity()
                {
                    ID = "1009", Name = "第9段"
                });
                stations.Add(new TyeLineEntity()
                {
                    ID = "1010", Name = "第10段"
                });
                stations.Add(new TyeLineEntity()
                {
                    ID = "1011", Name = "第11段"
                });
                stations.Add(new TyeLineEntity()
                {
                    ID = "1012", Name = "第12段"
                });

                //  Message:设置分析人员列表
                ObservableCollection <TyeAdminUserEntity> analysts = new ObservableCollection <TyeAdminUserEntity>();
                analysts.Add(new TyeAdminUserEntity()
                {
                    ID = "2001", Name = "刘德华"
                });
                analysts.Add(new TyeAdminUserEntity()
                {
                    ID = "2002", Name = "张国荣"
                });
                analysts.Add(new TyeAdminUserEntity()
                {
                    ID = "2003", Name = "贝克汉姆"
                });
                analysts.Add(new TyeAdminUserEntity()
                {
                    ID = "2004", Name = "齐达内"
                });
                analysts.Add(new TyeAdminUserEntity()
                {
                    ID = "2005", Name = "劳尔"
                });
                analysts.Add(new TyeAdminUserEntity()
                {
                    ID = "2006", Name = "马拉多纳"
                });
                analysts.Add(new TyeAdminUserEntity()
                {
                    ID = "2007", Name = "郝海东"
                });

                //  Message:加载历史任务信息
                ObservableCollection <TaskModel_2C> collection = new ObservableCollection <TaskModel_2C>();

                TaskModel_2C model = new TaskModel_2C();
                model.ID                 = "100000";
                model.AnalystID          = "2005";
                model.TaskEndTime        = DateTime.Now;
                model.TaskStartTime      = DateTime.Now;
                model.StartSiteID        = "1001";
                model.ProcessType        = 1;
                model.ProcessedFileCount = 44;
                model.TotalFileCount     = 100;
                model.EndSiteID          = "1004";
                model.Remark             = "1001,1002";
                collection.Add(model);

                model                    = new TaskModel_2C();
                model.ID                 = "100001";
                model.AnalystID          = "2001";
                model.TaskEndTime        = DateTime.Now;
                model.TaskStartTime      = DateTime.Now;
                model.StartSiteID        = "1001";
                model.ProcessedFileCount = 95;
                model.TotalFileCount     = 100;
                model.EndSiteID          = "1001";

                model.StartPoleID = "1";
                model.EndPoleID   = "3";
                model.Remark      = "1005,1009";
                collection.Add(model);

                entity.Model.SetTyeAdminUserEntity(analysts);
                entity.Model.SetTyeLineEntity(stations);

                //  Message:调用此方法前需要优先设置分析员和站信息列表
                entity.Model.SetTaskModelList(collection);

                entity.Model.SaveEvent += l =>
                {
                    Debug.WriteLine("说明");
                };

                this.RawIdCollection.Add(entity);
            }
            //  Do:取消
            else if (command == "btn_divied")
            {
                TaskAssignmentWindow window = new TaskAssignmentWindow();
                window.DataContext = this.Current.Model;

                Action <ObservableCollection <TaskModel_2C> > action = l =>
                {
                    Thread.Sleep(3000);

                    foreach (var item in l)
                    {
                        Debug.WriteLine(item.ID + "- " + item.StartSiteID + "- " + item.EndSiteID);
                    }

                    //  Message:调用主线程用Dispatcher
                    Application.Current.Dispatcher.Invoke(() =>
                    {
                        window.Close();
                    });
                };

                //  Message:注册保存事件
                this.Current.Model.SaveEvent += action;
                window.ShowDialog();
                this.Current.Model.SaveEvent -= action;
            }
            //  Do:取消
            else if (command == "btn_showTask")
            {
                TaskLookUpWindow window = new TaskLookUpWindow();
                window.DataContext = this.Current.Model;
                window.ShowDialog();
            }
            //  Do:取消
            else if (command == "btn_add")
            {
                RowIdEntity entity = new RowIdEntity();
                entity.ID = "初始化加载的任务列表示例";

                //  Message:设置站列表
                ObservableCollection <TyeLineEntity> stations = new ObservableCollection <TyeLineEntity>();

                stations.Add(new TyeLineEntity()
                {
                    ID = "1001", Name = "第1段"
                });
                stations.Add(new TyeLineEntity()
                {
                    ID = "1002", Name = "第2段"
                });
                stations.Add(new TyeLineEntity()
                {
                    ID = "1003", Name = "第3段"
                });
                stations.Add(new TyeLineEntity()
                {
                    ID = "1004", Name = "第4段"
                });
                stations.Add(new TyeLineEntity()
                {
                    ID = "1005", Name = "第5段"
                });
                stations.Add(new TyeLineEntity()
                {
                    ID = "1006", Name = "第6段"
                });
                stations.Add(new TyeLineEntity()
                {
                    ID = "1007", Name = "第7段"
                });
                stations.Add(new TyeLineEntity()
                {
                    ID = "1008", Name = "第8段"
                });
                stations.Add(new TyeLineEntity()
                {
                    ID = "1009", Name = "第9段"
                });
                stations.Add(new TyeLineEntity()
                {
                    ID = "1010", Name = "第10段"
                });
                stations.Add(new TyeLineEntity()
                {
                    ID = "1011", Name = "第11段"
                });
                stations.Add(new TyeLineEntity()
                {
                    ID = "1012", Name = "第12段"
                });

                //  Message:设置分析人员列表
                ObservableCollection <TyeAdminUserEntity> analysts = new ObservableCollection <TyeAdminUserEntity>();
                analysts.Add(new TyeAdminUserEntity()
                {
                    ID = "2001", Name = "刘德华"
                });
                analysts.Add(new TyeAdminUserEntity()
                {
                    ID = "2002", Name = "张国荣"
                });
                analysts.Add(new TyeAdminUserEntity()
                {
                    ID = "2003", Name = "贝克汉姆"
                });
                analysts.Add(new TyeAdminUserEntity()
                {
                    ID = "2004", Name = "齐达内"
                });
                analysts.Add(new TyeAdminUserEntity()
                {
                    ID = "2005", Name = "劳尔"
                });
                analysts.Add(new TyeAdminUserEntity()
                {
                    ID = "2006", Name = "马拉多纳"
                });
                analysts.Add(new TyeAdminUserEntity()
                {
                    ID = "2007", Name = "郝海东"
                });

                //  Message:加载历史任务信息
                ObservableCollection <TaskModel_2C> collection = new ObservableCollection <TaskModel_2C>();


                entity.Model.SetTyeAdminUserEntity(analysts);
                entity.Model.SetTyeLineEntity(stations);

                //  Message:调用此方法前需要优先设置分析员和站信息列表
                entity.Model.SetTaskModelList(collection);

                entity.Model.SaveEvent += l =>
                {
                    Debug.WriteLine("说明");
                };

                this.RawIdCollection.Add(entity);
            }
        }