예제 #1
0
        public void ViewSpotifyBaseObject <TSpotifyObject>(TSpotifyObject viewObject)
            where TSpotifyObject : SpotifyBaseObject, new()
        {
            LoggedInWindowTabItem viewTab = null;

            viewTab = TabItems.FirstOrDefault(x => x.ViewModel is ViewModelViewObject <TSpotifyObject> vm && vm.ViewSource is TSpotifyObject obj && obj.Id == viewObject.Id);

            if (viewTab == null)

            {
                UserControlViewObject content = new UserControlViewObject();

                content.RemoveByEvent += ViewContent_CloseByEvent;

                viewTab = new LoggedInWindowTabItem(true)
                {
                    Content = content,
                    //Name = viewObject.Name, name will be set inside of the viewmodel<T>
                    ViewModel = new ViewModelViewObject <TSpotifyObject>(this, viewObject)
                };



                TabItems.Add(viewTab);
            }

            SelectedTabItem = viewTab;
        }
예제 #2
0
        public void CloseTab(LoggedInWindowTabItem tabitem)
        {
            if (SelectedTabItem == tabitem)
            {
                SelectedTabItem = TabItems[TabItems.IndexOf(tabitem) - 1];
            }

            TabItems.Remove(tabitem);
        }
예제 #3
0
        private void FillTabControl()
        {
            LoggedInWindowTabItem tabStart = new LoggedInWindowTabItem()
            {
                Name    = "start",
                Content = new UserControlStart()
            };

            LoggedInWindowTabItem tabSession = new LoggedInWindowTabItem()
            {
                Name    = "session",
                Content = new UserControlSession()
            };

            LoggedInWindowTabItem tabSearch = new LoggedInWindowTabItem()
            {
                Name    = "search",
                Content = new UserControlSearch()
            };

            LoggedInWindowTabItem tabPlaylist = new LoggedInWindowTabItem()
            {
                Name    = "playlist",
                Content = new UserControlPlaylist()
            };

            LoggedInWindowTabItem tabLibrary = new LoggedInWindowTabItem()
            {
                Name    = "library",
                Content = new UserControlPlaylist()
            };

            LoggedInWindowTabItem tabUser = new LoggedInWindowTabItem()
            {
                Name    = "user",
                Content = new UserControlPlaylist()
            };

            LoggedInWindowTabItem tabFeatured = new LoggedInWindowTabItem()
            {
                Name    = "featured",
                Content = new UserControlPlaylist()
            };


            TabItems = new ObservableCollection <LoggedInWindowTabItem>()
            {
                tabStart, tabSession, tabSearch, tabPlaylist, tabLibrary, tabUser, tabFeatured
            };

            //Tabitems have to be created for viemodel start

            tabStart.ViewModel = ViewModelStart = new ViewModelStart(this);

            tabSession.ViewModel = ViewModelSession = new ViewModelSession(this);

            tabSearch.ViewModel = ViewModelSearch = new ViewModelSearch(this);

            tabPlaylist.ViewModel = ViewModelPlaylists = new ViewModelPlaylists(this);

            //temp
            tabLibrary.ViewModel = tabUser.ViewModel = tabFeatured.ViewModel = new ViewModelPlaylists(this);

            SelectedTabItem = tabStart;
        }