Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
wobba committed Dec 3, 2021
1 parent cc00053 commit b21d481
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -985,8 +985,12 @@ private void StartSearchQueryRequest()
: AcceptType.Xml;

//todo this should be split to several methods so we can reuse them
Task.Factory.StartNew(() => HttpRequestRunner.RunWebRequest(_searchQueryRequest),
TaskCreationOptions.LongRunning)
var scheduler = TaskScheduler.FromCurrentSynchronizationContext();
var tokenSource = new CancellationTokenSource();
CancellationToken ct = tokenSource.Token;

Task.Factory.StartNew(() => HttpRequestRunner.RunWebRequest(_searchQueryRequest), ct,
TaskCreationOptions.LongRunning | TaskCreationOptions.AttachedToParent, scheduler)
.ContinueWith(task =>
{
if (task.Exception != null)
Expand Down Expand Up @@ -1029,14 +1033,14 @@ private void StartSearchQueryRequest()
SetPromotedResultItems(searchResults);
}
}, TaskScheduler.FromCurrentSynchronizationContext()).ContinueWith(task =>
}, scheduler).ContinueWith(task =>
{
if (task.Exception != null)
{
ShowError(task.Exception);
}
MarkRequestOperation(false, status);
});
}, scheduler);
}
catch (Exception ex)
{
Expand Down Expand Up @@ -1959,7 +1963,7 @@ private async void OpenPreviewAllProperties(object sender, MouseButtonEventArgs
var scheduler = TaskScheduler.FromCurrentSynchronizationContext();
var tokenSource = new CancellationTokenSource();
CancellationToken ct = tokenSource.Token;
Task.Factory.StartNew(() => HttpRequestRunner.RunWebRequest(sqr), ct,
await Task.Factory.StartNew(() => HttpRequestRunner.RunWebRequest(sqr), ct,
TaskCreationOptions.LongRunning | TaskCreationOptions.AttachedToParent, scheduler).ContinueWith(
task =>
{
Expand Down Expand Up @@ -2459,15 +2463,15 @@ private void SetPromotedResultItems(SearchQueryResult searchResult)

var srq = searchResult.SecondaryQueryResults;

if (srq != null && srq[0].PromotedResults.Count > 0)
if (srq != null && srq[0].PromotedResults != null && srq[0].PromotedResults.Count > 0)
{
StackPanel spTop = new StackPanel { Orientation = Orientation.Vertical };

int counter = 1;

foreach (var psr in srq[0].PromotedResults)
{

StackPanel spEntry = new StackPanel { Margin = new Thickness(25) };
string resultTitle;
resultTitle = String.Format("Title: {0}", psr.Title);
Expand All @@ -2489,7 +2493,7 @@ private void SetPromotedResultItems(SearchQueryResult searchResult)
Header = "View"
};
StackPanel spProps = new StackPanel();

DockPanel propdp = new DockPanel();
propdp.Children.Add(
new TextBox
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down

0 comments on commit b21d481

Please sign in to comment.