public static void Info(object obj = null) { int serial = 0; if (obj == null) { serial = UOC.GetTargeSerialAsync(Strings.Target_object___).Result; if (serial == 0) { return; } } serial = AliasCommands.ResolveSerial(serial != 0 ? serial : obj); if (serial == 0) { return; } Entity entity = UOMath.IsMobile(serial) ? Engine.Mobiles.GetMobile(serial) : (Entity)Engine.Items.GetItem(serial); if (entity == null) { UOC.SystemMessage(Strings.Cannot_find_item___); return; } Thread t = new Thread(() => { ObjectInspectorWindow window = new ObjectInspectorWindow { DataContext = new ObjectInspectorViewModel(entity) }; window.ShowDialog(); }) { IsBackground = true }; t.SetApartmentState(ApartmentState.STA); t.Start(); }
private void ShowInspectorWindow(Dictionary <string, object> inspectableObject) { // Find the last known cursor position and place the caret there var visualColumn = 0; var isAtEndOfLine = false; var position = GetOffsetFromMousePosition(_lastKnownMousePosition, out visualColumn, out isAtEndOfLine); _editor.TextArea.Caret.Position = new TextViewPosition(_editor.TextArea.Document.GetLocation(position), visualColumn); _editor.TextArea.Caret.DesiredXPos = double.NaN; // Open the inspector _objectInspector = new ObjectInspectorWindow(_editor.TextArea) { SelectedObject = new InspectableDictionaryObject(inspectableObject), SizeToContent = SizeToContent.WidthAndHeight }; _objectInspector.Closed += (sender, eventArgs) => _objectInspector = null; _objectInspector.Show(); }
public static async Task InspectObjectAsync() { (TargetType targetType, TargetFlags _, int serial, int x, int y, int z, int itemID) = await GetTargetInfoAsync(Strings.Target_object___); if (targetType == TargetType.Object && serial != 0) { Entity entity = UOMath.IsMobile(serial) ? (Entity)Engine.Mobiles.GetMobile(serial) : Engine.Items.GetItem(serial); if (entity == null) { return; } Thread t = new Thread(() => { ObjectInspectorWindow window = new ObjectInspectorWindow { DataContext = new ObjectInspectorViewModel(entity) }; window.ShowDialog(); }) { IsBackground = true }; t.SetApartmentState(ApartmentState.STA); t.Start(); } else { if (itemID == 0) { if (x == 65535 && y == 65535) { return; } LandTile landTile = MapInfo.GetLandTile((int)Engine.Player.Map, x, y); Thread t = new Thread(() => { ObjectInspectorWindow window = new ObjectInspectorWindow { DataContext = new ObjectInspectorViewModel(landTile) }; window.ShowDialog(); }) { IsBackground = true }; t.SetApartmentState(ApartmentState.STA); t.Start(); } else { StaticTile[] statics = Statics.GetStatics((int)Engine.Player.Map, x, y); if (statics == null) { return; } StaticTile selectedStatic = statics.FirstOrDefault(i => i.ID == itemID); if (selectedStatic.ID == 0) { selectedStatic = TileData.GetStaticTile(itemID); selectedStatic.X = x; selectedStatic.Y = y; selectedStatic.Z = z; } Thread t = new Thread(() => { ObjectInspectorWindow window = new ObjectInspectorWindow { DataContext = new ObjectInspectorViewModel(selectedStatic) }; window.ShowDialog(); }) { IsBackground = true }; t.SetApartmentState(ApartmentState.STA); t.Start(); } } }