[英]Flex - Run Air Application In Background
I am trying to provide my users with the option to have my application launch automatically and complete a task at a certain time every week. 我正在尝试为我的用户提供自动启动应用程序并在每周特定时间完成任务的选项。
I can make my application launch at log in using NativeApplication.nativeApplication.startAtLogin=true but I then want to detect if the time is the time they selected and if it isn't then run the application in the background until the time does match or the user shuts down their computer. 我可以使用NativeApplication.nativeApplication.startAtLogin = true在登录时启动我的应用程序,但我想检测时间是否是他们选择的时间,如果不是,则在后台运行应用程序直到时间匹配或用户关闭他们的电脑。
Does anyone know of a way to do this? 有谁知道这样做的方法? On Adobe's webpage comparing Flex web apps and desktop apps it implied to me that applications could be run in the background but I'm struggling to find anything. 在Adobe的网页上比较Flex网络应用程序和桌面应用程序,它暗示我可以在后台运行应用程序,但我很难找到任何东西。
You can close the initial native window without killing the process 您可以关闭初始本机窗口而不会终止进程
NativeApplication.nativeApplication.autoExit = false;
NativeWindow(this.stage.nativeWindow).close();
OR 要么
You can close the initial native window and create a new window that acts as a desktop widget without appearing in the taskbar with either the UTILITY or LIGHTWEIGHT window type. 您可以关闭初始本机窗口并创建一个充当桌面窗口小部件的新窗口,而不会在任务栏中显示UTILITY或LIGHTWEIGHT窗口类型。
http://help.adobe.com/en_US/air/reference/html/flash/display/NativeWindowInitOptions.html#type http://help.adobe.com/en_US/air/reference/html/flash/display/NativeWindowInitOptions.html#type
Either you keep the process running which times when the next 'job' should be ran, or you can set a system cron job (or something similar) which is specific to the OS. 要么在运行下一个“作业”的时候保持进程运行,要么可以设置特定于OS的系统cron作业(或类似的东西)。 You'll want to use the NativeWindow option of 'LIGHTWEIGHT' so that your application doesn't show up to the user. 您将需要使用'LIGHTWEIGHT'的NativeWindow选项,以便您的应用程序不会显示给用户。
Personally, for these kinds of processes, I don't even try to use Air since it isn't really made for this kind of stuff. 就个人而言,对于这些类型的过程,我甚至不尝试使用Air,因为它并不是真的用于这种类型的东西。 It's meant to be used for UI based apps and not process based. 它旨在用于基于UI的应用程序而不是基于进程的应用程序。 Use Java or C# instead. 请改用Java或C#。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.