示例#1
0
        /// <summary>
        /// Retrieve the control contained in the supplied IEContainer
        /// </summary>
        /// <param name="IE">IEContainer</param>
        internal static void GenerateControl(IEDocument IE, ControlSelection selections, List<Control> validControls, List<Control> invalidControl)
        {
            Control tempControl = new Control();

            Cursor.Current = Cursors.WaitCursor;

            //Loop through all types of control supported by Watin and add the control to the appropriate control list

            AddControlsforDocument(IE, selections, validControls, invalidControl,"");

            if (IE.Frames.Count > 0)
            {
                foreach (var item in IE.Frames)
                {
                    AddControlsforDocument(item, selections, validControls, invalidControl,item.Id);
                }
            }

            Cursor.Current = Cursors.Default;
        }
示例#2
0
        private void WindowFinder_MouseUp(object sender, MouseEventArgs e)
        {
            EndSearch();
            IEDocument Ie = new IEDocument(winPoint);
            if (Ie.NativeDocument != null)
            {
                if (String.IsNullOrEmpty(Namespace))
                {
                    Namespace = "TheNameSpace";
                }
                Namespace = Utility.ConvertStringToCamelCase(Namespace);

                // If a class name has not been specified, use the page title.

                if (String.IsNullOrEmpty(ClassName))
                {
                    ClassName = Utility.TransformToAlphaNumeric(Ie.Title);
                    ClassName = Utility.ConvertStringToCamelCase(ClassName);
                }

                List<Control> validControls = new List<Control>();
                List<Control> invalidControls = new List<Control>();

                ControlGenerator.GenerateControl(Ie, Selection, validControls, invalidControls);

                string controlCS = ControlGenerator.GenerateControlCS(validControls, invalidControls, ClassName, Namespace);
                string PhysicalCS = ControlGenerator.GeneratePhysicalCS(validControls, invalidControls, ClassName, Namespace);
                string DataCS = ControlGenerator.GenerateDataCS(validControls, invalidControls, ClassName, Namespace);
                string VerificationCS = ControlGenerator.GenerateVerificationCS(validControls, invalidControls, ClassName, Namespace);

                if (Selection.SaveInSolutionStructure)
                {
                    SaveFilesInSolution(Namespace, ClassName, controlCS, PhysicalCS, DataCS, VerificationCS);
                    MessageBox.Show("Generation is complete.");
                }
                else
                {
                    if (Selection.GenerateControls)
                    {
                        SaveCs(controlCS, ClassName + ".Controls.generated");
                    }

                    if (Selection.GeneratePhysicalAndData)
                    {
                        SaveCs(PhysicalCS, ClassName + ".Physical.generated");
                        SaveCs(DataCS, ClassName + ".Data.generated");
                        SaveCs(VerificationCS, ClassName + ".Verification.generated");
                    }
                }

            }
            else
            {
                MessageBox.Show("No Web Page is detected on the cursor location", "Error");
            }
        }