示例#1
0
文件: Menu.cs 项目: nagappan/cobra
 public int CloseWindow(String windowName)
 {
     if (String.IsNullOrEmpty(windowName))
     {
         String[] windowList = null;
         Generic generic = new Generic(this.utils);
         try
         {
             windowList = generic.GetWindowList();
             foreach (String window in windowList)
             {
                 ArrayList menuList = new ArrayList();
                 try
                 {
                     if (utils.InternalGuiExist(window, "mnuSystem") == 1)
                     {
                         generic.GrabFocus(window);
                         InternalMenuHandler(window, "mnuSystem;mnuClose",
                             ref menuList, "Window");
                     }
                 }
                 catch (Exception ex)
                 {
                     LogMessage(ex);
                 }
                 finally
                 {
                     menuList = null;
                 }
             }
             return 1;
         }
         finally
         {
             generic = null;
             windowList = null;
         }
     }
     else
     {
         ArrayList menuList = new ArrayList();
         try
         {
             return InternalMenuHandler(windowName, "mnuSystem;mnuClose",
                 ref menuList, "Window");
         }
         finally
         {
             menuList = null;
         }
     }
 }
示例#2
0
 public string[] GetChild(String windowName, String childName = null,
     string role = null, string parentName = null)
 {
     Generic generic = new Generic(this);
     try
     {
         return generic.GetChild(windowName, childName, role, parentName);
     }
     finally
     {
         generic = null;
     }
 }
示例#3
0
 public string[] GetObjectNameAtCoords(int waitTime = 0)
 {
     Generic generic = new Generic(this);
     try
     {
         return generic.GetObjectNameAtCoords(waitTime);
     }
     finally
     {
         generic = null;
     }
 }
示例#4
0
 public string GetObjectProperty(String windowName, String objName,
     string property)
 {
     Generic generic = new Generic(this);
     try
     {
         return generic.GetObjectProperty(windowName, objName, property);
     }
     finally
     {
         generic = null;
     }
 }
示例#5
0
 public string[] GetObjectInfo(String windowName, String objName)
 {
     Generic generic = new Generic(this);
     try
     {
         return generic.GetObjectInfo(windowName, objName);
     }
     finally
     {
         generic = null;
     }
 }
示例#6
0
 public int[] GetWindowSize(String windowName)
 {
     Generic generic = new Generic(this);
     try
     {
         return generic.GetWindowSize(windowName);
     }
     finally
     {
         generic = null;
     }
 }
示例#7
0
        public int SimulateMouseMove(int source_x, int source_y, int dest_x, int dest_y, double delay = 0.0)
        {
            int[]   size;
            Generic generic = new Generic(utils);

            try
            {
                size = generic.GetWindowSize("paneProgramManager");
            }
            finally
            {
                generic = null;
            }
            if (source_x < size[0] || source_y <size[1] ||
                                                dest_x> size[2] || dest_y > size[3] ||
                source_x > size[2] || source_y > size[3] ||
                dest_x < size[0] || dest_y < size[1])
            {
                return(0);
            }
            bool x_flag = true; // Iterated x ?
            bool y_flag = true; // Iterated y ?

            while (true)
            {
                if (x_flag)
                {
                    if (source_x > dest_x)
                    {
                        // If source X greather than dest X
                        // then move -1 pixel
                        source_x -= 1;
                    }
                    else if (source_x < dest_x)
                    {
                        // If source X less than dest X
                        // then move +1 pixel
                        source_x += 1;
                    }
                    else
                    {
                        // If source X equal to dest X
                        // then don't process X co-ordinate
                        x_flag = false;
                    }
                }
                if (y_flag)
                {
                    if (source_y > dest_y)
                    {
                        // If source Y greather than dest Y
                        // then move -1 pixel
                        source_y -= 1;
                    }
                    else if (source_y < dest_y)
                    {
                        // If source Y less than dest Y
                        // then move +1 pixel
                        source_y += 1;
                    }
                    else
                    {
                        // If source Y equal to dest Y
                        // then don't process Y co-ordinate
                        y_flag = false;
                    }
                }
                if (delay != 0.0)
                {
                    utils.InternalWait(delay);
                }
                // Start mouse move from source_x, source_y to dest_x, dest_y
                GenerateMouseEvent(source_x, source_y, "abs");
                if (source_x == dest_x && source_y == dest_y)
                {
                    // If we have reached the dest_x and dest_y
                    // then break the loop
                    break;
                }
            }
            return(1);
        }
示例#8
0
 public int Click(String windowName, String objName)
 {
     Generic generic = new Generic(this);
     try
     {
         return generic.Click(windowName, objName);
     }
     finally
     {
         generic = null;
     }
 }
示例#9
0
 public int HasState(String windowName, String objName,
     String state, int guiTimeOut = 0)
 {
     Generic generic = new Generic(this);
     try
     {
         return generic.HasState(windowName, objName, state, guiTimeOut);
     }
     finally
     {
         generic = null;
     }
 }
示例#10
0
 public int ObjectExist(String windowName, String objName)
 {
     Generic generic = new Generic(this);
     try
     {
         return generic.ObjectExist(windowName, objName);
     }
     finally
     {
         generic = null;
     }
 }
示例#11
0
 public int GrabFocus(String windowName, String objName = null)
 {
     Generic generic = new Generic(this);
     try
     {
         return generic.GrabFocus(windowName, objName);
     }
     finally
     {
         generic = null;
     }
 }
示例#12
0
 public String[] GetWindowList()
 {
     Generic generic = new Generic(this);
     try
     {
         return generic.GetWindowList();
     }
     finally
     {
         generic = null;
     }
 }
示例#13
0
文件: Mouse.cs 项目: nagappan/cobra
 public int SimulateMouseMove(int source_x, int source_y, int dest_x, int dest_y, double delay = 0.0)
 {
     int[] size;
     Generic generic = new Generic(utils);
     try
     {
         size = generic.GetWindowSize("paneProgramManager");
     }
     finally
     {
         generic = null;
     }
     if (source_x < size[0] || source_y < size[1] ||
         dest_x > size[2] || dest_y > size[3] ||
         source_x > size[2] || source_y > size[3] ||
         dest_x < size[0] || dest_y < size[1])
         return 0;
     bool x_flag = true; // Iterated x ?
     bool y_flag = true; // Iterated y ?
     while (true)
     {
         if (x_flag)
         {
             if (source_x > dest_x)
             {
                 // If source X greather than dest X
                 // then move -1 pixel
                 source_x -= 1;
             }
             else if (source_x < dest_x)
             {
                 // If source X less than dest X
                 // then move +1 pixel
                 source_x += 1;
             }
             else
             {
                 // If source X equal to dest X
                 // then don't process X co-ordinate
                 x_flag = false;
             }
         }
         if (y_flag)
         {
             if (source_y > dest_y)
             {
                 // If source Y greather than dest Y
                 // then move -1 pixel
                 source_y -= 1;
             }
             else if (source_y < dest_y)
             {
                 // If source Y less than dest Y
                 // then move +1 pixel
                 source_y += 1;
             }
             else
             {
                 // If source Y equal to dest Y
                 // then don't process Y co-ordinate
                 y_flag = false;
             }
         }
         if (delay != 0.0)
             utils.InternalWait(delay);
         // Start mouse move from source_x, source_y to dest_x, dest_y
         GenerateMouseEvent(source_x, source_y, "abs");
         if (source_x == dest_x && source_y == dest_y)
         {
             // If we have reached the dest_x and dest_y
             // then break the loop
             break;
         }
     }
     return 1;
 }
示例#14
0
文件: Core.cs 项目: killerswan/cobra
 public int ActivateWindow(String windowName)
 {
     Generic generic = new Generic(this);
     try
     {
         return generic.GrabFocus(windowName);
     }
     finally
     {
         generic = null;
     }
 }
示例#15
0
 public string[] GetAppList()
 {
     Generic generic = new Generic(this);
     try
     {
         return generic.GetAppList();
     }
     finally
     {
         generic = null;
     }
 }
示例#16
0
 public int StateEnabled(String windowName, String objName)
 {
     Generic generic = new Generic(this);
     try
     {
         return generic.StateEnabled(windowName, objName);
     }
     finally
     {
         generic = null;
     }
 }
示例#17
0
 public string[] GetAllStates(String windowName, String objName)
 {
     Generic generic = new Generic(this);
     try
     {
         return generic.GetAllStates(windowName, objName);
     }
     finally
     {
         generic = null;
     }
 }
示例#18
0
 public String[] GetObjectList(String windowName)
 {
     Generic generic = new Generic(this);
     try
     {
         return generic.GetObjectList(windowName);
     }
     finally
     {
         generic = null;
     }
 }
示例#19
0
 public String GetAccessKey(String windowName, String objName)
 {
     Generic generic = new Generic(this);
     try
     {
         return generic.GetAccessKey(windowName, objName);
     }
     finally
     {
         generic = null;
     }
 }