예제 #1
0
        void Wiimote_ExtensionAttached(object sender, WiimoteExtensionEventArgs e)
        {
            IWiimoteExtension wiimoteExtension = Wiimote.Extension;

            Invoke(new Action <IWiimoteExtension>(delegate(IWiimoteExtension extension)
            {
                Control extensionControl = null;
                if (extension is NunchukExtension)
                {
                    NunchukUserControl nunchukUC = new NunchukUserControl();
                    nunchukUC.Nunchuk            = (NunchukExtension)extension;
                    extensionControl             = nunchukUC;
                }
                else if (extension is ClassicControllerExtension)
                {
                    ClassicControllerUserControl classicControllerUC = new ClassicControllerUserControl();
                    classicControllerUC.ClassicController            = (ClassicControllerExtension)extension;
                    extensionControl = classicControllerUC;
                }
                else if (extension is GuitarExtension)
                {
                    GuitarUserControl guitarUC = new GuitarUserControl();
                    guitarUC.Guitar            = (GuitarExtension)extension;
                    extensionControl           = guitarUC;
                }

                ExtensionControl = (IExtensionControl)extensionControl;
                if (extensionControl != null)
                {
                    extensionBox.Height = extensionControl.Height + 50;
                    extensionBox.Text   = extension.GetType().Name;
                    extensionBox.Controls.Add(extensionControl);
                    extensionControl.Dock = DockStyle.Fill;
                    this.Height           = extensionBox.Top + extensionBox.Height;
                }
                reportingmodeBox.SelectedItem = Wiimote.ReportingMode;
            }), wiimoteExtension);
        }
예제 #2
0
        void Wiimote_ExtensionAttached(object sender, WiimoteExtensionEventArgs e)
        {
            IWiimoteExtension wiimoteExtension = Wiimote.Extension;
            Invoke(new Action<IWiimoteExtension>(delegate(IWiimoteExtension extension)
            {
                Control extensionControl = null;
                if (extension is NunchukExtension)
                {
                    NunchukUserControl nunchukUC = new NunchukUserControl();
                    nunchukUC.Nunchuk = (NunchukExtension)extension;
                    extensionControl = nunchukUC;
                }
                else if (extension is ClassicControllerExtension)
                {
                    ClassicControllerUserControl classicControllerUC = new ClassicControllerUserControl();
                    classicControllerUC.ClassicController = (ClassicControllerExtension)extension;
                    extensionControl = classicControllerUC;
                }
                else if (extension is GuitarExtension)
                {
                    GuitarUserControl guitarUC = new GuitarUserControl();
                    guitarUC.Guitar = (GuitarExtension)extension;
                    extensionControl = guitarUC;
                }

                ExtensionControl = (IExtensionControl)extensionControl;
                if (extensionControl != null)
                {
                    extensionBox.Height = extensionControl.Height + 50;
                    extensionBox.Text = extension.GetType().Name;
                    extensionBox.Controls.Add(extensionControl);
                    extensionControl.Dock = DockStyle.Fill;
                    this.Height = extensionBox.Top + extensionBox.Height;
                }
                reportingmodeBox.SelectedItem = Wiimote.ReportingMode;
            }), wiimoteExtension);
        }