// This is a one off function that is called the first time the MainLoop() // function runs, it just sets up a few of the UI elements that only need // updating once. private void SetupFormLayout() { // need validator class instance if (Payout == null) { MessageBox.Show("Validator class is null.", "ERROR"); return; } // Positioning int x = 600, y = 40; // Add label Label lbl = new Label(); lbl.Location = new Point(x, y - 10); lbl.Size = new Size(80, 30); lbl.Text = "Recycle\nChannels:"; Controls.Add(lbl); for (int i = 1; i <= Payout.NumberOfChannels; i++) { CheckBox c = new CheckBox(); c.Location = new Point(x, y + (i * 20)); c.Name = i.ToString(); ChannelData d = new ChannelData(); Payout.GetDataByChannel(i, ref d); c.Text = CHelpers.FormatToCurrency(d.Value) + " " + new String(d.Currency); c.Checked = d.Recycling; c.CheckedChanged += new EventHandler(recycleBox_CheckedChange); Controls.Add(c); } }
// This is a one off function that is called the first time the MainLoop() // function runs, it just sets up a few of the UI elements that only need // updating once. private void SetupFormLayout() { // Get channel levels in hopper tbCoinLevels.Text = Hopper.GetChannelLevelInfo(); // setup list of recyclable channel tick boxes based on OS type System.OperatingSystem osInfo = System.Environment.OSVersion; int x1 = 0, y1 = 0, x2 = 0, y2 = 0; // XP, 2000, Server 2003 if (osInfo.Platform == PlatformID.Win32NT && osInfo.Version.Major == 5) { x1 = this.Location.X + 455; y1 = this.Location.Y + 10; x2 = this.Location.X + 780; y2 = this.Location.Y + 10; } // Vista, 7 else if (osInfo.Platform == PlatformID.Win32NT && osInfo.Version.Major == 6) { x1 = this.Location.X + 458; y1 = this.Location.Y + 12; x2 = this.Location.X + 780; y2 = this.Location.Y + 12; } GroupBox g1 = new GroupBox(); g1.Size = new Size(100, 380); g1.Location = new Point(x1, y1); g1.Text = "Hopper Recycling"; GroupBox g2 = new GroupBox(); g2.Size = new Size(100, 380); g2.Location = new Point(x2, y2); g2.Text = "Payout Recycling"; // Hopper checkboxes for (int i = 1; i <= Hopper.NumberOfChannels; i++) { CheckBox c = new CheckBox(); c.Location = new Point(5, 20 + (i * 20)); c.Name = i.ToString(); c.Text = CHelpers.FormatToCurrency(Hopper.GetChannelValue(i)) + " " + new String(Hopper.GetChannelCurrency(i)); c.Checked = Hopper.IsChannelRecycling(i); c.CheckedChanged += new EventHandler(recycleBoxHopper_CheckedChange); g1.Controls.Add(c); } // Payout checkboxes for (int i = 1; i <= Payout.NumberOfChannels; i++) { CheckBox c = new CheckBox(); c.Location = new Point(5, 20 + (i * 20)); c.Name = i.ToString(); ChannelData d = new ChannelData(); Payout.GetDataByChannel(i, ref d); c.Text = CHelpers.FormatToCurrency(d.Value) + " " + new String(d.Currency); c.Checked = d.Recycling; c.CheckedChanged += new EventHandler(recycleBoxPayout_CheckedChange); g2.Controls.Add(c); } Controls.Add(g1); Controls.Add(g2); }