/// <summary>
        /// Initialize the MFD
        /// </summary>
        /// <param name="configString">A config string to assign buttons, labels</param>
        /// <param name="ip">The IP address of the SCJoyServer</param>
        /// <param name="port">The first Joystick port</param>
        /// <returns>True if successfull</returns>
        public bool InitMFD(UC_MFDstartLand owner, MfdInstance mfd, string configString, string ip, uint port)
        {
            m_owner = owner;

            Initialized = MFD.Init(owner, mfd, configString, ip, port);
            if (!Initialized)
            {
                return(false);
            }

            // Init Drawing stuff for this panel

            // A frame around the usable area
            MFD.GProc.Drawings.Add(MfdBase.Frame(Color.Chartreuse));
            // Create all labels with a prototype font and color
            MFD.GProc.Drawings.Add(MfdLabels.LabelList(
                                       new TextItem( )
            {
                Font            = m_owner.Font,                    //   the font to use for button labels
                TextBrush       = new SolidBrush(Color.LimeGreen), // the text label color
                TextBrushActive = new SolidBrush(Color.Lime),      // the active text label color
                FillBrush       = null                             // new SolidBrush( ControlPaint.Dark( Color.LimeGreen, 0.7F ) ) // the text label background fill (or null)
            },
                                       MFD.ButtonLabelList));
            // Change individual items..

            // Add more to draw

            return(Initialized);
        }
        /// <summary>
        /// Initialize the MFD
        ///  aquires the MFD device, reads the config and establishes a SCJoyServer client
        /// </summary>
        /// <param name="mfd">The MFD instance to handle</param>
        /// <param name="configString">A config string to assign buttons, labels</param>
        /// <param name="ip">The IP address of the SCJoyServer</param>
        /// <param name="port">The first Joystick port of the Server</param>
        /// <returns>True if successfull</returns>
        public bool InitMFD(MfdInstance mfd, string configString, string ip = "", uint port = 0)
        {
            bool retVal = m_mfd.InitMFD(this, mfd, configString, ip, port);

            this.BackgroundImage = m_mfd.MFD.BackgroundImage;
            return(retVal);
        }
Beispiel #3
0
        /// <summary>
        /// Init access to joysticks
        ///   if initialized gives access to left and right (MFD 1 and MFD 2)
        /// </summary>
        /// <param name="mfd">Which one to init</param>
        /// <param name="hwnd">A window handle</param>
        /// <returns></returns>
        public static bool Init(MfdInstance mfd, Control hwnd)
        {
            string mfdGuid = "";

            if (mfd == MfdInstance.MFD_1)
            {
                mfdGuid = DevJoystick.MFD1_GUID;
            }
            else if (mfd == MfdInstance.MFD_2)
            {
                mfdGuid = DevJoystick.MFD2_GUID;
            }
            else
            {
                MessageBox.Show("dxSupport.Init() Invalid MFD instance - program exits now", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            if (DevJoysticks[(int)mfd] != null)
            {
                return(true);                            // we have it already..
            }
            // Init X things
            var js = InitDirectInput(mfdGuid, hwnd);

            if (js == null)
            {
                MessageBox.Show("dxSupport.Init() Initializing DirectXInput failed - program exits now", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            DevJoysticks[(int)mfd] = js;
            return(js != null);
        }
Beispiel #4
0
        /// <summary>
        /// Initialize the MFD
        /// </summary>
        /// <param name="configString">A config string to assign buttons, labels</param>
        /// <param name="ip">The IP address of the SCJoyServer</param>
        /// <param name="port">The first Joystick port</param>
        /// <returns>True if successfull</returns>
        public bool InitMFD(UC_MFDtest owner, MfdInstance mfd, string configString, string ip, uint port)
        {
            m_owner = owner;

            Initialized = MFD.Init(owner, mfd, configString, ip, port);
            if (!Initialized)
            {
                return(false);
            }

            // Init Drawing stuff for this panel

            // A frame around the usable area
            MFD.GProc.Drawings.Add(MfdBase.Frame(Color.Green));
            // Create all labels with a prototype font and color
            MFD.GProc.Drawings.Add(MfdLabels.LabelList(
                                       new TextItem( )
            {
                Font            = m_owner.Font,
                TextBrush       = new SolidBrush(Color.LimeGreen),
                TextBrushActive = null,
                FillBrush       = null
            },
                                       MFD.ButtonLabelList));
            // Change individual items..

            // Add more to draw

            return(Initialized);
        }
Beispiel #5
0
        public static DevJoystick MfdDevice(MfdInstance mfd)
        {
            if (mfd == MfdInstance.MFD_None)
            {
                return(null);
            }

            return(DevJoysticks[(int)mfd]);
        }
Beispiel #6
0
 /// <summary>
 /// MFD Panel Events
 /// </summary>
 public UC_MFD_CmdEventArgs(MfdInstance mfd, string commandArgument, bool pressed)
 {
     Mfd             = mfd;
     CommandArgument = commandArgument;
     Pressed         = pressed;
 }
 // The command callback implementation - used by MfdSupport
 void IMfdSupport.Command(MfdInstance mfd, string commandArgument, bool pressed)
 {
     // just send it to the Owner Form - no local processing in the UC
     CommandEvent?.Invoke(this, new UC_MFD_CmdEventArgs(mfd, commandArgument, pressed));
 }
Beispiel #8
0
 /// <summary>
 /// Initialize the MFD
 ///  aquires the MFD device, reads the config and establishes a SCJoyServer client
 /// </summary>
 /// <param name="mfd">The MFD instance to handle</param>
 /// <param name="configString">A config string to assign buttons, labels</param>
 /// <param name="ip">The IP address of the SCJoyServer</param>
 /// <param name="port">The first Joystick port of the Server</param>
 /// <returns>True if successfull</returns>
 public bool InitMFD(MfdInstance mfd, string configString, string ip = "", uint port = 0)
 {
     return(m_mfd.InitMFD(this, mfd, configString, ip, port));
 }