public BlockCreatorGui(PageObjectCreatorGui main) { _main = main; Owner = main; Receiver.SetReceivingForm(this); EnterBlockName(null, null); SuspendLayout(); ClientSize = new Size(400, 300); MinimumSize = new Size(320, 240); _enterBlockName.Click += EnterBlockName; _reset.Click += Reset; _fileMenu.MenuItems.Add(_enterBlockName); _fileMenu.MenuItems.Add(_reset); _menu.MenuItems.Add(_fileMenu); Menu = _menu; _grid.Columns.Add("Label (Editable)", "Label (Editable)"); _grid.Columns.Add("Selector", "Selector"); _grid.Columns.Add("Make Enumerable", "Make Enumerable"); _grid.RowHeadersVisible = false; _grid.AllowUserToResizeRows = false; _grid.AllowUserToAddRows = false; _grid.AllowUserToDeleteRows = false; _grid.AllowUserToOrderColumns = false; _grid.EditMode = DataGridViewEditMode.EditOnKeystroke; _grid.CellEndEdit += GridEdit; _grid.KeyUp += KeyUpHandler; _viewBlock.Text = "Save and View my Block"; _viewBlock.Click += ViewBlock; UpdateControlSize(null, null); Controls.Add(_grid); Controls.Add(_viewBlock); FormClosed += EndApplication; Resize += UpdateControlSize; ResumeLayout(); //Show dialog restricts the parent to be interacted with. ShowDialog(); Activate(); UpdateGridView(); }
private static void Main(string[] args) { _mainGui = new PageObjectCreatorGui(); //Note: The port number 8055 is meaningless. It simply must be the same as the port //number used in content.js within the chrome extension. _mainReceiver = new Receiver(_mainGui, 8055); var worker = new BackgroundWorker(); worker.WorkerSupportsCancellation = false; worker.WorkerReportsProgress = false; //The background worker's thread begin's in the receiver's StartRecording method. worker.DoWork += _mainReceiver.StartReceiving; //This starts the worker. worker.RunWorkerAsync(); //This starts and controls the GUI's thread. Part of and required for the C# Form Paradigm. Application.Run(_mainGui); }