Пример #1
0
        public void FixtureSetUp()
        {
            ViewManager.GetInstance().RegisterViewFactory(new TrendingViewFactory());
            IView view = ViewManager.GetInstance().GetView(TrendViewConst.AddDataPointData, TestConst.TEST_VIEW_ID);

            dataPointDataController = (DataPointDataController)(view.getController());
            dataPointDataController.AttachCallBack(null, view);
            if (DBConnectionStrings.GetInstance().GetConnectionStrings().Count < 1)
            {
                DBConnectionStrings.GetInstance().AddConnectionString(TestConst.CONNECTION_STR);
                SimpleDatabase.GetInstance().OpenConnection();
            }
        }
Пример #2
0
        public override void AttachListener(STEE.ISCS.MVC.IController controller)
        {
            DataPointDataController ctl = (DataPointDataController)(controller);

            this.browseCmd.Click += ctl.BrowseDP;

            if (m_formType == FormType.Add)
            {
                this.okCmd.Click += ctl.AddDataPointData;
            }
            else
            {
                this.okCmd.Click += ctl.ModifyDataPoint;
            }
        }
        public IView CreateView(string type, string id)
        {
            IView       view       = null;
            IController controller = null;
            IModel      model      = null;

            switch (type)
            {
            case  TrendViewConst.About:
                view          = new About();
                view.ViewType = TrendViewConst.About;
                break;

            case TrendViewConst.TrendView:
                view          = new TrendView();
                view.ViewType = TrendViewConst.TrendView;
                controller    = new TrendViewController();
                model         = new TrendViewModel();
                controller.Attach(model, view);
                break;

            // marker related:
            case TrendViewConst.MarkerList:
                view          = new MarkerList();
                view.ViewType = TrendViewConst.MarkerList;
                controller    = new MarkerListController();
                model         = new MarkerListModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.LoadConfigMarker:
                view       = new MarkerGroup();
                controller = new MarkerGroupController();
                model      = new MarkerGroupModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.SaveConfigMarker:
                view       = new MarkerGroup();
                controller = new MarkerGroupController();
                model      = new MarkerGroupModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.AddMarkerData:
                view       = new MarkerData();
                controller = new MarkerDataController();
                model      = new MarkerDataModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.EditMarkerData:
                view       = new MarkerData();
                controller = new MarkerDataController();
                model      = new MarkerDataModel();
                controller.Attach(model, view);
                break;

            // formula related:
            case TrendViewConst.FormulaList:
                view          = new FormulaList();
                view.ViewType = TrendViewConst.FormulaList;
                controller    = new FormulaListController();
                model         = new FormulaListModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.LoadConfigFormula:
                view       = new FormulaGroup();
                controller = new FormulaGroupController();
                model      = new FormulaGroupModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.SaveConfigFormula:
                view       = new FormulaGroup();
                controller = new FormulaGroupController();
                model      = new FormulaGroupModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.AddFormulaData:
                view       = new FormulaData();
                controller = new FormulaDataController();
                model      = new FormulaDataModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.EditFormulaData:
                view       = new FormulaData();
                controller = new FormulaDataController();
                model      = new FormulaDataModel();
                controller.Attach(model, view);
                break;

            // DP related:
            case TrendViewConst.DataPointList:
                view          = new DataPointList();
                view.ViewType = TrendViewConst.DataPointList;
                controller    = new DataPointListController();
                model         = new DataPointListModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.LoadConfigDataPoint:
                view       = new DataPointGroup();
                controller = new DataPointGroupController();
                model      = new DataPointGroupModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.SaveConfigDataPoint:
                view       = new DataPointGroup();
                controller = new DataPointGroupController();
                model      = new DataPointGroupModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.AddDataPointData:
                view       = new DataPointData();
                controller = new DataPointDataController();
                model      = new DataPointDataModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.EditDataPointData:
                view       = new DataPointData();
                controller = new DataPointDataController();
                model      = new DataPointDataModel();
                controller.Attach(model, view);
                break;

            //Hist DP related:
            case TrendViewConst.HistDataPointList:
                view          = new HistDataPointList();
                view.ViewType = TrendViewConst.HistDataPointList;
                controller    = new HistDataPointListController();
                model         = new HistDataPointListModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.LoadConfigHistDataPoint:
                view       = new HistDataPointGroup();
                controller = new HistDataPointGroupController();
                model      = new HistDataPointGroupModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.SaveConfigHistDataPoint:
                view       = new HistDataPointGroup();
                controller = new HistDataPointGroupController();
                model      = new HistDataPointGroupModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.AddHistDataPointData:
                view       = new HistDataPointData();
                controller = new HistDataPointDataController();
                model      = new HistDataPointDataModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.EditHistDataPointData:
                view       = new HistDataPointData();
                controller = new HistDataPointDataController();
                model      = new HistDataPointDataModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.OPCDataSelector:
                view       = new OPCDataSelector();
                controller = new OPCDataSelectorController();
                model      = new OPCDataSelectorModel();
                controller.Attach(model, view);
                break;

            case TrendViewConst.ChangeTrendTitle:
                view       = new EditChartTitle();
                controller = new ChangeTrendTitleController();
                model      = null;
                controller.Attach(model, view);
                break;

            default:
                break;
            }
            view.ViewID = id;
            return(view);
        }
Пример #4
0
        public void TestAttachListener02()
        {
            dataPointData.SetFormType(FormType.Edit);
            IController controller = new DataPointDataController(); /* TODO: Implement me */;

            dataPointData.AttachListener(controller);
            #region Record State
            ValueRecorder recorder = new ValueRecorder();
            recorder.Record((string)dataPointData.AccessibleDefaultActionDescription);
            recorder.Record((string)dataPointData.AccessibleDescription);
            recorder.Record((string)dataPointData.AccessibleName);
            recorder.Record((AccessibleRole)dataPointData.AccessibleRole);
            recorder.Record((bool)dataPointData.AllowDrop);
            recorder.Record((bool)dataPointData.AllowTransparency);
            recorder.Record((AnchorStyles)dataPointData.Anchor);
            recorder.Record((AutoScaleMode)dataPointData.AutoScaleMode);
            recorder.Record((bool)dataPointData.AutoScroll);
            recorder.Record((bool)dataPointData.AutoSize);
            recorder.Record((AutoSizeMode)dataPointData.AutoSizeMode);
            recorder.Record((AutoValidate)dataPointData.AutoValidate);
            recorder.Record((ImageLayout)dataPointData.BackgroundImageLayout);
            recorder.Record((int)dataPointData.Bottom);
            recorder.Record((bool)dataPointData.CanFocus);
            recorder.Record((bool)dataPointData.CanSelect);
            recorder.Record((bool)dataPointData.Capture);
            recorder.Record((bool)dataPointData.CausesValidation);
            recorder.Record((string)dataPointData.CompanyName);
            recorder.Record((bool)dataPointData.ContainsFocus);
            recorder.Record((bool)dataPointData.ControlBox);
            recorder.Record((bool)dataPointData.Created);
            recorder.Record((DialogResult)dataPointData.DialogResult);
            recorder.Record((bool)dataPointData.Disposing);
            recorder.Record((DockStyle)dataPointData.Dock);
            recorder.Record((bool)dataPointData.Enabled);
            recorder.Record((bool)dataPointData.Focused);
            recorder.Record((FormBorderStyle)dataPointData.FormBorderStyle);
            recorder.Record((bool)dataPointData.HasChildren);
            recorder.Record((int)dataPointData.Height);
            recorder.Record((bool)dataPointData.HelpButton);
            recorder.Record((ImeMode)dataPointData.ImeMode);
            recorder.Record((bool)dataPointData.InvokeRequired);
            recorder.Record((bool)dataPointData.IsAccessible);
            recorder.Record((bool)dataPointData.IsDisposed);
            recorder.Record((bool)dataPointData.IsHandleCreated);
            recorder.Record((bool)dataPointData.IsMdiChild);
            recorder.Record((bool)dataPointData.IsMdiContainer);
            recorder.Record((bool)dataPointData.IsMirrored);
            recorder.Record((bool)dataPointData.IsRestrictedWindow);
            recorder.Record((bool)dataPointData.KeyPreview);
            recorder.Record((int)dataPointData.Left);
            recorder.Record((bool)dataPointData.MaximizeBox);
            recorder.Record((bool)dataPointData.MinimizeBox);
            recorder.Record((bool)dataPointData.Modal);
            recorder.Record((string)dataPointData.Name);
            recorder.Record((double)dataPointData.Opacity);
            recorder.Record((string)dataPointData.ProductName);
            recorder.Record((string)dataPointData.ProductVersion);
            recorder.Record((bool)dataPointData.RecreatingHandle);
            recorder.Record((int)dataPointData.Right);
            recorder.Record((RightToLeft)dataPointData.RightToLeft);
            recorder.Record((bool)dataPointData.RightToLeftLayout);
            recorder.Record((bool)dataPointData.ShowIcon);
            recorder.Record((bool)dataPointData.ShowInTaskbar);
            recorder.Record((SizeGripStyle)dataPointData.SizeGripStyle);
            recorder.Record((FormStartPosition)dataPointData.StartPosition);
            recorder.Record((bool)ReflectionAccessor.Wrap(dataPointData).GetProperty("System.Windows.Forms.Layout.IArrangedElement.ParticipatesInLayout"));
            recorder.Record((int)dataPointData.TabIndex);
            recorder.Record((bool)dataPointData.TabStop);
            recorder.Record((string)dataPointData.Text);
            recorder.Record((int)dataPointData.Top);
            recorder.Record((bool)dataPointData.TopLevel);
            recorder.Record((bool)dataPointData.TopMost);
            recorder.Record((bool)dataPointData.UseWaitCursor);
            recorder.Record((string)dataPointData.ViewID);
            recorder.Record((string)dataPointData.ViewType);
            recorder.Record((bool)dataPointData.Visible);
            recorder.Record((int)dataPointData.Width);
            recorder.Record((FormWindowState)dataPointData.WindowState);
            recorder.FinishRecording();
            #endregion
        }