Example #1
0
 private void RunConfigureDialog(string nodePath)
 {
     using (var dlg = new XmlDocConfigureDlg())
     {
         // If this is optional and defaults to DictionaryPublicationLayout,
         // it messes up our Dictionary when we make something else configurable (like Classified Dictionary).
         var sProp = XmlUtils.GetAttributeValue(m_xnSpec, "layoutProperty");
         Debug.Assert(sProp != null, "When making a view configurable you need to put a 'layoutProperty' in the XML configuration.");
         dlg.SetConfigDlgInfo(m_xnSpec, Cache, (FwStyleSheet)StyleSheet,
                              FindForm() as IMainWindowDelegateCallbacks, Mediator, sProp);
         if (nodePath != null)
         {
             dlg.SetActiveNode(nodePath);
         }
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             // Configuration may well have changed. Reset XML tables and redraw.
             var sNewLayout = Mediator.PropertyTable.GetStringProperty(sProp, null);
             ResetTables(sNewLayout);
         }
         if (dlg.MasterRefreshRequired)
         {
             m_mediator.SendMessage("MasterRefresh", null);
         }
     }
 }
Example #2
0
        /// <summary>
        /// Launch the configure dialog.
        /// </summary>
        /// <param name="commandObject"></param>
        /// <returns></returns>
        public bool OnConfigureXmlDocView(object commandObject)
        {
            CheckDisposed();
            string sProp = XmlUtils.GetOptionalAttributeValue(m_configurationParameters, "layoutProperty");

            if (String.IsNullOrEmpty(sProp))
            {
                sProp = "DictionaryPublicationLayout";
            }
            using (var dlg = new XmlDocConfigureDlg())
            {
                dlg.SetConfigDlgInfo(m_configurationParameters, Cache, StyleSheet,
                                     this.FindForm() as IMainWindowDelegateCallbacks, m_mediator, sProp);
                if (dlg.ShowDialog(this) == DialogResult.OK)
                {
                    // LT-8767 When this dialog is launched from the Configure Dictionary View dialog
                    // m_mediator != null && m_rootSite == null so we need to handle this to prevent a crash.
                    if (m_mediator != null && m_rootSite != null)
                    {
                        (m_rootSite as XmlDocItemView).ResetTables(GetLayoutName(m_configurationParameters, m_mediator));
                    }
                }
                if (dlg.MasterRefreshRequired)
                {
                    m_mediator.SendMessage("MasterRefresh", null);
                }
                return(true);                // we handled it
            }
        }
Example #3
0
        /// <summary>
        /// Launch the configure dialog.
        /// </summary>
        /// <param name="commandObject"></param>
        /// <returns></returns>
        public bool OnConfigureXmlDocView(object commandObject)
        {
            CheckDisposed();

            XmlDocConfigureDlg dlg   = new XmlDocConfigureDlg();
            string             sProp = XmlUtils.GetOptionalAttributeValue(m_configurationParameters, "layoutProperty");

            if (String.IsNullOrEmpty(sProp))
            {
                sProp = "DictionaryPublicationLayout";
            }
            dlg.SetConfigDlgInfo(m_configurationParameters, Cache, StyleSheet,
                                 this.FindForm() as IMainWindowDelegateCallbacks, m_mediator, sProp);
            if (dlg.ShowDialog(this) == DialogResult.OK)
            {
                string sNewLayout = m_mediator.PropertyTable.GetStringProperty(sProp, null);
                m_mainView.ResetTables(sNewLayout);
                SelectAndScrollToCurrentRecord();
            }
            return(true);            // we handled it
        }
Example #4
0
        public void FlattenPossibilityList()
        {
            using (XmlDocConfigureDlg dlg = new XmlDocConfigureDlg())
            {
                Guid thirdLevelGuid;
                ICmPossibilityList theList = null;
                UndoableUnitOfWorkHelper.Do("undo", "redo", m_actionHandler,
                                            () =>
                {
                    theList     = Cache.ServiceLocator.GetInstance <ICmPossibilityListFactory>().Create();
                    var topItem = Cache.ServiceLocator.GetInstance <ICmPossibilityFactory>().Create();
                    theList.PossibilitiesOS.Add(topItem);
                    var secondLevelItem    = Cache.ServiceLocator.GetInstance <ICmPossibilityFactory>().Create();
                    var thirdLevelItemItem = Cache.ServiceLocator.GetInstance <ICmPossibilityFactory>().Create();
                    topItem.SubPossibilitiesOS.Add(secondLevelItem);
                    secondLevelItem.SubPossibilitiesOS.Add(thirdLevelItemItem);
                    thirdLevelGuid = thirdLevelItemItem.Guid;
                });

                Assert.AreEqual(3, XmlDocConfigureDlg.FlattenPossibilityList(theList.PossibilitiesOS).Count);
            }
        }
        public void FlattenPossibilityList()
        {
            using (XmlDocConfigureDlg dlg = new XmlDocConfigureDlg())
            {
                Guid thirdLevelGuid;
                ICmPossibilityList theList = null;
                UndoableUnitOfWorkHelper.Do("undo", "redo", m_actionHandler,
                  () =>
                {
                    theList = Cache.ServiceLocator.GetInstance<ICmPossibilityListFactory>().Create();
                    var topItem = Cache.ServiceLocator.GetInstance<ICmPossibilityFactory>().Create();
                    theList.PossibilitiesOS.Add(topItem);
                    var secondLevelItem = Cache.ServiceLocator.GetInstance<ICmPossibilityFactory>().Create();
                    var thirdLevelItemItem = Cache.ServiceLocator.GetInstance<ICmPossibilityFactory>().Create();
                    topItem.SubPossibilitiesOS.Add(secondLevelItem);
                    secondLevelItem.SubPossibilitiesOS.Add(thirdLevelItemItem);
                    thirdLevelGuid = thirdLevelItemItem.Guid;
                });

                Assert.AreEqual(3, XmlDocConfigureDlg.FlattenPossibilityList(theList.PossibilitiesOS).Count);
            }
        }
Example #6
0
		/// <summary>
		/// Launch the configure dialog.
		/// </summary>
		/// <param name="commandObject"></param>
		/// <returns></returns>
		public bool OnConfigureXmlDocView(object commandObject)
		{
			CheckDisposed();

			XmlDocConfigureDlg dlg = new XmlDocConfigureDlg();
			string sProp = XmlUtils.GetOptionalAttributeValue(m_configurationParameters, "layoutProperty");
			if (String.IsNullOrEmpty(sProp))
				sProp = "DictionaryPublicationLayout";
			dlg.SetConfigDlgInfo(m_configurationParameters, Cache, StyleSheet,
				this.FindForm() as IMainWindowDelegateCallbacks, m_mediator, sProp);
			if (dlg.ShowDialog(this) == DialogResult.OK)
			{
				string sNewLayout = m_mediator.PropertyTable.GetStringProperty(sProp, null);
				m_mainView.ResetTables(sNewLayout);
				SelectAndScrollToCurrentRecord();
			}
			return true; // we handled it
		}
Example #7
0
		private void RunConfigureDialog(string nodePath)
		{
			using (XmlDocConfigureDlg dlg = new XmlDocConfigureDlg())
			{
				string sProp = XmlUtils.GetOptionalAttributeValue(m_configurationParameters, "layoutProperty");
				if (String.IsNullOrEmpty(sProp))
					sProp = "DictionaryPublicationLayout";
				dlg.SetConfigDlgInfo(m_configurationParameters, Cache, StyleSheet,
					FindForm() as IMainWindowDelegateCallbacks, m_mediator, sProp);
				dlg.SetActiveNode(nodePath);
				if (dlg.ShowDialog(this) == DialogResult.OK)
				{
					string sNewLayout = m_mediator.PropertyTable.GetStringProperty(sProp, null);
					m_mainView.ResetTables(sNewLayout);
					SelectAndScrollToCurrentRecord();
				}
				if (dlg.MasterRefreshRequired)
					m_mediator.SendMessage("MasterRefresh", null);
			}
		}
Example #8
0
		/// <summary>
		/// Launch the configure dialog.
		/// </summary>
		/// <param name="commandObject"></param>
		/// <returns></returns>
		public bool OnConfigureXmlDocView(object commandObject)
		{
			CheckDisposed();

			XmlDocConfigureDlg dlg = new XmlDocConfigureDlg();
			string sProp = XmlUtils.GetOptionalAttributeValue(m_configurationParameters, "layoutProperty");
			if (String.IsNullOrEmpty(sProp))
				sProp = "DictionaryPublicationLayout";
			dlg.SetConfigDlgInfo(m_configurationParameters, Cache, StyleSheet,
				this.FindForm() as IMainWindowDelegateCallbacks, m_mediator, sProp);
			if (dlg.ShowDialog(this) == DialogResult.OK)
			{
				// LT-8767 When this dialog is launched from the Configure Dictionary View dialog
				// m_mediator != null && m_rootSite == null so we need to handle this to prevent a crash.
				if (m_mediator != null && m_rootSite != null)
				{
					string sNewLayout = m_mediator.PropertyTable.GetStringProperty(sProp, null);
					(m_rootSite as XmlDocItemView).ResetTables(sNewLayout);
				}
			}
			return true; // we handled it
		}
Example #9
0
 private void RunConfigureDialog(string nodePath)
 {
     using (var dlg = new XmlDocConfigureDlg())
     {
         // If this is optional and defaults to DictionaryPublicationLayout,
         // it messes up our Dictionary when we make something else configurable (like Classified Dictionary).
         var sProp = XmlUtils.GetAttributeValue(m_xnSpec, "layoutProperty");
         Debug.Assert(sProp != null, "When making a view configurable you need to put a 'layoutProperty' in the XML configuration.");
         dlg.SetConfigDlgInfo(m_xnSpec, Cache, (FwStyleSheet)StyleSheet,
             FindForm() as IMainWindowDelegateCallbacks, Mediator, sProp);
         if (nodePath != null)
             dlg.SetActiveNode(nodePath);
         if (dlg.ShowDialog(this) == DialogResult.OK)
         {
             // Configuration may well have changed. Reset XML tables and redraw.
             var sNewLayout = Mediator.PropertyTable.GetStringProperty(sProp, null);
             ResetTables(sNewLayout);
         }
         if (dlg.MasterRefreshRequired)
             m_mediator.SendMessage("MasterRefresh", null);
     }
 }