private void BtnCreate_Click(object sender, RoutedEventArgs e)
        {
            var temp    = SpUserMusicList.Children;
            var tabItem = new JmTabItem()
            {
                Header = CreateNewMusicListName(temp),
                Icon   = new TextBlock()
                {
                    Text     = "\ue62e",
                    FontSize = 15
                },
                Editable = true
            };

            tabItem.EditBoxLostFocus += TabItem_EditBoxLostFocus;
            var children = new List <UIElement>()
            {
                tabItem
            };

            foreach (UIElement item in temp)
            {
                children.Add(item);
            }
            SpUserMusicList.Children.Clear();
            foreach (var item in children)
            {
                SpUserMusicList.Children.Add(item);
            }
            Sviewer.JmScrollToElement(SpICreate);
        }
 private void NonNavPageDisplayed(object sender, EventArgs e)
 {
     if (_selectedTabItem != null)
     {
         _selectedTabItem.IsSelected = false;
         _selectedTabItem            = null;
     }
 }
 /// <summary>
 /// 设置选中的TabItem
 /// </summary>
 /// <param name="tabItem"></param>
 private void SetSelectedTabItem(JmTabItem tabItem)
 {
     tabItem.IsSelected = true;
     if (_selectedTabItem != null)
     {
         _selectedTabItem.IsSelected = false;
     }
     _selectedTabItem = tabItem;
 }
        private async void UserStateChanged(object sender, EventArgs e)
        {
            if (App.User == null)
            {
                TabILike.Visibility        = Visibility.Collapsed;
                SpICreate.Visibility       = Visibility.Collapsed;
                SpUserMusicList.Visibility = Visibility.Collapsed;
            }
            else
            {
                TabILike.Visibility     = Visibility.Visible;
                SpICreate.Visibility    = Visibility.Visible;
                TbLoading.Visibility    = Visibility.Visible;
                BtnSlideUp.Visibility   = Visibility.Visible;
                BtnSlideDown.Visibility = Visibility.Hidden;
                var userMusicList = await Task.Factory.StartNew(() =>
                {
                    return(UserMusicListService.GetUserMusicListByUserId(App.User.Id)
                           .OrderByDescending(u => u.CreationTime));
                });

                SpUserMusicList.Children.Clear();
                Dispatcher.Invoke(() =>
                {
                    foreach (var list in userMusicList)
                    {
                        var tabItem = new JmTabItem()
                        {
                            Header = list.Name,
                            Icon   = new TextBlock()
                            {
                                Text     = "\ue62e",
                                FontSize = 15
                            },
                            Tag = list.Id
                        };
                        tabItem.EditBoxLostFocus += TabItem_EditBoxLostFocus;
                        tabItem.MouseUp          += UserMusicListSelectionChanged;
                        tabItem.ContextMenu       = GetContextMenu();
                        SpUserMusicList.Children.Add(tabItem);
                    }
                });
                TbLoading.Visibility       = Visibility.Collapsed;
                SpUserMusicList.Visibility = Visibility.Visible;
            }
        }
 private void UserControl_Loaded(object sender, RoutedEventArgs e)
 {
     TiMusicHall.IsSelected = true;
     _selectedTabItem       = TiMusicHall;
     ChangePage();
 }