private void UpdatePorts() { cmbRemotePorts.Items.Clear(); cmbLocalPorts.Items.Clear(); if (curProtocol == (int)FirewallRule.KnownProtocols.TCP || curProtocol == (int)FirewallRule.KnownProtocols.UDP) { cmbRemotePorts.Items.Add(new ContentControl() { Content = Translate.fmt("port_any"), Tag = "*" }); cmbLocalPorts.Items.Add(new ContentControl() { Content = Translate.fmt("port_any"), Tag = "*" }); if (Rule.Direction == FirewallRule.Directions.Outboun) { if (curProtocol == (int)FirewallRule.KnownProtocols.TCP) { cmbRemotePorts.Items.Add(new ContentControl() { Content = FirewallRule.PortKeywordIpTlsOut, Tag = FirewallRule.PortKeywordIpTlsOut }); } } else if (Rule.Direction == FirewallRule.Directions.Inbound) { if (curProtocol == (int)FirewallRule.KnownProtocols.TCP) { cmbLocalPorts.Items.Add(new ContentControl() { Content = FirewallRule.PortKeywordIpTlsIn, Tag = FirewallRule.PortKeywordIpTlsIn }); cmbLocalPorts.Items.Add(new ContentControl() { Content = FirewallRule.PortKeywordRpcEp, Tag = FirewallRule.PortKeywordRpcEp }); cmbLocalPorts.Items.Add(new ContentControl() { Content = FirewallRule.PortKeywordRpc, Tag = FirewallRule.PortKeywordRpc }); } else if (curProtocol == (int)FirewallRule.KnownProtocols.UDP) { cmbLocalPorts.Items.Add(new ContentControl() { Content = FirewallRule.PortKeywordTeredo, Tag = FirewallRule.PortKeywordTeredo }); cmbLocalPorts.Items.Add(new ContentControl() { Content = FirewallRule.PortKeywordPly2Disc, Tag = FirewallRule.PortKeywordPly2Disc }); cmbLocalPorts.Items.Add(new ContentControl() { Content = FirewallRule.PortKeywordMDns, Tag = FirewallRule.PortKeywordMDns }); cmbLocalPorts.Items.Add(new ContentControl() { Content = FirewallRule.PortKeywordDhcp, Tag = FirewallRule.PortKeywordDhcp }); } } //if (!WpfFunc.CmbSelect(cmbRemotePorts, Rule.RemotePorts) && Rule.RemotePorts != null) // cmbRemotePorts.Text = Rule.RemotePorts; viewModel.RemotePort = WpfFunc.CmbPick(cmbRemotePorts, FirewallRule.IsEmptyOrStar(Rule.RemotePorts) ? "*" : Rule.RemotePorts); if (viewModel.RemotePort == null) { viewModel.RemotePortTxt = Rule.RemotePorts; } //if (!WpfFunc.CmbSelect(cmbLocalPorts, Rule.LocalPorts) && Rule.LocalPorts != null) // cmbLocalPorts.Text = Rule.LocalPorts; viewModel.LocalPort = WpfFunc.CmbPick(cmbLocalPorts, FirewallRule.IsEmptyOrStar(Rule.LocalPorts) ? "*" : Rule.LocalPorts); if (viewModel.LocalPort == null) { viewModel.LocalPortTxt = Rule.LocalPorts; } } }