示例#1
0
        private Button GetButton(int idx, string sticker)
        {
            Button btn = new Button
            {
                Tag     = idx,
                Content = sticker != null ? new System.Windows.Controls.Image()
                {
                    Source = new BitmapImage(new Uri(sticker))
                } : null,
                Width           = 64,
                Height          = 64,
                FontSize        = 32,
                Margin          = new Thickness(2),
                Padding         = new Thickness(4),
                BorderThickness = new Thickness(0.5),
                BorderBrush     = new SolidColorBrush(Colors.DarkCyan),
                Background      = new SolidColorBrush(Colors.Transparent),
            };

            btn.Click += async(s, e) =>
            {
                if (idx < 4)
                {
                    _tunePlayer.Play(idx);
                }

                OnControllerEvent(new DisplayEmojiEventArgs()
                {
                    EmojiIndex = idx
                });

                await ClearAfter();
            };

            return(btn);
        }
示例#2
0
 private void TimesUp()
 {
     _tunePlayer.Play(8);
 }