TDGage.cs 2.68 KB
Newer Older
潘栩锋's avatar
潘栩锋 committed
1 2 3 4 5 6 7 8
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;
9
using System.Windows;
潘栩锋's avatar
潘栩锋 committed
10 11 12 13 14

namespace FLY.FeedbackRenZiJia.UI.Client
{
    public class TDGage
    {
15 16 17
        public static TDGage Current { get; } = new TDGage();
        
        
潘栩锋's avatar
潘栩锋 committed
18 19 20 21 22 23
        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 WarningServiceClient mWarningService;
        public BufferWindow<FlyData_WarningHistory> mWarningReasonWindow;
24 25 26 27
        
        public FLY.Thick.Blowing.IService.IBlowing mBlowing;
        public FLY.Thick.Blowing.IService.IBlowingDetect mBDetect;
        
潘栩锋's avatar
潘栩锋 committed
28 29
        public TDGage()
        {
30 31 32 33
            mFeedback = new FeedbackRenZiJia.Client.FeedbackHeatServiceClient(OBJ_INTERFACE.OBJ_INTERFACE_ID.FEEDBACK_ID);
            mHeatBuf = new FeedbackRenZiJia.Client.HeatBufServiceClient(OBJ_INTERFACE.OBJ_INTERFACE_ID.HEATBUF_ID);
            mHeatCell = new FeedbackRenZiJia.Client.HeatCellServiceClient(OBJ_INTERFACE.OBJ_INTERFACE_ID.HEATCELL_ID);
            mSnapShotBuf = new FeedbackRenZiJia.Client.SnapShotBufServiceClient(OBJ_INTERFACE.OBJ_INTERFACE_ID.SNAPSHOT_ID);
潘栩锋's avatar
潘栩锋 committed
34 35 36 37 38 39 40 41
            
            FObjBase.FObjSys.Current.Connect_to_Another_OBJSys(
                SysParam.Current.ServerEP,
                mFeedback.ID,
                mHeatBuf.ID,
                mHeatCell.ID,
                mSnapShotBuf.ID);

42
            mWarningService = new WarningServiceClient(OBJ_INTERFACE.OBJ_INTERFACE_ID.WARNING_OBJ_ID);
潘栩锋's avatar
潘栩锋 committed
43 44 45 46 47
            FObjBase.FObjSys.Current.Connect_to_Another_OBJSys(
                SysParam.Current.ServerEP,
                mWarningService.GetIDs());

            mWarningReasonWindow = new BufferWindow<FlyData_WarningHistory>(mWarningService.ReasonList, 100);
48 49 50 51 52 53 54 55 56 57 58 59 60


            //把实例放入Application.Current.Properties
            Application.Current.Properties["IFeedbackHeat"] = mFeedback;
            Application.Current.Properties["IHeatBuf"] = mHeatBuf;
            Application.Current.Properties["IHeatCell"] = mHeatCell;
            Application.Current.Properties["ISnapShotBuf"] = mSnapShotBuf;


            //从Application.Current.Properties获取需要的单例
            mBlowing = Application.Current.Properties["IBlowing"] as FLY.Thick.Blowing.IService.IBlowing;
            mBDetect = Application.Current.Properties["IBlowingDetect"] as FLY.Thick.Blowing.IService.IBlowingDetect;

潘栩锋's avatar
潘栩锋 committed
61 62 63
        }
    }
}