using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace C4IT_DataHistoryProvider_Test
{
    public partial class frmMain2 : Form
    {
        public readonly bool CollectMode = false;

        public frmMain2(bool CollectMode)
        {
            this.CollectMode = CollectMode;
            InitializeComponent();
            tabControlMain.TabPages.Remove(tabPageNexthink);
            tabControlMain.TabPages.Remove(tabPageM42WPM);
        }


        public void DisableAllTabPages(UserControl self)
        {
            foreach (var Entry in this.tabControlMain.TabPages)
            {
                if (!(Entry is TabPage TP))
                    continue;

                foreach (var Entry2 in TP.Controls)
                {
                    if (!(Entry2 is UserControl UC))
                        continue;

                    if (UC != self)
                        UC.Enabled = false;
                }

            }
        }

        public void RemoveAllTabPages(TabPage self)
        {
            this.tabControlMain.TabPages.Clear();
            this.tabControlMain.TabPages.Add(self);
        }


        public void EnableAllTabPages()
        {
            foreach (var Entry in this.tabControlMain.TabPages)
            {
                if (!(Entry is TabPage TP))
                    continue;

                foreach (var Entry2 in TP.Controls)
                {
                    if (!(Entry2 is UserControl UC))
                        continue;
                    UC.Enabled = true;
                }

            }
        }
    }
}
