Ejemplo n.º 1
0
        public void LoadTree()
        {
            if (initLoading) return;
            if (null == load) load = new loadingDisplay();
           
            // clear current selection
            treeView_Library.Nodes.Clear();
            pictureBox_Series.Image = null;
            pictureBox_SeriesPoster.Image = null;
            comboBox_BannerSelection.Items.Clear();            
            comboBox_PosterSelection.Items.Clear();
            dataGridView1.Rows.Clear();

            SQLCondition condition = new SQLCondition();
            List<DBSeries> seriesList = DBSeries.Get(condition);
            load.updateStats(seriesList.Count, 0, 0);
            List<DBSeason> allSeasons = DBSeason.Get(new SQLCondition(), false);
            load.updateStats(seriesList.Count, allSeasons.Count, 0);            
            SQLiteResultSet results = DBTVSeries.Execute("select count(*) from online_episodes");

            load.updateStats(seriesList.Count, allSeasons.Count, int.Parse(results.GetRow(0).fields[0]));
            aboutScreen.setUpLocalInfo(seriesList.Count, allSeasons.Count, int.Parse(results.GetRow(0).fields[0]));

            if (seriesList.Count == 0)
            {
                load.Close();
                load = null;
                return;
            }

            // sort specials at end of season list if needed
            allSeasons.Sort();

            int index = 0;
            foreach (DBSeries series in seriesList)
            {
                var seasons = allSeasons.Where(s => s[DBSeason.cSeriesID] == series[DBSeries.cID]).ToList();
                CreateSeriesNode(series, seasons, index++);
            }
            this.ResumeLayout();
            load.Close();
            load = null;

            // select the first node
            if (this.treeView_Library.Nodes.Count > 0)
            {
                this.treeView_Library.SelectedNode = this.treeView_Library.Nodes[0];
                this.treeView_Library.Select();
            }
        }
Ejemplo n.º 2
0
        public ConfigurationForm()
        {
            m_localControlForInvoke = new Control();
            m_localControlForInvoke.CreateControl();
#if DEBUG
            //    Debugger.Launch();
#endif
            InitializeComponent();
            MPTVSeriesLog.AddNotifier(ref listBox_Log);

            MPTVSeriesLog.Write("**** Plugin started in configuration mode ***");

            Translation.Init();

            // set height/width
            int height = DBOption.GetOptions(DBOption.cConfigSizeHeight);
            int width = DBOption.GetOptions(DBOption.cConfigSizeWidth);
            if (height > this.MinimumSize.Height && width > this.MinimumSize.Width)
            {
                System.Drawing.Size s = new Size(width, height);
                this.Size = s;
            }
            this.Resize += new EventHandler(ConfigurationForm_Resize);            

            load = new loadingDisplay();

            OnlineParsing.OnlineParsingCompleted += new OnlineParsing.OnlineParsingCompletedHandler(OnlineParsing_OnCompleted);
            
            InitSettingsTreeAndPanes();
            InitExtraTreeAndPanes();
            
            LoadImportPathes();
            LoadExpressions();
            LoadReplacements();
            
            initLoading = false;
            LoadTree();

            // Only Advanced Users / Skin Designers need to see these.
            // Tabs are visible if import="false" TVSeries.SkinSettings.xml
            if (SkinSettings.ImportFormatting) tabControl_Details.TabPages.Remove(tabFormattingRules);
            if (SkinSettings.ImportLogos) tabControl_Details.TabPages.Remove(tabLogoRules);
            
            if (load != null) load.Close();
            instance = this;

            this.aboutScreen.setUpMPInfo(Settings.Version.ToString(), Settings.BuildDate);
            this.aboutScreen.setUpPaths();
        }
Ejemplo n.º 3
0
        public void LoadTree()
        {
            if (initLoading) return;
            if (null == load) load = new loadingDisplay();

            TreeView root = this.treeView_Library;
            root.Nodes.Clear();
            SQLCondition condition = new SQLCondition();
            List<DBSeries> seriesList = DBSeries.Get(condition);
            load.updateStats(seriesList.Count, 0, 0);
            List<DBSeason> altSeasonList = DBSeason.Get(new SQLCondition(), false);
            load.updateStats(seriesList.Count, altSeasonList.Count, 0);
            SQLiteResultSet results = DBTVSeries.Execute("select count(*) from online_episodes");

            load.updateStats(seriesList.Count, altSeasonList.Count, int.Parse(results.GetRow(0).fields[0]));
            aboutScreen.setUpLocalInfo(seriesList.Count, altSeasonList.Count, int.Parse(results.GetRow(0).fields[0]));

            if (seriesList.Count == 0)
            {
                load.Close();
                load = null;
                return;
            }

            // sort specials at end of season list if needed
            altSeasonList.Sort();

            foreach (DBSeries series in seriesList)
            {
                string sName = (DBOption.GetOptions(DBOption.cSeries_UseSortName) ? series[DBOnlineSeries.cSortName] : series[DBOnlineSeries.cPrettyName]);
                TreeNode seriesNode = new TreeNode(sName);
                seriesNode.Name = DBSeries.cTableName;
                seriesNode.Tag = (DBSeries)series;
                root.Nodes.Add(seriesNode);
                Font fontDefault = treeView_Library.Font;

                // set color for non-local files
                if (series[DBOnlineSeries.cEpisodeCount] == 0) {
                    seriesNode.ForeColor = System.Drawing.SystemColors.GrayText;
                }
                else {
                    // set color for watched items
                    if (series[DBOnlineSeries.cUnwatchedItems] == 0)
                        seriesNode.ForeColor = System.Drawing.Color.DarkBlue;
                }

                // set FontStyle
                if (series[DBSeries.cHidden])
                    seriesNode.NodeFont = new Font(fontDefault.Name, fontDefault.Size, FontStyle.Italic);

                int seriesID = series[DBSeries.cID];
                foreach (DBSeason season in altSeasonList)
                {
                    if (season[DBSeason.cSeriesID] == seriesID)
                    {
                        TreeNode seasonNode = null;
                        if (season[DBSeason.cIndex] == 0)
                            seasonNode = new TreeNode(Translation.specials);
                        else
                            seasonNode = new TreeNode(Translation.Season + " " + season[DBSeason.cIndex]);

                        seasonNode.Name = DBSeason.cTableName;
                        seasonNode.Tag = (DBSeason)season;
                        seriesNode.Nodes.Add(seasonNode);

                        // set no local files color
                        if (season[DBSeason.cEpisodeCount] == 0) {
                            seasonNode.ForeColor = System.Drawing.SystemColors.GrayText;
                        }
                        else {
                            // set color for watched season
                            if (season[DBSeason.cUnwatchedItems] == 0)
                                seasonNode.ForeColor = System.Drawing.Color.DarkBlue;
                        }

                        // set FontStyle
                        if (season[DBSeason.cHidden])
                            seasonNode.NodeFont = new Font(fontDefault.Name, fontDefault.Size, FontStyle.Italic);
                    }
                }
            }
            this.ResumeLayout();
            load.Close();
            load = null;
        }