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); }
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(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; } }
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 treeARM_AfterSelect(object sender, TreeViewEventArgs e) { LogProvider.WriteLog("treeARM_AfterSelect", "Start"); _SourceArmNode = e.Node; _PropertyPanel.Clear(); _PropertyPanel.ResourceText = String.Empty; if (e.Node.Tag != null) { if (e.Node.Tag.GetType() == typeof(TreeNode)) { TreeNode asmTreeNode = (TreeNode)e.Node.Tag; if (asmTreeNode.Tag != null) { _PropertyPanel.ResourceText = e.Node.Text; if (asmTreeNode.Tag.GetType() == typeof(Azure.Asm.VirtualNetwork)) { this._PropertyPanel.ResourceImage = imageList1.Images["VirtualNetwork"]; VirtualNetworkProperties properties = new VirtualNetworkProperties(); properties.PropertyChanged += Properties_PropertyChanged; properties.Bind(e.Node); _PropertyPanel.PropertyDetailControl = properties; } else if (asmTreeNode.Tag.GetType() == typeof(Azure.Asm.StorageAccount)) { this._PropertyPanel.ResourceImage = imageList1.Images["StorageAccount"]; Azure.Asm.StorageAccount storageAccount = (Azure.Asm.StorageAccount)asmTreeNode.Tag; _PropertyPanel.ResourceText = storageAccount.Name; StorageAccountProperties properties = new StorageAccountProperties(); properties.PropertyChanged += Properties_PropertyChanged; properties.Bind(this._AzureContextTargetARM, e.Node); _PropertyPanel.PropertyDetailControl = properties; } else if (asmTreeNode.Tag.GetType() == typeof(Azure.Asm.VirtualMachine)) { this._PropertyPanel.ResourceImage = imageList1.Images["VirtualMachine"]; VirtualMachineProperties properties = new VirtualMachineProperties(this.LogProvider); properties.AllowManangedDisk = (await _AzureContextSourceASM.AzureRetriever.GetAzureARMManagedDisks() != null); properties.PropertyChanged += Properties_PropertyChanged; await properties.Bind(e.Node, this); _PropertyPanel.PropertyDetailControl = properties; } else if (asmTreeNode.Tag.GetType() == typeof(Azure.Asm.NetworkSecurityGroup)) { this._PropertyPanel.ResourceImage = imageList1.Images["NetworkSecurityGroup"]; NetworkSecurityGroupProperties properties = new NetworkSecurityGroupProperties(); properties.PropertyChanged += Properties_PropertyChanged; properties.Bind(e.Node, this); _PropertyPanel.PropertyDetailControl = properties; } } } if (e.Node.Tag.GetType() == typeof(Azure.Asm.Subnet)) { this._PropertyPanel.ResourceImage = imageList1.Images["VirtualNetwork"]; Azure.Asm.Subnet asmSubnet = (Azure.Asm.Subnet)e.Node.Tag; SubnetProperties properties = new SubnetProperties(); properties.PropertyChanged += Properties_PropertyChanged; properties.Bind(e.Node); _PropertyPanel.PropertyDetailControl = properties; } else if (e.Node.Tag.GetType() == typeof(Azure.Asm.Disk)) { Azure.Asm.Disk asmDisk = (Azure.Asm.Disk)e.Node.Tag; this._PropertyPanel.ResourceImage = imageList1.Images["Disk"]; DiskProperties properties = new DiskProperties(this.LogProvider); properties.AllowManangedDisk = (await _AzureContextSourceASM.AzureRetriever.GetAzureARMManagedDisks() != null); properties.PropertyChanged += Properties_PropertyChanged; properties.Bind(this, e.Node); _PropertyPanel.PropertyDetailControl = properties; } else if (e.Node.Tag.GetType() == typeof(AvailabilitySet)) { this._PropertyPanel.ResourceImage = imageList1.Images["AvailabilitySet"]; AvailabilitySetProperties properties = new AvailabilitySetProperties(); properties.PropertyChanged += Properties_PropertyChanged; properties.Bind(e.Node); _PropertyPanel.PropertyDetailControl = properties; } else if (e.Node.Tag.GetType() == typeof(ResourceGroup)) { this._PropertyPanel.ResourceImage = imageList1.Images["ResourceGroup"]; ResourceGroupProperties properties = new ResourceGroupProperties(); properties.PropertyChanged += Properties_PropertyChanged; await properties.Bind(this, e.Node); _PropertyPanel.PropertyDetailControl = properties; } } _SourceArmNode = null; LogProvider.WriteLog("treeARM_AfterSelect", "End"); StatusProvider.UpdateStatus("Ready"); }