Esempio n. 1
0
        public void ShowPinnedSeries(AnimeSeriesVM series, bool isMetroDash = false)
        {
            this.Cursor = Cursors.Wait;

            CloseableTabItem cti = new CloseableTabItem();
            //TabItem cti = new TabItem();

            // if the pinned tab already has this, don't open it again.
            int curTab = -1;
            foreach (object obj in tabPinned.Items)
            {
                curTab++;
                CloseableTabItem ctiTemp = obj as CloseableTabItem;
                if (ctiTemp == null) continue;

                AnimeSeriesVM ser = null;
                ContentControl ctrl = ctiTemp.Content as AnimeSeriesContainerControl;
                if (ctrl == null)
                {
                    ContentControl subControl = ctrl.Content as AnimeSeriesSimplifiedControl;
                    if (subControl == null)
                        subControl = ctrl.Content as AnimeSeries;

                    if (subControl != null)
                        ctrl = subControl;
                }
                else
                {
                    ContentControl subControl = ctrl.DataContext as AnimeSeriesSimplifiedControl;
                    if (subControl == null)
                        subControl = ctrl.DataContext as AnimeSeries;

                    if (subControl != null)
                        ctrl = subControl;
                }

                if (ctrl == null)
                    continue;

                ser = ctrl.DataContext as AnimeSeriesVM;
                if (ser == null) continue;

                if (ser.AnimeSeriesID == series.AnimeSeriesID)
                {
                    tabControl1.SelectedIndex = TAB_MAIN_Pinned;
                    tabPinned.SelectedIndex = curTab;
                    this.Cursor = Cursors.Arrow;
                    return;
                }
            }

            string tabHeader = series.SeriesName;
            if (tabHeader.Length > 30)
                tabHeader = tabHeader.Substring(0, 30) + "...";
            cti.Header = tabHeader;

            if (AppSettings.DisplaySeriesSimple)
            {
                AnimeSeriesSimplifiedControl ctrl = new AnimeSeriesSimplifiedControl();
                ctrl.DataContext = series;

                AnimeSeriesContainerControl cont = new AnimeSeriesContainerControl();
                cont.IsMetroDash = false;
                cont.DataContext = ctrl;

                cti.Content = cont;

                tabPinned.Items.Add(cti);
            }
            else
            {
                AnimeSeries seriesControl = new AnimeSeries();
                seriesControl.DataContext = series;

                AnimeSeriesContainerControl cont = new AnimeSeriesContainerControl();
                cont.IsMetroDash = false;
                cont.DataContext = seriesControl;

                cti.Content = cont;

                tabPinned.Items.Add(cti);
            }

            tabControl1.SelectedIndex = TAB_MAIN_Pinned;
            tabPinned.SelectedIndex = tabPinned.Items.Count - 1;

            this.Cursor = Cursors.Arrow;
        }
Esempio n. 2
0
        public void ShowPinnedSeriesOld(AnimeSeriesVM series)
        {
            this.Cursor = Cursors.Wait;

            CloseableTabItem cti = new CloseableTabItem();
            //TabItem cti = new TabItem();

            // if the pinned tab already has this, don't open it again.
            int curTab = -1;
            foreach (object obj in tabPinned.Items)
            {
                curTab++;
                CloseableTabItem ctiTemp = obj as CloseableTabItem;
                if (ctiTemp == null) continue;

                AnimeSeries ctrl = ctiTemp.Content as AnimeSeries;
                if (ctrl == null) continue;

                AnimeSeriesVM ser = ctrl.DataContext as AnimeSeriesVM;
                if (ser == null) continue;

                if (ser.AnimeSeriesID == series.AnimeSeriesID)
                {
                    tabControl1.SelectedIndex = TAB_MAIN_Pinned;
                    tabPinned.SelectedIndex = curTab;
                    this.Cursor = Cursors.Arrow;
                    return;
                }
            }

            string tabHeader = series.SeriesName;
            if (tabHeader.Length > 30)
                tabHeader = tabHeader.Substring(0, 30) + "...";
            cti.Header = tabHeader;

            //AnimeSeries_Hulu seriesControl = new AnimeSeries_Hulu();
            AnimeSeries seriesControl = new AnimeSeries();
            seriesControl.DataContext = series;
            cti.Content = seriesControl;

            tabPinned.Items.Add(cti);

            tabControl1.SelectedIndex = TAB_MAIN_Pinned;
            tabPinned.SelectedIndex = tabPinned.Items.Count - 1;

            this.Cursor = Cursors.Arrow;
        }
Esempio n. 3
0
		public void ShowPinnedSeries(AnimeSeriesVM series)
		{
			this.Cursor = Cursors.Wait;

			CloseableTabItem cti = new CloseableTabItem();
			//TabItem cti = new TabItem();
			cti.Header = series.SeriesName;

			//AnimeSeries_Hulu seriesControl = new AnimeSeries_Hulu();
			AnimeSeries seriesControl = new AnimeSeries();
			seriesControl.DataContext = series;
			cti.Content = seriesControl;

			tabPinned.Items.Add(cti);

			tabControl1.SelectedIndex = TAB_MAIN_Pinned;
			tabPinned.SelectedIndex = tabPinned.Items.Count - 1;

			this.Cursor = Cursors.Arrow;
		}