当前位置: 首页>>代码示例>>C#>>正文


C# XCore.UIItemDisplayProperties类代码示例

本文整理汇总了C#中XCore.UIItemDisplayProperties的典型用法代码示例。如果您正苦于以下问题:C# UIItemDisplayProperties类的具体用法?C# UIItemDisplayProperties怎么用?C# UIItemDisplayProperties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


UIItemDisplayProperties类属于XCore命名空间,在下文中一共展示了UIItemDisplayProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OnDisplayDataTreeMerge

		/// <summary>
		/// decide whether to enable this tree delete Menu Item
		/// </summary>
		/// <param name="commandObject"></param>
		/// <param name="display"></param>
		/// <returns></returns>
		public override bool OnDisplayDataTreeMerge(object commandObject, ref UIItemDisplayProperties display)
		{
			display.Enabled = CanMergeOrMove;
			if(!display.Enabled)
				display.Text += StringTbl.GetString("(cannot merge this)");

			return true;//we handled this, no need to ask anyone else.
		}
开发者ID:sillsdev,项目名称:FieldWorks,代码行数:14,代码来源:ReversalIndexEntryMenuHandler.cs

示例2: OnDisplayShowEnvironmentError

		/// <summary>
		/// This menu item is turned off if a slash already exists in the environment string.
		/// </summary>
		/// <param name="commandObject"></param>
		/// <param name="display"></param>
		/// <returns></returns>
		public virtual bool OnDisplayShowEnvironmentError(object commandObject,
			ref UIItemDisplayProperties display)
		{
			CheckDisposed();
			StringRepSliceView view = Control as StringRepSliceView;
			if (view == null)
				return false;
			display.Enabled = view.CanShowEnvironmentError();
			return true;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:16,代码来源:PhEnvStrRepresentationSlice.cs

示例3: DoDisplayMacro_NoMacro_HidesCommand

 public void DoDisplayMacro_NoMacro_HidesCommand()
 {
     var props = new UIItemDisplayProperties(null, "SomeMacro", true, null, false);
     var ml = new MacroListener();
     using (var command = GetF4CommandObject())
     {
         ml.DoDisplayMacro(command, props, null);
         Assert.That(props.Visible, Is.False); // no implementation of F4, hide it altogether.
     }
 }
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:10,代码来源:MacroListenerTests.cs

示例4: DoDisplayMacro_NoSelection_ShowsDisabledCommand

 public void DoDisplayMacro_NoSelection_ShowsDisabledCommand()
 {
     var props = new UIItemDisplayProperties(null, "SomeMacro", true, null, false);
     var ml = new MacroListener();
     SetupF4Implementation(ml);
     using (var command = GetF4CommandObject())
     {
         ml.DoDisplayMacro(command, props, null);
         Assert.That(props.Visible, Is.True);
         Assert.That(props.Enabled, Is.False); // can't do it without a selection
         Assert.That(props.Text, Is.EqualTo("F4test"));
     }
 }
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:13,代码来源:MacroListenerTests.cs

示例5: OnDisplayDataTreeInsert

		/// <summary>
		/// decide whether to display this tree insert Menu Item
		/// </summary>
		/// <param name="commandObject"></param>
		/// <param name="display"></param>
		/// <returns></returns>
		public override bool OnDisplayDataTreeInsert(object commandObject, ref UIItemDisplayProperties display)
		{
			Slice slice = m_dataEntryForm.CurrentSlice;
			if (slice == null && m_dataEntryForm.Controls.Count > 0)
				slice = m_dataEntryForm.FieldAt(0);
			if (slice == null
				|| (m_dataEntryForm.Mediator.PropertyTable.GetValue("ActiveClerk") as RecordClerk).ListSize == 0)
			{
				// don't display the datatree menu/toolbar items when we don't have a data tree slice.
				display.Visible = false;
				display.Enabled = false;
				return true;
			}

			base.OnDisplayDataTreeInsert(commandObject, ref display);

			if (!(slice.Object is LexEntry) && !(slice.ContainingDataTree.Root is LexEntry))
				return false;
			FDO.Ling.LexEntry entry = slice.Object as LexEntry;
			if (entry == null)
				entry = slice.ContainingDataTree.Root as LexEntry;
			XCore.Command command = (XCore.Command)commandObject;

			if (command.Id.EndsWith("AffixProcess"))
			{
				bool enable = MoMorphType.IsAffixType(entry.MorphType);
				display.Enabled = enable;
				display.Visible = enable;
				return true;
			}

			//if there aren't any alternate forms, go ahead and let the user choose either kind
			if (entry.AlternateFormsOS.Count==0)
				return true;

			if (command.Id.EndsWith("AffixAllomorph"))
			{
				if (!(entry.AlternateFormsOS.FirstItem is MoAffixAllomorph))
					display.Visible = false;
				return true;
			}

			if (command.Id.EndsWith("StemAllomorph"))
			{
				if (!(entry.AlternateFormsOS.FirstItem is MoStemAllomorph))
					display.Visible = false;
				return true;
			}

			return true;//we handled this, no need to ask anyone else.
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:57,代码来源:LexEntryMenuHandler.cs

示例6: OnDisplayLexiconLookup

		public bool OnDisplayLexiconLookup(object commandObject,
			ref UIItemDisplayProperties display)
		{
			display.Visible = true;
			display.Enabled = false;
			// Enable the command if the selection exists and we actually have a word.
			int ichMin;
			int ichLim;
			int hvo;
			int tag;
			int ws;
			ITsString tss;
			GetWordLimitsOfSelection(out ichMin, out ichLim, out hvo, out tag, out ws, out tss);
			if (ichLim > ichMin)
				display.Enabled = true;
			return true;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:17,代码来源:StTextSlice.cs

示例7: OnDisplayMoveReversalPOS

		/// <summary>
		/// handle the message to see if the menu item should be enabled
		/// </summary>
		/// <param name="commandObject"></param>
		/// <param name="display"></param>
		/// <returns></returns>
		public virtual bool OnDisplayMoveReversalPOS(object commandObject,
			ref UIItemDisplayProperties display)
		{
			Slice slice = m_dataEntryForm.CurrentSlice;
			if (slice == null || slice.Object == null)
			{
				display.Enabled = false;
			}
			else
			{
				display.Enabled = CanMergeOrMove;
				display.Visible = InFriendlyArea;
			}
			if(!display.Enabled)
				display.Text += StringTbl.GetString("(cannot move this)");
			return true; //we've handled this
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:23,代码来源:ReversalEntryPOS.cs

示例8: DoDisplayMacro_WithSafeToDo_ResultDependsOnMacro

        public void DoDisplayMacro_WithSafeToDo_ResultDependsOnMacro()
        {
            var props = new UIItemDisplayProperties(null, "SomeMacro", true, null, false);
            var ml = MakeMacroListenerWithCache();
            var macro = SetupF4Implementation(ml);
            var entry = Cache.ServiceLocator.GetInstance<ILexEntryFactory>().Create();
            var sel = GetValidMockSelection(entry);
            using (var command = GetF4CommandObject())
            {
                ml.DoDisplayMacro(command, props, sel);
                Assert.That(props.Visible, Is.True);
                Assert.That(props.Enabled, Is.True);
                Assert.That(props.Text, Is.EqualTo("F4test"));

                props = new UIItemDisplayProperties(null, "SomeMacro", true, null, false);
                macro.BeEnabled = false;
                ml.DoDisplayMacro(command, props, sel);
                Assert.That(props.Visible, Is.True);
                Assert.That(props.Enabled, Is.False); // can't do it if the macro says no good.
                Assert.That(props.Text, Is.EqualTo("F4test"));
            }
        }
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:22,代码来源:MacroListenerTests.cs

示例9: OnDisplayRedo

		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Disables/enables the Edit/Redo menu item
		/// </summary>
		/// <param name="commandObject"></param>
		/// <param name="display"></param>
		/// <returns><c>true</c></returns>
		/// ------------------------------------------------------------------------------------
		protected bool OnDisplayRedo(object commandObject, ref UIItemDisplayProperties display)
		{
			if (m_silCache.GetActionHandler().CanRedo())
			{
				display.Enabled = true;
				return true;
			}
			return false; // we don't want to handle the command.
		}
开发者ID:sillsdev,项目名称:WorldPad,代码行数:17,代码来源:PhoneEnvReferenceView.cs

示例10: OnDisplaySpellingStatusDisapprove

		public virtual bool OnDisplaySpellingStatusDisapprove(object commandObject,
			ref UIItemDisplayProperties display)
		{
			display.Enabled = display.Visible = InFriendlyArea;
			return true; //we've handled this
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:6,代码来源:MorphologyListener.cs

示例11: OnDisplayJumpToTool

		/// <summary>
		///
		/// </summary>
		/// <param name="commandObject"></param>
		/// <param name="display"></param>
		/// <returns></returns>
		public virtual bool OnDisplayJumpToTool(object commandObject, ref UIItemDisplayProperties display)
		{
			var cache = (FdoCache)m_mediator.PropertyTable.GetValue("cache");
			var cmd = (Command)commandObject;
			var className = XmlUtils.GetManditoryAttributeValue(cmd.Parameters[0], "className");
			var specifiedClsid = 0;
			if ((cache.MetaDataCacheAccessor as IFwMetaDataCacheManaged).ClassExists(className))
				specifiedClsid = cache.MetaDataCacheAccessor.GetClassId(className);
			var anal = Analysis;
			if (anal != null)
			{
				if (anal.ClassID == specifiedClsid)
				{
					display.Enabled = display.Visible = true;
					return true;
				}

				if (specifiedClsid == WfiGlossTags.kClassId)
				{
					if (m_dataEntryForm != null && m_dataEntryForm.CurrentSlice != null &&
						CurrentSliceObject != null && CurrentSliceObject.ClassID == specifiedClsid)
					{
						display.Enabled = display.Visible = true;
						return true;
					}
				}
			}
			return false;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:35,代码来源:MorphologyListener.cs

示例12: OnDisplayViewIncorrectWords

		public bool OnDisplayViewIncorrectWords(object commandObject,
			ref UIItemDisplayProperties display)
		{
			display.Enabled = display.Visible = InFriendlyArea;
			return true; //we've handled this
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:6,代码来源:MorphologyListener.cs

示例13: OnDisplayUseVernSpellingDictionary

		/// <summary>
		/// Enable the spelling tool always. Correct the property value if need be to match whether
		/// we are actually showing vernacular spelling.
		/// </summary>
		/// <param name="commandObject"></param>
		/// <param name="display"></param>
		/// <returns></returns>
		public virtual bool OnDisplayUseVernSpellingDictionary(object commandObject,
			ref UIItemDisplayProperties display)
		{
			CheckDisposed();

			display.Enabled = display.Visible = Cache != null;
			if (Cache == null)
				return true;
			display.Checked = IsVernacularSpellingEnabled();
			return true; //we've handled this
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:18,代码来源:MorphologyListener.cs

示例14: OnDisplayAddApprovedAnalysis

		//

		public virtual bool OnDisplayAddApprovedAnalysis(object commandObject,
			ref UIItemDisplayProperties display)
		{
			// The null test covers cases where there is no current object because the list (as filtered) is empty.
			if (InFriendlyArea && m_mediator != null && m_dataEntryForm.Root != null)
			{
#pragma warning disable 0219
				FdoCache cache = (FdoCache)m_mediator.PropertyTable.GetValue("cache");
				display.Visible = true;
				display.Enabled = Wordform != null;
#pragma warning restore 0219
			}
			else
			{
				display.Enabled = display.Visible = false;
			}
			return true; //we've handled this
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:20,代码来源:MorphologyListener.cs

示例15: QueryDisplayProperties

        /// <summary>
        ///
        /// </summary>
        /// <param name="group">This provides more context for colleagues to know whether to add a command to a menu.
        /// colleagues who want to support short-cut keys should be able to handle <c>null</c>, apart from a context menu group.</param>
        /// <param name="mediator"></param>
        /// <param name="command"></param>
        /// <param name="defaultVisible"></param>
        /// <param name="label"></param>
        /// <returns></returns>
        private static UIItemDisplayProperties QueryDisplayProperties(ChoiceGroup group, Mediator mediator, Command command, bool defaultVisible, string label)
        {
            // Let the default be that it is enabled if we know that it has
            //at least one potential receiver, based on the method signatures of the
            //current set of colleagues.
            //If one of those colleagues thinks that it should be disabled at the moment,
            //then it needs to implement the corresponding Display method
            //and disable it from there.
            bool hasReceiver = mediator.HasReceiver(command.MessageString);
            UIItemDisplayProperties display = new UIItemDisplayProperties(group, label, hasReceiver, command.IconName, defaultVisible);

            //OK, this is a little non-obvious
            //first we allow anyone who knows about this specific command to influence how it is displayed
            //why was it this way?			m_mediator.SendMessage("Display"+this.m_idOfCorrespondingCommand, CommandObject, ref display);
            mediator.SendMessage("Display" + command.Id, command, ref display);

            //but then, we also allow anyone who knows about this specific message that would be sent
            //to control how it is displayed.  What's the difference?
            //Well, it is not uncommon for a single message, e.g. "InsertRecord", to be associated with
            //multiple commands, e.g. "CmdInsertPersonRecord", "CmdInsertCompanyRecord".
            //And in this case, there may not be any actual code which knows about one of these commands,
            //instead the code may be written to just listen  for the "InsertRecord" message and then act
            //upon its arguments which, in this example, would cause it to either insert a person or a company.
            mediator.SendMessage("Display" + command.MessageString, command, ref display);
            return display;
        }
开发者ID:sillsdev,项目名称:CarlaLegacy,代码行数:36,代码来源:Choice.cs


注:本文中的XCore.UIItemDisplayProperties类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。