-
Notifications
You must be signed in to change notification settings - Fork 500
/
Copy pathConstants.cs
70 lines (61 loc) · 2.51 KB
/
Constants.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
//*********************************************************
//
// Copyright (c) Microsoft. All rights reserved.
// THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
// ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
// IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
// PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************
using System;
using System.Collections.Generic;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml.Controls;
namespace SDKTemplate
{
public partial class MainPage : SDKTemplate.Common.LayoutAwarePage
{
public const string FEATURE_NAME = "File picker C# sample";
List<Scenario> scenarios = new List<Scenario>
{
new Scenario() { Title = "Pick a single photo", ClassType = typeof(FilePicker.Scenario1) },
new Scenario() { Title = "Pick multiple files", ClassType = typeof(FilePicker.Scenario2) },
new Scenario() { Title = "Pick a folder", ClassType = typeof(FilePicker.Scenario3) },
new Scenario() { Title = "Save a file", ClassType = typeof(FilePicker.Scenario4) },
new Scenario() { Title = "Open a cached file", ClassType = typeof(FilePicker.Scenario5) },
new Scenario() { Title = "Update a cached file", ClassType = typeof(FilePicker.Scenario6) },
};
//<Snippetall_checksnapped>
//<Snippetcs_checksnapped>
internal bool EnsureUnsnapped()
{
// FilePicker APIs will not work if the application is in a snapped state.
// If an app wants to show a FilePicker while snapped, it must attempt to unsnap first
bool unsnapped = ((ApplicationView.Value != ApplicationViewState.Snapped) || ApplicationView.TryUnsnap());
if (!unsnapped)
{
NotifyUser("Cannot unsnap the sample.", NotifyType.StatusMessage);
}
return unsnapped;
}
//</Snippetcs_checksnapped>
//</Snippetall_checksnapped>
internal void ResetScenarioOutput(TextBlock output)
{
// clear Error/Status
NotifyUser("", NotifyType.ErrorMessage);
NotifyUser("", NotifyType.StatusMessage);
// clear scenario output
output.Text = "";
}
}
public class Scenario
{
public string Title { get; set; }
public Type ClassType { get; set; }
public override string ToString()
{
return Title;
}
}
}