diff --git a/Avalonia.Desktop.slnf b/Avalonia.Desktop.slnf index 3fa8e969c8..2f034bd083 100644 --- a/Avalonia.Desktop.slnf +++ b/Avalonia.Desktop.slnf @@ -5,6 +5,7 @@ "packages\\Avalonia\\Avalonia.csproj", "samples\\ControlCatalog.NetCore\\ControlCatalog.NetCore.csproj", "samples\\ControlCatalog\\ControlCatalog.csproj", + "samples\\GpuInterop\\GpuInterop.csproj", "samples\\IntegrationTestApp\\IntegrationTestApp.csproj", "samples\\MiniMvvm\\MiniMvvm.csproj", "samples\\SampleControls\\ControlSamples.csproj", diff --git a/Avalonia.sln b/Avalonia.sln index fc42a5d63b..ce9a37a3ce 100644 --- a/Avalonia.sln +++ b/Avalonia.sln @@ -231,6 +231,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControlCatalog.Browser.Blaz EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReactiveUIDemo", "samples\ReactiveUIDemo\ReactiveUIDemo.csproj", "{75C47156-C5D8-44BC-A5A7-E8657C2248D6}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GpuInterop", "samples\GpuInterop\GpuInterop.csproj", "{C810060E-3809-4B74-A125-F11533AF9C1B}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -542,6 +544,10 @@ Global {75C47156-C5D8-44BC-A5A7-E8657C2248D6}.Debug|Any CPU.Build.0 = Debug|Any CPU {75C47156-C5D8-44BC-A5A7-E8657C2248D6}.Release|Any CPU.ActiveCfg = Release|Any CPU {75C47156-C5D8-44BC-A5A7-E8657C2248D6}.Release|Any CPU.Build.0 = Release|Any CPU + {C810060E-3809-4B74-A125-F11533AF9C1B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C810060E-3809-4B74-A125-F11533AF9C1B}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C810060E-3809-4B74-A125-F11533AF9C1B}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C810060E-3809-4B74-A125-F11533AF9C1B}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE @@ -606,6 +612,7 @@ Global {15B93A4C-1B46-43F6-B534-7B25B6E99932} = {9B9E3891-2366-4253-A952-D08BCEB71098} {90B08091-9BBD-4362-B712-E9F2CC62B218} = {9B9E3891-2366-4253-A952-D08BCEB71098} {75C47156-C5D8-44BC-A5A7-E8657C2248D6} = {9B9E3891-2366-4253-A952-D08BCEB71098} + {C810060E-3809-4B74-A125-F11533AF9C1B} = {9B9E3891-2366-4253-A952-D08BCEB71098} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {87366D66-1391-4D90-8999-95A620AD786A} diff --git a/build/Base.props b/build/Base.props index 26f19e3abc..c2fc11c94b 100644 --- a/build/Base.props +++ b/build/Base.props @@ -1,6 +1,7 @@  + diff --git a/build/SharpDX.props b/build/SharpDX.props index 69aa817a01..ff521977fd 100644 --- a/build/SharpDX.props +++ b/build/SharpDX.props @@ -1,9 +1,14 @@  + + 4.0.1 + - - - - - + + + + + + + diff --git a/samples/ControlCatalog/MainView.xaml b/samples/ControlCatalog/MainView.xaml index 166b98436e..83776ec2c1 100644 --- a/samples/ControlCatalog/MainView.xaml +++ b/samples/ControlCatalog/MainView.xaml @@ -144,9 +144,12 @@ - + + + + diff --git a/samples/ControlCatalog/MainView.xaml.cs b/samples/ControlCatalog/MainView.xaml.cs index 1726028a3f..a9bf150ff9 100644 --- a/samples/ControlCatalog/MainView.xaml.cs +++ b/samples/ControlCatalog/MainView.xaml.cs @@ -60,7 +60,7 @@ namespace ControlCatalog { if (flowDirections.SelectedItem is FlowDirection flowDirection) { - this.FlowDirection = flowDirection; + TopLevel.GetTopLevel(this).FlowDirection = flowDirection; } }; diff --git a/samples/ControlCatalog/Pages/DialogsPage.xaml b/samples/ControlCatalog/Pages/DialogsPage.xaml index 5325534909..90c717e7ed 100644 --- a/samples/ControlCatalog/Pages/DialogsPage.xaml +++ b/samples/ControlCatalog/Pages/DialogsPage.xaml @@ -1,6 +1,8 @@ + xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" + xmlns:storage="clr-namespace:Avalonia.Platform.Storage;assembly=Avalonia.Base" + xmlns:generic="clr-namespace:System.Collections.Generic;assembly=System.Collections"> @@ -42,6 +44,19 @@ + + + + Desktop + Documents + Downloads + Pictures + Videos + Music + + + + ("PickerLastResults"); var resultsVisible = this.Get("PickerLastResultsVisible"); var bookmarkContainer = this.Get("BookmarkContainer"); var openedFileContent = this.Get("OpenedFileContent"); var openMultiple = this.Get("OpenMultiple"); + var currentFolderBox = this.Get("CurrentFolderBox"); + + currentFolderBox.TextChanged += async (sender, args) => + { + if (ignoreTextChanged) return; + + if (Enum.TryParse(currentFolderBox.Text, true, out var folderEnum)) + { + lastSelectedDirectory = await GetStorageProvider().TryGetWellKnownFolder(folderEnum); + } + else + { + if (!Uri.TryCreate(currentFolderBox.Text, UriKind.Absolute, out var folderLink)) + { + Uri.TryCreate("file://" + currentFolderBox.Text, UriKind.Absolute, out folderLink); + } + + if (folderLink is not null) + { + lastSelectedDirectory = await GetStorageProvider().TryGetFolderFromPath(folderLink); + } + } + }; - IStorageFolder? lastSelectedDirectory = null; List GetFilters() { @@ -84,7 +109,7 @@ namespace ControlCatalog.Pages { Title = "Open multiple files", Filters = GetFilters(), - Directory = lastSelectedDirectory?.TryGetUri(out var path) == true ? path.LocalPath : null, + Directory = lastSelectedDirectory?.Path is {IsAbsoluteUri:true} path ? path.LocalPath : null, AllowMultiple = true }.ShowAsync(GetWindow()); results.Items = result; @@ -97,7 +122,7 @@ namespace ControlCatalog.Pages { Title = "Save file", Filters = filters, - Directory = lastSelectedDirectory?.TryGetUri(out var path) == true ? path.LocalPath : null, + Directory = lastSelectedDirectory?.Path is {IsAbsoluteUri:true} path ? path.LocalPath : null, DefaultExtension = filters?.Any() == true ? "txt" : null, InitialFileName = "test.txt" }.ShowAsync(GetWindow()); @@ -109,7 +134,7 @@ namespace ControlCatalog.Pages var result = await new OpenFolderDialog() { Title = "Select folder", - Directory = lastSelectedDirectory?.TryGetUri(out var path) == true ? path.LocalPath : null + Directory = lastSelectedDirectory?.Path is {IsAbsoluteUri:true} path ? path.LocalPath : null, }.ShowAsync(GetWindow()); if (string.IsNullOrEmpty(result)) { @@ -117,7 +142,7 @@ namespace ControlCatalog.Pages } else { - lastSelectedDirectory = new BclStorageFolder(new System.IO.DirectoryInfo(result)); + SetFolder(await GetStorageProvider().TryGetFolderFromPath(result)); results.Items = new[] { result }; resultsVisible.IsVisible = true; } @@ -127,7 +152,7 @@ namespace ControlCatalog.Pages var result = await new OpenFileDialog() { Title = "Select both", - Directory = lastSelectedDirectory?.TryGetUri(out var path) == true ? path.LocalPath : null, + Directory = lastSelectedDirectory?.Path is {IsAbsoluteUri:true} path ? path.LocalPath : null, AllowMultiple = true }.ShowManagedAsync(GetWindow(), new ManagedFileDialogOptions { @@ -210,7 +235,7 @@ namespace ControlCatalog.Pages #endif await reader.WriteLineAsync(openedFileContent.Text); - lastSelectedDirectory = await file.GetParentAsync(); + SetFolder(await file.GetParentAsync()); } await SetPickerResult(file is null ? null : new[] { file }); @@ -226,7 +251,7 @@ namespace ControlCatalog.Pages await SetPickerResult(folders); - lastSelectedDirectory = folders.FirstOrDefault(); + SetFolder(folders.FirstOrDefault()); }; this.Get