mardi 17 mars 2015

How to load ViewModel/View in WPF under CaliburnMicro


Vote count:

0




I have a timer in my wpf application wich every 5 minutes ask a WCF service. If the service have message for my application, I get a list which contains text data and a specific code.


This code give an information about the view which must be loaded to print the data.


I have two ViewModel (the data source is the same for both): One for a Ticker > one view and One for Popup > two view


Project files :



  1. View

    • Popup

      • PopHigh.xaml

      • PopMedium.xaml



    • Ticker

      • TickerLayout.xaml

      • TickerNormal.xaml





  2. ViewModel

    • PopupAlertViewModel

    • TickerAlertViewModel



  3. Models

  4. ViewParsers


Datasource :



public class AlertParser : IAlertParser{
AlertServiceClient service;
public List<AlertModel> TickerAlertData()
{
try
{
service = new AlertServiceClient();
List<AlertModel> items = (from item in service.GetActiveAlert() select new AlertModel
{
Alertid= item.AlertId,
Alertstartdate = item.AlertStartDate,
Alerttitle = item.AlertTitle,
Alerttxt = item.AlertText
}).ToList();
return items;
}
catch
{
return null;
}
}
}


When my application is launched, there is no loaded view, only a icon in the systray(with wpf notifyicon).


My problem is, under theses circonstances, I don't understand how I could loaded a couple ViewModel/View, and pass the data to them, when my timer return a true from my service.


Many examples on the web have a mainview loaded, that's why I'm lost (like Conductor example on caliburn micro page).


Thanks for any help !



asked 28 secs ago







How to load ViewModel/View in WPF under CaliburnMicro

Aucun commentaire:

Enregistrer un commentaire