mirror of
https://github.com/greenshot/greenshot
synced 2025-08-14 02:37:03 -07:00
Made notifications work again, activation doesn't work yet due to missing ToastActivatorCLSID on the shortcut.
This commit is contained in:
parent
a29f6faa27
commit
f206046010
11 changed files with 392 additions and 269 deletions
70
GreenshotWin10Plugin/Native/NotificationUserInput.cs
Normal file
70
GreenshotWin10Plugin/Native/NotificationUserInput.cs
Normal file
|
@ -0,0 +1,70 @@
|
|||
// ******************************************************************
|
||||
// Copyright (c) Microsoft. All rights reserved.
|
||||
// This code is licensed under the MIT License (MIT).
|
||||
// THE CODE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
|
||||
// INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH
|
||||
// THE CODE OR THE USE OR OTHER DEALINGS IN THE CODE.
|
||||
// ******************************************************************
|
||||
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using GreenshotWin10Plugin.Native.Structs;
|
||||
|
||||
namespace GreenshotWin10Plugin.Native
|
||||
{
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
public class NotificationUserInput : IReadOnlyDictionary<string, string>
|
||||
{
|
||||
private readonly NotificationUserInputData[] _notificationUserInputData;
|
||||
|
||||
internal NotificationUserInput(NotificationUserInputData[] notificationUserInputData)
|
||||
{
|
||||
_notificationUserInputData = notificationUserInputData;
|
||||
}
|
||||
|
||||
public string this[string key] => _notificationUserInputData.First(i => i.Key == key).Value;
|
||||
|
||||
public IEnumerable<string> Keys => _notificationUserInputData.Select(i => i.Key);
|
||||
|
||||
public IEnumerable<string> Values => _notificationUserInputData.Select(i => i.Value);
|
||||
|
||||
public int Count => _notificationUserInputData.Length;
|
||||
|
||||
public bool ContainsKey(string key)
|
||||
{
|
||||
return _notificationUserInputData.Any(i => i.Key == key);
|
||||
}
|
||||
|
||||
public IEnumerator<KeyValuePair<string, string>> GetEnumerator()
|
||||
{
|
||||
return _notificationUserInputData.Select(i => new KeyValuePair<string, string>(i.Key, i.Value)).GetEnumerator();
|
||||
}
|
||||
|
||||
public bool TryGetValue(string key, out string value)
|
||||
{
|
||||
foreach (var item in _notificationUserInputData)
|
||||
{
|
||||
if (item.Key == key)
|
||||
{
|
||||
value = item.Value;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
value = null;
|
||||
return false;
|
||||
}
|
||||
|
||||
IEnumerator IEnumerable.GetEnumerator()
|
||||
{
|
||||
return GetEnumerator();
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue