Beispiel #1
0
        public override RibbonItemData GetItem()
        {
            var item = new RibbonCommand();

            FillItem(item);
            return(item);
        }
Beispiel #2
0
 internal string GetCommandUIHandlerXML(RibbonCommand command)
 {
     return(new XDocument(
                new XElement("CommandUIHandler",
                             new XAttribute("Command", command.Id),
                             new XAttribute("CommandAction", "javascript: " + command.HandlerStatement + ";"),
                             new XAttribute("EnabledScript", "javascript: " + command.EnabledStatement + ";"))).ToString());
 }
        //*************************************************************************
        //  Constructor: RunRibbonCommandEventArgs()
        //
        /// <summary>
        /// Initializes a new instance of the <see
        /// cref="RunRibbonCommandEventArgs" /> class.
        /// </summary>
        ///
        /// <param name="ribbonCommand">
        /// The ribbon command that needs to be run.
        /// </param>
        //*************************************************************************
        public RunRibbonCommandEventArgs(
            RibbonCommand ribbonCommand
            )
        {
            m_eRibbonCommand = ribbonCommand;

            AssertValid();
        }
Beispiel #4
0
        //*************************************************************************
        //  Constructor: RunRibbonCommandEventArgs()
        //
        /// <summary>
        /// Initializes a new instance of the <see
        /// cref="RunRibbonCommandEventArgs" /> class.
        /// </summary>
        ///
        /// <param name="ribbonCommand">
        /// The ribbon command that needs to be run.
        /// </param>
        //*************************************************************************

        public RunRibbonCommandEventArgs
        (
            RibbonCommand ribbonCommand
        )
        {
            m_eRibbonCommand = ribbonCommand;

            AssertValid();
        }
Beispiel #5
0
    public ICommand EndStroke(Transform parent, Material mat)
    {
        string ribbonId = System.Guid.NewGuid().ToString();
        // Reset Preview and Pass it's data to the new tube
        RibbonCommand rc = new RibbonCommand(ribbonId, this, _preview.Vertices, _preview.Tris, _preview.Uvs, parent, mat);

        _preview.Reset();
        rc.Execute();

        return(rc);
    }
Beispiel #6
0
        private RibbonGroup SetGroup(string groupName)
        {
            if (_groups.ContainsKey(groupName))
            {
                return(_groups[groupName]);
            }
            var group        = new RibbonGroup();
            var titleCommand = new RibbonCommand {
                LabelTitle = groupName
            };

            group.Command      = titleCommand;
            _groups[groupName] = group;
            Groups.Add(group);
            return(group);
        }
Beispiel #7
0
        private void AddButton(string iconImage, string groupName, string textButton)
        {
            var button  = new RibbonButton();
            var command = new RibbonCommand {
                LabelTitle = textButton
            };

            if (string.IsNullOrEmpty(iconImage))
            {
                throw new Exception("Should not happen!");
            }
            command.LargeImageSource = new BitmapImage(new Uri(iconImage, UriKind.RelativeOrAbsolute));
            command.Executed        += ContextCommandExecuted;
            _commands.Add(command);
            var group = SetGroup(groupName);

            group.Controls.Add(button);
            button.Command = command;
        }
        public override void UpdateUi()
        {
            var command = new RibbonCommand {
                LabelTitle = Path.Name
            };

            RibbonGroupControl = new RibbonGroup {
                Command = command
            };
            Control = RibbonGroupControl;

            var path = Path;

            foreach (var folder in path.Folders.Values)
            {
                if (folder.Factory == null)
                {
                    folder.Factory = new RibbonGroupConcretePathFactory();
                }
            }
        }
        private void AddButton(string iconImage, string groupName, string textButton)
        {
            var buttonGroup = "Default";

            if (groupName.Length > 0)
            {
                buttonGroup = groupName;
            }
            var button  = new MenuItem(textButton);
            var command = new RibbonCommand {
                LabelTitle = textButton
            };

            if (string.IsNullOrEmpty(iconImage))
            {
                throw new Exception("Invalid icon image!");
            }
            command.LargeImageSource = new BitmapImage(new Uri(iconImage, UriKind.RelativeOrAbsolute));
            var group = SetGroup(buttonGroup);

            group.Add(button, command);
            button.Click += ContextCommandExecuted;
        }
Beispiel #10
0
 public RibbonCommandVM(RibbonCommand item)
     : base(item)
 {
     Command = item.Command;
 }
Beispiel #11
0
        private RibbonItemData GetItem(IPaletteCommand com)
        {
            RibbonItemData item;

            switch (com)
            {
            case PaletteInsertBlock paletteInsertBlock:
                item = new RibbonInsertBlock
                {
                    Name       = paletteInsertBlock.blName,
                    File       = GetBlockFile(paletteInsertBlock.file),
                    Explode    = paletteInsertBlock.explode,
                    Layer      = paletteInsertBlock.Layer?.Name,
                    BlockName  = paletteInsertBlock.blName,
                    Properties = paletteInsertBlock.props
                };
                break;

            case PaletteVisualInsertBlocks paletteVisualInsertBlocks:
                item = new RibbonVisualInsertBlock
                {
                    Name    = paletteVisualInsertBlocks.Name ?? paletteVisualInsertBlocks.CommandName,
                    File    = GetBlockFile(paletteVisualInsertBlocks.file),
                    Explode = paletteVisualInsertBlocks.explode,
                    Layer   = paletteVisualInsertBlocks.Layer?.Name,
                };
                break;

            case SplitCommand splitCommand:
                item = new RibbonSplit
                {
                    Items = splitCommand.Commands?.Select(GetItem).ToList()
                };
                break;

            case ToggleButton toggleButton:
                item = new RibbonToggle
                {
                    Name      = toggleButton.Name ?? toggleButton.CommandName,
                    IsChecked = toggleButton.IsChecked,
                    Command   = toggleButton.CommandName
                };
                break;

            case PaletteCommand paletteCommand:
                item = new RibbonCommand
                {
                    Name    = paletteCommand.Name ?? paletteCommand.CommandName,
                    Command = paletteCommand.CommandName,
                };
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(com));
            }

            item.Name        = com.Name;
            item.Access      = com.Access;
            item.Description = com.Description;
            item.IsTest      = com.IsTest;
            SaveImage(com);
            return(item);
        }
Beispiel #12
0
        //*************************************************************************
        //  Method: FireRunRibbonCommandEvent()
        //
        /// <summary>
        /// Fires the <see cref="RunRibbonCommand" /> event if appropriate.
        /// </summary>
        ///
        /// <param name="eRibbonCommand">
        /// The ribbon command to run.
        /// </param>
        //*************************************************************************
        protected void FireRunRibbonCommandEvent(
            RibbonCommand eRibbonCommand
            )
        {
            AssertValid();

            RunRibbonCommandEventHandler oRunRibbonCommand = this.RunRibbonCommand;

            if (oRunRibbonCommand != null)
            {
            oRunRibbonCommand( this,
                new RunRibbonCommandEventArgs(eRibbonCommand) );
            }
        }
Beispiel #13
0
        /// <summary>
        /// Generic Executed function
        ///
        /// Throws a NotImplementedException if a linked Ribbon item is executed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void RibbonCommand_Executed(object sender, ExecutedRoutedEventArgs e)
        {
            RibbonCommand rc = (RibbonCommand)e.Command;

            throw new NotImplementedException();
        }