Example #1
0
        public void DisplayCommandManagerView()
        {
            var toolbar = new CustomToolbarInfo();

            toolbar.Groups = new CommandGroupInfo[]
            {
                new CommandGroupInfo()
                {
                    Title    = "Toolbar1",
                    Commands = new CommandMacroInfo[]
                    {
                        new CommandMacroInfo()
                        {
                            MacroPath   = "D:\\1.swb",
                            Title       = "Command1",
                            Description = "Sample command in toolbar which will invoke some macro",
                            EntryPoint  = new MacroStartFunction()
                            {
                                ModuleName = "Module1",
                                SubName    = "Sub1"
                            }
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command2"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command3"
                        }
                    }
                },
                new CommandGroupInfo()
                {
                    Title    = "Toolbar2",
                    Commands = new CommandMacroInfo[]
                    {
                        new CommandMacroInfo()
                        {
                            Title = "Command4"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command5"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command6"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command7"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command8"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command9"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command10"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command11"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command12"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command13"
                        }
                    }
                }
            };

            var confProviderMock  = new Mock <IToolbarConfigurationProvider>();
            var settsProviderMock = new Mock <ISettingsProvider>();

            confProviderMock.Setup(m => m.GetToolbar(out It.Ref <bool> .IsAny, It.IsAny <string>())).
            Returns(toolbar);

            settsProviderMock.Setup(p => p.GetSettings())
            .Returns(new ToolbarSettings());

            var vm = new CommandManagerVM(confProviderMock.Object, settsProviderMock.Object,
                                          new Mock <IMessageService>().Object);

            var form = new CommandManagerForm();

            form.DataContext = vm;

            form.ShowDialog();
        }
Example #2
0
 public CommandManagerForm(CommandManagerVM vm, IntPtr parent)
 {
     InitializeComponent();
     this.DataContext = vm;
     new System.Windows.Interop.WindowInteropHelper(this).Owner = parent;
 }
Example #3
0
        public void DisplayCommandManagerView()
        {
            var toolbar = new CustomToolbarInfo();

            toolbar.Groups = new CommandGroupInfo[]
            {
                new CommandGroupInfo()
                {
                    Title    = "Toolbar1",
                    Commands = new CommandMacroInfo[]
                    {
                        new CommandMacroInfo()
                        {
                            Title = "Command1", Description = "Sample command in toolbar which will invoke some macro"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command2"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command3"
                        }
                    }
                },
                new CommandGroupInfo()
                {
                    Title    = "Toolbar2",
                    Commands = new CommandMacroInfo[]
                    {
                        new CommandMacroInfo()
                        {
                            Title = "Command4"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command5"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command6"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command7"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command8"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command9"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command10"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command11"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command12"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command13"
                        }
                    }
                }
            };

            var confProviderMock  = new Mock <IToolbarConfigurationProvider>();
            var settsProviderMock = new Mock <ISettingsProvider>();

            confProviderMock.Setup(m => m.GetToolbar(out It.Ref <bool> .IsAny, It.IsAny <string>())).
            Returns(toolbar);

            settsProviderMock.Setup(p => p.GetSettings())
            .Returns(new ToolbarSettings());

            var vm = new CommandManagerVM(confProviderMock.Object, settsProviderMock.Object,
                                          new Mock <IMessageService>().Object);

            new CommandManagerForm(vm, IntPtr.Zero).ShowDialog();
        }
Example #4
0
        public void DisplayCommandManagerView()
        {
            var toolbar = new CustomToolbarInfo();

            toolbar.Groups = new CommandGroupInfo[]
            {
                new CommandGroupInfo()
                {
                    Title    = "Toolbar1",
                    Commands = new CommandMacroInfo[]
                    {
                        new CommandMacroInfo()
                        {
                            MacroPath   = "D:\\1.swb",
                            Title       = "Command1",
                            Description = "Sample command in toolbar which will invoke some macro",
                            EntryPoint  = new MacroStartFunction("Module1", "Sub1")
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command2"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command3"
                        }
                    }
                },
                new CommandGroupInfo()
                {
                    Title    = "Toolbar2",
                    Commands = new CommandMacroInfo[]
                    {
                        new CommandMacroInfo()
                        {
                            Title = "Command4"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command5"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command6"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command7"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command8"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command9"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command10"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command11"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command12"
                        },
                        new CommandMacroInfo()
                        {
                            Title = "Command13"
                        }
                    }
                }
            };

            var confProviderMock  = new Mock <IToolbarConfigurationProvider>();
            var settsProviderMock = new Mock <ISettingsProvider>();

            confProviderMock.Setup(m => m.GetToolbar(It.IsAny <string>())).
            Returns(toolbar);

            settsProviderMock.Setup(p => p.ReadSettings <ToolbarSettings>())
            .Returns(new ToolbarSettings());

            var vm = new CommandManagerVM(confProviderMock.Object,
                                          new Mock <IMessageService>().Object, new Mock <IXLogger>().Object,
                                          new Mock <ICadDescriptor>().Object,
                                          c => new CommandGroupVM(c, new Mock <IIconsProvider[]>().Object, new Mock <IFilePathResolver>().Object,
                                                                  x => new CommandMacroVM(x, new Mock <IIconsProvider[]>().Object, new Mock <IFilePathResolver>().Object, new Mock <IMacroEntryPointsExtractor>().Object)));

            var form = new CommandManagerForm();

            form.DataContext = vm;

            form.ShowDialog();
        }