コード例 #1
0
        public void Initialize()
        {
            if (!DesignerProperties.GetIsInDesignMode(this))
            {
                tracklist.MouseDoubleClick += tracklist_PreviewMouseDoubleClick;
                tracksViewModel             = new ObservableTracksViewModel();

                Results.Tracks = new ObservableCollection <TrackViewModel>();

                tracklist.ReadOnly = true;

                tracklist.ItemsSource = Results.Tracks;

                if (Results.Tracks != null)
                {
                    Results.Tracks.CollectionChanged += Tracks_CollectionChanged;
                }
                TrackQuery.GetTracks();

                if (Results.Tracks.Count == 0)
                {
                    Tabs.FadeOut();
                    grdDD.FadeIn();
                }

                Cycling.Cycler.Initialize();

                //drags
                _dda.Register(tracklist);

                //LoadPlugins
                foreach (var v in PluginCore.Instance().LibraryComponents)
                {
                    if (v.Type == ComponentType.Progressive)
                    {
                        v.StateChangedEvent += ComponentOnStateChangedEvent;
                    }
                    //Add static all type ones

                    if (v.Type == ComponentType.Static &&
                        (v.Category == LibraryComponentCategory.All))
                    {
                        TreeViewItem item = new TreeViewItem();
                        item.Header = v.Caption;
                        item.Tag    = v;
                        List <TreeViewItem> str = new List <TreeViewItem>();
                        if (v.Children != null)
                        {
                            foreach (var va in v.Children)
                            {
                                str.Add(new TreeViewItem()
                                {
                                    Header = va, Tag = v, Padding = new Thickness(0, 8, 0, 8)
                                });
                            }
                        }
                        item.ItemsSource = str;
                        plugTree.Items.Add(item);
                    }
                }
                plugTree.SelectedItemChanged += plugTree_SelectedItemChanged;
                //RefreshPlugs();
                dpt.Tick    += dpt_Tick;
                dpt.Interval = new TimeSpan(00, 0, 0, 0, 100);
            }
        }
コード例 #2
0
        void plugTree_SelectedItemChanged(object sender, RoutedPropertyChangedEventArgs <object> e)
        {
            var sel = plugTree.SelectedItem as TreeViewItem;

            if (sel != null)
            {
                var t = sel.Tag as LibraryComponent;
                t.ChildrenToggled(sel.Header.ToString());
                //library togs

                if (t.Caption == " My Library" && grdDD.Visibility == Visibility.Hidden)
                {
                    Tabs.FadeIn();
                    Container.FadeOut();
                    switch (sel.Header.ToString())
                    {
                    case " Songs":
                        EnumerationsContainer.LibraryUi = LibraryUiMode.Songs;
                        break;

                    case " Artists":
                        EnumerationsContainer.LibraryUi = LibraryUiMode.Artist;
                        break;

                    case " Albums":
                        EnumerationsContainer.LibraryUi = LibraryUiMode.Album;
                        break;

                    case " Genres":
                        EnumerationsContainer.LibraryUi = LibraryUiMode.Genre;
                        break;
                    }
                    RefreshUi();
                }
                else
                {
                    Tabs.FadeOut();
                    Container.FadeIn();
                    LibraryComponent lc = sel.Tag as LibraryComponent;

                    if (!lc.Initialized)
                    {
                        lc.Initialize();
                    }
                    if (!Container.Children.Contains(lc.ComponentUI))
                    {
                        if (lc.ComponentUI != null)
                        {
                            Container.Children.Add(lc.ComponentUI);
                        }
                    }
                    foreach (Control v in Container.Children)
                    {
                        if (v != lc.ComponentUI)
                        {
                            v.FadeOut();
                        }
                    }
                    lc.ComponentUI.FadeIn();
                }
            }
        }