private void coordinator_WindowAdded(Frame frame, EventArgs args)
 {
     if (frame.Name == mWindow) {
         mManager = mOverlayPlugin[frame.Name];
         frame.Core.FrameAdded -= mWindowAddedListener;
     }
 }
        public override void Init(Core input)
        {
            base.Init(input);

            if (input.HasPlugin<OverlayPlugin>()) {
                mOverlayPlugin = input.GetPlugin<OverlayPlugin>();
            }

            if (input.Frames.Count() == 0)
                input.FrameAdded += new Action<Frame, EventArgs>(input_FrameAdded);
            else {
                mFrame = input.Frames.First();
                if (mConfig.Frame != null)
                    mFrame = input[mConfig.Frame];
                input_FrameAdded(mFrame, null);
            }
        }
        void input_FrameAdded(Frame rame, EventArgs args)
        {
            if (mConfig.Frame == null || rame.Name.Equals(mConfig.Frame)) {
                mFrame = rame;

                List<ITouchSource> sources = new List<ITouchSource>();
                sources.Add(this);
                if (mOverlayPlugin != null)
                    sources.Add(new OverlayTouchSource(mOverlayPlugin[rame.Name]));

                mL = new VerticalAxis(sources.ToArray());
                mR = new VerticalAxis(sources.ToArray());
                mLeftX = new TwoDAxis(mL, true, false);
                mLeftY = new TwoDAxis(mL, false, false);
                mRightX = new TwoDAxis(mR, true, true);
                mRightY = new TwoDAxis(mR, false, true);
                mSingle = new VerticalAxis(sources.ToArray());

                mL.W = mConfig.LeftW;
                mL.H = mConfig.LeftH;
                mL.PaddingH = mConfig.LeftPaddingH;
                mL.PaddingV = mConfig.LeftPaddingV;

                mR.W = mConfig.RightW;
                mR.H = mConfig.RightH;
                mR.PaddingH = mConfig.RightPaddingH;
                mR.PaddingV = mConfig.RightPaddingV;

                mSingle.W = mConfig.SingleW;
                mSingle.H = mConfig.SingleH;
                mSingle.PaddingH = mConfig.SinglePaddingH;
                mSingle.PaddingV = mConfig.SinglePaddingV;

                mSinglePos = mConfig.SinglePos;

                mL.SizeChanged += OnChange;
                mR.SizeChanged += OnChange;
                mSingle.SizeChanged += OnChange;
                OnChange();

                AddAxis(mLeftX);
                AddAxis(mLeftY);
                AddAxis(mRightX);
                AddAxis(mRightY);
                AddAxis(mSingle);

                Core input = rame.Core;

                if (Enabled)
                    Enabled = true;
            }
        }
        public void Init(Frame frame)
        {
            mFrame = frame;
            mConfig = new UnrealConfig(frame.Name);

            if (mConfig.AutoStartUnreal)
                Launch();
            else if (mConfig.AutoStartServer)
                StartServer();
        }