public InterfaceCommand(AutomationElement element)
        {
            Element = element;
            UpdateTexts();
            Command = new RelayCommand(async(parameter) =>
            {
                if ((parameter as Tree <InterfaceCommand>).IsLeaf)
                {
                    await Task.Run(async() =>
                    {
                        try
                        {
                            Debug.WriteLine(element.Current.ControlType.ProgrammaticName);
                            if (element.Current.ControlType == ControlType.Button)
                            {
                                var com = element.GetCurrentPattern(InvokePattern.Pattern) as InvokePattern;
                                com.Invoke();
                            }
                            else if (element.Current.ControlType == ControlType.ListItem)
                            {
                                var com = element.GetCurrentPattern(SelectionItemPattern.Pattern) as SelectionItemPattern;
                                com.Select();
                            }

                            await Task.Delay(300);
                            await UpdateTexts();
                        }
                        catch (ElementNotAvailableException)
                        {
                        }
                        catch (ElementNotEnabledException)
                        {
                        }
                    });
                }
                else
                {
                    Debug.WriteLine("Inspect");
                    Inspect?.Invoke(this, (parameter as Tree <InterfaceCommand>));
                }
            });
        }