void MainPage_Unloaded(object sender, RoutedEventArgs e) { if (program == null) { return; } program.terminate(); program = null; }
void MainPage_Loaded(object sender, RoutedEventArgs _e) { if (native != null) { return; } if (base_uri == null) { setBaseUri(); } native = new NativeXAML(); Debug.WriteLine(base_uri); native.setLoaderURL(base_uri); rsupport = new RenderSupportXAML(FlowScreen, base_uri, media); http = new HttpSupportNet(base_uri, media); sound = new SoundSupportXAML(FlowScreen, base_uri, media); notification = new NotificationsSupportXAML(); program = new flowgen.Program(); this.Unloaded += MainPage_Unloaded; RenderSupportXAML.registerFont("Book", "Assets/Book/FRABK.TTF#Franklin Gothic Book", FontStyle.Normal); RenderSupportXAML.registerFont("Italic", "Assets/Italic/FRABKIT.TTF#Franklin Gothic Book", FontStyle.Italic); RenderSupportXAML.registerFont("Demi", "Assets/Demi/FRADM.TTF#Franklin Gothic Demi", FontStyle.Normal); RenderSupportXAML.registerFont("Medium", "Assets/Medium/framd.ttf#Franklin Gothic Medium", FontStyle.Normal); RenderSupportXAML.registerFont("MediumItalic", "Assets/MediumItalic/FRAMDIT.TTF#Franklin Gothic Medium", FontStyle.Italic); RenderSupportXAML.registerFont("DejaVuSans", "Assets/DejaVuSans/DejaVuSans.ttf#Deja Vu Sans", FontStyle.Normal); RenderSupportXAML.registerFont("DejaVuSansOblique", "Assets/DejaVuSansOblique/DejaVuSans-Oblique.ttf#Deja Vu Sans", FontStyle.Oblique); RenderSupportXAML.registerFont("DejaVuSerif", "Assets/DejaVuSerif/DejaVuSerif.ttf#Deja Vu Serif", FontStyle.Normal); RenderSupportXAML.registerFont("Chess", "Assets/Chess/chess_merida_unicode.ttf#Chess Merida Unicode", FontStyle.Normal); RenderSupportXAML.registerFont("FeltTipRoman", "Assets/FeltTipRoman/felttiproman.ttf#Felt Tip Roman", FontStyle.Normal); RenderSupportXAML.registerFont("MaterialIcons", "Assets/MaterialIcons/MaterialIcons-Regular.ttf#Material Icons", FontStyle.Normal); RenderSupportXAML.registerFont("Roboto", "Assets/Roboto/Roboto-Regular.ttf#Roboto", FontStyle.Normal); RenderSupportXAML.registerFont("RobotoMedium", "Assets/RobotoMedium/Roboto-Medium.ttf#Roboto Medium", FontStyle.Normal); #if DEBUG Application.Current.DebugSettings.EnableFrameRateCounter = true; #endif try { program.start(makeHost); } catch (Exception e) { Debug.WriteLine(e.ToString()); } }