コード例 #1
0
 private void ResultExpander_Collapsed(object sender, RoutedEventArgs e)
 {
     ResultItems.Ready();
     if (ResultNextPage is Button)
     {
         ResultNextPage.Hide();
     }
 }
コード例 #2
0
        private void Page_Loaded(object sender, RoutedEventArgs e)
        {
            ParentWindow = Window.GetWindow(this);

            #region Update ContextMenu
            var cmr = Resources["MenuSearchResult"] as ContextMenu;
            if (cmr is ContextMenu)
            {
                foreach (dynamic item in cmr.Items)
                {
                    if (item is MenuItem && item.Name.Equals("ActionResultFilter", StringComparison.CurrentCultureIgnoreCase))
                    {
                        ActionResultFilter = item;
                        if ((item as MenuItem).Items.Count > 0)
                        {
                            ((item as MenuItem).Items[0] as MenuItem).IsChecked = true;
                        }
                        break;
                    }
                }
            }

            var cmf = Resources["MenuSearchFilter"] as ContextMenu;
            if (cmf is ContextMenu)
            {
                ContextMenuResultFilter = cmf;
                foreach (dynamic item in cmf.Items)
                {
                    if (item is MenuItem)
                    {
                        var mi = item as MenuItem;
                        if (mi.Name.Equals("SearchFilter_00000users", StringComparison.CurrentCultureIgnoreCase))
                        {
                            mi.IsChecked = true;
                            break;
                        }
                    }
                }
            }
            #endregion

            #region ToolButton MouseOver action
            SearchFilter.MouseOverAction();
            ResultPrevPage.MouseOverAction();
            ResultNextPage.MouseOverAction();
            ResultNextAppend.MouseOverAction();
            SearchRefreshThumb.MouseOverAction();
            #endregion

            if (!string.IsNullOrEmpty(Contents))
            {
                UpdateDetail(Contents);
            }
        }
コード例 #3
0
        public async void UpdateDetail(string content)
        {
            if (CanUpdateing.Wait(0))
            {
                try
                {
                    ResultExpander.Show();
                    if (Contents is string && !string.IsNullOrEmpty(Contents))
                    {
                        if (!ResultExpander.IsExpanded)
                        {
                            ResultExpander.IsExpanded = true;
                        }

                        var tokens = await CommonHelper.ShowLogin();

                        if (tokens == null)
                        {
                            throw (new Exception("No Token"));
                        }

                        ShowResultInline(tokens, Contents, result_filter);
                    }
                    if (ResultNextPage is Button)
                    {
                        ResultNextPage.Show();
                    }
                }
                catch (Exception ex)
                {
                    ResultExpander.Header = $"Search Results, ERROR: {ex.Message}";
                }
                finally
                {
                    if (ParentWindow != null)
                    {
                        ParentWindow.SizeToContent = SizeToContent.WidthAndHeight;
                    }
                    if (CanUpdateing is SemaphoreSlim && CanUpdateing.CurrentCount <= 0)
                    {
                        CanUpdateing.Release();
                    }
                }
            }
        }
コード例 #4
0
        private async void ResultNextPage_Click(object sender, RoutedEventArgs e)
        {
            var tokens = await CommonHelper.ShowLogin();

            if (tokens == null)
            {
                return;
            }

            if (Contents is string)
            {
                var next_url = string.Empty;
                if (ResultExpander.Tag is string)
                {
                    next_url = ResultExpander.Tag as string;
                }

                var append = sender == ResultNextAppend || sender.GetUid().Equals("ActionNextResultAppend", StringComparison.CurrentCultureIgnoreCase) ? true : false;
                ShowResultInline(tokens, Contents, result_filter, next_url, append);
            }
            ResultNextPage.Show();
        }