Exemplo n.º 1
0
        private void FixUiStatus(WidgetTab tabModel)
        {
            foreach (var expand in tabModel.WidgetExpands)
            {
                FixStatusOfExpand(expand);
            }

            if (!tabModel.WidgetExpands.Any(expand => expand.IsVisible))
            {
                tabModel.IsEmptyHintVisible = true;
            }
            else
            {
                tabModel.IsEmptyHintVisible = false;
            }
        }
Exemplo n.º 2
0
        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;
        }