Ejemplo n.º 1
0
        protected override void SetupDataContext()
        {
            Debug.Assert(m_configurationParameters != null);

            base.SetupDataContext();

            //this will normally be the same name as the view, e.g. "basicEdit". This plus the name of the vector
            //should give us a unique context for the dataTree control parameters.

            string persistContext = XmlUtils.GetOptionalAttributeValue(m_configurationParameters, "persistContext");

            if (persistContext != "")
            {
                persistContext = m_vectorName + "." + persistContext + ".DataTree";
            }
            else
            {
                persistContext = m_vectorName + ".DataTree";
            }

            m_dataEntryForm.PersistenceProvder = new PersistenceProvider(persistContext, m_mediator.PropertyTable);

            Clerk.UpdateRecordTreeBarIfNeeded();
            SetupSliceFilter();
            m_dataEntryForm.Dock        = DockStyle.Fill;
            m_dataEntryForm.StringTbl   = StringTbl;
            m_dataEntryForm.SmallImages = (ImageCollection)m_mediator.PropertyTable.GetValue("smallImages");
            string sDatabase = Cache.ProjectId.Name;

            m_dataEntryForm.Initialize(Cache, true, Inventory.GetInventory("layouts", sDatabase),
                                       Inventory.GetInventory("parts", sDatabase));
            m_dataEntryForm.Init(m_mediator, m_configurationParameters);
            if (m_dataEntryForm.AccessibilityObject != null)
            {
                m_dataEntryForm.AccessibilityObject.Name = "RecordEditView.DataTree";
            }
            //set up the context menu, overriding the automatic menu creator/handler

            m_menuHandler = DTMenuHandler.Create(m_dataEntryForm, m_configurationParameters);
            m_menuHandler.Init(m_mediator, m_configurationParameters);

//			m_dataEntryForm.SetContextMenuHandler(new SliceMenuRequestHandler((m_menuHandler.GetSliceContextMenu));
            m_dataEntryForm.SetContextMenuHandler(m_menuHandler.ShowSliceContextMenu);

            Controls.Add(m_dataEntryForm);
            m_dataEntryForm.BringToFront();
        }