コード例 #1
0
ファイル: domain_blocker.cs プロジェクト: Meticulus/tactical
        private void initialize()
        {
            
            Setting enable = new Setting(typeof(Boolean),"Enable",true,"Enable domain blocking", "General");
            enable.OnSettingChanged += new EventHandler(enable_OnSettingChanged);

            Setting errorOnBlock = new Setting(typeof(Boolean), "Show As Error",false,"Blocked domains are given the status \"ERR\"","General");
            errorOnBlock.OnSettingChanged += new EventHandler(errorOnBlock_OnSettingChanged);

            _domains = new String[BlockedDomains.Count];
            domainlist = new Setting(typeof(String[]),"Domain List",_domains ,"A line separated list of domains to block. (i.e. www.doubleclick.net)", "Domain List");
            domainlist.OnSettingChanged += new EventHandler(domainlist_OnSettingChanged);
            _settings.AddRange(new Setting[]{domainlist,errorOnBlock,enable});

			contextual_action block_domain = new contextual_action(
				"block domain(s)",
				new Type[]{ typeof(proxy_transaction),typeof(proxy_transaction[]) });
			block_domain.DoWork += handle_block_domain;

			contextual_action unblock_domain = new contextual_action(
				"unblock domain(s)",
				new Type[] { typeof(proxy_transaction), typeof(proxy_transaction[]) });
			unblock_domain.DoWork += handle_unblock_domain;

			_contextual_actions.Add(block_domain);
			_contextual_actions.Add(unblock_domain);
        }
コード例 #2
0
		public void add_actions(contextual_action[] actions) {
			foreach(contextual_action a in actions) {
				a.RunWorkerCompleted += delegate(object sender, RunWorkerCompletedEventArgs e) {
					this.desc_label.Text = (String)e.Result;
				};
				MenuItem i = new MenuItem(a.name);
				i.Name = a.name;
				i.ButtonPressEvent += handle_action;
				_cm.Add(i);
			}
			_cm.ShowAll();
			_actions.AddRange(actions);
		}