forked from xamarin/Xamarin.Forms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSimpleApp.cs
42 lines (37 loc) · 793 Bytes
/
SimpleApp.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
using System.Diagnostics;
namespace Xamarin.Forms.Controls
{
public class SimpleApp : Application
{
public SimpleApp()
{
var label = new Label { VerticalOptions = LayoutOptions.CenterAndExpand };
if (Current.Properties.ContainsKey("LabelText"))
{
label.Text = (string)Current.Properties["LabelText"] + " Restored!";
Debug.WriteLine("Initialized");
}
else
{
Current.Properties["LabelText"] = "Wowza";
label.Text = (string)Current.Properties["LabelText"] + " Set!";
Debug.WriteLine("Saved");
}
MainPage = new ContentPage
{
Content = new StackLayout
{
Children =
{
label
}
}
};
SerializeProperties();
}
static async void SerializeProperties()
{
await Current.SavePropertiesAsync();
}
}
}