mirror of
https://github.com/Ryujinx/GtkSharp.git
synced 2024-09-09 00:13:20 +02:00
![Rickard Edström](/assets/img/avatar_default.png)
Create a GLibSynchronizationContext that sends code to be run on the GLib main loop, and set it as the current SynchronizationContext in Gtk.Init(). When you use the await keyword to do a task asynchronously, by default the awaiter will capture the current SynchronizationContext, and if there was one, when the task completes it’ll Post the supplied continuation back to that context, rather than running it on whatever thread it wants. This means that if you use the async/await keywords in your Gtk# app, things will now work as expected with the GTK main thread. For example: static async void DoWork () // called in the GTK main thread { // Do some stuff with the UI... label.Text = "Starting Work"; // Run something asynchronously, UI is not frozen int res = await DoLongOperation (); // Do some more UI stuff, it'll run on the GTK main thread label.Text = "Work done"; } Signed-off-by: Bertrand Lorentz <bertrand.lorentz@gmail.com>
90 lines
3.6 KiB
XML
90 lines
3.6 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<Project DefaultTargets="Build" ToolsVersion="3.5" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
<PropertyGroup>
|
|
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
|
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
|
|
<ProductVersion>9.0.21022</ProductVersion>
|
|
<SchemaVersion>2.0</SchemaVersion>
|
|
<ProjectGuid>{3BF1D531-8840-4F15-8066-A9788D8C398B}</ProjectGuid>
|
|
<OutputType>Exe</OutputType>
|
|
<RootNamespace>glib</RootNamespace>
|
|
<AssemblyName>glib</AssemblyName>
|
|
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
|
</PropertyGroup>
|
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
|
|
<DebugSymbols>true</DebugSymbols>
|
|
<DebugType>full</DebugType>
|
|
<Optimize>false</Optimize>
|
|
<OutputPath>bin\Debug</OutputPath>
|
|
<DefineConstants>DEBUG;</DefineConstants>
|
|
<ErrorReport>prompt</ErrorReport>
|
|
<WarningLevel>4</WarningLevel>
|
|
<PlatformTarget>x86</PlatformTarget>
|
|
<ConsolePause>false</ConsolePause>
|
|
</PropertyGroup>
|
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
|
|
<DebugType>none</DebugType>
|
|
<Optimize>false</Optimize>
|
|
<OutputPath>bin\Release</OutputPath>
|
|
<ErrorReport>prompt</ErrorReport>
|
|
<WarningLevel>4</WarningLevel>
|
|
<PlatformTarget>x86</PlatformTarget>
|
|
<ConsolePause>false</ConsolePause>
|
|
</PropertyGroup>
|
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
|
<ItemGroup>
|
|
<Compile Include="Argv.cs" />
|
|
<Compile Include="AssemblyInfo.cs" />
|
|
<Compile Include="ConnectBeforeAttribute.cs" />
|
|
<Compile Include="DefaultSignalHandlerAttribute.cs" />
|
|
<Compile Include="DestroyNotify.cs" />
|
|
<Compile Include="ExceptionManager.cs" />
|
|
<Compile Include="FileUtils.cs" />
|
|
<Compile Include="GException.cs" />
|
|
<Compile Include="GInterfaceAdapter.cs" />
|
|
<Compile Include="GInterfaceAttribute.cs" />
|
|
<Compile Include="Global.cs" />
|
|
<Compile Include="GString.cs" />
|
|
<Compile Include="GType.cs" />
|
|
<Compile Include="GTypeAttribute.cs" />
|
|
<Compile Include="Idle.cs" />
|
|
<Compile Include="InitiallyUnowned.cs" />
|
|
<Compile Include="IOChannel.cs" />
|
|
<Compile Include="IWrapper.cs" />
|
|
<Compile Include="KeyFile.cs" />
|
|
<Compile Include="List.cs" />
|
|
<Compile Include="ListBase.cs" />
|
|
<Compile Include="Log.cs" />
|
|
<Compile Include="MainContext.cs" />
|
|
<Compile Include="MainLoop.cs" />
|
|
<Compile Include="ManagedValue.cs" />
|
|
<Compile Include="Markup.cs" />
|
|
<Compile Include="Marshaller.cs" />
|
|
<Compile Include="MissingIntPtrCtorException.cs" />
|
|
<Compile Include="NotifyHandler.cs" />
|
|
<Compile Include="Object.cs" />
|
|
<Compile Include="ObjectManager.cs" />
|
|
<Compile Include="Opaque.cs" />
|
|
<Compile Include="ParamSpec.cs" />
|
|
<Compile Include="Priority.cs" />
|
|
<Compile Include="PropertyAttribute.cs" />
|
|
<Compile Include="PtrArray.cs" />
|
|
<Compile Include="Signal.cs" />
|
|
<Compile Include="SignalArgs.cs" />
|
|
<Compile Include="SignalAttribute.cs" />
|
|
<Compile Include="SignalClosure.cs" />
|
|
<Compile Include="SList.cs" />
|
|
<Compile Include="Source.cs" />
|
|
<Compile Include="Spawn.cs" />
|
|
<Compile Include="Thread.cs" />
|
|
<Compile Include="Timeout.cs" />
|
|
<Compile Include="ToggleRef.cs" />
|
|
<Compile Include="TypeFundamentals.cs" />
|
|
<Compile Include="TypeInitializerAttribute.cs" />
|
|
<Compile Include="Value.cs" />
|
|
<Compile Include="ValueArray.cs" />
|
|
<Compile Include="Variant.cs" />
|
|
<Compile Include="VariantType.cs" />
|
|
<Compile Include="GLibSynchronizationContext.cs" />
|
|
</ItemGroup>
|
|
</Project> |