本文整理汇总了C++中Surface::AddXamlHandler方法的典型用法代码示例。如果您正苦于以下问题:C++ Surface::AddXamlHandler方法的具体用法?C++ Surface::AddXamlHandler怎么用?C++ Surface::AddXamlHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Surface
的用法示例。
在下文中一共展示了Surface::AddXamlHandler方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Surface
int
main (int argc, char **argv) {
MonoDomain *domain;
Deployment *deployment;
MoonWindow *window;
MoonWindowingSystem *winsys;
Surface *surface;
char *data_dir;
// setenv ("MONO_PATH", "/opt/mono/lib/mono/2.0:/opt/moonlight-osx/lib/mono/moonlight/", 1);
setenv ("MONO_PATH", "/Users/plasma/Work/darwoon/moon/class/lib/2.1", 1);
//setenv ("MOONLIGHT_DEBUG", "mediaplayer", 1);
setenv ("MOONLIGHT_OVERRIDES", "curlbridge=yes", 1);
setenv ("MOONLIGHT_DISABLE_INCOMPLETE_MESSAGE", "1", 1);
setenv ("XAP_URI", "file://Users/plasma/tmp/xap", 1);
mono_config_parse_memory(mono_config);
mono_debug_init (MONO_DEBUG_FORMAT_MONO);
mono_set_signal_chaining (true);
domain = mono_jit_init_version ("Moonlight for OSX Root Domain", "v2.0.50727");
mono_jit_set_trace_options ("E:all");
Runtime::InitDesktop ();
winsys = Runtime::GetWindowingSystem ();
winsys->SetPlatformWindowingSystemData (NULL);
deployment = Deployment::GetCurrent ();
window = winsys->CreateWindow (MoonWindowType_Desktop, 640, 480);
surface = new Surface (window);
deployment->SetSurface (surface);
window->SetSurface (surface);
surface->SetSourceLocation (Uri::Create ("file:///Users/toshok/tmp/xap"));
deployment->SetXapFilename (argv[1]);
deployment->SetXapLocation (Uri::Create ("file:///Users/toshok/src/moonlight-android/moonlight-activity/DemoApp.xap"));
window->SetTitle (argv[1]);
surface->AddXamlHandler (Surface::ErrorEvent, error_handler, NULL);
surface->unref ();
if (!deployment->InitializeManagedDeployment (NULL, NULL, NULL)) {
surface->unref ();
g_debug ("Could not initialize managed deployment");
return 0;
}
g_warning ("pid: %i\n", getpid ());
winsys->RunMainLoop (window);
// Shutdown ungracefully for now
return 1;
}
示例2: Surface
static MoonWindow*
create_window (Deployment *deployment, const char *app_id)
{
MoonAppRecord *app;
OutOfBrowserSettings *oob;
MoonWindow *moon_window;
Surface *surface;
/* fetch the app record */
if (!(app = installer->GetAppRecord (app_id))) {
g_warning ("Could not find application: %s", app_id);
return NULL;
}
/* create the moonlight widget */
moon_window = winsys->CreateWindow (MoonWindowType_Desktop, 0, 0);
surface = new Surface (moon_window);
surface->EnsureManagedPeer ();
deployment->SetSurface (surface);
moon_window->SetSurface (surface);
setup_app (deployment, installer->GetBaseInstallDir (), app);
surface->AddXamlHandler (Surface::ErrorEvent, error_handler, NULL);
surface->unref ();
/* load the xap */
if (!deployment->InitializeManagedDeployment (NULL, NULL, NULL)) {
surface->unref ();
return NULL;
}
if ((oob = deployment->GetOutOfBrowserSettings ()))
load_window_icons (moon_window, deployment, oob->GetIcons ());
delete app;
return moon_window;
}
示例3: Surface
static MoonWindow*
create_window (Deployment *deployment, const char *app_id)
{
MoonAppRecord *app;
OutOfBrowserSettings *oob;
WindowSettings *settings;
MoonWindow *moon_window;
Surface *surface;
/* fetch the app record */
if (!(app = installer->GetAppRecord (app_id))) {
g_warning ("Could not find application: %s", app_id);
return NULL;
}
/* create the moonlight widget */
moon_window = winsys->CreateWindow (MoonWindowType_Desktop, 0, 0);
surface = new Surface (moon_window);
deployment->SetSurface (surface);
moon_window->SetSurface (surface);
if (!load_app (deployment, installer->GetBaseInstallDir (), app))
return NULL;
surface->AddXamlHandler (Surface::ErrorEvent, error_handler, NULL);
if ((oob = deployment->GetOutOfBrowserSettings ())) {
load_window_icons (moon_window, deployment, oob->GetIcons ());
settings = oob->GetWindowSettings ();
} else
settings = NULL;
if (settings != NULL) {
Uri *uri;
const char *hostname = NULL;
uri = Uri::Create (app->origin);
if (uri != NULL)
hostname = uri->GetHost ();
if (!hostname || !*hostname)
hostname = "localhost";
char *window_title = g_strdup_printf ("%s - %s",
settings->GetTitle(),
hostname);
delete uri;
moon_window->SetTitle (window_title);
g_free (window_title);
moon_window->Resize (settings->GetWidth (), settings->GetHeight());
if (settings->GetWindowStartupLocation () == WindowStartupLocationManual) {
// FIXME: this should really use a MoonWindow::Move
moon_window->SetLeft (settings->GetLeft ());
moon_window->SetTop (settings->GetTop ());
}
moon_window->SetStyle (settings->GetWindowStyle ());
} else if (oob != NULL) {
moon_window->SetTitle (oob->GetShortName ());
} else {
moon_window->SetTitle ("Moonlight");
}
delete app;
return moon_window;
}