13 changed files
BExplorer/BetterExplorer | ||
_MainWindow | ||
MainWindow_Updating.cs | ||
Api | ||
ToastNotifications | ||
BetterExplorerNotificationActivator.cs | ||
DesktopNotificationHistoryCompat.cs | ||
DesktopNotificationManagerCompat.cs | ||
NotificationActivator.cs | ||
NotificationUserInput.cs | ||
App.xaml.cs | ||
BetterExplorer.csproj | ||
MainWindow.xaml | ||
packages.config | ||
Shell | ||
_Plugin Interfaces | ||
FileSystemListItem.cs | ||
Interop | ||
Constants.cs | ||
ShellViewEx.cs | ||
MainWindow_Updating.cs
/BExplorer/BetterExplorer/_MainWindow/MainWindow_Updating.cs+22/BExplorer/BetterExplorer/_MainWindow/MainWindow_Updating.cs
Add comment 3 using System.Threading;
Add comment 4 using System.Windows;
Add comment 5 using System.Windows.Threading;
Add comment 6 Plus using Windows.Data.Xml.Dom;
Add comment 7 Plus using Windows.UI.Notifications;
Add comment 8 Plus using BetterExplorer.Api;
Add comment 9 Plus using Microsoft.Toolkit.Uwp.Notifications;
Add comment 6 10
Add comment 7 11 namespace BetterExplorer {
Add comment 8 12 partial class MainWindow {
Add comment 53 57 // CheckForUpdate(false);
Add comment 54 58 //}
Add comment 55 59 }
Add comment 60 Plus
Add comment 61 Plus private void MainWindow_OnClosed(Object sender, EventArgs e) {
Add comment 62 Plus
Add comment 63 Plus }
Add comment 64 Plus
Add comment 65 Plus private void ButtonBase_OnClick(Object sender, RoutedEventArgs e) {
Add comment 66 Plus ToastContent toastContent = new ToastContentBuilder()
Add comment 67 Plus .AddToastActivationInfo("action=viewConversation&conversationId=5", ToastActivationType.Foreground)
Add comment 68 Plus .AddText("Hello world!")
Add comment 69 Plus .AddButton("Test", ToastActivationType.Foreground, "Alabala")
Add comment 70 Plus .GetToastContent();
Add comment 71 Plus
Add comment 72 Plus // And create the toast notification
Add comment 73 Plus var toast = new ToastNotification(toastContent.GetXml());
Add comment 74 Plus
Add comment 75 Plus // And then show it
Add comment 76 Plus Microsoft.Toolkit.Uwp.Notifications.DesktopNotificationManagerCompat.CreateToastNotifier().Show(toast);
Add comment 77 Plus }
Add comment 56 78 }
Add comment 57 79 }
BetterExplorerNotificationActivator.cs
/BExplorer/BetterExplorer/Api/ToastNotifications/BetterExplorerNotificationActivator.cs-1+2/BExplorer/BetterExplorer/Api/ToastNotifications/BetterExplorerNotificationActivator.cs
Add comment 4 using System.Runtime.InteropServices;
Add comment 5 using System.Text;
Add comment 6 using System.Threading.Tasks;
Add comment 7 Plus using Microsoft.Toolkit.Uwp.Notifications;
Add comment 7 8
Add comment 8 9 namespace BetterExplorer.Api.ToastNotifications {
Add comment 9 10 [ClassInterface(ClassInterfaceType.None)]
Add comment 10 Minus [ComSourceInterfaces(typeof(INotificationActivationCallback))]
Add comment 11 Plus [ComSourceInterfaces(typeof(NotificationActivator.INotificationActivationCallback))]
Add comment 11 12 [Guid("A0176474-ED11-437F-8EBF-B53D64C41FC3"), ComVisible(true)]
Add comment 12 13 public class BetterExplorerNotificationActivator : NotificationActivator {
Add comment 13 14 public override void OnActivated(String arguments, NotificationUserInput userInput, String appUserModelId) {
DesktopNotificationHistoryCompat.cs
/BExplorer/BetterExplorer/Api/DesktopNotificationHistoryCompat.cs-84/BExplorer/BetterExplorer/Api/DesktopNotificationHistoryCompat.cs
Add comment 1 Minus // ******************************************************************
Add comment 2 Minus // Copyright (c) Microsoft. All rights reserved.
Add comment 3 Minus // This code is licensed under the MIT License (MIT).
Add comment 4 Minus // THE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
Add comment 5 Minus // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Add comment 6 Minus // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Add comment 7 Minus // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
Add comment 8 Minus // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
Add comment 9 Minus // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
Add comment 10 Minus // THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
Add comment 11 Minus // ******************************************************************
Add comment 12 Minus using System.Collections.Generic;
Add comment 13 Minus using Windows.UI.Notifications;
Add comment 14 Minus
Add comment 15 Minus namespace BetterExplorer.Api {
Add comment 16 Minus
Add comment 17 Minus /// <summary>
Add comment 18 Minus /// Manages the toast notifications for an app including the ability the clear all toast history and removing individual toasts.
Add comment 19 Minus /// </summary>
Add comment 20 Minus public sealed class DesktopNotificationHistoryCompat {
Add comment 21 Minus private string _aumid;
Add comment 22 Minus private ToastNotificationHistory _history;
Add comment 23 Minus /// <summary>
Add comment 24 Minus /// Do not call this. Instead, call <see cref="DesktopNotificationManagerCompat.History"/> to obtain an instance.
Add comment 25 Minus /// </summary>
Add comment 26 Minus /// <param name="aumid"></param>
Add comment 27 Minus internal DesktopNotificationHistoryCompat(string aumid) {
Add comment 28 Minus this._aumid = aumid;
Add comment 29 Minus this._history = ToastNotificationManager.History;
Add comment 30 Minus }
Add comment 31 Minus /// <summary>
Add comment 32 Minus /// Removes all notifications sent by this app from action center.
Add comment 33 Minus /// </summary>
Add comment 34 Minus public void Clear() {
Add comment 35 Minus if (this._aumid != null) {
Add comment 36 Minus this._history.Clear(this._aumid);
Add comment 37 Minus } else {
Add comment 38 Minus this._history.Clear();
Add comment 39 Minus }
Add comment 40 Minus }
Add comment 41 Minus /// <summary>
Add comment 42 Minus /// Gets all notifications sent by this app that are currently still in Action Center.
Add comment 43 Minus /// </summary>
Add comment 44 Minus /// <returns>A collection of toasts.</returns>
Add comment 45 Minus public IReadOnlyList<ToastNotification> GetHistory() {
Add comment 46 Minus return this._aumid != null ? this._history.GetHistory(this._aumid) : this._history.GetHistory();
Add comment 47 Minus }
Add comment 48 Minus /// <summary>
Add comment 49 Minus /// Removes an individual toast, with the specified tag label, from action center.
Add comment 50 Minus /// </summary>
Add comment 51 Minus /// <param name="tag">The tag label of the toast notification to be removed.</param>
Add comment 52 Minus public void Remove(string tag) {
Add comment 53 Minus if (this._aumid != null) {
Add comment 54 Minus this._history.Remove(tag, string.Empty, this._aumid);
Add comment 55 Minus } else {
Add comment 56 Minus this._history.Remove(tag);
Add comment 57 Minus }
Add comment 58 Minus }
Add comment 59 Minus /// <summary>
Add comment 60 Minus /// Removes a toast notification from the action using the notification's tag and group labels.
Add comment 61 Minus /// </summary>
Add comment 62 Minus /// <param name="tag">The tag label of the toast notification to be removed.</param>
Add comment 63 Minus /// <param name="group">The group label of the toast notification to be removed.</param>
Add comment 64 Minus public void Remove(string tag, string group) {
Add comment 65 Minus if (this._aumid != null) {
Add comment 66 Minus this._history.Remove(tag, group, this._aumid);
Add comment 67 Minus } else {
Add comment 68 Minus this._history.Remove(tag, group);
Add comment 69 Minus }
Add comment 70 Minus }
Add comment 71 Minus /// <summary>
Add comment 72 Minus /// Removes a group of toast notifications, identified by the specified group label, from action center.
Add comment 73 Minus /// </summary>
Add comment 74 Minus /// <param name="group">The group label of the toast notifications to be removed.</param>
Add comment 75 Minus public void RemoveGroup(string group) {
Add comment 76 Minus if (this._aumid != null) {
Add comment 77 Minus this._history.RemoveGroup(group, this._aumid);
Add comment 78 Minus } else {
Add comment 79 Minus this._history.RemoveGroup(group);
Add comment 80 Minus }
Add comment 81 Minus }
Add comment 82 Minus }
Add comment 83 Minus
Add comment 84 Minus }
DesktopNotificationManagerCompat.cs
/BExplorer/BetterExplorer/Api/DesktopNotificationManagerCompat.cs-165/BExplorer/BetterExplorer/Api/DesktopNotificationManagerCompat.cs
Add comment 1 Minus // ******************************************************************
Add comment 2 Minus // Copyright (c) Microsoft. All rights reserved.
Add comment 3 Minus // This code is licensed under the MIT License (MIT).
Add comment 4 Minus // THE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
Add comment 5 Minus // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Add comment 6 Minus // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Add comment 7 Minus // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
Add comment 8 Minus // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
Add comment 9 Minus // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
Add comment 10 Minus // THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
Add comment 11 Minus // ******************************************************************
Add comment 12 Minus using System;
Add comment 13 Minus using System.Diagnostics;
Add comment 14 Minus using System.Runtime.InteropServices;
Add comment 15 Minus using System.Text;
Add comment 16 Minus using Windows.UI.Notifications;
Add comment 17 Minus
Add comment 18 Minus namespace BetterExplorer.Api {
Add comment 19 Minus
Add comment 20 Minus public class DesktopNotificationManagerCompat {
Add comment 21 Minus public const string TOAST_ACTIVATED_LAUNCH_ARG = "-ToastActivated";
Add comment 22 Minus private static bool _registeredAumidAndComServer;
Add comment 23 Minus private static string _aumid;
Add comment 24 Minus private static bool _registeredActivator;
Add comment 25 Minus /// <summary>
Add comment 26 Minus /// If not running under the Desktop Bridge, you must call this method to register your AUMID with the Compat library and to
Add comment 27 Minus /// register your COM CLSID and EXE in LocalServer32 registry. Feel free to call this regardless, and we will no-op if running
Add comment 28 Minus /// under Desktop Bridge. Call this upon application startup, before calling any other APIs.
Add comment 29 Minus /// </summary>
Add comment 30 Minus /// <param name="aumid">An AUMID that uniquely identifies your application.</param>
Add comment 31 Minus public static void RegisterAumidAndComServer<T>(string aumid)
Add comment 32 Minus where T : NotificationActivator {
Add comment 33 Minus if (string.IsNullOrWhiteSpace(aumid)) {
Add comment 34 Minus throw new ArgumentException("You must provide an AUMID.", nameof(aumid));
Add comment 35 Minus }
Add comment 36 Minus
Add comment 37 Minus // If running as Desktop Bridge
Add comment 38 Minus if (DesktopBridgeHelpers.IsRunningAsUwp()) {
Add comment 39 Minus // Clear the AUMID since Desktop Bridge doesn't use it, and then we're done.
Add comment 40 Minus // Desktop Bridge apps are registered with platform through their manifest.
Add comment 41 Minus // Their LocalServer32 key is also registered through their manifest.
Add comment 42 Minus DesktopNotificationManagerCompat._aumid = null;
Add comment 43 Minus DesktopNotificationManagerCompat._registeredAumidAndComServer = true;
Add comment 44 Minus return;
Add comment 45 Minus }
Add comment 46 Minus
Add comment 47 Minus DesktopNotificationManagerCompat._aumid = aumid;
Add comment 48 Minus
Add comment 49 Minus String exePath = Process.GetCurrentProcess().MainModule.FileName;
Add comment 50 Minus DesktopNotificationManagerCompat.RegisterComServer<T>(exePath);
Add comment 51 Minus
Add comment 52 Minus DesktopNotificationManagerCompat._registeredAumidAndComServer = true;
Add comment 53 Minus }
Add comment 54 Minus private static void RegisterComServer<T>(String exePath)
Add comment 55 Minus where T : NotificationActivator {
Add comment 56 Minus // We register the EXE to start up when the notification is activated
Add comment 57 Minus string regString = String.Format("SOFTWARE\\Classes\\CLSID\\{{{0}}}\\LocalServer32", typeof(T).GUID);
Add comment 58 Minus var key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(regString);
Add comment 59 Minus
Add comment 60 Minus // Include a flag so we know this was a toast activation and should wait for COM to process
Add comment 61 Minus // We also wrap EXE path in quotes for extra security
Add comment 62 Minus key.SetValue(null, '"' + exePath + '"' + " " + DesktopNotificationManagerCompat.TOAST_ACTIVATED_LAUNCH_ARG);
Add comment 63 Minus }
Add comment 64 Minus /// <summary>
Add comment 65 Minus /// Registers the activator type as a COM server client so that Windows can launch your activator.
Add comment 66 Minus /// </summary>
Add comment 67 Minus /// <typeparam name="T">Your implementation of NotificationActivator. Must have GUID and ComVisible attributes on class.</typeparam>
Add comment 68 Minus public static void RegisterActivator<T>()
Add comment 69 Minus where T : NotificationActivator {
Add comment 70 Minus // Register type
Add comment 71 Minus var regService = new RegistrationServices();
Add comment 72 Minus
Add comment 73 Minus regService.RegisterTypeForComClients(
Add comment 74 Minus typeof(T),
Add comment 75 Minus RegistrationClassContext.LocalServer,
Add comment 76 Minus RegistrationConnectionType.MultipleUse);
Add comment 77 Minus
Add comment 78 Minus DesktopNotificationManagerCompat._registeredActivator = true;
Add comment 79 Minus }
Add comment 80 Minus /// <summary>
Add comment 81 Minus /// Creates a toast notifier. You must have called <see cref="RegisterActivator{T}"/> first (and also <see cref="RegisterAumidAndComServer(string)"/> if you're a classic Win32 app), or this will throw an exception.
Add comment 82 Minus /// </summary>
Add comment 83 Minus /// <returns></returns>
Add comment 84 Minus public static ToastNotifier CreateToastNotifier() {
Add comment 85 Minus DesktopNotificationManagerCompat.EnsureRegistered();
Add comment 86 Minus
Add comment 87 Minus if (DesktopNotificationManagerCompat._aumid != null) {
Add comment 88 Minus // Non-Desktop Bridge
Add comment 89 Minus return ToastNotificationManager.CreateToastNotifier(DesktopNotificationManagerCompat._aumid);
Add comment 90 Minus } else {
Add comment 91 Minus // Desktop Bridge
Add comment 92 Minus return ToastNotificationManager.CreateToastNotifier();
Add comment 93 Minus }
Add comment 94 Minus }
Add comment 95 Minus /// <summary>
Add comment 96 Minus /// Gets the <see cref="DesktopNotificationHistoryCompat"/> object. You must have called <see cref="RegisterActivator{T}"/> first (and also <see cref="RegisterAumidAndComServer(string)"/> if you're a classic Win32 app), or this will throw an exception.
Add comment 97 Minus /// </summary>
Add comment 98 Minus public static DesktopNotificationHistoryCompat History {
Add comment 99 Minus get {
Add comment 100 Minus DesktopNotificationManagerCompat.EnsureRegistered();
Add comment 101 Minus
Add comment 102 Minus return new DesktopNotificationHistoryCompat(DesktopNotificationManagerCompat._aumid);
Add comment 103 Minus }
Add comment 104 Minus }
Add comment 105 Minus private static void EnsureRegistered() {
Add comment 106 Minus // If not registered AUMID yet
Add comment 107 Minus if (!DesktopNotificationManagerCompat._registeredAumidAndComServer) {
Add comment 108 Minus // Check if Desktop Bridge
Add comment 109 Minus if (DesktopBridgeHelpers.IsRunningAsUwp()) {
Add comment 110 Minus // Implicitly registered, all good!
Add comment 111 Minus DesktopNotificationManagerCompat._registeredAumidAndComServer = true;
Add comment 112 Minus } else {
Add comment 113 Minus // Otherwise, incorrect usage
Add comment 114 Minus throw new Exception("You must call RegisterAumidAndComServer first.");
Add comment 115 Minus }
Add comment 116 Minus }
Add comment 117 Minus
Add comment 118 Minus // If not registered activator yet
Add comment 119 Minus if (!DesktopNotificationManagerCompat._registeredActivator) {
Add comment 120 Minus // Incorrect usage
Add comment 121 Minus throw new Exception("You must call RegisterActivator first.");
Add comment 122 Minus }
Add comment 123 Minus }
Add comment 124 Minus /// <summary>
Add comment 125 Minus /// Gets a boolean representing whether http images can be used within toasts. This is true if running under Desktop Bridge.
Add comment 126 Minus /// </summary>
Add comment 127 Minus public static bool CanUseHttpImages { get { return DesktopBridgeHelpers.IsRunningAsUwp(); } }
Add comment 128 Minus /// <summary>
Add comment 129 Minus /// Code from https://github.com/qmatteoq/DesktopBridgeHelpers/edit/master/DesktopBridge.Helpers/Helpers.cs
Add comment 130 Minus /// </summary>
Add comment 131 Minus private class DesktopBridgeHelpers {
Add comment 132 Minus const long APPMODEL_ERROR_NO_PACKAGE = 15700L;
Add comment 133 Minus [DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
Add comment 134 Minus static extern int GetCurrentPackageFullName(ref int packageFullNameLength, StringBuilder packageFullName);
Add comment 135 Minus private static bool? _isRunningAsUwp;
Add comment 136 Minus public static bool IsRunningAsUwp() {
Add comment 137 Minus if (DesktopBridgeHelpers._isRunningAsUwp == null) {
Add comment 138 Minus if (DesktopBridgeHelpers.IsWindows7OrLower) {
Add comment 139 Minus DesktopBridgeHelpers._isRunningAsUwp = false;
Add comment 140 Minus } else {
Add comment 141 Minus int length = 0;
Add comment 142 Minus StringBuilder sb = new StringBuilder(0);
Add comment 143 Minus int result = DesktopBridgeHelpers.GetCurrentPackageFullName(ref length, sb);
Add comment 144 Minus
Add comment 145 Minus sb = new StringBuilder(length);
Add comment 146 Minus result = DesktopBridgeHelpers.GetCurrentPackageFullName(ref length, sb);
Add comment 147 Minus
Add comment 148 Minus DesktopBridgeHelpers._isRunningAsUwp = result != DesktopBridgeHelpers.APPMODEL_ERROR_NO_PACKAGE;
Add comment 149 Minus }
Add comment 150 Minus }
Add comment 151 Minus
Add comment 152 Minus return DesktopBridgeHelpers._isRunningAsUwp.Value;
Add comment 153 Minus }
Add comment 154 Minus private static bool IsWindows7OrLower {
Add comment 155 Minus get {
Add comment 156 Minus int versionMajor = Environment.OSVersion.Version.Major;
Add comment 157 Minus int versionMinor = Environment.OSVersion.Version.Minor;
Add comment 158 Minus double version = versionMajor + (double)versionMinor / 10;
Add comment 159 Minus return version <= 6.1;
Add comment 160 Minus }
Add comment 161 Minus }
Add comment 162 Minus }
Add comment 163 Minus }
Add comment 164 Minus
Add comment 165 Minus }
NotificationActivator.cs
/BExplorer/BetterExplorer/Api/NotificationActivator.cs-53/BExplorer/BetterExplorer/Api/NotificationActivator.cs
Add comment 1 Minus // ******************************************************************
Add comment 2 Minus // Copyright (c) Microsoft. All rights reserved.
Add comment 3 Minus // This code is licensed under the MIT License (MIT).
Add comment 4 Minus // THE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
Add comment 5 Minus // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Add comment 6 Minus // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Add comment 7 Minus // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
Add comment 8 Minus // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
Add comment 9 Minus // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
Add comment 10 Minus // THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
Add comment 11 Minus // ******************************************************************
Add comment 12 Minus using System;
Add comment 13 Minus using System.Runtime.InteropServices;
Add comment 14 Minus
Add comment 15 Minus namespace BetterExplorer.Api {
Add comment 16 Minus
Add comment 17 Minus /// <summary>
Add comment 18 Minus /// Apps must implement this activator to handle notification activation.
Add comment 19 Minus /// </summary>
Add comment 20 Minus public abstract class NotificationActivator : NotificationActivator.INotificationActivationCallback {
Add comment 21 Minus public void Activate(string appUserModelId, string invokedArgs, NOTIFICATION_USER_INPUT_DATA[] data, uint dataCount) {
Add comment 22 Minus this.OnActivated(invokedArgs, new NotificationUserInput(data), appUserModelId);
Add comment 23 Minus }
Add comment 24 Minus /// <summary>
Add comment 25 Minus /// This method will be called when the user clicks on a foreground or background activation on a toast. Parent app must implement this method.
Add comment 26 Minus /// </summary>
Add comment 27 Minus /// <param name="arguments">The arguments from the original notification. This is either the launch argument if the user clicked the body of your toast, or the arguments from a button on your toast.</param>
Add comment 28 Minus /// <param name="userInput">Text and selection values that the user entered in your toast.</param>
Add comment 29 Minus /// <param name="appUserModelId">Your AUMID.</param>
Add comment 30 Minus public abstract void OnActivated(string arguments, NotificationUserInput userInput, string appUserModelId);
Add comment 31 Minus
Add comment 32 Minus // These are the new APIs for Windows 10
Add comment 33 Minus
Add comment 34 Minus #region NewAPIs
Add comment 35 Minus [StructLayout(LayoutKind.Sequential), Serializable]
Add comment 36 Minus public struct NOTIFICATION_USER_INPUT_DATA {
Add comment 37 Minus [MarshalAs(UnmanagedType.LPWStr)] public string Key;
Add comment 38 Minus [MarshalAs(UnmanagedType.LPWStr)] public string Value;
Add comment 39 Minus }
Add comment 40 Minus [ComImport,
Add comment 41 Minus Guid("53E31837-6600-4A81-9395-75CFFE746F94"), ComVisible(true),
Add comment 42 Minus InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
Add comment 43 Minus public interface INotificationActivationCallback {
Add comment 44 Minus void Activate(
Add comment 45 Minus [In, MarshalAs(UnmanagedType.LPWStr)] string appUserModelId,
Add comment 46 Minus [In, MarshalAs(UnmanagedType.LPWStr)] string invokedArgs,
Add comment 47 Minus [In, MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 3)] NOTIFICATION_USER_INPUT_DATA[] data,
Add comment 48 Minus [In, MarshalAs(UnmanagedType.U4)] uint dataCount);
Add comment 49 Minus }
Add comment 50 Minus #endregion
Add comment 51 Minus }
Add comment 52 Minus
Add comment 53 Minus }
NotificationUserInput.cs
/BExplorer/BetterExplorer/Api/NotificationUserInput.cs-52/BExplorer/BetterExplorer/Api/NotificationUserInput.cs
Add comment 1 Minus // ******************************************************************
Add comment 2 Minus // Copyright (c) Microsoft. All rights reserved.
Add comment 3 Minus // This code is licensed under the MIT License (MIT).
Add comment 4 Minus // THE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
Add comment 5 Minus // INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
Add comment 6 Minus // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
Add comment 7 Minus // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
Add comment 8 Minus // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
Add comment 9 Minus // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
Add comment 10 Minus // THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
Add comment 11 Minus // ******************************************************************
Add comment 12 Minus using System.Collections;
Add comment 13 Minus using System.Collections.Generic;
Add comment 14 Minus using System.Linq;
Add comment 15 Minus
Add comment 16 Minus namespace BetterExplorer.Api {
Add comment 17 Minus
Add comment 18 Minus /// <summary>
Add comment 19 Minus /// Text and selection values that the user entered on your notification. The Key is the ID of the input, and the Value is what the user entered.
Add comment 20 Minus /// </summary>
Add comment 21 Minus public class NotificationUserInput : IReadOnlyDictionary<string, string> {
Add comment 22 Minus private NotificationActivator.NOTIFICATION_USER_INPUT_DATA[] _data;
Add comment 23 Minus internal NotificationUserInput(NotificationActivator.NOTIFICATION_USER_INPUT_DATA[] data) {
Add comment 24 Minus this._data = data;
Add comment 25 Minus }
Add comment 26 Minus public string this[string key] => this._data.First(i => i.Key == key).Value;
Add comment 27 Minus public IEnumerable<string> Keys => this._data.Select(i => i.Key);
Add comment 28 Minus public IEnumerable<string> Values => this._data.Select(i => i.Value);
Add comment 29 Minus public int Count => this._data.Length;
Add comment 30 Minus public bool ContainsKey(string key) {
Add comment 31 Minus return this._data.Any(i => i.Key == key);
Add comment 32 Minus }
Add comment 33 Minus public IEnumerator<KeyValuePair<string, string>> GetEnumerator() {
Add comment 34 Minus return this._data.Select(i => new KeyValuePair<string, string>(i.Key, i.Value)).GetEnumerator();
Add comment 35 Minus }
Add comment 36 Minus public bool TryGetValue(string key, out string value) {
Add comment 37 Minus foreach (var item in this._data) {
Add comment 38 Minus if (item.Key == key) {
Add comment 39 Minus value = item.Value;
Add comment 40 Minus return true;
Add comment 41 Minus }
Add comment 42 Minus }
Add comment 43 Minus
Add comment 44 Minus value = null;
Add comment 45 Minus return false;
Add comment 46 Minus }
Add comment 47 Minus IEnumerator IEnumerable.GetEnumerator() {
Add comment 48 Minus return this.GetEnumerator();
Add comment 49 Minus }
Add comment 50 Minus }
Add comment 51 Minus }
Add comment 52 Minus
BetterExplorer.csproj
/BExplorer/BetterExplorer/BetterExplorer.csproj/BExplorer/BetterExplorer/BetterExplorer.csproj
MainWindow.xaml
/BExplorer/BetterExplorer/MainWindow.xaml/BExplorer/BetterExplorer/MainWindow.xaml
packages.config
/BExplorer/BetterExplorer/packages.config/BExplorer/BetterExplorer/packages.config
FileSystemListItem.cs
/Shell/_Plugin Interfaces/FileSystemListItem.cs/Shell/_Plugin Interfaces/FileSystemListItem.cs