private void btnApply_Click(object sender, RoutedEventArgs e) { ProgramList.ID id = mEventList.ElementAt(curIndex); long expiration = GetExpiration(); Program.Config.AccessLevels NetAccess = (Program.Config.AccessLevels)(cmbAccess.SelectedItem as ComboBoxItem).Tag; if (NetAccess == Program.Config.AccessLevels.CustomConfig) { if (!MakeCustom(id, expiration)) { return; } } else if (NetAccess == Program.Config.AccessLevels.StopNotify) { Program prog = App.itf.GetProgram(id); if (expiration != 0) { prog.config.SilenceUntill = expiration; } else { prog.config.Notify = false; } App.itf.UpdateProgram(prog.guid, prog.config); } else { switch (NetAccess) { case Program.Config.AccessLevels.FullAccess: // add and enable allow all rule App.itf.UpdateRule(FirewallRule.MakeAllowRule(id, Firewall.Directions.Bidirectiona, expiration)); break; case Program.Config.AccessLevels.LocalOnly: // create block rule only of we operate in blacklist mode //if (App.itf.GetFilteringMode() == Firewall.FilteringModes.BlackList) //{ //add and enable block rules for the internet App.itf.UpdateRule(FirewallRule.MakeBlockInetRule(id, Firewall.Directions.Bidirectiona, expiration)); //} //add and enable allow rules for the lan App.itf.UpdateRule(FirewallRule.MakeAllowLanRule(id, Firewall.Directions.Bidirectiona, expiration)); break; case Program.Config.AccessLevels.BlockAccess: // add and enable broad block rules App.itf.UpdateRule(FirewallRule.MakeBlockRule(id, Firewall.Directions.Bidirectiona, expiration)); break; } } PopEntry(); }