Ejemplo n.º 1
0
        public ICommand AddSeparator()
        {
            var separator = new System.Windows.Forms.ToolStripSeparator();

            this.menu.Add(separator);
            var command = new CIRCeCommand {
                Item = separator
            };

            this.commandsList.Add(command);

            return(command);
        }
Ejemplo n.º 2
0
        public ICommand AddSeparator()
        {
            if (this.Dispatcher.InvokeRequired)
            {
                return((ICommand)this.Dispatcher.EndInvoke(this.Dispatcher.BeginInvoke(new Func <ICommand>(AddSeparator))));
            }

            var separator = new System.Windows.Forms.ToolStripSeparator();

            this.Items.Add(separator);
            var command = new CIRCeCommand {
                Item = separator
            };

            this.commandsList.Add(command);

            return(command);
        }
Ejemplo n.º 3
0
        public ICommand AddCommand(string title, Action <IEnumerable <IRC.Client.Base.ChannelUserInfo> > action /*, Func<IEnumerable<IRC.Client.Base.ChannelUserInfo>> canExecute = null*/)
        {
            var item = new System.Windows.Forms.ToolStripMenuItem {
                Text = title
            };

            item.Click += (sender, e) =>
            {
                var items = this.list.LVSelectedItems;
                if (items.Length > 0)
                {
                    action(items.Select(i => i.ToNew()).ToArray());
                }
            };
            this.menu.Add(item);
            var command = new CIRCeCommand {
                Item = item
            };

            this.commandsList.Add(command);

            return(command);
        }
Ejemplo n.º 4
0
        public ICommand AddCommand(string title, Action action)
        {
            if (this.Dispatcher.InvokeRequired)
            {
                return((ICommand)this.Dispatcher.EndInvoke(this.Dispatcher.BeginInvoke(new Func <string, Action, ICommand>(AddCommand), title, action)));
            }

            var item = new System.Windows.Forms.ToolStripMenuItem {
                Text = title
            };

            item.Click += (sender, e) =>
            {
                action();
            };
            this.Items.Add(item);
            var command = new CIRCeCommand {
                Item = item
            };

            this.commandsList.Add(command);

            return(command);
        }