protected override void OnLoaded() { base.OnLoaded(); BtnCommand = new RelayCommand <string>(OnCommand); MouseDubleClickCommand = new RelayCommand <UrlInfo>(OnMouseDubleClick); RegeistMessenger <UrlInfo>(OnRequestCreateUrl); ReceiveAddressBookMonitor.Default.MonitorCallBack += accounts => { Application.Current.Dispatcher.Invoke(() => { var selectedItem = this.SelectedItem; UrlInfos.Clear(); accounts.ForEach(x => UrlInfos.Add(new UrlInfo() { Address = x.Address, Tag = x.Tag })); if (selectedItem != null) { this.SelectedItem = UrlInfos.FirstOrDefault(x => x.Address == selectedItem.Address); } }); ReceiveAddressBookMonitor.Default.Start(6000); }; LoadUrls(); UrlInfos.CollectionChanged += (s, e) => { RaisePropertyChanged("UrlInfos"); }; }
protected override void OnLoaded() { base.OnLoaded(); BtnCommand = new RelayCommand <string>(OnCommand); MouseDubleClickCommand = new RelayCommand <UrlInfo>(OnMouseDubleClick); RegeistMessenger <UrlInfo>(OnRequestCreateUrl); RegeistMessenger <PayUrlPageType>(OnGetRequest); PayAddressBookMonitor.Default.MonitorCallBack += books => { Application.Current.Dispatcher.Invoke(() => { string account = null; if (SelectedItem != null) { account = SelectedItem.Address; } UrlInfos.Clear(); books.ForEach(x => { UrlInfos.Add(new UrlInfo(x)); }); if (account != null) { SelectedItem = UrlInfos.FirstOrDefault(x => x.Address == account); } StaticViewModel.GlobalViewModel.IsLoading = false; }); }; LoadUrls(); UrlInfos.CollectionChanged += (s, e) => { RaisePropertyChanged("UrlInfos"); }; }
void LoadUrls() { PayAddressBookMonitor.Default.MonitorCallBack += books => { Application.Current.Dispatcher.Invoke(() => { PayAddressBookMonitor.Default.Stop(); UrlInfos.Clear(); books.ForEach(x => { UrlInfos.Add(new UrlInfo(x)); }); }); }; }
void LoadUrls() { ReceiveAddressBookMonitor.Default.MonitorCallBack += accounts => { ReceiveAddressBookMonitor.Default.Stop(); Application.Current.Dispatcher.Invoke(() => { UrlInfos.Clear(); accounts.ForEach(x => UrlInfos.Add(new UrlInfo() { Address = x.Address, Tag = x.Tag })); }); }; }
protected override void OnLoaded() { base.OnLoaded(); BtnCommand = new RelayCommand <string>(OnCommand); MouseDubleClickCommand = new RelayCommand <UrlInfo>(OnMouseDubleClick); RegeistMessenger <UrlInfo>(OnRequestCreateUrl); RegeistMessenger <PayUrlPageType>(OnGetRequest); PayAddressBookMonitor.Default.MonitorCallBack += books => { Application.Current.Dispatcher.Invoke(() => { PayAddressBookMonitor.Default.Stop(); UrlInfos.Clear(); books.ForEach(x => { UrlInfos.Add(new UrlInfo(x)); }); }); }; LoadUrls(); UrlInfos.CollectionChanged += (s, e) => { RaisePropertyChanged("UrlInfos"); }; }