static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); for (int i = 1; i <= 8; i++) { BoothController b = new BoothController(i); controllers.Add(i, b); } Application.Run(new frmController()); }
public frmController() { string Service_Port = ConfigurationManager.AppSettings["SERVICE_PORT"]; InitializeComponent(); Service_URL = "http://" + GetLocalIPAddress() + ":" + Service_Port + "/votecontroller"; Uri baseAddress = new Uri(Service_URL); host = new ServiceHost(typeof(JMOVoteService), baseAddress); ServiceMetadataBehavior smb = new ServiceMetadataBehavior(); smb.HttpGetEnabled = true; smb.MetadataExporter.PolicyVersion = PolicyVersion.Policy15; host.Description.Behaviors.Add(smb); host.Open(); int xpos = 10; int ypos = 10; int width = 160; int height = 150; for (int i = 1; i <= 8; i++) { if (i > 4 && ypos < height) { xpos = 10; ypos = ypos + height + 10; } BoothController b = Program.controllers[i]; b.Left = xpos; b.Top = ypos; this.Controls.Add(b); xpos += width; } }