public InteractionForm(PuppetMasterMaster master, string siteName)
 {
     InitializeComponent();
     this._master = master;
     Text = "Command - " + siteName;
     this.IndividualBox.KeyDown += iKeyDown;
     this.GroupBox.KeyDown += gKeyDown;
 }
        private static void InitializePuppetMasterMaster(string siteName)
        {
            PuppetMasterMaster master = new PuppetMasterMaster(siteName);
            BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();
            serverProv.TypeFilterLevel = TypeFilterLevel.Full;

            IDictionary prop = new Hashtable();
            int port = Utility.GetPort(siteName);
            prop["port"] = port;
            prop["name"] = siteName;

            try
            {
                TcpChannel channel = new TcpChannel(prop, null, serverProv);
                ChannelServices.RegisterChannel(channel, false);
                RemotingServices.Marshal(master, prop["name"].ToString(), typeof (IPuppetMasterMaster));
            } catch (Exception ex)
            {
                Console.Out.WriteLine("********************************************");
                Console.Out.WriteLine("*\tERROR: A problem occured while registering this service");
                Console.Out.WriteLine("*\t" + ex.Message);
                Console.Out.WriteLine("*********************************************");
                Console.ReadLine();
            }

            Console.Out.WriteLine("**Config:**");
            Console.Out.WriteLine("OrderingGuarantee: {0}", master.OrderingGuarantee);
            Console.Out.WriteLine("RoutingPolicy: {0}", master.RoutingPolicy);
            Console.Out.WriteLine("LoggingLevel: {0}", master.LoggingLevel);
            Console.Out.WriteLine("***********");
            string url = "tcp://*****:*****@"Running a " + master + " at " + url);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            InteractionForm form = new InteractionForm(master, siteName);
            master.LogDelegate = new DelegateDeliverMessage(form.DeliverMessage);

            master.Form = form;
            Application.Run(form);

            Console.WriteLine(@"Press any key to exit");
            Console.ReadLine();
        }