There is a timer in my WPF application, which asks WCF service every 5 minutes. If there is a message for my application in the service, then I get a list that contains text data and a specific code.
This code gives an information about the view that should be loaded to print the data.
I have two ViewModel (the same as for the data source): for a ticker > one view and one for the popup two views
Project files:
- See
- popup
- pops out Xml
- Popmandium view. XML
TickerLayout.xaml - TickerNormal.xaml
- popup
- Model
- AlertModel.cs <
- View Modal
- PopWebModel
- TickerViewModel
- ViewParsers
- AlertParser.cs
Data source:
Public class warning parser: IAlertParser {AlertServiceClient service; Public listing & lt; AlertModel & gt; Ticker AlertData () {try {service = new AlertServiceClient ()); & Lt; AlertModel & gt; Item = (Select the item from service. GetActiveAlert () Select the new AlertModel {Alertid = Item Alert ID, AlertStartDate = Item AlertStartDate, Alertitile = Items.Alertitil, AlertText = Items.Alert Text}). ToList (); Return the goods; } Hold {return tap; When my application has been launched, there is no loaded view, only an icon in the system (with wpf notifyicon). My problem is, the circulation of the thesis, I do not understand how I can load a view model / view, and pass the data to them when my timer from my service Return true.
In many instances on the Web there is a main Vision loading, which is why I am losing (like conductor example on the Calibri Micro page).
Thanks for any help!
Edit:
OK, my timer looks like this:
if (service.IsAlertReady () = true) {string hostName = Dns.GetHostName (); String myIP = Dns.GetHostEntry (hostName). Adesters list [0]. Ostring (); Service.IsAlertForMe (MYIP); If (service.IsAlertForMe (myIP) == true) {ShellViewModel shell = new ShellViewModel (); Shell.ShowMediumPop (); } And ...
ShellViewModel
public class ShellViewModel: conductor < Object & gt; {Public Zero ShowMediumPop () {Enabled ActiveTime (new popewoodload ()); }}
popewmodel
public square popupmodel: screen {safe override zero current} {base.OnActivate (); }}
PopView.Medium
I'm sorry but I can not understand how my idea can be started on my ticker tick. I have read the documentation, but I need some signals to understand this mechanism.
A program, any program that contains a large number of programs, including views that you Want to show in a variety of ways, here's something:
var app = new app (); App.InitializeComponent (); App.Run ();
Or you can start the sequence directly:
var view = new MyView (); View.Show (); // or see. ShowDialog ();
If the view is a main window, you can create a content control area to inject user content that has a sub-view that you want to display. It still needs to open the main window ... so the above examples will also work in the main window while injecting the main window. User control Injection function, Setting content contents for an example of user control Eventhandlers can handle this scenario well ...
Public Zero NewUserControlInMainWindow (Object Sender, UserControl uc) {// XCC = Xaml Content Control in Main Window XCC.Content = uc; }
I'm not sure how Calibration shows injection ....
No comments:
Post a Comment