forked from xamarin/Xamarin.Forms
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
68 lines (61 loc) · 1.92 KB
/
Program.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
using GLib;
using Xamarin.Forms;
using Xamarin.Forms.ControlGallery.GTK;
using System;
using Xamarin.Forms.Platform.GTK;
using Xamarin.Forms.Platform.GTK.Renderers;
using Xamarin.Forms.Controls;
using Xamarin.Forms.Maps.GTK;
[assembly: ExportRenderer(typeof(DisposePage), typeof(DisposePageRenderer))]
[assembly: ExportRenderer(typeof(DisposeLabel), typeof(DisposeLabelRenderer))]
namespace Xamarin.Forms.ControlGallery.GTK
{
class Program
{
[STAThread]
static void Main(string[] args)
{
ExceptionManager.UnhandledException += OnUnhandledException;
GtkOpenGL.Init();
GtkThemes.Init();
Gtk.Application.Init();
FormsMaps.Init(string.Empty);
Forms.Init();
var app = new App();
//var app = new BasicOpenGLApp();
//var app = new AdvancedOpenGLApp();
var window = new FormsWindow();
window.LoadApplication(app);
window.SetApplicationTitle("Xamarin.Forms GTK# Backend");
window.SetApplicationIcon("xamarinlogo.png");
window.Show();
Gtk.Application.Run();
}
private static void OnUnhandledException(UnhandledExceptionArgs args)
{
System.Diagnostics.Debug.WriteLine($"Unhandled GTK# exception: {args.ExceptionObject}");
}
}
public class DisposePageRenderer : PageRenderer
{
protected override void Dispose(bool disposing)
{
if (disposing)
{
((DisposePage)Element).SendRendererDisposed();
}
base.Dispose(disposing);
}
}
public class DisposeLabelRenderer : LabelRenderer
{
protected override void Dispose(bool disposing)
{
if (disposing)
{
((DisposeLabel)Element).SendRendererDisposed();
}
base.Dispose(disposing);
}
}
}