using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
using DevExpress.XtraBars;
using SystemX.Product.ALIS.UI.View;
using static SystemX.Product.ALIS.UI.View.ViewCfg;
using SystemX.Net.Platform.Common.Util;
using DataBaseConnection.Control;
using System.Data.SqlClient;
using SystemX.Product.ALIS.UI.Subs;
using System.Diagnostics;
using static SystemX.Net.Platform.Common.Util.LogMessage;
using SystemX.Product.ALIS.Interface;
using SystemX.Product.ALIS.UI.View.Base;
using System.Net;

namespace SystemX.Product.ALIS.UI
{
    public partial class FrmMain
    {
        /// <summary>
        /// IChildController - CloseAllChildForm
        /// </summary>
        public void CloseAllChildForm()
        {
            if (DocFrames == null)
                return;

            while (DocFrames.Count != 0)
            {
                for (int i = 0; i < DocFrames.Count; i++)
                    DocFrames.ElementAt(i).Close();
            }
        }

        /// <summary>
        /// IChildController - CloseChildForm
        /// </summary>
        /// <param name="SetType"></param>
        public void CloseChildForm(eAppFunctionType SetType)
        {
            FrmChild frmFound = DocFrames.Find(x => x.DocType == SetType);

            if (frmFound != null)
                DocFrames.Remove(frmFound);
        }

        /// <summary>
        /// IChildController - SetObjectValue
        /// </summary>
        /// <param name="obj"></param>
        public void SetObjectValue(object obj)
        {
            strConnIPAddress = (string)obj;
        }

        /// <summary>
        /// IChildController - GoToFindTestListFileFocus
        /// </summary>
        /// <param name="nTestListFileNo"></param>
        public void GoToFindTestListFileFocus(int nTestListFileNo)
        {
            FrmChild frmFound = DocFrames.Find(x => x.DocType == eAppFunctionType.M_TestListFile);

            if (frmFound != null)
                ((IChildSubscribe)frmFound).GoToFindTestListFileFocus(nTestListFileNo);
        }

        /// <summary>
        /// IChildController - GoToFindVariantFocus
        /// </summary>
        /// <param name="nParentNo"></param>
        public void GoToFindVariantFocus(int nVariantNo)
        {
            FrmChild frmFound = DocFrames.Find(x => x.DocType == eAppFunctionType.M_TestListVariant);

            if (frmFound != null)
                ((IChildSubscribe)frmFound).GoToFindVariantFocus(nVariantNo);
        }

        public eAppFunctionType CurrentSelectFunctionType(eAppFunctionType GetFuncType)
        {
            eCurrentSelectFuncType = GetFuncType;

            return GetFuncType;
        }
    }
}