예제 #1
0
        /// <summary>
        /// Creates and shows an Add Source context menu at the mouse pointer
        /// </summary>
        public ContextMenuStrip AddSourceContextMenu()
        {
            var inputmenu = new ContextMenuStrip {
                Renderer = new AccessKeyMenuStripRenderer()
            };

            foreach (string inputType in Obs.GetSourceInputTypes())
            {
                string displayname = Obs.GetSourceTypeDisplayName(inputType);

                var menuitem = new ToolStripMenuItem(displayname + " (" + inputType + ")")
                {
                    Tag = Tuple.Create(inputType, displayname + (Sources.Count + 1))
                };

                inputmenu.Items.Add(menuitem);
            }
            return(inputmenu);
        }
예제 #2
0
        ContextMenuStrip FilterMenu()
        {
            var filtermenu = new ContextMenuStrip();

            foreach (string filterType in Obs.GetSourceFilterTypes())
            {
                string displayname = Obs.GetSourceTypeDisplayName(filterType) + FilterSource.Filters.Count + 1;

                var menuitem = new ToolStripMenuItem(displayname + " (" + filterType + ")");

                menuitem.Click += (o, args) =>
                {
                    var filter = new Filter(filterType, displayname);
                    FilterSource.AddFilter(filter);
                    Select(filter);
                };

                filtermenu.Items.Add(menuitem);
            }

            return(filtermenu);
        }