public Dictionary <string, MenuAction> GetAction(object target, WindowAnalysisTreeInfo info)
        {
            var dic = new Dictionary <string, MenuAction>();

            if (target is UIElement uiElement)
            {
                dic["Pickup Children(&P)"]       = () => ElementPicker.PickupChildren(uiElement);
                dic["Create Control Driver(&D)"] = () => DriverDesigner.CreateControlDriver((UIElement)target);
                dic["Show Base Class(&B)"]       = () =>
                {
                    AnalyzeWindow.Output.Show();
                    var type = target.GetType();
                    AnalyzeWindow.Output.WriteLine(string.Empty);
                    while (type != null)
                    {
                        AnalyzeWindow.Output.WriteLine(type.FullName);
                        type = type.BaseType;
                    }
                };

                //非推奨
                dic["Create Driver (*Obsolete)"] = () =>
                {
                    using (var dom = System.CodeDom.Compiler.CodeDomProvider.CreateProvider("CSharp"))
                    {
                        new WPFDriverCreator(dom).CreateDriver(uiElement);
                    }
                };
            }
            return(dic);
        }
        public Dictionary <string, MenuAction> GetAction(object target, WindowAnalysisTreeInfo info)
        {
            var dic = new Dictionary <string, MenuAction>();

            if (target is DependencyObject ctrl)
            {
                dic["Create Driver(&C)"] = () =>
                {
                    using (var dom = CodeDomProvider.CreateProvider("CSharp"))
                    {
                        new WPFDriverCreator(dom).CreateDriver(ctrl);
                    }
                };
            }

            if (target is ItemsControl itemsControl)
            {
                dic["Create Items Control Driver(&I)"] = () =>
                {
                    using (var form = new InputDriverNameForm())
                    {
                        if (form.ShowDialog() != DialogResult.OK)
                        {
                            return;
                        }
                        using (var dom = CodeDomProvider.CreateProvider("CSharp"))
                        {
                            new WPFDriverCreator(dom).CreateItemsControlDriver(form.DriverName, itemsControl);
                        }
                    }
                };
            }
            return(dic);
        }
        public Dictionary <string, MenuAction> GetAction(object target, WindowAnalysisTreeInfo info)
        {
            var dic = new Dictionary <string, MenuAction>();

            if (target is Form || target is UserControl)
            {
                dic["Create Driver(&C)"] = () =>
                {
                    using (var dom = CodeDomProvider.CreateProvider("CSharp"))
                    {
                        new WinFormsDriverCreator(dom).CreateDriver((Control)target);
                    }
                };
            }
            return(dic);
        }
        public Dictionary <string, MenuAction> GetAction(object target, WindowAnalysisTreeInfo info)
        {
            var dic = new Dictionary <string, MenuAction>();

            var grid = target as DataGrid;

            if (grid != null)
            {
                dic["Create Grid Column Define to Output."] = () =>
                {
                    AnalyzeWindow.Output.Show();

                    AnalyzeWindow.Output.WriteLine("public class GridColumns");
                    AnalyzeWindow.Output.WriteLine("{");
                    int i = 0;
                    foreach (var e in grid.Columns)
                    {
                        AnalyzeWindow.Output.WriteLine("    const int " + e.Header.ToString().Replace(" ", "") + " = " + i++ + ";");
                    }
                    AnalyzeWindow.Output.WriteLine("}");
                };

                dic["Create Grid Column Define to Code View."] = () =>
                {
                    var code = new StringBuilder();
                    code.AppendLine("namespace " + DriverCreatorAdapter.SelectedNamespace);
                    code.AppendLine("{");
                    code.AppendLine("    public class GridColumns");
                    code.AppendLine("    {");
                    int i = 0;
                    foreach (var e in grid.Columns)
                    {
                        code.AppendLine("        const int " + e.Header.ToString().Replace(" ", "") + " = " + i++ + ";");
                    }
                    code.AppendLine("    }");
                    code.AppendLine("}");
                    DriverCreatorAdapter.AddCode("GridColumns.cs", code.ToString(), target);
                };
            }
            return(dic);
        }
        public Dictionary <string, MenuAction> GetAction(object target, WindowAnalysisTreeInfo info)
        {
            var dic = new Dictionary <string, MenuAction>();

            return(dic);
        }