예제 #1
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();
                    }
                }
            }
        }
예제 #2
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();
        }