Exemplo n.º 1
0
        protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
        {
            string tag;
            string username = null;

            if (NavigationContext.QueryString.TryGetValue("tag", out tag))
            {
                search.txtSearch.Text  = tag;
                search.rbTag.IsChecked = true;
            }
            else if (NavigationContext.QueryString.TryGetValue("username", out username))
            {
                search.txtSearch.Text   = username;
                search.rbUser.IsChecked = true;
            }


            if (tag != null || username != null)
            {
                SearchVm.Search(null, username, tag, (vm) =>
                {
                    this.DataContext = vm;
                });
            }
            base.OnNavigatedTo(e);
        }
Exemplo n.º 2
0
        private void SearchButton_Click(object sender, RoutedEventArgs e)
        {
            string tag  = null;
            string text = null;
            string user = null;

            string search = txtSearch.Text;

            if (String.IsNullOrEmpty(search))
            {
                return;
            }

            if (rbTag.IsChecked.GetValueOrDefault())
            {
                tag = search;
            }

            if (rbText.IsChecked.GetValueOrDefault())
            {
                text = search;
            }

            if (rbUser.IsChecked.GetValueOrDefault())
            {
                user = search;
            }

            SearchVm.Search(text, user, tag,
                            (vm) =>
            {
                view.DataContext = vm;
                view.Visibility  = System.Windows.Visibility.Visible;
            }
                            );
        }