本文整理汇总了C#中Application.addEventListener方法的典型用法代码示例。如果您正苦于以下问题:C# Application.addEventListener方法的具体用法?C# Application.addEventListener怎么用?C# Application.addEventListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Application
的用法示例。
在下文中一共展示了Application.addEventListener方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: onReady
public void onReady()
{
setConnectButtonState("Disconnect", true, true);
interAppBus_ = controller_.getInterApplicationBus();
interAppBus_.addSubscribeListener((uuid, topic) => {
bool exists = false;
if (!subscriptionMap.TryGetValue(topic, out exists)) {
subscriptionMap.Add(topic, true);
if (subscriptionCallback != null)
subscriptionCallback();
}
});
Console.WriteLine("OnReady.");
ApplicationOptions mainAppOptions = new ApplicationOptions(htmlDemoUuid_, htmlDemoUuid_, "https://developer.openf.in/htmlinterappcommdemo/1/index.html");
mainAppOptions.Version = "v1.0.0.0b";
mainAppOptions.IsAdmin = true;
WindowOptions mainWindowOptions = mainAppOptions.MainWindowOptions;
mainWindowOptions.AutoShow = true;
mainWindowOptions.DefaultLeft = 100;
mainWindowOptions.DefaultTop = 100;
mainWindowOptions.DefaultWidth = 510;
mainWindowOptions.DefaultHeight = 350;
mainWindowOptions.Maximizable = false;
mainWindowOptions.ShowTaskbarIcon = true;
AckCallback afterAppCreation = (ack) =>
{
Console.WriteLine("afterAppCreation");
Console.WriteLine(ack.getJsonObject().ToString());
AckCallback afterRun = (runAck) =>
{
Console.WriteLine("afterRun");
Console.WriteLine(runAck.getJsonObject().ToString());
};
Console.WriteLine("app.run()");
// Using same callback for success and error in case app is already running
htmlApplication_.run(afterRun, afterRun);
};
// Using same callback for success and error in case app already exists
Console.WriteLine("Creating App");
htmlApplication_ = new Application(mainAppOptions, controller_, afterAppCreation, afterAppCreation);
htmlApplication_.addEventListener("closed", (ack) => {
controller_.disconnect();
System.Windows.Forms.Application.ExitThread();
});
}