-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCreateEventPage.xaml.cs
133 lines (100 loc) · 3.73 KB
/
CreateEventPage.xaml.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
using CosmosStudentPlanner;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Input.Inking;
using Windows.UI.Input.Inking.Analysis;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
using CosmosStudentPlanner.Model;
using Microsoft.Graphics.Canvas;
using System.Diagnostics;
using Windows.UI.Xaml.Media.Imaging;
using Windows.Storage;
using Windows.Graphics.Imaging;
using Windows.Graphics.Display;
using Windows.UI;
using static CosmosStudentPlanner.Model.MasterContext;
// The Blank Page item template is documented at https://go.microsoft.com/fwlink/?LinkId=234238
namespace CosmosStudentPlanner
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class CreateEventPage : Page
{
public CreateEventPage()
{
this.InitializeComponent();
Loaded += CreateEventPage_Loaded;
Windows.UI.ViewManagement.UISettings settings =
new Windows.UI.ViewManagement.UISettings();
HorizontalAlignment alignment =
(settings.HandPreference ==
Windows.UI.ViewManagement.HandPreference.RightHanded) ?
HorizontalAlignment.Left : HorizontalAlignment.Right;
EventInkToolbar.HorizontalAlignment = alignment;
EventInkNote.InkPresenter.InputDeviceTypes =
Windows.UI.Core.CoreInputDeviceTypes.Mouse |
Windows.UI.Core.CoreInputDeviceTypes.Touch |
Windows.UI.Core.CoreInputDeviceTypes.Pen;
}
private void CreateEventPage_Loaded(object sender, RoutedEventArgs e)
{
using (var db = new MasterContext())
{
}
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
NavigateBack_Button.IsEnabled = this.Frame.CanGoBack;
}
private void NavigateBack_Click(object sender, RoutedEventArgs e)
{
On_BackRequested();
}
private bool On_BackRequested()
{
if (this.Frame.CanGoBack)
{
this.Frame.GoBack();
return true;
}
return false;
}
private void BackInvoked(KeyboardAccelerator sender, KeyboardAcceleratorInvokedEventArgs args)
{
On_BackRequested();
args.Handled = true;
}
private void EventType_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
}
private void DeviceOnDeviceLost(CanvasDevice sender, object args)
{
Debug.WriteLine("DeviceOnDeviceLost");
}
private void Create_Event_Click(object sender, RoutedEventArgs e)
{
CanvasDevice device = CanvasDevice.GetSharedDevice();
CanvasRenderTarget renderTarget = new CanvasRenderTarget(device, (int)EventInkNote.ActualWidth, (int)EventInkNote.ActualHeight, 96);
using (var ds = renderTarget.CreateDrawingSession())
{
ds.Clear(Colors.White);
ds.DrawInk(EventInkNote.InkPresenter.StrokeContainer.GetStrokes());
}
using (var db = new MasterContext())
{
}
}
}
}