本文整理汇总了C#中Mono.Debugging.Client.ObjectValue类的典型用法代码示例。如果您正苦于以下问题:C# ObjectValue类的具体用法?C# ObjectValue怎么用?C# ObjectValue使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ObjectValue类属于Mono.Debugging.Client命名空间,在下文中一共展示了ObjectValue类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetVisualizerWidget
public override Control GetVisualizerWidget (ObjectValue val)
{
string value = val.Value;
Gdk.Color col = new Gdk.Color (85, 85, 85);
if (!val.IsNull && (val.TypeName == "string" || val.TypeName == "char[]"))
value = '"' + GetString (val) + '"';
if (DebuggingService.HasInlineVisualizer (val))
value = DebuggingService.GetInlineVisualizer (val).InlineVisualize (val);
var label = new Gtk.Label ();
label.Text = value;
var font = label.Style.FontDescription.Copy ();
if (font.SizeIsAbsolute) {
font.AbsoluteSize = font.Size - 1;
} else {
font.Size -= (int)(Pango.Scale.PangoScale);
}
label.ModifyFont (font);
label.ModifyFg (StateType.Normal, col);
label.SetPadding (4, 4);
if (label.SizeRequest ().Width > 500) {
label.WidthRequest = 500;
label.Wrap = true;
label.LineWrapMode = Pango.WrapMode.WordChar;
} else {
label.Justify = Gtk.Justification.Center;
}
if (label.Layout.GetLine (1) != null) {
label.Justify = Gtk.Justification.Left;
var line15 = label.Layout.GetLine (15);
if (line15 != null) {
label.Text = value.Substring (0, line15.StartIndex).TrimEnd ('\r', '\n') + "\n…";
}
}
label.Show ();
return label;
}
示例2: PinnedWatchWidget
public PinnedWatchWidget (TextEditor editor, PinnedWatch watch)
{
objectValue = watch.Value;
Editor = editor;
Watch = watch;
valueTree = new ObjectValueTreeView ();
valueTree.AllowAdding = false;
valueTree.AllowEditing = true;
valueTree.AllowPinning = true;
valueTree.HeadersVisible = false;
valueTree.CompactView = true;
valueTree.PinnedWatch = watch;
if (objectValue != null)
valueTree.AddValue (objectValue);
valueTree.ButtonPressEvent += HandleValueTreeButtonPressEvent;
valueTree.ButtonReleaseEvent += HandleValueTreeButtonReleaseEvent;
valueTree.MotionNotifyEvent += HandleValueTreeMotionNotifyEvent;
Gtk.Frame fr = new Gtk.Frame ();
fr.ShadowType = Gtk.ShadowType.Out;
fr.Add (valueTree);
Add (fr);
HandleEditorOptionsChanged (null, null);
ShowAll ();
//unpin.Hide ();
Editor.EditorOptionsChanged += HandleEditorOptionsChanged;
DebuggingService.PausedEvent += HandleDebuggingServicePausedEvent;
DebuggingService.ResumedEvent += HandleDebuggingServiceResumedEvent;
}
示例3: GetVisualizerWidget
public override Gtk.Widget GetVisualizerWidget (ObjectValue val)
{
var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone ();
string file = Path.GetTempFileName ();
Gdk.Pixbuf pixbuf;
ops.AllowTargetInvoke = true;
try {
var pix = (RawValue) val.GetRawValue (ops);
pix.CallMethod ("Save", file, "png");
pixbuf = new Gdk.Pixbuf (file);
} finally {
File.Delete (file);
}
var sc = new Gtk.ScrolledWindow ();
sc.ShadowType = Gtk.ShadowType.In;
sc.HscrollbarPolicy = Gtk.PolicyType.Automatic;
sc.VscrollbarPolicy = Gtk.PolicyType.Automatic;
var image = new Gtk.Image (pixbuf);
sc.AddWithViewport (image);
sc.ShowAll ();
return sc;
}
示例4: ExceptionInfo
/// <summary>
/// The provided value can have the following members:
/// Type of the object: type of the exception
/// Message: Message of the exception
/// Instance: Raw instance of the exception
/// StackTrace: an array of frames. Each frame must have:
/// Value of the object: display text of the frame
/// File: name of the file
/// Line: line
/// Col: column
/// InnerException: inner exception, following the same format described above.
/// </summary>
public ExceptionInfo (ObjectValue exception)
{
this.exception = exception;
if (exception.IsEvaluating || exception.IsEvaluatingGroup)
exception.ValueChanged += HandleExceptionValueChanged;
}
示例5: GetString
string GetString (ObjectValue val)
{
var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone ();
ops.AllowTargetInvoke = true;
ops.ChunkRawStrings = true;
if (val.TypeName == "string") {
var rawString = val.GetRawValue (ops) as RawValueString;
var length = rawString.Length;
if (length > 0) {
return rawString.Substring (0, Math.Min (length, 4096));
} else {
return "";
}
} else if (val.TypeName == "char[]") {
var rawArray = val.GetRawValue (ops) as RawValueArray;
var length = rawArray.Length;
if (length > 0) {
return new string (rawArray.GetValues (0, Math.Min (length, 4096)) as char[]);
} else {
return "";
}
} else {
throw new InvalidOperationException ();
}
}
示例6: Show
public void Show (ObjectValue val)
{
value = val;
visualizers = new List<ValueVisualizer> (DebuggingService.GetValueVisualizers (val));
visualizers.Sort ((v1, v2) => string.Compare (v1.Name, v2.Name, StringComparison.CurrentCultureIgnoreCase));
buttons = new List<ToggleButton> ();
Gtk.Button defaultVis = null;
for (int i = 0; i < visualizers.Count; i++) {
var button = new ToggleButton ();
button.Label = visualizers [i].Name;
button.Toggled += OnComboVisualizersChanged;
if (visualizers [i].IsDefaultVisualizer (val))
defaultVis = button;
hbox1.PackStart (button, false, false, 0);
buttons.Add (button);
button.CanFocus = false;
button.Show ();
}
if (defaultVis != null)
defaultVis.Click ();
else if (buttons.Count > 0)
buttons [0].Click ();
if (val.IsReadOnly || !visualizers.Any (v => v.CanEdit (val))) {
buttonCancel.Label = Gtk.Stock.Close;
buttonSave.Hide ();
}
}
示例7: CanVisualize
public override bool CanVisualize (ObjectValue val)
{
switch (val.TypeName) {
case "char[]": return true;
case "string": return true;
default: return false;
}
}
示例8: Create
static ObjectValue Create (IObjectValueSource source, ObjectPath path, string typeName)
{
ObjectValue ob = new ObjectValue ();
ob.source = source;
ob.path = path;
ob.typeName = typeName;
return ob;
}
示例9: Show
public static void Show (ObjectValue val, Control widget, Gdk.Rectangle previewButtonArea)
{
DestroyWindow ();
wnd = new PreviewVisualizerWindow (val, widget);
wnd.ShowPopup (widget, previewButtonArea, PopupPosition.Left);
wnd.Destroyed += HandleDestroyed;
OnWindowShown (EventArgs.Empty);
}
示例10: Create
static ObjectValue Create (IObjectValueSource source, ObjectPath path, string typeName)
{
var val = new ObjectValue ();
val.typeName = typeName;
val.source = source;
val.path = path;
return val;
}
示例11: UpdateValue
public void UpdateValue (ObjectValue newValue)
{
try {
callback.UpdateValue (newValue);
} catch {
// Ignore
}
}
示例12: DebugValueWindow
// PinWindow pinWindow;
// TreeIter currentPinIter;
public DebugValueWindow (Mono.TextEditor.TextEditor editor, int offset, StackFrame frame, ObjectValue value, PinnedWatch watch): base (Gtk.WindowType.Toplevel)
{
this.TypeHint = WindowTypeHint.PopupMenu;
this.AllowShrink = false;
this.AllowGrow = false;
this.Decorated = false;
TransientFor = (Gtk.Window) editor.Toplevel;
// Avoid getting the focus when the window is shown. We'll get it when the mouse enters the window
AcceptFocus = false;
sw = new ScrolledWindow ();
sw.HscrollbarPolicy = PolicyType.Never;
sw.VscrollbarPolicy = PolicyType.Never;
tree = new ObjectValueTreeView ();
sw.Add (tree);
ContentBox.Add (sw);
tree.Frame = frame;
tree.CompactView = true;
tree.AllowAdding = false;
tree.AllowEditing = true;
tree.HeadersVisible = false;
tree.AllowPinning = true;
tree.RootPinAlwaysVisible = true;
tree.PinnedWatch = watch;
DocumentLocation location = editor.Document.OffsetToLocation (offset);
tree.PinnedWatchLine = location.Line;
tree.PinnedWatchFile = ((ExtensibleTextEditor)editor).View.ContentName;
tree.AddValue (value);
tree.Selection.UnselectAll ();
tree.SizeAllocated += OnTreeSizeChanged;
tree.PinStatusChanged += delegate {
Destroy ();
};
// tree.MotionNotifyEvent += HandleTreeMotionNotifyEvent;
sw.ShowAll ();
// pinWindow = new PinWindow (this);
// pinWindow.SetPinned (false);
// pinWindow.ButtonPressEvent += HandlePinWindowButtonPressEvent;
tree.StartEditing += delegate {
Modal = true;
};
tree.EndEditing += delegate {
Modal = false;
};
ShowArrow = true;
Theme.CornerRadius = 3;
}
示例13: StoreValue
public bool StoreValue (ObjectValue val)
{
try {
val.SetRawValue (textView.Buffer.Text);
} catch {
MonoDevelop.Ide.MessageService.ShowError ("Unable to set text");
}
return true;
}
示例14: Show
public void Show (ObjectValue val)
{
value = val;
visualizers = new List<IValueVisualizer> (DebuggingService.GetValueVisualizers (val));
visualizers.Sort (delegate (IValueVisualizer v1, IValueVisualizer v2) {
return v1.Name.CompareTo (v2.Name);
});
foreach (IValueVisualizer vis in visualizers)
comboVisualizers.AppendText (vis.Name);
comboVisualizers.Active = 0;
}
示例15: CanVisualize
public override bool CanVisualize (ObjectValue val)
{
switch (val.TypeName) {
case "System.IO.MemoryStream":
case "Foundation.NSData":
case "sbyte[]":
case "byte[]":
return true;
default:
return false;
}
}