Ejemplo n.º 1
0
        async private void OnMouseUp(InputEventArgs e)
        {
            try
            {
                IRecordEvent re = new RecordEvent
                {
                    Button = e.Button
                };
                re.Selector = new WindowsSelector(e.Element.RawElement, null, false);
                if (re.Selector == null)
                {
                    return;
                }
                if (re.Selector.Count < 2)
                {
                    return;
                }
                re.OffsetX   = e.X - e.Element.Rectangle.X;
                re.OffsetY   = e.Y - e.Element.Rectangle.Y;
                re.UIElement = e.Element;
                re.Element   = e.Element;
                re.X         = e.X;
                re.Y         = e.Y;

                foreach (var p in Plugins.recordPlugins)
                {
                    // if (p.Name != "Windows")
                    if (p.Name == "IE" || p.Name == "Java" || p.Name == "NM")
                    {
                        try
                        {
                            if (p.ParseUserAction(ref re))
                            {
                                continue;
                            }
                        }
                        catch (Exception ex)
                        {
                            Log.Error(ex.ToString());
                        }
                    }
                }

                if (e.Element == null)
                {
                    return;
                }
                var i = new mouseevent(re);
                try
                {
                    await global.webSocketClient.InsertOne(PluginConfig.collectionname, 0, false, i);
                }
                catch (Exception ex)
                {
                    Log.Error(ex.ToString());
                }
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
            }
        }
Ejemplo n.º 2
0
        private void OnMouseUp(InputEventArgs e)
        {
            try
            {
                //if (e.Element == null) return;
                //var pathToRoot = new List<AutomationElement>();
                //AutomationElement element = e.Element.RawElement;
                //WindowsSelector selector = new WindowsSelector(element, null, false);
                //var json = selector.ToString();
                //var i = new dbitem() { Selector = JArray.Parse(json) };
                //_ = global.webSocketClient.InsertOne(PluginConfig.collectionname, 0, false, i);
                IRecordEvent re = new RecordEvent
                {
                    Button = e.Button
                };
                re.Selector = new WindowsSelector(e.Element.RawElement, null, false);
                if (re.Selector == null)
                {
                    return;
                }
                if (re.Selector.Count < 2)
                {
                    return;
                }
                re.OffsetX   = e.X - e.Element.Rectangle.X;
                re.OffsetY   = e.Y - e.Element.Rectangle.Y;
                re.UIElement = e.Element;
                re.Element   = e.Element;
                re.X         = e.X;
                re.Y         = e.Y;

                foreach (var p in Plugins.recordPlugins)
                {
                    // if (p.Name != "Windows")
                    if (p.Name == "IE" || p.Name == "Java" || p.Name == "NM")
                    {
                        try
                        {
                            if (p.ParseUserAction(ref re))
                            {
                                continue;
                            }
                        }
                        catch (Exception ex)
                        {
                            Log.Error(ex.ToString());
                        }
                    }
                }

                if (e.Element == null)
                {
                    return;
                }
                var i = new mouseevent(re);
                _ = global.webSocketClient.InsertOne(PluginConfig.collectionname, 0, false, i);
            }
            catch (Exception ex)
            {
                Log.Error(ex.ToString());
            }
        }