static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            f                 = new WiiBalanceScaleForm();
            StarFull          = f.lblQuality.Text.Substring(0, 1);
            StarEmpty         = f.lblQuality.Text.Substring(4, 1);
            f.lblWeight.Text  = "";
            f.lblQuality.Text = "";
            f.lblUnit.Text    = "";
            f.btnReset.Click += new System.EventHandler(btnReset_Click);
            f.lblUnit.Click  += new System.EventHandler(lblUnit_Click);

            ConnectBalanceBoard(false);
            if (f == null)
            {
                return;            //connecting required application restart, end this process here
            }
            BoardTimer          = new System.Windows.Forms.Timer();
            BoardTimer.Interval = 50;
            BoardTimer.Tick    += new System.EventHandler(BoardTimer_Tick);
            BoardTimer.Start();

            Application.Run(f);
            Shutdown();
        }
 static void Shutdown()
 {
     if (BoardTimer != null)
     {
         BoardTimer.Stop(); BoardTimer = null;
     }
     if (cm != null)
     {
         cm.Cancel(); cm = null;
     }
     if (f != null)
     {
         if (f.Visible)
         {
             f.Close();
         }
         f = null;
     }
 }
Example #3
0
        public WiiBalanceStatokinesigram()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            f = new WiiBalanceScaleForm();

            f.boxType.TextChanged   += new System.EventHandler(UpdateUI);
            f.boxType.TextChanged   += new System.EventHandler(SetExperimentType);
            f.txtName.TextChanged   += new System.EventHandler(UpdateUI);
            f.txtHeight.TextChanged += new System.EventHandler(UpdateUI);
            f.txtWeight.TextChanged += new System.EventHandler(UpdateUI);
            f.txtNotes.TextChanged  += new System.EventHandler(UpdateUI);
            f.boxSex.TextChanged    += new System.EventHandler(UpdateUI);
            f.txtPath.TextChanged   += new System.EventHandler(UpdateUI);

            f.countdown.TextChanged += new System.EventHandler(Countdown_changed);

            f.txtPath.Text = Environment.ExpandEnvironmentVariables("%userprofile%"); //default path

            f.btnReset.Click += new System.EventHandler(Reset_click);

            f.btnStart.Enabled = false;
            f.btnStart.Click  += new System.EventHandler(StartTimer_click);

            ConnectBalanceBoard(false);

            if (f == null)
            {
                //connecting required application restart, end this process here
                Shutdown();
                return;
            }

            f.btnZero.Click  += BtnZero_Click;
            f.btnScale.Click += BtnWeight_Click;

            pm = new PlayerManager();

            Application.Run(f);
            Shutdown();
        }