private void SelectIntellisenseEmoticon() { if (this.EmoticonIntellisenseListBox.SelectedItem is TwitchChatEmoteViewModel) { TwitchChatEmoteViewModel emoticon = this.EmoticonIntellisenseListBox.SelectedItem as TwitchChatEmoteViewModel; if (emoticon != null) { this.SelectIntellisenseItem(emoticon.Name); } } else if (this.EmoticonIntellisenseListBox.SelectedItem is BetterTTVEmoteModel) { BetterTTVEmoteModel emoticon = this.EmoticonIntellisenseListBox.SelectedItem as BetterTTVEmoteModel; if (emoticon != null) { this.SelectIntellisenseItem(emoticon.code); } } else if (this.EmoticonIntellisenseListBox.SelectedItem is FrankerFaceZEmoteModel) { FrankerFaceZEmoteModel emoticon = this.EmoticonIntellisenseListBox.SelectedItem as FrankerFaceZEmoteModel; if (emoticon != null) { this.SelectIntellisenseItem(emoticon.name); } } this.HideIntellisense(); }
private async void EmoticonControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e) { try { if (this.DataContext != null) { if (this.DataContext is TwitchChatEmoteViewModel) { TwitchChatEmoteViewModel emote = (TwitchChatEmoteViewModel)this.DataContext; this.ProcessGifImage(emote.Name, emote.ImageURL); this.Image.ToolTip = this.AltText.Text = emote.Name; } else if (this.DataContext is BetterTTVEmoteModel) { BetterTTVEmoteModel emote = (BetterTTVEmoteModel)this.DataContext; if (emote.imageType.Equals("gif")) { this.ProcessGifImage(emote.code, emote.url); } else { this.Image.Source = await this.DownloadImageUrl(emote.url); } this.Image.ToolTip = this.AltText.Text = emote.code; } else if (this.DataContext is FrankerFaceZEmoteModel) { FrankerFaceZEmoteModel emote = (FrankerFaceZEmoteModel)this.DataContext; this.Image.Source = await this.DownloadImageUrl(emote.url); this.Image.ToolTip = this.AltText.Text = emote.name; } else if (this.DataContext is TwitchBitsCheerViewModel) { TwitchBitsCheerViewModel bitsCheer = (TwitchBitsCheerViewModel)this.DataContext; this.Image.Source = await this.DownloadImageUrl((ChannelSession.AppSettings.IsDarkBackground)?bitsCheer.Tier.DarkImage : bitsCheer.Tier.LightImage); this.Image.ToolTip = this.AltText.Text = bitsCheer.Text; this.Text.Visibility = Visibility.Visible; this.Text.Text = bitsCheer.Amount.ToString(); } else if (this.DataContext is string) { string imageUrl = (string)this.DataContext; this.Image.Source = await this.DownloadImageUrl(imageUrl); } if (this.Image.Source != null) { this.Image.MaxWidth = this.Image.MaxHeight = this.Image.Width = this.Image.Height = ChannelSession.Settings.ChatFontSize * 2; } } } catch (Exception ex) { Logger.Log(ex); } }
public ChatImageControl(TwitchChatEmoteViewModel emote) : this() { this.DataContext = emote; }