Ejemplo n.º 1
0
 private void mnuToolsTiming_Click(object sender, EventArgs e)
 {
     using (frmTiming objfrmTiming = new frmTiming())
     {
         frmDataWindow activeMdiChild = (frmDataWindow)base.ActiveMdiChild;
         objfrmTiming.endTime = activeMdiChild.endTime;
         if (objfrmTiming.ShowDialog() == DialogResult.OK)
         {
             foreach (frmDataWindow objfrmDataWindow in base.MdiChildren)
             {
                 objfrmDataWindow.endTime = objfrmTiming.endTime;
             }
         }
     }
 }
Ejemplo n.º 2
0
        private void openWiiMoteWindows()
        {
            int count = 1;

            foreach (Wiimote wiimote in this.mWC)
            {
                frmDataWindow objfrmDataWindow = new frmDataWindow(wiimote)
                {
                    MdiParent = this,
                    Text      = "Wiimote " + count.ToString()
                };
                this.mWiimoteMap[wiimote.ID]     = objfrmDataWindow;
                wiimote.WiimoteChanged          += new EventHandler <WiimoteChangedEventArgs>(this.wm_WiimoteChanged);
                wiimote.WiimoteExtensionChanged += new EventHandler <WiimoteExtensionChangedEventArgs>(this.wm_WiimoteExtensionChanged);
                wiimote.SetLEDs(count++);
                string      subkey = @"Software\MDWSoftware\WiiPhysics\Parameters";
                RegistryKey key    = Registry.CurrentUser.CreateSubKey(subkey);
                if (key.GetValue("BarLength") != null)
                {
                    objfrmDataWindow.barLength = Convert.ToDouble(key.GetValue("BarLength"));
                }
                else
                {
                    objfrmDataWindow.barLength = 0.2;
                }
                if ((key.GetValue("EndTime") != null) && (key.GetValue("ContinuousScan") != null))
                {
                    if (Convert.ToBoolean(key.GetValue("ContinuousScan")))
                    {
                        objfrmDataWindow.endTime = double.PositiveInfinity;
                    }
                    else
                    {
                        objfrmDataWindow.endTime = Convert.ToDouble(key.GetValue("EndTime"));
                    }
                }
                else
                {
                    objfrmDataWindow.endTime = double.PositiveInfinity;
                }
                if (wiimote.WiimoteState.ExtensionType != ExtensionType.BalanceBoard)
                {
                    wiimote.SetReportType(InputReport.IRExtensionAccel, IRSensitivity.Maximum, true);
                    objfrmDataWindow.scanMode        = "rbAccelerometer";
                    objfrmDataWindow.graphsToShow[0] = true;
                    objfrmDataWindow.graphsToShow[1] = true;
                    objfrmDataWindow.graphsToShow[2] = true;
                    objfrmDataWindow.graphsToShow[3] = false;
                }
                else
                {
                    wiimote.SetLEDs(true, false, false, false);
                    objfrmDataWindow.scanMode        = "rbBalanceBoard";
                    objfrmDataWindow.graphsToShow[0] = true;
                    objfrmDataWindow.graphsToShow[1] = true;
                    objfrmDataWindow.graphsToShow[2] = true;
                    objfrmDataWindow.graphsToShow[3] = true;
                    objfrmDataWindow.graphsToShow[4] = true;
                }
                objfrmDataWindow.Show();
                try
                {
                    switch (base.MdiChildren.Length)
                    {
                    case 0:
                    {
                        continue;
                    }

                    case 1:
                    {
                        base.ActiveMdiChild.WindowState = FormWindowState.Maximized;
                        continue;
                    }
                    }
                    base.LayoutMdi(MdiLayout.TileHorizontal);
                    continue;
                }
                catch (Exception exception)
                {
                    MessageBox.Show(exception.Message, "Unknown error", MessageBoxButtons.OK, MessageBoxIcon.Hand);
                    continue;
                }
            }
        }