public MainViewModel(ViewModelLocator owner) { Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo("en-En"); _owner = owner; this.IsServerConnected = false; _app = new AppConnector(Client.Client.WCFclient()); if (IsInDesignModeStatic) { // Create design time view services and models this.Title = $"{WpfUI.Resources.text.Notebook}(Disign mode)"; } else { // Create run time view services and models this.Title = $"{WpfUI.Resources.text.Notebook}"; } this.Contacts = new ObservableCollection <IContactInfo>(_app.ViewAll()); __listCond = _contacts; Messenger.Default.Register <ContactInfo>(this, "ContactAdded", (p) => { this.AddContact(p); }); Messenger.Default.Register <System.Collections.Generic.List <IContactInfo> >(this, "SearchedContacts", (p) => { this.Contacts = new ObservableCollection <IContactInfo>(p); }); Messenger.Default.Send(_app, "GetAppConnector"); var th = new Thread(() => { while (true) { this.IsServerConnected = _app.Ping(); RaisePropertyChanged("IsServerConnected"); } }); th.Priority = ThreadPriority.Highest; th.IsBackground = true; th.Start(); }
public void MenuView() { __listCond = new ObservableCollection <IContactInfo>(_app.ViewAll()); this.Contacts = __listCond; }