private void OnCommandAdded(object sender, CommandEventArgs args)
        {
            var dec = new CommandDecorator(args.Command);

            _cmds.Add(dec);
            _cmdsByName[dec.Name] = dec;
        }
Ejemplo n.º 2
0
        private void invokeScriptToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var cmd = _wl.CreateInvokeScriptCommand();

            cmd.Description = cmd.Label = cmd.Tooltip = Strings.InvokeScriptCmdDescription;
            var dec = new CommandDecorator(cmd);

            _commands.Add(dec);
            SetSelectedCommand(dec);
        }
        private ICommand GetSelectedCommand()
        {
            CommandDecorator cmd = null;

            if (grdCommands.SelectedRows.Count == 1)
            {
                cmd = grdCommands.SelectedRows[0].DataBoundItem as CommandDecorator;
            }
            else if (grdCommands.SelectedCells.Count == 1)
            {
                cmd = grdCommands.Rows[grdCommands.SelectedCells[0].RowIndex].DataBoundItem as CommandDecorator;
            }
            return(cmd.DecoratedInstance);
        }
Ejemplo n.º 4
0
        private void searchToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(_wl.Map.ResourceId))
            {
                MessageBox.Show(Strings.SpecifyMapForWebLayout);
                return;
            }

            var cmd = _wl.CreateSearchCommand();

            cmd.Description = cmd.Label = cmd.Tooltip = Strings.SearchCmdDescription;
            var dec = new CommandDecorator(cmd);

            _commands.Add(dec);
            SetSelectedCommand(dec);
        }
        public override void Bind(IEditorService service)
        {
            _wl = (IWebLayout)service.GetEditedResource();
            _wl.CommandSet.CustomCommandAdded   += OnCommandAdded;
            _wl.CommandSet.CustomCommandRemoved += OnCommandRemoved;

            edContextMenu.Bind(service, _wl, _wl.ContextMenu);
            edTaskMenu.Bind(service, _wl, _wl.TaskPane.TaskBar);
            edToolbar.Bind(service, _wl, _wl.ToolBar);

            foreach (var cmd in _wl.CommandSet.Commands)
            {
                var dec = new CommandDecorator(cmd);
                _cmds.Add(dec);
                _cmdsByName[dec.Name] = dec;
            }
            grdCommands.DataSource = _cmds;
        }
Ejemplo n.º 6
0
        public override void Bind(IEditorService service)
        {
            _wl = (IWebLayout)service.GetEditedResource();
            _wl.CommandSet.CustomCommandAdded += OnCommandAdded;
            _wl.CommandSet.CustomCommandRemoved += OnCommandRemoved;

            edContextMenu.Bind(service, _wl, _wl.ContextMenu);
            edTaskMenu.Bind(service, _wl, _wl.TaskPane.TaskBar);
            edToolbar.Bind(service, _wl, _wl.ToolBar);

            foreach (var cmd in _wl.CommandSet.Commands)
            {
                var dec = new CommandDecorator(cmd);
                _cmds.Add(dec);
                _cmdsByName[dec.Name] = dec;
            }
            grdCommands.DataSource = _cmds;
        }
Ejemplo n.º 7
0
 private void SetSelectedCommand(CommandDecorator cmd)
 {
     grdCommands.ClearSelection();
     foreach (DataGridViewRow row in grdCommands.Rows)
     {
         if (row.DataBoundItem == cmd)
         {
             //HACK: This is a long-winded way of simulating a programmatic
             //click of the cell that contains this databound item
             //
             //See: http://social.msdn.microsoft.com/forums/en-US/winformsdatacontrols/thread/47e9c3ef-a8de-48c9-8e0d-4f3fdd34517e/
             grdCommands.FirstDisplayedScrollingRowIndex = row.Index;
             grdCommands.Refresh();
             grdCommands.CurrentCell = row.Cells[1];
             row.Selected            = true;
             grdCommands_CellContentClick(this, new DataGridViewCellEventArgs(1, row.Index));
             break;
         }
     }
 }
Ejemplo n.º 8
0
 void OnCommandAdded(ICommand cmd)
 {
     var dec = new CommandDecorator(cmd);
     _cmds.Add(dec);
     _cmdsByName[dec.Name] = dec;
 }
Ejemplo n.º 9
0
 private void SetSelectedCommand(CommandDecorator cmd)
 {
     grdCommands.ClearSelection();
     foreach (DataGridViewRow row in grdCommands.Rows)
     {
         if (row.DataBoundItem == cmd)
         {
             //HACK: This is a long-winded way of simulating a programmatic
             //click of the cell that contains this databound item
             //
             //See: http://social.msdn.microsoft.com/forums/en-US/winformsdatacontrols/thread/47e9c3ef-a8de-48c9-8e0d-4f3fdd34517e/
             grdCommands.FirstDisplayedScrollingRowIndex = row.Index;
             grdCommands.Refresh();
             grdCommands.CurrentCell = row.Cells[1];
             row.Selected = true;
             grdCommands_CellContentClick(this, new DataGridViewCellEventArgs(1, row.Index));
             break;
         }
     }
 }
Ejemplo n.º 10
0
        private void searchToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(_wl.Map.ResourceId))
            {
                MessageBox.Show(Strings.SpecifyMapForWebLayout);
                return;
            }

            var cmd = _wl.CreateSearchCommand();
            cmd.Description = cmd.Label = cmd.Tooltip = Strings.SearchCmdDescription;
            var dec = new CommandDecorator(cmd);
            _commands.Add(dec);
            SetSelectedCommand(dec);
        }
Ejemplo n.º 11
0
 private void invokeURLToolStripMenuItem_Click(object sender, EventArgs e)
 {
     var cmd = _wl.CreateInvokeUrlCommand();
     cmd.Description = cmd.Label = cmd.Tooltip = Strings.InvokeUrlCmdDescription;
     var dec = new CommandDecorator(cmd);
     _commands.Add(dec);
     SetSelectedCommand(dec);
 }