private async void GetInstanceValue(TreeViewItem selTreeItem, InstanceValue selInstValue, bool rawValue = false) { if (TypeExtractor.IsString(selInstValue.Kind)) { if (selInstValue.Value.IsLong()) { ValueWindows.ShowContentWindow(selInstValue.GetDescription(), selInstValue, ValueWindows.WndType.Content); } return; } if (selInstValue.HaveFields()) { return; // already has values } ulong addr = _mainWindow.GetAddressFromEntry(selInstValue.Value.FullContent); if (selInstValue.Address != Constants.InvalidAddress && addr != Constants.InvalidAddress && addr == selInstValue.Address) { if (!rawValue) // if known collection show it in a collection window { if (TypeExtractor.IsKnownType(selInstValue.TypeName)) { var msg = "Getting object value at: " + Utils.RealAddressString(selInstValue.Address); _mainWindow.ExecuteInstanceValueQuery(msg, selInstValue.Address); return; } } var index = MainWindow.CurrentIndex; StatusText.Text = "Getting value at address: " + selInstValue.Address + ", please wait..."; Mouse.OverrideCursor = Cursors.Wait; (string error, InstanceValue[] fields) = await Task.Factory.StartNew(() => { return(index.GetInstanceValueFields(selInstValue.Address, selInstValue.Parent)); }, _mainWindow.DumpSTAScheduler); if (Utils.IsInformation(error)) { StatusText.Text = error; } else { StatusText.Text = "Getting fields at address: " + selInstValue.Address + (fields != null ? ", done." : ", failed."); } Mouse.OverrideCursor = null; if (error != null && !Utils.IsInformation(error)) { GuiUtils.ShowError(error, this); return; } if (fields.Length < 1) { return; } if (fields.Length == 1 && fields[0].IsArray()) { ValueWindows.ShowContentWindow(fields[0].GetDescription(), fields[0], ValueWindows.WndType.List); return; } if (fields.Length > 0) { selInstValue.SetFields(fields); for (int i = 0, icount = fields.Length; i < icount; ++i) { var fld = fields[i]; var tvNode = new TreeViewItem { Header = GuiUtils.GetInstanceValueStackPanel(fld), Tag = fld }; selTreeItem.Items.Add(tvNode); } } selTreeItem.ExpandSubtree(); } else { StatusText.Text = "Value for " + selInstValue.TypeName + " cannot be expanded."; return; } }