зеркало из https://github.com/DeGsoft/maui-linux.git
Merge pull request #60 from xamarin/warnings-WP8-4014
Turn off suppression of warning CS4014 Port TaskExtensions from WinRT projects to WP8 Update implementation of OpenUriAction to use TaskExtensions
This commit is contained in:
Родитель
748153c4e1
Коммит
e9eaacff4a
|
@ -0,0 +1,33 @@
|
||||||
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
using Windows.Foundation;
|
||||||
|
|
||||||
|
namespace Xamarin.Forms
|
||||||
|
{
|
||||||
|
internal static class TaskExtensions
|
||||||
|
{
|
||||||
|
public static void WatchForError(this IAsyncAction self)
|
||||||
|
{
|
||||||
|
self.AsTask().WatchForError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void WatchForError<T>(this IAsyncOperation<T> self)
|
||||||
|
{
|
||||||
|
self.AsTask().WatchForError();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void WatchForError(this Task self)
|
||||||
|
{
|
||||||
|
SynchronizationContext context = SynchronizationContext.Current;
|
||||||
|
if (context == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
self.ContinueWith(t => {
|
||||||
|
Exception exception = t.Exception.InnerExceptions.Count > 1 ? t.Exception : t.Exception.InnerException;
|
||||||
|
|
||||||
|
context.Post(e => { throw (Exception)e; }, exception);
|
||||||
|
}, CancellationToken.None, TaskContinuationOptions.OnlyOnFaulted, TaskScheduler.Default);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -134,7 +134,7 @@ namespace Xamarin.Forms
|
||||||
|
|
||||||
public void OpenUriAction(Uri uri)
|
public void OpenUriAction(Uri uri)
|
||||||
{
|
{
|
||||||
Launcher.LaunchUriAsync(uri);
|
Launcher.LaunchUriAsync(uri).WatchForError();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void StartTimer(TimeSpan interval, Func<bool> callback)
|
public void StartTimer(TimeSpan interval, Func<bool> callback)
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
<ErrorReport>prompt</ErrorReport>
|
<ErrorReport>prompt</ErrorReport>
|
||||||
<WarningLevel>4</WarningLevel>
|
<WarningLevel>4</WarningLevel>
|
||||||
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
|
||||||
<NoWarn>4014;0618;0219</NoWarn>
|
<NoWarn>0618;0219</NoWarn>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||||
<DebugType>pdbonly</DebugType>
|
<DebugType>pdbonly</DebugType>
|
||||||
|
@ -202,6 +202,7 @@
|
||||||
<DependentUpon>TableView.xaml</DependentUpon>
|
<DependentUpon>TableView.xaml</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
<Compile Include="TableViewRenderer.cs" />
|
<Compile Include="TableViewRenderer.cs" />
|
||||||
|
<Compile Include="TaskExtensions.cs" />
|
||||||
<Compile Include="TextAlignmentToHorizontalAlignmentConverter.cs" />
|
<Compile Include="TextAlignmentToHorizontalAlignmentConverter.cs" />
|
||||||
<Compile Include="TextCellRenderer.cs" />
|
<Compile Include="TextCellRenderer.cs" />
|
||||||
<Compile Include="TimePickerRenderer.cs" />
|
<Compile Include="TimePickerRenderer.cs" />
|
||||||
|
|
Загрузка…
Ссылка в новой задаче