示例#1
0
        private SharePopup()
        {
            InitializeComponent();
            DataContext = TLContainer.Current.Resolve <ShareViewModel>();

            //Title = Strings.Resources.ShareSendTo;
            PrimaryButtonText   = Strings.Resources.Send;
            SecondaryButtonText = Strings.Resources.Close;

            EmojiPanel.DataContext   = EmojiDrawerViewModel.GetForCurrentView(ViewModel.SessionId);
            CaptionInput.CustomEmoji = CustomEmoji;

            ViewModel.PropertyChanged += OnPropertyChanged;

            var debouncer = new EventDebouncer <TextChangedEventArgs>(Constants.TypingTimeout, handler => SearchField.TextChanged += new TextChangedEventHandler(handler));

            debouncer.Invoked += async(s, args) =>
            {
                var items = ViewModel.Search;
                if (items != null && string.Equals(SearchField.Text, items.Query))
                {
                    await items.LoadMoreItemsAsync(2);

                    await items.LoadMoreItemsAsync(3);
                }
            };
        }
示例#2
0
        private void LoadAtIndex(Chat chat, int index, bool unload)
        {
            if (index == 0)
            {
                if (unload)
                {
                    UnloadAtIndex(1);
                    UnloadAtIndex(2);
                }

                if (EmojisRoot == null)
                {
                    FindName(nameof(EmojisRoot));
                    EmojisRoot.DataContext = EmojiDrawerViewModel.GetForCurrentView(ViewModel.SessionId);
                }

                EmojisRoot.Activate(chat);
                SettingsService.Current.Stickers.SelectedTab = StickersTab.Emoji;
            }
            else if (index == 1)
            {
                if (unload)
                {
                    UnloadAtIndex(0);
                    UnloadAtIndex(2);
                }

                if (AnimationsRoot == null)
                {
                    FindName(nameof(AnimationsRoot));
                    AnimationsRoot.DataContext           = AnimationDrawerViewModel.GetForCurrentView(ViewModel.SessionId);
                    AnimationsRoot.ItemClick             = Animations_ItemClick;
                    AnimationsRoot.ItemContextRequested += (s, args) => AnimationContextRequested?.Invoke(s, args);
                }

                AnimationsRoot.Activate(chat);
                SettingsService.Current.Stickers.SelectedTab = StickersTab.Animations;
            }
            else if (index == 2)
            {
                if (unload)
                {
                    UnloadAtIndex(0);
                    UnloadAtIndex(1);
                }

                if (StickersRoot == null)
                {
                    FindName(nameof(StickersRoot));
                    StickersRoot.DataContext           = StickerDrawerViewModel.GetForCurrentView(ViewModel.SessionId);
                    StickersRoot.ItemClick             = Stickers_ItemClick;
                    StickersRoot.ItemContextRequested += (s, args) => StickerContextRequested?.Invoke(s, args);
                    StickersRoot.ChoosingItem         += (s, args) => ChoosingSticker?.Invoke(s, args);
                }

                StickersRoot.Activate(chat);
                SettingsService.Current.Stickers.SelectedTab = StickersTab.Stickers;
            }
        }