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


C# TextBuffer.SetText方法代码示例

本文整理汇总了C#中Gtk.TextBuffer.SetText方法的典型用法代码示例。如果您正苦于以下问题:C# TextBuffer.SetText方法的具体用法?C# TextBuffer.SetText怎么用?C# TextBuffer.SetText使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gtk.TextBuffer的用法示例。


在下文中一共展示了TextBuffer.SetText方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GtkCertificateViewer

		public GtkCertificateViewer (string filename) 
		{
			Application.Init();

			Glade.XML gxml = new Glade.XML (null, "certview.glade", "CertificateViewer", null);
			gxml.Autoconnect (this);

			cf = new CertificateFormatter (filename);

			// init UI
			brokenSealImage.Pixbuf = new Pixbuf (null, "wax-seal-broken.png");
			sealImage.Pixbuf = new Pixbuf (null, "wax-seal.png");

			Tooltips tt = new Tooltips ();
			issuedToEntry.Text = cf.Issuer (false);
			tt.SetTip (issuedToEntry, issuedToEntry.Text, issuedToEntry.Text);
			issuedByEntry.Text = cf.Subject (false);
			tt.SetTip (issuedByEntry, issuedByEntry.Text, issuedByEntry.Text);

			subjectAltNameLabel.Text = cf.SubjectAltName (false);
			subjectAltNameLabel.Visible = (subjectAltNameLabel.Text != null);

			notBeforeEntry.Text = cf.Certificate.ValidFrom.ToString ("yyyy-MM-dd");
			notAfterEntry.Text = cf.Certificate.ValidUntil.ToString ("yyyy-MM-dd");

			TextBuffer tb = new TextBuffer (null);
			if (cf.Status != null)
				tb.SetText (cf.Status);
			certStatusTextview.Buffer = tb;
			if (cf.Status != null) {
				certInfoTextview.Buffer = tb;
				certInfoTextview.ModifyText (StateType.Normal, new Gdk.Color (0xff, 0x00, 0x00));
			}

			sealImage.Visible = (cf.Status == null);
			brokenSealImage.Visible = !sealImage.Visible;

			Type[] storeType = new Type [4] { typeof (string), typeof (string), typeof (string), typeof (int) };
			allStore = new ListStore (storeType);
			v1Store = new ListStore (storeType);
			extensionsStore = new ListStore (storeType);
			criticalStore = new ListStore (storeType);
			propertiesStore = new ListStore (storeType);
			emptyStore = new ListStore (storeType);

			AddToStores (CertificateFormatter.FieldNames.Version, cf.Version (false), cf.Version (true), 1);
			AddToStores (CertificateFormatter.FieldNames.SerialNumber, cf.SerialNumber (false), cf.SerialNumber (true), 0);
			AddToStores (CertificateFormatter.FieldNames.SignatureAlgorithm, cf.SignatureAlgorithm (false), cf.SignatureAlgorithm (true), 0);
			AddToStores (CertificateFormatter.FieldNames.Issuer, cf.Issuer (false), cf.Issuer (true), 0);
			AddToStores (CertificateFormatter.FieldNames.ValidFrom, cf.ValidFrom (false), cf.ValidFrom (true), 0);
			AddToStores (CertificateFormatter.FieldNames.ValidUntil, cf.ValidUntil (false), cf.ValidUntil (true), 0);
			AddToStores (CertificateFormatter.FieldNames.Subject, cf.Subject (false), cf.Subject (true), 0);
			AddToStores (CertificateFormatter.FieldNames.PublicKey, cf.PublicKey (false), cf.PublicKey (true), 0);
			for (int i=0; i < cf.Certificate.Extensions.Count; i++) {
				X509Extension xe = cf.GetExtension (i);
				string name = xe.Name;
				int icon = 2;
				if (xe.Critical)
					icon = 3;
				string exts = xe.ToString ();
				string details;
				if (xe.Name == xe.Oid) {
					exts = cf.Extension (i, false);
					details = cf.Extension (i, true);
				}
				else {
					details = xe.ToString ();
					exts = CertificateFormatter.OneLine (details);
				}

				AddToStores (name, exts, details, icon);
			}
			AddToStores (CertificateFormatter.PropertyNames.ThumbprintAlgorithm, cf.ThumbprintAlgorithm, cf.ThumbprintAlgorithm, 4);
			string ftb = CertificateFormatter.Array2Word (cf.Thumbprint);
			AddToStores (CertificateFormatter.PropertyNames.Thumbprint, ftb, ftb, 4);

			// select appropriate store to show
			OnShowComboChanged (null, null);

			TreeViewColumn fieldColumn = new TreeViewColumn ();
			CellRendererPixbuf pr = new CellRendererPixbuf ();
			CellRenderer fieldRenderer = new CellRendererText ();
			fieldColumn.PackStart (pr, false);
			fieldColumn.SetCellDataFunc (pr, CellDataFunc, IntPtr.Zero, null);
			fieldColumn.Title = "Field";
			fieldColumn.PackStart (fieldRenderer, false);
			fieldColumn.AddAttribute (fieldRenderer, "text", 0);
			detailsTreeview.AppendColumn (fieldColumn);

			TreeViewColumn valueColumn = new TreeViewColumn ();
			CellRenderer valueRenderer = new CellRendererText ();
			valueColumn.Title = "Value";
			valueColumn.PackStart (valueRenderer, true);
			valueColumn.AddAttribute (valueRenderer, "text", 1);
			detailsTreeview.AppendColumn (valueColumn);

//			detailsTreeview.ModifyText (StateType.Selected, new Gdk.Color (0x33, 0xff, 0x33));

			Application.Run();
		}
开发者ID:nobled,项目名称:mono,代码行数:100,代码来源:gcertview.cs

示例2: OnCursorChanged

		private void OnCursorChanged (object o, EventArgs args)
		{
			TreeModel model;
			TreeIter iter = new TreeIter ();
			TreeSelection ts = detailsTreeview.Selection;
			ts.GetSelected (out model, out iter);

			TextBuffer tb = new TextBuffer (null);
			tb.SetText ((string) detailsTreeview.Model.GetValue (iter, 2));
			detailsTextview.Buffer = tb;
		}
开发者ID:nobled,项目名称:mono,代码行数:11,代码来源:gcertview.cs


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