Esempio n. 1
0
        public void Complete(Parameter parameter)
        {
            OmissionParameter param = parameter as OmissionParameter;

            if (param == null)
            {
                return;
            }

            TabControl target = parameter.Target as TabControl;

            if (target == null)
            {
                return;
            }

            string pageKey     = string.Format("{0}|{1}|{2}", param.DbName, param.NumberType, param.Dimension);
            string pageText    = string.Format("{0}|{1}|{2}", param.CategoryName, param.NumberTypeName, param.DimensionName);
            string listViewKey = "omv_" + pageKey;

            TabPage  tabPage  = this.GetTabPage(target, pageKey, pageText);
            ListView listView = this.GetListView(tabPage, listViewKey, param);

            this.FillListView(listView, param.Precision);

            target.SelectedTab = tabPage;

            param.Owner.SetStatusText(pageText, string.Format("号码个数:{0}", this.viewDatas.Count));
        }
Esempio n. 2
0
        private ListView GetListView(Control tabPage, string key, OmissionParameter param)
        {
            ListView listView = null;

            if (tabPage.Controls.ContainsKey(key))
            {
                listView = tabPage.Controls[key] as ListView;
                listView.Items.Clear();
                listView.Tag = param;
                return(listView);
            }

            listView               = new ListView();
            listView.Name          = key;
            listView.Dock          = DockStyle.Fill;
            listView.View          = View.Details;
            listView.FullRowSelect = true;
            listView.GridLines     = true;
            listView.Tag           = param;

            this.AddListViewColumnHeaders(listView);
            this.AddListViewEvents(listView, param);
            tabPage.Controls.Add(listView);

            return(listView);
        }
Esempio n. 3
0
        public void Start(Parameter parameter)
        {
            OmissionParameter param = parameter as OmissionParameter;

            if (param == null)
            {
                return;
            }

            this.SetViewData(param);
        }
Esempio n. 4
0
        private void SetViewData(OmissionParameter param, List <OmissionValue> omValues)
        {
            this.viewDatas = new List <OmissionValueViewData>(omValues.Count);

            int progressCount = 0;
            int total         = omValues.Count;

            foreach (var omv in omValues)
            {
                this.viewDatas.Add(new OmissionValueViewData(param.StartDC, param.EndDC, omv));
                int percent = (int)((float)(++progressCount) / (float)total * 100);
                param.Worker.ReportProgress(percent, param.UserState);
            }
        }
Esempio n. 5
0
        private void SetViewData(OmissionParameter param)
        {
            OmissionValueLys     lys      = new OmissionValueLys(param.DbName);
            List <OmissionValue> omValues = null;

            if (Cache.OmissonValueColumnHeaders[param.OrderByColName].IsDbSort)
            {
                omValues = lys.GetOmissionValues(param.RuleType, param.NumberType,
                                                 param.Dimension, param.Filter, param.OrderByColName, param.SortType);
                this.SetViewData(param, omValues);
            }
            else
            {
                omValues = lys.GetOmissionValues(param.RuleType, param.NumberType, param.Dimension, param.Filter);
                this.SetViewData(param, omValues);
                this.viewDatas = param.SortType.Equals("DESC") ?
                                 this.viewDatas.OrderByDescending(x => x[param.OrderByColName]).ToList() :
                                 this.viewDatas.OrderBy(x => x[param.OrderByColName]).ToList();
            }
        }
Esempio n. 6
0
        private void AddListViewEvents(ListView listView, OmissionParameter param)
        {
            listView.ColumnClick += new ColumnClickEventHandler(param.Owner.OmissionValueListViewColumnClick);

            listView.ContextMenu = new ContextMenu();
            MenuItem menuItem = new MenuItem("查看(&V)", param.Owner.OmissionValueListViewContextMenuItemClick);

            menuItem.Name = "omv_view";
            menuItem.Tag  = param;
            listView.ContextMenu.MenuItems.Add(menuItem);

            menuItem      = new MenuItem("公式(&F)", param.Owner.OmissionValueListViewContextMenuItemClick);
            menuItem.Name = "omv_formula";
            menuItem.Tag  = param;
            listView.ContextMenu.MenuItems.Add(menuItem);

            menuItem      = new MenuItem("刷新(&R)", param.Owner.OmissionValueListViewContextMenuItemClick);
            menuItem.Name = "omv_refresh";
            menuItem.Tag  = param;
            listView.ContextMenu.MenuItems.Add(menuItem);
        }
Esempio n. 7
0
        private void SetViewData(OmissionParameter param, List<OmissionValue> omValues)
        {
            this.viewDatas = new List<OmissionValueViewData>(omValues.Count);

            int progressCount = 0;
            int total = omValues.Count;
            foreach (var omv in omValues)
            {
                this.viewDatas.Add(new OmissionValueViewData(param.StartDC, param.EndDC, omv));
                int percent = (int)((float)(++progressCount) / (float)total * 100);
                param.Worker.ReportProgress(percent, param.UserState);
            }
        }
Esempio n. 8
0
        private void SetViewData(OmissionParameter param)
        {
            OmissionValueLys lys = new OmissionValueLys(param.DbName);
            List<OmissionValue> omValues = null;

            if (Cache.OmissonValueColumnHeaders[param.OrderByColName].IsDbSort)
            {
                omValues = lys.GetOmissionValues(param.RuleType, param.NumberType,
                    param.Dimension, param.Filter, param.OrderByColName, param.SortType);
                this.SetViewData(param, omValues);
            }
            else
            {
                omValues = lys.GetOmissionValues(param.RuleType, param.NumberType, param.Dimension, param.Filter);
                this.SetViewData(param, omValues);
                this.viewDatas = param.SortType.Equals("DESC") ?
                    this.viewDatas.OrderByDescending(x => x[param.OrderByColName]).ToList() :
                    this.viewDatas.OrderBy(x => x[param.OrderByColName]).ToList();
            }
        }
Esempio n. 9
0
        private ListView GetListView(Control tabPage, string key, OmissionParameter param)
        {
            ListView listView = null;

            if (tabPage.Controls.ContainsKey(key))
            {
                listView = tabPage.Controls[key] as ListView;
                listView.Items.Clear();
                listView.Tag = param;
                return listView;
            }

            listView = new ListView();
            listView.Name = key;
            listView.Dock = DockStyle.Fill;
            listView.View = View.Details;
            listView.FullRowSelect = true;
            listView.GridLines = true;
            listView.Tag = param;

            this.AddListViewColumnHeaders(listView);
            this.AddListViewEvents(listView, param);
            tabPage.Controls.Add(listView);

            return listView;
        }
Esempio n. 10
0
        private void AddListViewEvents(ListView listView, OmissionParameter param)
        {
            listView.ColumnClick += new ColumnClickEventHandler(param.Owner.OmissionValueListViewColumnClick);

            listView.ContextMenu = new ContextMenu();
            MenuItem menuItem = new MenuItem("查看(&V)", param.Owner.OmissionValueListViewContextMenuItemClick);
            menuItem.Name = "omv_view";
            menuItem.Tag = param;
            listView.ContextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("公式(&F)", param.Owner.OmissionValueListViewContextMenuItemClick);
            menuItem.Name = "omv_formula";
            menuItem.Tag = param;
            listView.ContextMenu.MenuItems.Add(menuItem);

            menuItem = new MenuItem("刷新(&R)", param.Owner.OmissionValueListViewContextMenuItemClick);
            menuItem.Name = "omv_refresh";
            menuItem.Tag = param;
            listView.ContextMenu.MenuItems.Add(menuItem);
        }