English 中文(简体)
MVVERL WP7号电文多次发射
原标题:MVVMLight Message firing multiple times in WP7 app

我是莫斯·洛威的新成员,并在我的工作计划7中开始使用。 我有一份看法/网页,为电离层动物进行登记,而我的电离层辐射仪则发出信号显示。 这发挥了巨大作用。 然而,当你回到先前的屏幕上(用WP7回到了纽顿),然后又进入网页(用AppBarmenu项目)时,电文两度(和每看一页的电文)。 我假定,观点每次都登记,旧版本正在传递这一信息,但我不相信它应如何发挥作用。

我试图打电话给考试和测验科。 清洗我的纳格特 从确保旧电文在离开网页时就没有登记,但这无助于。 我的守则是:

观点:

public AboutPage()
{
    InitializeComponent();

    Messenger.Default.Register<DialogMessage>(this, msg => { var result = MessageBox.Show(msg.Content, msg.Caption, msg.Button); });
}

    protected override void OnNavigatedFrom(NavigationEventArgs args)
    {
        ViewModelLocator.AboutViewModelStatic.Cleanup();
        base.OnNavigatedFrom(args);
    }

关于Model的意见: (Code由指挥部发射)

        var message = new DialogMessage("Why does this fire multiple times?", DialogMessageCallback) { Button = MessageBoxButton.OK, Caption = "" };
        Messenger.Default.Send(message);

这同样如此,但是每当你来到这个网页时,我们都会再次开枪...... 我认为,这是与清理有关的事情,但我并不相信,在工作计划7中应当如何工作......任何建议都值得赞赏。

最佳回答

一种看法是制造和摧毁的,因为你通过申请采取行动。 因此,在你看来,在制作电文时,这种观点正在登记。

更好的办法是在GisModel的构造中建立登记,使用“观点”和“观点”数据。 The ViewModel is produced one and used during the life of the application. Jonas Follesoe s Airliness Norway is well WP7 application to knowledge about MVVERLight, You can found the MVVVVERLight Counsellor category are used very nicely.

HTH, indy fromoz

问题回答

暂无回答




相关问题
Silverlight Rich text box control

Our team decided that we need our own custom Rich text box control for Silverlight app we are developing. We looked at existing controls mentioned at A good rich text control for Silverlight but ...

Silverlight ImageBrush not rendering (with Bing Map Control)

I m trying to add an image to a Pushpin instance from the Silverlight Bing Map Control, but I can t seem to get it to render (the pushpin renders fine). This is probably a general WPF question rather ...

Silverlight OpenFileDialog DoEvents equivalent

I m processing large files after they are selected by the user. My code looks like the following: if (FileDialog.ShowDialog() == true) { // process really big file } This freezes up the UI so ...

list of controls with templates in silverlight

Does anyone know where to find a list of controls that you can set the template on in Silverlight? I ve wasted several hours now trying to create control templates only to find that the control doesn ...

Silverlight, Updating the UI during processing

I have a simple silverlight multifile upload application, and i want to provide the user with some feedback, right now its only in a test phase and i dont have the webservice. Somehow i cant get the ...

Silverlight 3 - FindName returns null

This looks a bug to me.. Using Silverlight 3 and i have a user control defined in XAML and trying to access the object during runtime returns a null. <Grid> <common:CommonGridEditPanel x:...

silverlight 3 collection binding

Someone please help me understand why this binding does not work... I have a class called SelectionManager with a property called dates which is populated by a WCF service. The property is an ...

热门标签