Skip to content

Commit

Permalink
Win10 stuff is in a separate optional assembly
Browse files Browse the repository at this point in the history
  • Loading branch information
gro-ove committed May 22, 2018
1 parent 0b95941 commit c352edd
Show file tree
Hide file tree
Showing 40 changed files with 424 additions and 150 deletions.
1 change: 1 addition & 0 deletions AcManager.AcSound/AcManager.AcSound.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<TargetFrameworkProfile />
<ActualPlatform>$(Platform)</ActualPlatform>
<ActualPlatform Condition="'$(ActualPlatform)' == 'AnyCPU'">x86</ActualPlatform>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
Expand Down
1 change: 1 addition & 0 deletions AcManager.ContentRepair/AcManager.ContentRepair.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkProfile />
<FileAlignment>512</FileAlignment>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
Expand Down
2 changes: 2 additions & 0 deletions AcManager.Controls/AcManager.Controls.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B1D477C5-F639-4043-B8A6-82EA950F9890}</ProjectGuid>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AcManager.Controls</RootNamespace>
Expand All @@ -16,6 +17,7 @@
<WarningLevel>4</WarningLevel>
<ActualPlatform>$(Platform)</ActualPlatform>
<ActualPlatform Condition="'$(ActualPlatform)' == 'AnyCPU'">x86</ActualPlatform>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
Expand Down
1 change: 1 addition & 0 deletions AcManager.DiscordRpc/AcManager.DiscordRpc.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<FileAlignment>512</FileAlignment>
<ActualPlatform>$(Platform)</ActualPlatform>
<ActualPlatform Condition="'$(ActualPlatform)' == 'AnyCPU'">x86</ActualPlatform>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<FileAlignment>512</FileAlignment>
<ActualPlatform>$(Platform)</ActualPlatform>
<ActualPlatform Condition="'$(ActualPlatform)' == 'AnyCPU'">x86</ActualPlatform>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
Expand Down
1 change: 1 addition & 0 deletions AcManager.Tools.Tests/AcManager.Tools.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
Expand Down
2 changes: 2 additions & 0 deletions AcManager.Tools/AcManager.Tools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<FileAlignment>512</FileAlignment>
<ActualPlatform>$(Platform)</ActualPlatform>
<ActualPlatform Condition="'$(ActualPlatform)' == 'AnyCPU'">x86</ActualPlatform>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
Expand Down Expand Up @@ -268,6 +269,7 @@
<Compile Include="GameProperties\WeatherSpecific\WeatherSpecificDirectoryReplacementBase.cs" />
<Compile Include="GameProperties\WeatherSpecific\WeatherSpecificFileReplacementBase.cs" />
<Compile Include="GameProperties\WeatherSpecific\WeatherSpecificHelperBase.cs" />
<Compile Include="GameProperties\WeatherSpecific\WeatherSpecificLightingHelper.cs" />
<Compile Include="GameProperties\WeatherSpecific\WeatherSpecificTyreSmokeHelper.cs" />
<Compile Include="GameProperties\WeatherSpecific\WeatherSpecificVideoSettingsHelper.cs" />
<Compile Include="Helpers\AbstractFilesStorage.cs" />
Expand Down
10 changes: 10 additions & 0 deletions AcManager.sln
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AcManager.DiscordRpc", "AcM
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AcTools.WheelAngles", "AcTools.WheelAngles\AcTools.WheelAngles.csproj", "{FB504C5F-0420-41E2-8E17-ABC25A9C5491}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FirstFloor.ModernUI.Win8Extension", "FirstFloor.ModernUI.Win8Extension\FirstFloor.ModernUI.Win8Extension.csproj", "{E7E7DE99-925E-4BF2-9E34-838FD6EE7191}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Expand Down Expand Up @@ -271,6 +273,14 @@ Global
{FB504C5F-0420-41E2-8E17-ABC25A9C5491}.Release|x64.Build.0 = Release|x64
{FB504C5F-0420-41E2-8E17-ABC25A9C5491}.Release|x86.ActiveCfg = Release|x86
{FB504C5F-0420-41E2-8E17-ABC25A9C5491}.Release|x86.Build.0 = Release|x86
{E7E7DE99-925E-4BF2-9E34-838FD6EE7191}.Debug|x64.ActiveCfg = Debug|x64
{E7E7DE99-925E-4BF2-9E34-838FD6EE7191}.Debug|x64.Build.0 = Debug|x64
{E7E7DE99-925E-4BF2-9E34-838FD6EE7191}.Debug|x86.ActiveCfg = Debug|x86
{E7E7DE99-925E-4BF2-9E34-838FD6EE7191}.Debug|x86.Build.0 = Debug|x86
{E7E7DE99-925E-4BF2-9E34-838FD6EE7191}.Release|x64.ActiveCfg = Release|x64
{E7E7DE99-925E-4BF2-9E34-838FD6EE7191}.Release|x64.Build.0 = Release|x64
{E7E7DE99-925E-4BF2-9E34-838FD6EE7191}.Release|x86.ActiveCfg = Release|x86
{E7E7DE99-925E-4BF2-9E34-838FD6EE7191}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
18 changes: 14 additions & 4 deletions AcManager/AcManager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{36F3CF0E-1754-4853-95F6-6C9FBD2C0D05}</ProjectGuid>
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<OutputType>WinExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>AcManager</RootNamespace>
Expand All @@ -39,6 +40,7 @@
<ActualPlatform>$(Platform)</ActualPlatform>
<ActualPlatform Condition="'$(ActualPlatform)' == 'AnyCPU'">x86</ActualPlatform>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Assets\Icons\Icon.ico</ApplicationIcon>
Expand Down Expand Up @@ -199,10 +201,6 @@
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="Windows">
<HintPath>C:\Program Files (x86)\Windows Kits\8.1\References\CommonConfiguration\Neutral\Windows.winmd</HintPath>
<Private>False</Private>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
Expand Down Expand Up @@ -1870,6 +1868,18 @@
<Name>StringBasedFilter</Name>
</ProjectReference>
</ItemGroup>
<!-- Win8+ special: begin -->
<Import Project="..\Libraries\Windows8Reference.props" />
<ItemGroup Condition="Exists('$(Windows8Reference)')">
<ProjectReference Include="..\FirstFloor.ModernUI.Win8Extension\FirstFloor.ModernUI.Win8Extension.csproj">
<Project>{e7e7de99-925e-4bf2-9e34-838fd6ee7191}</Project>
<Name>FirstFloor.ModernUI.Win8Extension</Name>
</ProjectReference>
</ItemGroup>
<PropertyGroup Condition="Exists('$(Windows8Reference)')">
<DefineConstants>$(DefineConstants);WIN8SUPPORTED</DefineConstants>
</PropertyGroup>
<!-- Win8+ special: end -->
<ItemGroup>
<Folder Include="Assets\Libs\" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
using System.Windows.Documents;
using System.Windows.Input;
using System.Xml.Schema;
using Windows.UI.Popups;
using AcManager.Controls;
using AcManager.Controls.ViewModels;
using AcManager.Pages.Drive;
Expand Down
72 changes: 14 additions & 58 deletions AcManager/Tools/Win10SharingUiHelper.cs
Original file line number Diff line number Diff line change
@@ -1,76 +1,32 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.InteropServices.WindowsRuntime;
using System.Windows;
using System.Windows.Interop;
using Windows.ApplicationModel.DataTransfer;
using System.Runtime.CompilerServices;
using AcManager.Controls.Helpers;
using FirstFloor.ModernUI;
using FirstFloor.ModernUI.Helpers;

#if WIN8SUPPORTED
using FirstFloor.ModernUI.Win8Extension;
#endif

namespace AcManager.Tools {
// Feels like it doesn’t really work, Windows 10 just isn’t there yet. Also, this way sharing
// might be cancelled later, and if user will try again, it would be nice not to ask him details.
public class Win10SharingUiHelper : ICustomSharingUiHelper {
public bool ShowShared(string type, string link) {
try {
return ShowSharedInner(type, link);
return TryToShow(type, link);
} catch {
return false;
}
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static bool ShowSharedInner(string type, string link) {
var test = typeof(DataTransferManager);
Logging.Debug(test.FullName);

var mainWindow = Application.Current.MainWindow;
if (mainWindow == null) return false;

_type = type;
_link = link;
ActionExtension.InvokeInMainThread(() => {
var handle = new WindowInteropHelper(mainWindow).Handle;
var dataTransferManager = DataTransferManagerHelper.GetForWindow(handle);
dataTransferManager.DataRequested -= OnDataRequested;
dataTransferManager.DataRequested += OnDataRequested;
DataTransferManagerHelper.ShowShareUIForWindow(handle);
});

return true;
// ReSharper disable UnusedParameter.Local
private static bool TryToShow(string type, string link) {
// ReSharper restore UnusedParameter.Local
#if WIN8SUPPORTED
return Share.TryToShow(type, link);
#else
return false;
#endif
}

private static class DataTransferManagerHelper {
private static readonly Guid Guid = new Guid("a5caee9b-8708-49d1-8d36-67d25a8da00c");

// ReSharper disable once SuspiciousTypeConversion.Global
private static IDataTransferManagerInterop DataTransferManagerInterop =>
(IDataTransferManagerInterop)WindowsRuntimeMarshal.GetActivationFactory(typeof(DataTransferManager));

public static DataTransferManager GetForWindow(IntPtr hwnd) {
return DataTransferManagerInterop.GetForWindow(hwnd, Guid);
}

public static void ShowShareUIForWindow(IntPtr hwnd) {
DataTransferManagerInterop.ShowShareUIForWindow(hwnd);
}

[ComImport, Guid("3A3DCD6C-3EAB-43DC-BCDE-45671CE800C8"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
private interface IDataTransferManagerInterop {
DataTransferManager GetForWindow([In] IntPtr appWindow, [In] ref Guid riid);
void ShowShareUIForWindow(IntPtr appWindow);
}
}

private static string _type;
private static string _link;

private static void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs args) {
args.Request.Data.SetWebLink(new Uri(_link));
args.Request.Data.Properties.Title = _type.ToTitle();
args.Request.Data.Properties.Description = "This item will be shared.";
}
}
}
1 change: 1 addition & 0 deletions AcTools.GenericMods/AcTools.GenericMods.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkProfile />
<FileAlignment>512</FileAlignment>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
Expand Down
1 change: 1 addition & 0 deletions AcTools.LapTimes.LevelDb/AcTools.LapTimes.LevelDb.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkProfile />
<FileAlignment>512</FileAlignment>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
Expand Down
1 change: 1 addition & 0 deletions AcTools.LapTimes/AcTools.LapTimes.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<TargetFrameworkProfile />
<FileAlignment>512</FileAlignment>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
Expand Down
1 change: 1 addition & 0 deletions AcTools.NeuralTyres.Tests/AcTools.NeuralTyres.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkProfile />
<FileAlignment>512</FileAlignment>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<DebugType>pdbonly</DebugType>
Expand Down
2 changes: 1 addition & 1 deletion AcTools.NeuralTyres/AcTools.NeuralTyres.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<FileAlignment>512</FileAlignment>
<ActualPlatform>$(Platform)</ActualPlatform>
<ActualPlatform Condition="'$(ActualPlatform)' == 'AnyCPU'">x86</ActualPlatform>
<LangVersion>latest</LangVersion>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<DebugType>pdbonly</DebugType>
Expand Down
1 change: 1 addition & 0 deletions AcTools.Render.Tests/AcTools.Render.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
Expand Down
1 change: 1 addition & 0 deletions AcTools.Render/AcTools.Render.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<FileAlignment>512</FileAlignment>
<ActualPlatform>$(Platform)</ActualPlatform>
<ActualPlatform Condition="'$(ActualPlatform)' == 'AnyCPU'">x86</ActualPlatform>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
Expand Down
1 change: 1 addition & 0 deletions AcTools.Tests/AcTools.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
<TargetFrameworkVersion>v4.5.2</TargetFrameworkVersion>
<TargetFrameworkProfile />
<FileAlignment>512</FileAlignment>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
Expand Down
1 change: 1 addition & 0 deletions AcTools.WheelAngles/AcTools.WheelAngles.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<FileAlignment>512</FileAlignment>
<ActualPlatform>$(Platform)</ActualPlatform>
<ActualPlatform Condition="'$(ActualPlatform)' == 'AnyCPU'">x86</ActualPlatform>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
Expand Down
1 change: 1 addition & 0 deletions AcTools/AcTools.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<NuGetPackageImportStamp>894b5421</NuGetPackageImportStamp>
<ActualPlatform>$(Platform)</ActualPlatform>
<ActualPlatform Condition="'$(ActualPlatform)' == 'AnyCPU'">x86</ActualPlatform>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
Expand Down
1 change: 1 addition & 0 deletions CustomPreviewUpdater/CustomPreviewUpdater.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<ActualPlatform>$(Platform)</ActualPlatform>
<ActualPlatform Condition="'$(ActualPlatform)' == 'AnyCPU'">x86</ActualPlatform>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
Expand Down
1 change: 1 addition & 0 deletions CustomShowroom/CustomShowroom.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<FileAlignment>512</FileAlignment>
<ActualPlatform>$(Platform)</ActualPlatform>
<ActualPlatform Condition="'$(ActualPlatform)' == 'AnyCPU'">x86</ActualPlatform>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
Expand Down
1 change: 1 addition & 0 deletions FirstFloor.ModernUI.Tests/FirstFloor.ModernUI.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
<IsCodedUITest>False</IsCodedUITest>
<TestProjectType>UnitTest</TestProjectType>
<LangVersion>7.1</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
Expand Down
Loading

0 comments on commit c352edd

Please sign in to comment.