public void RemoveEntity(CharacterPropertiesShortcutBar entity, Action <bool> callback) { _queue.Add(new Task(() => { var result = _wrappedDatabase.RemoveEntity(entity); callback?.Invoke(result); })); }
/// <summary> /// Handles the adding of items to 1-9 shortcut bar in lower-right corner.<para /> /// Note that there are two rows. The top row is 1-9, the bottom row has no hotkeys. /// </summary> public void HandleActionAddShortcut(Shortcut shortcut) { // When a shortcut is added on top of an existing item, the client automatically sends the RemoveShortcut command for that existing item first, then will add the new item, and re-add the existing item to the appropriate place. var entity = new CharacterPropertiesShortcutBar { CharacterId = Biota.Id, ShortcutBarIndex = shortcut.Index, ShortcutObjectId = shortcut.ObjectId }; Character.CharacterPropertiesShortcutBar.Add(entity); ChangesDetected = true; }
public bool RemoveEntity(CharacterPropertiesShortcutBar entity) { using (var context = new ShardDbContext()) { context.CharacterPropertiesShortcutBar.Remove(entity); try { context.SaveChanges(); return(true); } catch (Exception ex) { // Character name might be in use or some other fault log.Error($"RemoveEntity failed with exception: {ex}"); return(false); } } }
public Shortcut(CharacterPropertiesShortcutBar shortcut) { Index = shortcut.ShortcutBarIndex; ObjectId = shortcut.ShortcutObjectId; Spell = new LayeredSpell(); }