Esempio n. 1
0
        public MultiTypeObjectPool(CreateInstanceDelegate createInstanceMethod = null, Arg1Delegate <IPoolable> disposeInstanceMethod = null,
                                   Arg1Delegate <IPoolable> getInstanceMethod  = null, Arg1Delegate <IPoolable> returnInstanceMethod  = null)
        {
            poolDict = new Dictionary <Type, ObjectPool <IPoolable> >();

            this.CreateInstanceMethod  = createInstanceMethod;
            this.DisposeInstanceMethod = disposeInstanceMethod;
            this.GetInstanceMethod     = getInstanceMethod;
            this.ReturnInstanceMethod  = returnInstanceMethod;
        }
Esempio n. 2
0
        public ToolStripMenuItem AddCheckableMenuItem(string text, Arg1Delegate <bool> OnClick = null)
        {
            ToolStripMenuItem item = null;

            item = new ToolStripMenuItem(text, null, (object sender, EventArgs e) => {
                item.Checked = !item.Checked;
                OnClick?.Invoke(item.Checked);
            });
            Menu.Items.Add(item);

            return(item);
        }