紧凑型框架 - 让所有打开的窗体 [英] Compact Framework - get all open forms

查看:144
本文介绍了紧凑型框架 - 让所有打开的窗体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我提出一个Windows CE应用,其中,用户可以在运行时改变GUI语言。
我已经实现了我自己翻译的逻辑形式的Load事件。

I am making a Windows CE application in which the user can change the GUI language at runtime. I have implemented my own translation logic in the Load event of the form.

现在,我想更新所有打开的窗体,当用户更改语言。
是否有办法(在Compact Framework的!!)来检索应用程序的所有打开的窗体?

Now, I would like to update all open forms when the user changes the language. Is there a way (in Compact Framework!!) to retrieve all open forms of the application?

推荐答案

您可以创建您使用实例化所有的形式FormManager类。这将使经理的机会,倾听他们的关闭事件跟踪这些形式的寿命,如果他们使用的通用接口(比如一个具有OnUiLanguageChanged方法)来调用它们的方法集体。

You can create a FormManager class that you use to instantiate all of your forms. This would give the manager the opportunity to track the lifespan of those forms by listening for their Close event, and to call methods on them en masse if they utilize a common interface (say one with a OnUiLanguageChanged method).

另外,你可以创建在应用程序中暴露的事件,每个表单可以订阅的对象。这样一来,你不需要知道哪些形式是开放的。 Intsead所有打开的形式,只要他们AER开放,如果他们收到它,他们可以适当地更新自己听了一UiLanguageChanged事件。

Alternatively, you can create an object in your application that exposes an event that each Form can subscribe to. In that way, you don't need to know which forms are open. Intsead all open forms are listening for a UiLanguageChanged event as long as they aer open, and if they recieve it they can update themselves appropriately.

这篇关于紧凑型框架 - 让所有打开的窗体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆