private Editor(IEditable d, string titleType, ListViewItem lvi, RichTextBox rtb) { InitializeComponent(); data = d; data.Locked = true; this.lvi = lvi; this.rtb = rtb; // First, set the RichTextBox's Font to the default. // Then, change if text already exists. richText.Font = new Font(Config.EditorFontName, Config.EditorFontSize); frmMain.EditorOpened(); if (titleType == null) this.Text = d.GetType().Name + ": " + d.Title; else this.Text = titleType + ": " + d.Title; richText.Rtf = Utils.TreatRtfFont(data.Text, Config.EditorFontName, Config.EditorFontSize); UpdateButtons(); }
public override bool TryConvert(ConvertBinder binder, out object result) { if (binder.Type == typeof(IEditable) || (obj != null && binder.Type.GetTypeInfo().IsAssignableFrom(obj.GetType()))) { result = obj; return(true); } var list = obj as IEditableList; if (list != null) { if (binder.Type == typeof(System.Collections.IEnumerable)) { result = (obj as IEditableList).Select(x => Wrap(x.Get())); return(true); } } return(base.TryConvert(binder, out result)); }