Ejemplo n.º 1
0
		protected override void SetupDataContext()
		{
			TriggerMessageBoxIfAppropriate();
			System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;

			//m_flid = RecordClerk.GetFlidOfVectorFromName(m_vectorName, Cache, out m_owningObject);
			RecordClerk clerk = Clerk;
			clerk.ActivateUI(false);
			m_fakeFlid = clerk.VirtualFlid;
			// retrieve persisted clerk index and set it.
			int idx = m_mediator.PropertyTable.GetIntProperty(clerk.PersistedIndexProperty, -1, PropertyTable.SettingsGroup.LocalSettings);
			if (idx >= 0 && !clerk.HasEmptyList)
			{
				int idxOld = clerk.CurrentIndex;
				try
				{
					clerk.JumpToIndex(idx);
				}
				catch
				{
					clerk.JumpToIndex(idxOld >= 0 ? idxOld : 0);
				}
			}
			clerk.SelectedRecordChanged();
			m_hvoOwner = clerk.OwningObject.Hvo;

			clerk.IsDefaultSort = false;

			// Create the main view

			// Review JohnT: should it be m_configurationParameters or .FirstChild?
			m_mainView = new XmlSeqView(m_hvoOwner, m_fakeFlid, m_configurationParameters);
			m_mainView.Init(m_mediator, m_configurationParameters); // Required call to xCore.Colleague.
			m_mainView.Dock = System.Windows.Forms.DockStyle.Fill;
			m_mainView.Cache = Cache;
			m_mainView.SelectionChangedEvent +=
				new FwSelectionChangedEventHandler(OnSelectionChanged);
			m_mainView.ShowRangeSelAfterLostFocus = true;	// This makes selections visible.
			// If the rootsite doesn't have a rootbox, we can't display the record!
			// Calling ShowRecord() from InitBase() sets the state to appear that we have
			// displayed (and scrolled), even though we haven't.  See LT-7588 for the effect.
			m_mainView.MakeRoot();
			SetupStylesheet();
			Controls.Add(m_mainView);
			if (Controls.Count == 2)
			{
				Controls.SetChildIndex(m_mainView, 1);
				m_mainView.BringToFront();
			}
			m_fullyInitialized = true; // Review JohnT: was this really the crucial last step?

		}
Ejemplo n.º 2
0
		protected override void SetupDataContext()
		{
			TriggerMessageBoxIfAppropriate();
			using (new WaitCursor(this))
			{
				//m_flid = RecordClerk.GetFlidOfVectorFromName(m_vectorName, Cache, out m_owningObject);
				RecordClerk clerk = Clerk;
				clerk.ActivateUI(false);
				// Enhance JohnT: could use logic similar to RecordView.InitBase to load persisted list contents (filtered and sorted).
				if (clerk.RequestedLoadWhileSuppressed)
					clerk.UpdateList(false);
				m_fakeFlid = clerk.VirtualFlid;
				if (clerk.OwningObject != null)
				{
					m_hvoOwner = clerk.OwningObject.Hvo;
				}

				if (!clerk.SetCurrentFromRelatedClerk())
				{
					// retrieve persisted clerk index and set it.
					int idx = m_mediator.PropertyTable.GetIntProperty(clerk.PersistedIndexProperty, -1,
						PropertyTable.SettingsGroup.LocalSettings);
					if (idx >= 0 && !clerk.HasEmptyList)
					{
						int idxOld = clerk.CurrentIndex;
						try
						{
							clerk.JumpToIndex(idx);
						}
						catch
						{
							clerk.JumpToIndex(idxOld >= 0 ? idxOld : 0);
						}
					}
					clerk.SelectedRecordChanged(false);
				}

				clerk.IsDefaultSort = false;

				// Create the main view

				// Review JohnT: should it be m_configurationParameters or .FirstChild?
				IApp app = (IApp)m_mediator.PropertyTable.GetValue("App");
				m_mainView = new XmlSeqView(Cache, m_hvoOwner, m_fakeFlid, m_configurationParameters, Clerk.VirtualListPublisher, app,
					Publication);
				m_mainView.Init(m_mediator, m_configurationParameters); // Required call to xCore.Colleague.
				m_mainView.Dock = DockStyle.Fill;
				m_mainView.Cache = Cache;
				m_mainView.SelectionChangedEvent +=
					new FwSelectionChangedEventHandler(OnSelectionChanged);
				m_mainView.MouseClick += m_mainView_MouseClick;
				m_mainView.MouseMove += m_mainView_MouseMove;
				m_mainView.MouseLeave += m_mainView_MouseLeave;
				m_mainView.ShowRangeSelAfterLostFocus = true;	// This makes selections visible.
				// If the rootsite doesn't have a rootbox, we can't display the record!
				// Calling ShowRecord() from InitBase() sets the state to appear that we have
				// displayed (and scrolled), even though we haven't.  See LT-7588 for the effect.
				m_mainView.MakeRoot();
				SetupStylesheet();
				Controls.Add(m_mainView);
				if (Controls.Count == 2)
				{
					Controls.SetChildIndex(m_mainView, 1);
					m_mainView.BringToFront();
				}

				m_fullyInitialized = true; // Review JohnT: was this really the crucial last step?
			}
		}