-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Expand file tree
/
Copy pathOnLoadPage.cs
More file actions
82 lines (60 loc) · 2.47 KB
/
OnLoadPage.cs
File metadata and controls
82 lines (60 loc) · 2.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.Globalization;
using Microsoft.CommandPalette.Extensions;
using Microsoft.CommandPalette.Extensions.Toolkit;
using Windows.Foundation;
namespace SamplePagesExtension;
internal sealed partial class OnLoadPage : IListPage
{
private readonly List<ListItem> _items = new();
public IIconInfo Icon => new IconInfo("\uE8AB"); // switch
public string Title => "Load/Unload sample";
public string PlaceholderText => "This page changes each time you load it";
public ICommandItem EmptyContent => new CommandItem() { Icon = new IconInfo("\uE8AB"), Title = "This page starts empty", Subtitle = "but go back and open it again" };
public IFilters Filters => null;
public IGridProperties GridProperties => null;
public bool HasMoreItems => false;
public string SearchText => string.Empty;
public bool ShowDetails => false;
public OptionalColor AccentColor => default;
public bool IsLoading => false;
public string Id => string.Empty;
public string Name => "Open";
#pragma warning disable CS0067 // The event is never used
public event TypedEventHandler<object, IPropChangedEventArgs> PropChanged;
private event TypedEventHandler<object, IItemsChangedEventArgs> InternalItemsChanged;
#pragma warning restore CS0067 // The event is never used
public event TypedEventHandler<object, IItemsChangedEventArgs> ItemsChanged
{
add
{
InternalItemsChanged += value;
var nowString = DateTime.Now.ToString("T", CultureInfo.CurrentCulture);
var item = new ListItem(new NoOpCommand())
{
Title = $"Loaded {nowString}",
Icon = new IconInfo("\uECCB"), // Radio button on
};
_items.Add(item);
}
remove
{
InternalItemsChanged -= value;
var nowString = DateTime.Now.ToString("T", CultureInfo.CurrentCulture);
var item = new ListItem(new NoOpCommand())
{
Title = $"Unloaded {nowString}",
Icon = new IconInfo("\uECCA"), // Radio button off
};
_items.Add(item);
}
}
public IListItem[] GetItems() => _items.ToArray();
public void LoadMore()
{
}
}