private void cmbExistingArmSubnet_SelectedIndexChanged(object sender, EventArgs e) { TreeNode asmTreeNode = (TreeNode)_VirtualMachineNode.Tag; Azure.Asm.VirtualMachine asmVirtualMachine = (Azure.Asm.VirtualMachine)asmTreeNode.Tag; ComboBox cmbSender = (ComboBox)sender; if (cmbSender.SelectedItem == null) { asmVirtualMachine.TargetVirtualNetwork = null; asmVirtualMachine.TargetSubnet = null; } else { if (cmbSender.SelectedItem.GetType() == typeof(Azure.Asm.Subnet)) { Azure.Asm.Subnet asmSubnet = (Azure.Asm.Subnet)cmbSender.SelectedItem; asmVirtualMachine.TargetVirtualNetwork = asmSubnet.Parent; asmVirtualMachine.TargetSubnet = asmSubnet; } else if (cmbSender.SelectedItem.GetType() == typeof(Azure.Arm.Subnet)) { Azure.Arm.Subnet armSubnet = (Azure.Arm.Subnet)cmbSender.SelectedItem; asmVirtualMachine.TargetVirtualNetwork = armSubnet.Parent; asmVirtualMachine.TargetSubnet = armSubnet; } } PropertyChanged(); }
internal void Bind(TargetTreeView targetTreeView, MigrationTarget.Subnet targetSubnet) { _TargetTreeView = targetTreeView; _Subnet = targetSubnet; txtTargetName.Text = targetSubnet.TargetName; if (targetSubnet.SourceSubnet != null) { if (targetSubnet.SourceSubnet.GetType() == typeof(Azure.Asm.Subnet)) { Azure.Asm.Subnet asmSubnet = (Azure.Asm.Subnet)targetSubnet.SourceSubnet; lblSourceName.Text = asmSubnet.Name; lblAddressSpace.Text = asmSubnet.AddressPrefix; } else if (targetSubnet.SourceSubnet.GetType() == typeof(Azure.Arm.Subnet)) { Azure.Arm.Subnet armSubnet = (Azure.Arm.Subnet)targetSubnet.SourceSubnet; lblSourceName.Text = armSubnet.Name; lblAddressSpace.Text = armSubnet.AddressPrefix; } } if (String.Compare(txtTargetName.Text, ArmConst.GatewaySubnetName, true) == 0) { // if gateway subnet, the name can't be changed txtTargetName.Enabled = false; } networkSecurityGroup.Bind(_Subnet.NetworkSecurityGroup, _TargetTreeView); routeTable.Bind(_Subnet.RouteTable, _TargetTreeView); }
internal void Bind(MigrationTarget.Subnet targetSubnet) { _Subnet = targetSubnet; txtTargetName.Text = targetSubnet.TargetName; if (targetSubnet.SourceSubnet != null) { if (targetSubnet.SourceSubnet.GetType() == typeof(Azure.Asm.Subnet)) { Azure.Asm.Subnet asmSubnet = (Azure.Asm.Subnet)targetSubnet.SourceSubnet; lblSourceName.Text = asmSubnet.Name; lblAddressSpace.Text = asmSubnet.AddressPrefix; } else if (targetSubnet.SourceSubnet.GetType() == typeof(Azure.Arm.Subnet)) { Azure.Arm.Subnet armSubnet = (Azure.Arm.Subnet)targetSubnet.SourceSubnet; lblSourceName.Text = armSubnet.Name; lblAddressSpace.Text = armSubnet.AddressPrefix; } } if (String.Compare(txtTargetName.Text, ArmConst.GatewaySubnetName, true) == 0) { // if gateway subnet, the name can't be changed txtTargetName.Enabled = false; } }
private async void rbExistingARMVNet_CheckedChanged(object sender, EventArgs e) { RadioButton rb = (RadioButton)sender; if (rb.Checked) { #region Add "In MigAz Migration" Virtual Networks to cmbExistingArmVNets cmbExistingArmVNets.Items.Clear(); cmbExistingArmSubnet.Items.Clear(); foreach (Azure.Arm.VirtualNetwork armVirtualNetwork in await _AzureContext.AzureRetriever.GetAzureARMVirtualNetworks()) { if (armVirtualNetwork.HasNonGatewaySubnet) { cmbExistingArmVNets.Items.Add(armVirtualNetwork); } } #endregion #region Seek Target VNet and Subnet as ComboBox SelectedItems if (_TargetNetworkInterface != null && _TargetNetworkInterface.TargetNetworkInterfaceIpConfigurations.Count() > 0) { if (_TargetNetworkInterface.TargetNetworkInterfaceIpConfigurations[0].TargetVirtualNetwork != null) { // Attempt to match target to list items for (int i = 0; i < cmbExistingArmVNets.Items.Count; i++) { Azure.Arm.VirtualNetwork listVirtualNetwork = (Azure.Arm.VirtualNetwork)cmbExistingArmVNets.Items[i]; if (listVirtualNetwork.ToString() == _TargetNetworkInterface.TargetNetworkInterfaceIpConfigurations[0].TargetVirtualNetwork.ToString()) { cmbExistingArmVNets.SelectedIndex = i; break; } } } if (_TargetNetworkInterface.TargetNetworkInterfaceIpConfigurations[0].TargetSubnet != null) { // Attempt to match target to list items for (int i = 0; i < cmbExistingArmSubnet.Items.Count; i++) { Azure.Arm.Subnet listSubnet = (Azure.Arm.Subnet)cmbExistingArmSubnet.Items[i]; if (listSubnet.ToString() == _TargetNetworkInterface.TargetNetworkInterfaceIpConfigurations[0].TargetSubnet.ToString()) { cmbExistingArmSubnet.SelectedIndex = i; break; } } } } #endregion } await PropertyChanged(); }
internal void Bind(TreeNode asmSubnetNode) { _AsmSubnetNode = asmSubnetNode; if (_AsmSubnetNode.Tag.GetType() == typeof(Azure.Asm.Subnet)) { Azure.Asm.Subnet asmSubnet = (Azure.Asm.Subnet)_AsmSubnetNode.Tag; lblSourceName.Text = asmSubnet.Name; lblAddressSpace.Text = asmSubnet.AddressPrefix; txtTargetName.Text = asmSubnet.TargetName; } else if (_AsmSubnetNode.Tag.GetType() == typeof(Azure.Arm.Subnet)) { Azure.Arm.Subnet armSubnet = (Azure.Arm.Subnet)_AsmSubnetNode.Tag; lblSourceName.Text = armSubnet.Name; lblAddressSpace.Text = armSubnet.AddressPrefix; txtTargetName.Text = armSubnet.TargetName; } }
private void txtTargetName_TextChanged(object sender, EventArgs e) { TextBox txtSender = (TextBox)sender; if (_AsmSubnetNode.Tag.GetType() == typeof(Azure.Asm.Subnet)) { Azure.Asm.Subnet asmSubnet = (Azure.Asm.Subnet)_AsmSubnetNode.Tag; asmSubnet.TargetName = txtSender.Text; _AsmSubnetNode.Text = asmSubnet.TargetName; } else if (_AsmSubnetNode.Tag.GetType() == typeof(Azure.Arm.Subnet)) { Azure.Arm.Subnet armSubnet = (Azure.Arm.Subnet)_AsmSubnetNode.Tag; armSubnet.TargetName = txtSender.Text; _AsmSubnetNode.Text = armSubnet.TargetName; } PropertyChanged(); }
private async void rbExistingARMVNet_CheckedChanged(object sender, EventArgs e) { RadioButton rb = (RadioButton)sender; if (rb.Checked) { #region Add "Existing in Subscription / Location" ARM Virtual Networks to cmbExistingArmVNets cmbExistingArmVNets.Items.Clear(); cmbExistingArmSubnet.Items.Clear(); if (_AzureContext != null && _AzureContext.AzureRetriever != null && _TargetTreeView.TargetResourceGroup != null && _TargetTreeView.TargetResourceGroup.TargetLocation != null) { foreach (Azure.Arm.VirtualNetwork armVirtualNetwork in await _AzureContext.AzureRetriever.GetAzureARMVirtualNetworks(_TargetTreeView.TargetResourceGroup.TargetLocation)) { if (armVirtualNetwork.HasNonGatewaySubnet) { cmbExistingArmVNets.Items.Add(armVirtualNetwork); } } } #endregion #region Seek Target VNet and Subnet as ComboBox SelectedItems if (_NetworkInterfaceTarget != null) { if (_NetworkInterfaceTarget.TargetVirtualNetwork != null) { // Attempt to match target to list items for (int i = 0; i < cmbExistingArmVNets.Items.Count; i++) { Azure.Arm.VirtualNetwork listVirtualNetwork = (Azure.Arm.VirtualNetwork)cmbExistingArmVNets.Items[i]; if (listVirtualNetwork.ToString() == _NetworkInterfaceTarget.TargetVirtualNetwork.ToString()) { cmbExistingArmVNets.SelectedIndex = i; break; } } } if (_NetworkInterfaceTarget.TargetSubnet != null) { // Attempt to match target to list items for (int i = 0; i < cmbExistingArmSubnet.Items.Count; i++) { Azure.Arm.Subnet listSubnet = (Azure.Arm.Subnet)cmbExistingArmSubnet.Items[i]; if (listSubnet.ToString() == _NetworkInterfaceTarget.TargetSubnet.ToString()) { cmbExistingArmSubnet.SelectedIndex = i; break; } } } } #endregion } if (PropertyChanged != null) { PropertyChanged(); } }