Skip to content

Commit 0c734ba

Browse files
use SHOW_WINDOW_CMD.SHOW_WINDOW_CMD instead of Vanara.PInvoke.ShowWindowCommand
1 parent 27e0ae3 commit 0c734ba

File tree

8 files changed

+24
-22
lines changed

8 files changed

+24
-22
lines changed

src/Files.App/Data/Items/ListedItem.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
using System.Drawing;
1010
using System.IO;
1111
using System.Text;
12-
using Vanara.PInvoke;
1312
using Windows.Storage;
13+
using Windows.Win32.UI.WindowsAndMessaging;
1414

1515
#pragma warning disable CS0618 // Type or member is obsolete
1616

@@ -527,7 +527,7 @@ public override string Name
527527
public string Arguments { get; set; }
528528
public string WorkingDirectory { get; set; }
529529
public bool RunAsAdmin { get; set; }
530-
public ShowWindowCommand ShowWindowCommand { get; set; }
530+
public SHOW_WINDOW_CMD ShowWindowCommand { get; set; }
531531
public bool IsUrl { get; set; }
532532
public bool IsSymLink { get; set; }
533533
public override bool IsExecutable => FileExtensionHelpers.IsExecutableFile(TargetPath, true);

src/Files.App/Data/Items/ShellLinkItem.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Copyright (c) Files Community
22
// Licensed under the MIT License.
33

4-
using Vanara.PInvoke;
4+
using Windows.Win32.UI.WindowsAndMessaging;
55

66
namespace Files.App.Data.Items
77
{
@@ -17,7 +17,7 @@ public sealed class ShellLinkItem : ShellFileItem
1717

1818
public bool InvalidTarget { get; set; }
1919

20-
public ShowWindowCommand ShowWindowCommand { get; set; }
20+
public SHOW_WINDOW_CMD ShowWindowCommand { get; set; }
2121

2222
public ShellLinkItem()
2323
{

src/Files.App/Data/Models/SelectedItemsPropertiesViewModel.cs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using Files.Shared.Helpers;
66
using System.Windows.Input;
77
using TagLib;
8-
using Vanara.PInvoke;
8+
using Windows.Win32.UI.WindowsAndMessaging;
99

1010
namespace Files.App.Data.Models
1111
{
@@ -782,22 +782,22 @@ public bool RunAsAdminEnabled
782782
set => SetProperty(ref runAsAdminEnabled, value);
783783
}
784784

785-
private static readonly IReadOnlyDictionary<ShowWindowCommand, string> showWindowCommandTypes = new Dictionary<ShowWindowCommand, string>()
785+
private static readonly IReadOnlyDictionary<SHOW_WINDOW_CMD, string> showWindowCommandTypes = new Dictionary<SHOW_WINDOW_CMD, string>
786786
{
787-
{ ShowWindowCommand.SW_NORMAL, Strings.NormalWindow.GetLocalizedResource() },
788-
{ ShowWindowCommand.SW_SHOWMINNOACTIVE, Strings.Minimized.GetLocalizedResource() },
789-
{ ShowWindowCommand.SW_MAXIMIZE, Strings.Maximized.GetLocalizedResource() }
787+
{ SHOW_WINDOW_CMD.SW_NORMAL, Strings.NormalWindow.GetLocalizedResource() },
788+
{ SHOW_WINDOW_CMD.SW_SHOWMINNOACTIVE, Strings.Minimized.GetLocalizedResource() },
789+
{ SHOW_WINDOW_CMD.SW_MAXIMIZE, Strings.Maximized.GetLocalizedResource() }
790790
}.AsReadOnly();
791-
public IReadOnlyDictionary<ShowWindowCommand, string> ShowWindowCommandTypes { get => showWindowCommandTypes; }
791+
public IReadOnlyDictionary<SHOW_WINDOW_CMD, string> ShowWindowCommandTypes { get => showWindowCommandTypes; }
792792

793793
public string SelectedShowWindowCommand
794794
{
795795
get => ShowWindowCommandTypes.GetValueOrDefault(ShowWindowCommandEditedValue)!;
796796
set => ShowWindowCommandEditedValue = ShowWindowCommandTypes.First(e => e.Value == value).Key;
797797
}
798798

799-
private ShowWindowCommand showWindowCommand;
800-
public ShowWindowCommand ShowWindowCommand
799+
private SHOW_WINDOW_CMD showWindowCommand;
800+
public SHOW_WINDOW_CMD ShowWindowCommand
801801
{
802802
get => showWindowCommand;
803803
set
@@ -807,8 +807,8 @@ public ShowWindowCommand ShowWindowCommand
807807
}
808808
}
809809

810-
private ShowWindowCommand showWindowCommandEditedValue;
811-
public ShowWindowCommand ShowWindowCommandEditedValue
810+
private SHOW_WINDOW_CMD showWindowCommandEditedValue;
811+
public SHOW_WINDOW_CMD ShowWindowCommandEditedValue
812812
{
813813
get => showWindowCommandEditedValue;
814814
set

src/Files.App/Helpers/UI/UIFilesystemHelpers.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
using System.IO;
77
using System.Net;
88
using System.Text;
9-
using Vanara.PInvoke;
109
using Windows.ApplicationModel.DataTransfer;
1110
using Windows.Storage;
11+
using Windows.Win32.UI.WindowsAndMessaging;
1212

1313
namespace Files.App.Helpers
1414
{
@@ -246,7 +246,7 @@ public static async Task<bool> HandleShortcutCannotBeCreated(string shortcutName
246246
/// <summary>
247247
/// Updates ListedItem properties for a shortcut
248248
/// </summary>
249-
public static void UpdateShortcutItemProperties(ShortcutItem item, string targetPath, string arguments, string workingDir, bool runAsAdmin, ShowWindowCommand showWindowCommand)
249+
public static void UpdateShortcutItemProperties(ShortcutItem item, string targetPath, string arguments, string workingDir, bool runAsAdmin, SHOW_WINDOW_CMD showWindowCommand)
250250
{
251251
item.TargetPath = Environment.ExpandEnvironmentVariables(targetPath);
252252
item.Arguments = arguments;

src/Files.App/Utils/Shell/ShellFolderExtensions.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public static ShellLinkItem GetShellLinkItem(ShellLink linkItem)
127127
{
128128
IsFolder = !string.IsNullOrEmpty(linkItem.TargetPath) && linkItem.Target.IsFolder,
129129
RunAsAdmin = linkItem.RunAsAdministrator,
130-
ShowWindowCommand = linkItem.ShowState,
130+
ShowWindowCommand = (Windows.Win32.UI.WindowsAndMessaging.SHOW_WINDOW_CMD)linkItem.ShowState,
131131
Arguments = linkItem.Arguments,
132132
WorkingDirectory = Environment.ExpandEnvironmentVariables(linkItem.WorkingDirectory),
133133
TargetPath = Environment.ExpandEnvironmentVariables(linkItem.TargetPath)

src/Files.App/Utils/Storage/Operations/FileOperationsHelpers.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
using Vanara.PInvoke;
1313
using Vanara.Windows.Shell;
1414
using Windows.ApplicationModel.DataTransfer;
15+
using Windows.Win32.UI.WindowsAndMessaging;
1516

1617
namespace Files.App.Utils.Storage
1718
{
@@ -733,7 +734,7 @@ public static void TryCancelOperation(string operationId)
733734
}
734735
}
735736

736-
public static Task<bool> CreateOrUpdateLinkAsync(string linkSavePath, string targetPath, string arguments = "", string workingDirectory = "", bool runAsAdmin = false, ShowWindowCommand showWindowCommand = ShowWindowCommand.SW_NORMAL)
737+
public static Task<bool> CreateOrUpdateLinkAsync(string linkSavePath, string targetPath, string arguments = "", string workingDirectory = "", bool runAsAdmin = false, SHOW_WINDOW_CMD showWindowCommand = SHOW_WINDOW_CMD.SW_NORMAL)
737738
{
738739
try
739740
{
@@ -748,7 +749,7 @@ public static Task<bool> CreateOrUpdateLinkAsync(string linkSavePath, string tar
748749
newLink.SaveAs(linkSavePath); // Overwrite if exists
749750

750751
// ShowState has to be set after SaveAs has been called, otherwise an UnauthorizedAccessException gets thrown in some cases
751-
newLink.ShowState = showWindowCommand;
752+
newLink.ShowState = (ShowWindowCommand)showWindowCommand;
752753

753754
return Task.FromResult(true);
754755
}

src/Files.App/Utils/Storage/StorageItems/ShellStorageFile.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
using Windows.Storage;
88
using Windows.Storage.FileProperties;
99
using Windows.Storage.Streams;
10+
using Windows.Win32.UI.WindowsAndMessaging;
1011
using IO = System.IO;
1112

1213
namespace Files.App.Utils.Storage
@@ -17,7 +18,7 @@ public sealed class ShortcutStorageFile : ShellStorageFile, IShortcutStorageItem
1718
public string Arguments { get; }
1819
public string WorkingDirectory { get; }
1920
public bool RunAsAdmin { get; }
20-
public ShowWindowCommand ShowWindowCommand { get; set; }
21+
public SHOW_WINDOW_CMD ShowWindowCommand { get; set; }
2122

2223
public ShortcutStorageFile(ShellLinkItem item) : base(item)
2324
{

src/Files.App/Utils/Storage/StorageItems/ShellStorageFolder.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
// Licensed under the MIT License.
33

44
using System.Runtime.InteropServices.WindowsRuntime;
5-
using Vanara.PInvoke;
65
using Windows.Foundation;
76
using Windows.Storage;
87
using Windows.Storage.FileProperties;
98
using Windows.Storage.Search;
9+
using Windows.Win32.UI.WindowsAndMessaging;
1010

1111
namespace Files.App.Utils.Storage
1212
{
@@ -16,7 +16,7 @@ public sealed class ShortcutStorageFolder : ShellStorageFolder, IShortcutStorage
1616
public string Arguments { get; }
1717
public string WorkingDirectory { get; }
1818
public bool RunAsAdmin { get; }
19-
public ShowWindowCommand ShowWindowCommand { get; set; }
19+
public SHOW_WINDOW_CMD ShowWindowCommand { get; set; }
2020

2121
public ShortcutStorageFolder(ShellLinkItem item) : base(item)
2222
{

0 commit comments

Comments
 (0)