Beispiel #1
0
        void InitializeAdditionBar()
        {
            BarViewModel addingBar = ViewModelSource.Create(() => new BarViewModel()
            {
                Name = "Addition"
            });

            Bars.Add(addingBar);
            var addGroupCommand = ViewModelSource.Create(() => new GroupBarButtonInfo()
            {
                Caption = "Add", LargeGlyph = DXImageHelper.GetDXImage("Add_32x32.png"), SmallGlyph = DXImageHelper.GetDXImage("Add_16x16.png")
            });
            var parentCommand = ViewModelSource.Create(() => new ParentBarButtonInfo(this, MyParentCommandType.CommandCreation)
            {
                Caption = "Add Command", LargeGlyph = DXImageHelper.GetDXImage("Add_32x32.png"), SmallGlyph = DXImageHelper.GetDXImage("Add_16x16.png")
            });
            var parentBar = ViewModelSource.Create(() => new ParentBarButtonInfo(this, MyParentCommandType.BarCreation)
            {
                Caption = "Add Bar", LargeGlyph = DXImageHelper.GetDXImage("Add_32x32.png"), SmallGlyph = DXImageHelper.GetDXImage("Add_16x16.png")
            });

            addGroupCommand.Commands.Add(parentCommand);
            addGroupCommand.Commands.Add(parentBar);
            addingBar.Commands.Add(addGroupCommand);
            addingBar.Commands.Add(parentCommand);
            addingBar.Commands.Add(parentBar);
        }
Beispiel #2
0
        void InitializeClipboardBar()
        {
            BarViewModel clipboardBar = ViewModelSource.Create(() => new BarViewModel()
            {
                Name = "Clipboard"
            });

            Bars.Add(clipboardBar);
            var cutCommand = ViewModelSource.Create(() => new BarButtonInfo(cutCommandExecuteFunc)
            {
                Caption = "Cut", LargeGlyph = DXImageHelper.GetDXImage("Cut_32x32.png"), SmallGlyph = DXImageHelper.GetDXImage("Cut_16x16.png")
            });
            var copyCommand = ViewModelSource.Create(() => new BarButtonInfo(copyCommandExecuteFunc)
            {
                Caption = "Copy", LargeGlyph = DXImageHelper.GetDXImage("Copy_32x32.png"), SmallGlyph = DXImageHelper.GetDXImage("Copy_16x16.png")
            });
            var pasteCommand = ViewModelSource.Create(() => new BarButtonInfo(pasteCommandExecuteFunc)
            {
                Caption = "Paste", LargeGlyph = DXImageHelper.GetDXImage("Paste_32x32.png"), SmallGlyph = DXImageHelper.GetDXImage("Paste_16x16.png")
            });
            var selectCommand = ViewModelSource.Create(() => new BarButtonInfo(selectAllCommandExecuteFunc)
            {
                Caption = "Select All", LargeGlyph = DXImageHelper.GetDXImage("SelectAll_32x32.png"), SmallGlyph = DXImageHelper.GetDXImage("SelectAll_16x16.png")
            });
            var blankCommand = ViewModelSource.Create(() => new BarButtonInfo(blankCommandExecuteFunc)
            {
                Caption = "Clear Page", LargeGlyph = DXImageHelper.GetDXImage("New_32x32.png"), SmallGlyph = DXImageHelper.GetDXImage("New_16x16.png")
            });

            clipboardBar.Commands.Add(cutCommand);
            clipboardBar.Commands.Add(copyCommand);
            clipboardBar.Commands.Add(pasteCommand);
            clipboardBar.Commands.Add(selectCommand);
            clipboardBar.Commands.Add(blankCommand);
        }
        static void Execute(MyParentCommandType type, MVVMBarViewModel viewModel)
        {
            switch (type)
            {
            case MyParentCommandType.CommandCreation:
                viewModel.Bars[0].Commands.Add(CreateNewBarButtonInfo(viewModel));
                break;

            case MyParentCommandType.BarCreation:
                BarViewModel model = ViewModelSource.Create(() => new BarViewModel()
                {
                    Name = "New Bar"
                });
                model.Commands.Add(CreateNewBarButtonInfo(viewModel));
                viewModel.Bars.Add(model);
                break;
            }
        }