Example #1
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Gets the inspector objects for the specified TextProps.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		private List<IInspectorObject> GetInspectorObjectsForTextProps(TextProps txp,
			IInspectorObject ioParent, int level)
		{
			int saveIntPropCount = 0, saveStrPropCount = 0;

			//IInspectorObject ioParent = txp as IInspectorObject;
			if (ioParent != null)
				txp = ioParent.Object as TextProps;

			List<IInspectorObject> list = new List<IInspectorObject>();
			IInspectorObject io;
			ICollection txp1 = txp as ICollection;

			if (txp1 != null)
			{
				int i = 0;
				foreach (object item in txp1)
				{
					io = CreateInspectorObject(item, txp, ioParent, level);
					io.DisplayName = string.Format("[{0}]", i++);
					list.Add(io);
				}

				return list;
			}

			PropertyInfo[] props = GetPropsForObj(txp);
			foreach (PropertyInfo pi in props)
			{
				if (pi.Name != "IntProps" && pi.Name != "StrProps" && pi.Name != "IntPropCount" && pi.Name != "StrPropCount")
					continue;
				else
					switch (pi.Name)
					{
						case "IntProps":
							object propObj = pi.GetValue(txp, null);
							io = CreateInspectorObject(pi, propObj, txp, ioParent, level);
							io.DisplayValue = "Count = " + saveIntPropCount.ToString();
							io.HasChildren = (saveIntPropCount > 0);
							list.Add(io);
							break;
						case "StrProps":
							object propObj1 = pi.GetValue(txp, null);
							io = CreateInspectorObject(pi, propObj1, txp, ioParent, level);
							io.DisplayValue = "Count = " + saveStrPropCount.ToString();
							io.HasChildren = (saveStrPropCount > 0);
							list.Add(io);
							break;
						case "StrPropCount":
							saveStrPropCount = (int)pi.GetValue(txp, null);
							break;
						case "IntPropCount":
							saveIntPropCount = (int)pi.GetValue(txp, null);
							break;
					}
			}

			list.Sort(CompareInspectorObjectNames);
			return list;
		}
Example #2
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Initializes a new instance of the <see cref="T:TsStringRunInfo"/> class.
		/// </summary>
		/// ------------------------------------------------------------------------------------
		public TsStringRunInfo(int irun, ITsString tss, FdoCache cache)
		{
			Text = "\"" + (tss.get_RunText(irun) ?? string.Empty) + "\"";
			TextProps = new TextProps(irun, tss, cache);
		}