public BotControl(Behaviors.Bot bot) { Bot = bot; InitializeComponent(); bot.CharactersSelected += OnCharacterSelected; }
public BotViewModel GetBotViewModel(Behaviors.Bot bot) { lock (DocumentPane.Children) { var document = DocumentPane.Children.FirstOrDefault(x => x.Content is BotControl && (x.Content as BotControl).ViewModel.Bot == bot); return(document != null ? (document.Content as BotControl).ViewModel : null); } }
public void AddChild(Behaviors.Bot bot) { var child = new MdiChild(); child.Title = "Bot"; child.Content = new BotControl(bot); child.Closed += OnChildClosed; MdiContainer.Children.Add(child); }
public void RemoveChild(Behaviors.Bot bot) { var childs = MdiContainer.Children. Where(entry => entry.Content is BotControl && (entry.Content as BotControl).Bot == bot).ToArray(); foreach (var child in childs) { child.Content = null; child.Close(); } }
private void OnCharacterSelected(Behaviors.Bot bot, PlayedCharacter character) { }
public void HandleIdentificationMessage(Behaviors.Bot bot, IdentificationMessage message) { Dispatcher.Invoke(new Action(() => CloseChildByLogin(message.login))); }
private void OnBotRemoved(BotManager manager, Behaviors.Bot bot) { // Dispatcher.Invoke(new Action(() => RemoveChild(bot))); // note : remove the window only if another bot with the same name is created }
private void OnBotAdded(BotManager manager, Behaviors.Bot bot) { Dispatcher.Invoke(new Action(() => AddChild(bot))); }