void MyWidget_CollectionChanged(object sender, System.Collections.Specialized.NotifyCollectionChangedEventArgs e) { ICustomLibraryService CustomLibraryService; CustomLibraryService = ServiceLocator.Current.GetInstance <CustomLibraryServiceProvider>(); CustomLibraryService.RegisterLibraies(MyWidgetLibraryTab.WidgetExpands.Cast <ICustomLibrary>()); }
public WidgetGalleryViewModel() { ///create my tab MyWidgetLibraryTab = new WidgetTab(); SearchResultTab = new WidgetTab(); MyWidgetLibraryTab.RegisterDomLoadedEvent(); ICustomLibraryService CustomLibraryService; CustomLibraryService = ServiceLocator.Current.GetInstance <CustomLibraryServiceProvider>(); CustomLibraryService.RegisterMyLibrary(MyWidgetLibraryTab); MyWidgetLibraryTab.WidgetExpands.CollectionChanged += MyWidget_CollectionChanged; MyWidgetLibraryTab.WidgetExpands.Add(new WidgetExpand { Header = FavouriteExpandHeader }); ///events _ListEventAggregator.GetEvent <WidgetFavouriteEvent>().Subscribe(WidgetFavouriteHandler, ThreadOption.UIThread); _ListEventAggregator.GetEvent <ResetFavouriteEvent>().Subscribe(ResetFavouriteHandler, ThreadOption.UIThread); _ListEventAggregator.GetEvent <UpdateLanguageEvent>().Subscribe(UpdateLanguagesHandler, ThreadOption.UIThread); _ListEventAggregator.GetEvent <CustomWidgetChangedEvent>().Subscribe(CustomWidgetChangedHandler, ThreadOption.UIThread); _ListEventAggregator.GetEvent <DeleteLibraryWidgetEvent>().Subscribe(DeleteCustomLibraryHandler, ThreadOption.UIThread); _ListEventAggregator.GetEvent <LibraryExpandChangedEvent>().Subscribe(LibraryExpandChangedEventHandler, ThreadOption.UIThread); _ListEventAggregator.GetEvent <DomLoadedEvent>().Subscribe(DomLoadedEventHandler, ThreadOption.UIThread); _ListEventAggregator.GetEvent <ExportToMYLibraryEvent>().Subscribe(ExportToMyLibraryAction); _ListEventAggregator.GetEvent <RefreshCustomLibraryEvent>().Subscribe(RefreshCustomLibraryAction); this.WidgetSearchChangedCommand = new DelegateCommand <object>(WidgetSearchChangedExecute); this.TabIndexChangedCommand = new DelegateCommand <object>(TabIndexChangedExecute); ///set delay timer this._inputDelayTimer = new DispatcherTimer(); this._inputDelayTimer.Interval = TimeSpan.FromMilliseconds(500); this._inputDelayTimer.Tick += _inputDelayTimer_Tick; this.InitializeInfo(); Application.Current.Exit += Current_Exit; }