/// ------------------------------------------------------------------------------------
        /// <summary>
        /// Determines if a dialog box asking for user settings is necessary and, if so,
        /// shows the dialog box.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private bool GetFilterValuesFromUser(ICmFilter userFilter)
        {
            if (userFilter == null)
            {
                return(true);
            }

            using (NonUndoableUnitOfWorkHelper undoHelper = new NonUndoableUnitOfWorkHelper(
                       Cache.ServiceLocator.GetInstance <IActionHandler>()))
            {
                userFilter.ShowPrompt = 0;
                undoHelper.RollBack   = false;
            }

            switch (userFilter.FilterName)
            {
            case "kstidNoteMultiFilter":
                using (MultipleFilterDlg dlg = new MultipleFilterDlg(Cache,
                                                                     m_helpTopicProvider, userFilter))
                {
                    if (dlg.ShowDialog() != DialogResult.OK)
                    {
                        return(false);
                    }
                }
                break;

            case "kstidCategoryNoteFilter":
                using (CategoryFilterDlg dlg = new CategoryFilterDlg(Cache,
                                                                     m_helpTopicProvider, userFilter))
                {
                    if (dlg.ShowDialog() != DialogResult.OK)
                    {
                        return(false);
                    }
                }
                break;
            }
            return(true);
        }
Beispiel #2
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Determines if a dialog box asking for user settings is necessary and, if so,
        /// shows the dialog box.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private bool GetFilterValuesFromUser(CmFilter userFilter)
        {
            if (userFilter == null)
            {
                return(true);
            }

            // Don't try create an undo task for this. The user won't expect to undo/redo this
            // action. (TE-8575)
            using (new SuppressSubTasks(Cache))
            {
                Cache.SetIntProperty(userFilter.Hvo,
                                     (int)SIL.FieldWorks.FDO.Cellar.CmFilter.CmFilterTags.kflidShowPrompt, 0);

                if (userFilter.ShortName == "kstidNoteMultiFilter")
                {
                    using (MultipleFilterDlg dlg = new MultipleFilterDlg(Cache, userFilter))
                    {
                        if (dlg.ShowDialog() != DialogResult.OK)
                        {
                            return(false);
                        }
                    }
                }
                else if (userFilter.ShortName == "kstidCategoryNoteFilter")
                {
                    using (CategoryFilterDlg dlg = new CategoryFilterDlg(Cache, userFilter))
                    {
                        if (dlg.ShowDialog() != DialogResult.OK)
                        {
                            return(false);
                        }
                    }
                }
            }

            return(true);
        }
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Determines if a dialog box asking for user settings is necessary and, if so,
		/// shows the dialog box.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private bool GetFilterValuesFromUser(ICmFilter userFilter)
		{
			if (userFilter == null)
				return true;

			using (NonUndoableUnitOfWorkHelper undoHelper = new NonUndoableUnitOfWorkHelper(
				Cache.ServiceLocator.GetInstance<IActionHandler>()))
			{
				userFilter.ShowPrompt = 0;
				undoHelper.RollBack = false;
			}

			switch (userFilter.FilterName)
			{
				case "kstidNoteMultiFilter":
					using (MultipleFilterDlg dlg = new MultipleFilterDlg(Cache,
						m_helpTopicProvider, userFilter))
					{
						if (dlg.ShowDialog() != DialogResult.OK)
							return false;
					}
					break;
				case "kstidCategoryNoteFilter":
					using (CategoryFilterDlg dlg = new CategoryFilterDlg(Cache,
						m_helpTopicProvider, userFilter))
					{
						if (dlg.ShowDialog() != DialogResult.OK)
							return false;
					}
					break;
			}
			return true;
		}
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Determines if a dialog box asking for user settings is necessary and, if so,
		/// shows the dialog box.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private bool GetFilterValuesFromUser(CmFilter userFilter)
		{
			if (userFilter == null)
				return true;

			// Don't try create an undo task for this. The user won't expect to undo/redo this
			// action. (TE-8575)
			using (new SuppressSubTasks(Cache))
			{
				Cache.SetIntProperty(userFilter.Hvo,
					(int)SIL.FieldWorks.FDO.Cellar.CmFilter.CmFilterTags.kflidShowPrompt, 0);

				if (userFilter.ShortName == "kstidNoteMultiFilter")
				{
					using (MultipleFilterDlg dlg = new MultipleFilterDlg(Cache, userFilter))
					{
						if (dlg.ShowDialog() != DialogResult.OK)
							return false;
					}
				}
				else if (userFilter.ShortName == "kstidCategoryNoteFilter")
				{
					using (CategoryFilterDlg dlg = new CategoryFilterDlg(Cache, userFilter))
					{
						if (dlg.ShowDialog() != DialogResult.OK)
							return false;
					}
				}
			}

			return true;
		}