Пример #1
0
        private void Recommended_ElementPrepared(Microsoft.UI.Xaml.Controls.ItemsRepeater sender, Microsoft.UI.Xaml.Controls.ItemsRepeaterElementPreparedEventArgs args)
        {
            var content = args.Element as StackPanel;
            var filter  = content.DataContext as RecommendedChatFilter;

            var grid = content.Children[0] as Grid;

            var button = grid.Children[0] as BadgeButton;
            var add    = grid.Children[1] as Button;

            var separator = content.Children[1];

            var icon = Icons.ParseFilter(filter.Filter);

            button.Glyph   = Icons.FilterToGlyph(icon).Item1;
            button.Content = filter.Filter.Title;
            button.Badge   = filter.Description;

            add.Command          = ViewModel.RecommendCommand;
            add.CommandParameter = filter;

            separator.Visibility = args.Index < sender.ItemsSourceView.Count - 1
                ? Visibility.Visible
                : Visibility.Collapsed;
        }
Пример #2
0
        private void EmojiList_ContainerContentChanging(ListViewBase sender, ContainerContentChangingEventArgs args)
        {
            if (args.InRecycleQueue)
            {
                return;
            }

            if (args.ItemContainer.ContentTemplateRoot is FontIcon textBlock && args.Item is ChatFilterIcon icon)
            {
                textBlock.Glyph = Icons.FilterToGlyph(icon).Item1;
            }
        }
Пример #3
0
        private void Items_ElementPrepared(Microsoft.UI.Xaml.Controls.ItemsRepeater sender, Microsoft.UI.Xaml.Controls.ItemsRepeaterElementPreparedEventArgs args)
        {
            var button = args.Element as BadgeButton;
            var filter = button.DataContext as ChatFilterInfo;

            var icon = Icons.ParseFilter(filter.IconName);

            button.Glyph            = Icons.FilterToGlyph(icon).Item1;
            button.Content          = filter.Title;
            button.Command          = ViewModel.EditCommand;
            button.CommandParameter = filter;
            button.ChevronGlyph     = args.Index < ViewModel.CacheService.Options.ChatFilterCountMax ? Icons.ChevronRight : Icons.LockClosed;
        }
Пример #4
0
        public ChatFilterViewModel(ChatFilterInfo info)
        {
            if (info.Id == Constants.ChatListMain)
            {
                ChatList = new ChatListMain();
            }
            else if (info.Id == Constants.ChatListArchive)
            {
                ChatList = new ChatListArchive();
            }
            else
            {
                ChatList = new ChatListFilter(info.Id);
            }

            ChatFilterId = info.Id;

            _title     = info.Title;
            _icon      = Icons.ParseFilter(info.IconName);
            _iconGlyph = Icons.FilterToGlyph(_icon).Item1;
        }
Пример #5
0
 private string ConvertEmoji(ChatFilterIcon icon)
 {
     return(Icons.FilterToGlyph(icon).Item1);
 }
Пример #6
0
 public void Update(ChatFilterInfo info)
 {
     Title     = info.Title;
     Icon      = Icons.ParseFilter(info.IconName);
     IconGlyph = Icons.FilterToGlyph(_icon).Item1;
 }