using FLY.OBJComponents.Client;
using FLY.OBJComponents.Common;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Reflection;
using System.Text;

namespace FLY.FeedbackRenZiJia.UI.Client
{
    public class TDGage
    {
        static TDGage current;
        public static TDGage Current
        {
            get
            {
                if (current == null)
                {
                    current = new TDGage();
                }
                return current;
            }
        }


        public FLY.FeedbackRenZiJia.Client.FeedbackHeatServiceClient mFeedback;
        public FLY.FeedbackRenZiJia.Client.HeatBufServiceClient mHeatBuf;
        public FLY.FeedbackRenZiJia.Client.HeatCellServiceClient mHeatCell;
        public FLY.FeedbackRenZiJia.Client.SnapShotBufServiceClient mSnapShotBuf;
        public FLY.Thick.Blowing.Client.BlowingServiceClient mBlowing;
        public  FLY.Thick.Blowing.Client.BlowingDetectServiceClient mBDetect;

        public WarningServiceClient mWarningService;
        public BufferWindow<FlyData_WarningHistory> mWarningReasonWindow;

        public TDGage()
        {
            mFeedback = new FeedbackRenZiJia.Client.FeedbackHeatServiceClient();
            mHeatBuf = new FeedbackRenZiJia.Client.HeatBufServiceClient();
            mHeatCell = new FeedbackRenZiJia.Client.HeatCellServiceClient();
            mSnapShotBuf = new FeedbackRenZiJia.Client.SnapShotBufServiceClient();
            
            FObjBase.FObjSys.Current.Connect_to_Another_OBJSys(
                SysParam.Current.ServerEP,
                mFeedback.ID,
                mHeatBuf.ID,
                mHeatCell.ID,
                mSnapShotBuf.ID);

            mWarningService = new WarningServiceClient(FLY.FeedbackRenZiJia.OBJ_INTERFACE.OBJ_INTERFACE_ID.WARNING_OBJ_ID);
            FObjBase.FObjSys.Current.Connect_to_Another_OBJSys(
                SysParam.Current.ServerEP,
                mWarningService.GetIDs());

            mBlowing = new Thick.Blowing.Client.BlowingServiceClient();
            mBDetect = new Thick.Blowing.Client.BlowingDetectServiceClient();
            FObjBase.FObjSys.Current.Connect_to_Another_OBJSys(
                SysParam.Current.ThickEP,
                mBlowing.ID, mBDetect.ID);

            mWarningReasonWindow = new BufferWindow<FlyData_WarningHistory>(mWarningService.ReasonList, 100);
        }
    }
}