-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAppUtility.cs
55 lines (49 loc) · 1.66 KB
/
AppUtility.cs
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
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Core;
using Windows.Foundation;
using Windows.UI;
using Windows.UI.ViewManagement;
namespace My_Date_Countdown
{
class AppUtility
{
public AppUtility setMinWindowSize(double width, double height)
{
ApplicationView.GetForCurrentView().SetPreferredMinSize(
new Size(
width,
height
)
);
return this;
}
public AppUtility setTitleBarTranslucent(bool state)
{
ApplicationViewTitleBar formattableTitleBar = ApplicationView.GetForCurrentView().TitleBar;
formattableTitleBar.ButtonBackgroundColor = Colors.Transparent;
CoreApplicationViewTitleBar coreTitleBar = CoreApplication.GetCurrentView().TitleBar;
coreTitleBar.ExtendViewIntoTitleBar = state;
return this;
}
// Make sure to declare in appmanifest
// https://blogs.windows.com/windowsdeveloper/2017/08/01/configure-app-start-log/
public async Task<bool> requestStartupTaskAsync(string startupId)
{
StartupTask startupTask = await StartupTask.GetAsync(startupId);
if (startupTask.State != StartupTaskState.Enabled)
{
await startupTask.RequestEnableAsync();
if (startupTask.State != StartupTaskState.Enabled)
{
return false;
}
}
return true;
}
}
}