Example #1
0
        private void NewToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FileCreator fileCreate = new FileCreator();

            fileCreate.ShowDialog();
            AutomationElementTreeControl aetc = new AutomationElementTreeControl();

            this.Text = "Visual UI Automation Verify : Client Side Provider - File Name : " + aetc.FileName;
        }
Example #2
0
        /// <summary>
        /// this will stop highlighting, release all handlers and references.
        /// </summary>
        public void Dispose()
        {
            if (!_isDisposed)
            {
                StopHighlighting();
                OnDispose();

                _treeControl = null;
                _isDisposed  = true;
            }
        }
Example #3
0
        /// <summary>
        /// creates appropriate ElementHighLighter according to the id
        /// </summary>
        /// <returns>new instance of ElementHighLighter</returns>
        public static ElementHighlighter CreateHighlighterById(string id, AutomationElementTreeControl treeControl)
        {
            Debug.Assert(id != null);

            switch (id.ToUpper())
            {
            case BoundingRectangle: return(new BoundingRectangleElementHighLighter(treeControl));

            case FadingBoundingRectangle: return(new FadingBoundingRectangleElementHighLighter(treeControl));

            case BoundingRectangleAndRays: return(new RaysAndBoundingRectangleElementHighlighter(treeControl));

            default:
                throw new ArgumentException(String.Format("Invalid argument value {0}", id));
            }
        }
Example #4
0
        private void OpenToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFile = new OpenFileDialog();

            openFile.Filter = "XML File Only |*.XML";
            if (openFile.ShowDialog() == DialogResult.OK)
            {
                selectedFileName = openFile.FileName;
                MessageBox.Show("File loaded: " + selectedFileName);
            }
            RepositoryUtility            utility  = new RepositoryUtility();
            RepositoryNode               nodeInfo = utility.ReadData(OpenFileLocation);
            AutomationElementTreeControl aetc     = new AutomationElementTreeControl();

            aetc.FileName = OpenFileLocation;
        }
Example #5
0
        public RaysAndBoundingRectangleElementHighlighter(AutomationElementTreeControl treeControl) : base(treeControl)
        {
            _topLeftVerticalRay       = new ScreenRectangle();
            _topLeftHorizontalRay     = new ScreenRectangle();
            _topRightVerticalRay      = new ScreenRectangle();
            _topRightHorizontalRay    = new ScreenRectangle();
            _bottomLeftVerticalRay    = new ScreenRectangle();
            _bottomLeftHorizontalRay  = new ScreenRectangle();
            _bottomRightVerticalRay   = new ScreenRectangle();
            _bottomRightHorizontalRay = new ScreenRectangle();

            this._rays = new ScreenRectangle[] { _topLeftVerticalRay, _topLeftHorizontalRay,
                                                 _topRightVerticalRay, _topRightHorizontalRay,
                                                 _bottomLeftVerticalRay, _bottomLeftHorizontalRay,
                                                 _bottomRightVerticalRay, _bottomRightHorizontalRay };

            double boundingRectOpacity = base._rectangle.Opacity;

            foreach (ScreenRectangle ray in this._rays)
            {
                ray.Color   = Drawing.Color.Blue;
                ray.Opacity = boundingRectOpacity;
            }
        }
Example #6
0
        private void OpenToolStripMenuItem_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFile = new OpenFileDialog();

            openFile.Filter = "XML File Only |*.XML";
            if (openFile.ShowDialog() == DialogResult.OK)
            {
                selectedFileName = openFile.FileName;
                MessageBox.Show("File loaded: " + selectedFileName, "Success!!", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            RepositoryUtility utility = new RepositoryUtility();

            if (!string.IsNullOrEmpty(OpenFileLocation))
            {
                RepositoryNode nodeInfo           = utility.ReadData(OpenFileLocation);
                AutomationElementTreeControl aetc = new AutomationElementTreeControl();
                aetc.FileName = OpenFileLocation;
                this.Text     = "Visual UI Automation Verify : Client Side Provider - File Name : " + OpenFileLocation;
            }
            else if (string.IsNullOrEmpty(OpenFileLocation))
            {
                this.Text = "Visual UI Automation Verify : Client Side Provider";
            }
        }
Example #7
0
        private void Button1_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(FileName.Text) || string.IsNullOrEmpty(FileLocation.Text))
            {
                MessageBox.Show("File Name and Folder Location should not be empty", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            else if (!ValidateFileName(FileName.Text) || !TryGetFullPath(FileLocation.Text))
            {
                if (!ValidateFileName(FileName.Text))
                {
                    MessageBox.Show("Invalid file name.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                else if (!TryGetFullPath(FileLocation.Text))
                {
                    MessageBox.Show("Invalid folder path.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
                return;
            }

            string folderName = string.Concat(FileLocation.Text.Substring(FileLocation.Text.LastIndexOf("\\"),
                                                                          FileLocation.Text.Length - FileLocation.Text.LastIndexOf("\\")).Replace(@"\", ""));

            FileLocation.Text = Path.GetFullPath(FileLocation.Text);

            if (FileLocation.Text == fileDirPath)
            {
                DialogResult dr = MessageBox.Show("Folder Name: '" + folderName + "' already exists. \nClick OK to enter File Location", "Error", MessageBoxButtons.OK);
                FileLocation.Focus();
                return;
            }

            try
            {
                //if (!ValidateFileName(FileName.Text))
                //{
                //    MessageBox.Show("Invalid file name .Expected file name [Examlple : fileName.xml]", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //    return;
                //}
                // check File not created
                bool fileExists   = File.Exists(FileLocation.Text + @"\" + FileName.Text);
                bool folderExists = Directory.Exists(FileLocation.Text);
                if (fileExists)
                {
                    MessageBox.Show("Folder &File already Exists", "Warining",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation,
                                    MessageBoxDefaultButton.Button1);
                    xmlLocation = FileLocation.Text + "\\" + FileName.Text;
                    return;
                }
                else if (folderExists)
                {
                    DialogResult dr = MessageBox.Show("Folder already exists but file not exists.\nDo you want to create xml file as folder already exists? ", "Warining",
                                                      MessageBoxButtons.YesNo,
                                                      MessageBoxIcon.Exclamation,
                                                      MessageBoxDefaultButton.Button1);

                    if (dr == DialogResult.Yes)
                    {
                        File.Create(FileLocation.Text + "\\" + FileName.Text);
                        //Strore file location
                        xmlLocation = FileLocation.Text + "\\" + FileName.Text;
                        DialogResult d = MessageBox.Show("File creation successful. File Name: " + string.Concat(FileLocation.Text, @"\", FileName.Text), "Message", MessageBoxButtons.OK);
                        if (d == DialogResult.OK)
                        {
                            this.Close();
                        }
                    }
                    else if (dr == DialogResult.No)
                    {
                        FileLocation.Focus();
                    }
                }
                else
                {
                    Directory.CreateDirectory(FileLocation.Text);
                    //create xml file
                    File.Create(FileLocation.Text + "\\" + FileName.Text);
                    //Strore file location
                    xmlLocation = FileLocation.Text + "\\" + FileName.Text;
                    DialogResult d = MessageBox.Show("'File Created Successfully:' " + string.Concat(FileLocation.Text, @"\", FileName.Text), "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (d == DialogResult.OK)
                    {
                        this.Close();
                    }
                }
            }
            catch
            {
                MessageBox.Show("Error Cannot Access Location", "Warining",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
            }
            AutomationElementTreeControl aetc = new AutomationElementTreeControl();

            aetc.FileName = NewFileLocation;
        }
Example #8
0
 public ElementHighlighter(AutomationElementTreeControl treeControl)
 {
     Debug.Assert(treeControl != null);
     this._treeControl = treeControl;
 }
Example #9
0
 public FadingBoundingRectangleElementHighLighter(AutomationElementTreeControl treeControl) : base(treeControl)
 {
 }
Example #10
0
 public BoundingRectangleElementHighLighter(AutomationElementTreeControl treeControl) : base(treeControl)
 {
     _rectangle.Color   = Drawing.Color.Red;
     _rectangle.Opacity = 0.8;
 }
Example #11
0
 /// <summary>
 /// initialize with tree control
 /// </summary>
 public HoverMode(AutomationElementTreeControl TreeControl)
 {
     this._treeControl = TreeControl;
 }
Example #12
0
        private void Button1_Click(object sender, EventArgs e)
        {
            string folderName = string.Concat(FileLocation.Text.Substring(FileLocation.Text.LastIndexOf("\\"),
                                                                          FileLocation.Text.Length - FileLocation.Text.LastIndexOf("\\")).Replace(@"\", ""));

            if (FileLocation.Text == fileDirPath)
            {
                DialogResult dr = MessageBox.Show("Folder Name: '" + folderName + "' already exists. \nClick OK to enter File Location", "Error", MessageBoxButtons.OK);
                FileLocation.Focus();
                return;
            }
            else
            {
                foreach (string d in Directory.GetDirectories(fileDirPath, "*.*", SearchOption.AllDirectories))
                {
                    if (new DirectoryInfo(d).Name.ToUpperInvariant().Equals(folderName.ToUpperInvariant()))
                    {
                        DialogResult dr = MessageBox.Show("Folder Name: '" + folderName + "' already exists. \nClick OK to continue or Cancel to re-enter File Location",
                                                          "Warning", MessageBoxButtons.OKCancel);
                        if (dr == DialogResult.Cancel)
                        {
                            FileLocation.Focus();
                            return;
                        }
                        break;
                    }
                }
            }
            try
            {
                // check File not created
                if (!File.Exists(FileLocation.Text + "\\" + FileName.Text))
                {
                    if (!Directory.Exists(FileLocation.Text))
                    {
                        Directory.CreateDirectory(FileLocation.Text);
                    }
                    //create xml file
                    File.Create(FileLocation.Text + "\\" + FileName.Text);
                    //Strore file location
                    xmlLocation = FileLocation.Text + "\\" + FileName.Text;
                    DialogResult d = MessageBox.Show("'File Created Successfully:' " + string.Concat(FileLocation.Text, @"\", FileName.Text), "Message", MessageBoxButtons.OK);
                    if (d == DialogResult.OK)
                    {
                        this.Close();
                    }
                }
                else
                {
                    MessageBox.Show("Folder/File already Exists", "Warining",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Exclamation,
                                    MessageBoxDefaultButton.Button1);
                    xmlLocation = FileLocation.Text + "\\" + FileName.Text;
                }
            }
            catch
            {
                MessageBox.Show("Error creating file .Cannot Access Location");
            }
            AutomationElementTreeControl aetc = new AutomationElementTreeControl();

            aetc.FileName = NewFileLocation;
        }
Example #13
0
 public FocusTracer(AutomationElementTreeControl TreeControl)
 {
     this._treeControl = TreeControl;
 }