internal void Bind(AsmToArmForm asmToArmForm, AsmDisk asmDisk) { _AsmToArmForm = asmToArmForm; _AsmDataDisk = asmDisk; BindCommon(); }
internal void Bind(AsmToArmForm asmToArmForm, TreeNode armDataDiskNode) { _AsmToArmForm = asmToArmForm; _ARMDataDiskNode = armDataDiskNode; _AsmDataDisk = (AsmDisk)_ARMDataDiskNode.Tag; BindCommon(); }
private bool RecursiveHealthCheckNode(TreeNode treeNode) { if (treeNode.Tag != null) { if (treeNode.Tag.GetType() == typeof(ArmResourceGroup)) { ArmResourceGroup armResourceGroup = (ArmResourceGroup)treeNode.Tag; if (armResourceGroup.Location == null) { treeARM.SelectedNode = treeNode; this.Refresh(); MessageBox.Show("Target Location must be selected before exporting."); return(false); } } else if (treeNode.Tag.GetType() == typeof(TreeNode)) // Tag is the sourced ASM TreeNode { TreeNode asmTreeNode = (TreeNode)treeNode.Tag; if (asmTreeNode.Tag != null) { if (asmTreeNode.Tag.GetType() == typeof(AsmNetworkSecurityGroup)) { AsmNetworkSecurityGroup asmNetworkSecurityGroup = (AsmNetworkSecurityGroup)asmTreeNode.Tag; // Validate the Target Name is not blank if (asmNetworkSecurityGroup.TargetName == String.Empty) { treeARM.SelectedNode = treeNode; this.Refresh(); MessageBox.Show("Target Name must be selected before exporting."); return(false); } } else if (asmTreeNode.Tag.GetType() == typeof(AsmVirtualNetwork)) { AsmVirtualNetwork asmVirtualNetwork = (AsmVirtualNetwork)asmTreeNode.Tag; // Validate the Target Name is not blank if (asmVirtualNetwork.TargetName == String.Empty) { treeARM.SelectedNode = treeNode; this.Refresh(); MessageBox.Show("Target Name must be selected before exporting."); return(false); } foreach (TreeNode virtualNetworkNode in treeNode.Parent.Nodes) { TreeNode asmVirtualNetworkNode = (TreeNode)virtualNetworkNode.Tag; AsmVirtualNetwork asmVirtualNetworkCompare = (AsmVirtualNetwork)asmVirtualNetworkNode.Tag; if (asmVirtualNetworkCompare.Name != asmVirtualNetwork.Name && asmVirtualNetworkCompare.TargetName == asmVirtualNetwork.TargetName) { treeARM.SelectedNode = treeNode; this.Refresh(); MessageBox.Show("Target Names must be unique to migrate Virtual Networks."); return(false); } } } else if (asmTreeNode.Tag.GetType() == typeof(AsmVirtualMachine)) { AsmVirtualMachine asmVirtualMachine = (AsmVirtualMachine)asmTreeNode.Tag; if (asmVirtualMachine.TargetName == String.Empty) { treeARM.SelectedNode = treeNode; this.Refresh(); MessageBox.Show("Target Name for Virtual Machine must be specified."); return(false); } if (asmVirtualMachine.TargetAvailabilitySet == null) { treeARM.SelectedNode = treeNode; this.Refresh(); MessageBox.Show("Target Availability Set for Virtual Machine must be specified."); return(false); } if (asmVirtualMachine.TargetVirtualNetwork == null) { treeARM.SelectedNode = treeNode; this.Refresh(); MessageBox.Show("Target Virtual Network for Virtual Machine must be specified."); return(false); } if (asmVirtualMachine.TargetSubnet == null) { treeARM.SelectedNode = treeNode; this.Refresh(); MessageBox.Show("Target Subnet for Virtual Machine must be specified."); return(false); } if (asmVirtualMachine.OSVirtualHardDisk.TargetStorageAccount == null) { treeARM.SelectedNode = treeNode; this.Refresh(); MessageBox.Show("Target VM OS Disk Storage Account must be specified."); return(false); } } else if (asmTreeNode.Tag.GetType() == typeof(AsmStorageAccount)) { AsmStorageAccount asmStorageAccount = (AsmStorageAccount)asmTreeNode.Tag; if (asmStorageAccount.TargetName == String.Empty) { treeARM.SelectedNode = treeNode; this.Refresh(); MessageBox.Show("Target Storage Account Name must be specified."); return(false); } } } } else if (treeNode.Tag.GetType() == typeof(AsmSubnet)) { AsmSubnet asmSubnet = (AsmSubnet)treeNode.Tag; if (asmSubnet.TargetName == String.Empty) { treeARM.SelectedNode = treeNode; this.Refresh(); MessageBox.Show("Target Subnet Name must be specified."); return(false); } } else if (treeNode.Tag.GetType() == typeof(ArmAvailabilitySet)) { ArmAvailabilitySet armAvailabilitySet = (ArmAvailabilitySet)treeNode.Tag; if (armAvailabilitySet.TargetName == String.Empty) { treeARM.SelectedNode = treeNode; this.Refresh(); MessageBox.Show("Target Availability Set Name must be specified."); return(false); } } else if (treeNode.Tag.GetType() == typeof(AsmDisk)) { AsmDisk asmDisk = (AsmDisk)treeNode.Tag; if (asmDisk.TargetStorageAccount == null) { treeARM.SelectedNode = treeNode; this.Refresh(); MessageBox.Show("Target VM Data Disk Storage Account must be specified."); return(false); } } } foreach (TreeNode childNode in treeNode.Nodes) { bool nodeResult = RecursiveHealthCheckNode(childNode); if (nodeResult == false) { return(false); } } return(true); }
private async void treeARM_AfterSelect(object sender, TreeViewEventArgs e) { ClearAzureResourceManagerProperties(); lblAzureObjectName.Text = String.Empty; if (e.Node.Tag != null) { if (e.Node.Tag.GetType() == typeof(TreeNode)) { TreeNode asmTreeNode = (TreeNode)e.Node.Tag; if (asmTreeNode.Tag != null) { lblAzureObjectName.Text = e.Node.Text; if (asmTreeNode.Tag.GetType() == typeof(AsmVirtualNetwork)) { pictureBox1.Image = imageList1.Images["VirtualNetwork"]; VirtualNetworkProperties properties = new VirtualNetworkProperties(); properties.Bind(e.Node); panel1.Controls.Add(properties); } else if (asmTreeNode.Tag.GetType() == typeof(AsmStorageAccount)) { pictureBox1.Image = imageList1.Images["StorageAccount"]; AsmStorageAccount storageAccount = (AsmStorageAccount)asmTreeNode.Tag; lblAzureObjectName.Text = storageAccount.Name; StorageAccountProperties properties = new StorageAccountProperties(); properties.Bind(this._AzureContextTargetARM, e.Node); panel1.Controls.Add(properties); } else if (asmTreeNode.Tag.GetType() == typeof(AsmVirtualMachine)) { pictureBox1.Image = imageList1.Images["VirtualMachine"]; VirtualMachineProperties properties = new VirtualMachineProperties(); properties.Bind(e.Node, this); panel1.Controls.Add(properties); } else if (asmTreeNode.Tag.GetType() == typeof(AsmNetworkSecurityGroup)) { pictureBox1.Image = imageList1.Images["NetworkSecurityGroup"]; NetworkSecurityGroupProperties properties = new NetworkSecurityGroupProperties(); properties.Bind(e.Node, this); panel1.Controls.Add(properties); } } } if (e.Node.Tag.GetType() == typeof(AsmSubnet)) { pictureBox1.Image = imageList1.Images["VirtualNetwork"]; AsmSubnet asmSubnet = (AsmSubnet)e.Node.Tag; SubnetProperties properties = new SubnetProperties(); properties.Bind(e.Node); panel1.Controls.Add(properties); } else if (e.Node.Tag.GetType() == typeof(AsmDisk)) { AsmDisk asmDisk = (AsmDisk)e.Node.Tag; pictureBox1.Image = imageList1.Images["Disk"]; DiskProperties properties = new DiskProperties(); properties.Bind(this, e.Node); panel1.Controls.Add(properties); } else if (e.Node.Tag.GetType() == typeof(ArmAvailabilitySet)) { pictureBox1.Image = imageList1.Images["AvailabilitySet"]; AvailabilitySetProperties properties = new AvailabilitySetProperties(); properties.Bind(e.Node); panel1.Controls.Add(properties); } else if (e.Node.Tag.GetType() == typeof(ArmResourceGroup)) { pictureBox1.Image = imageList1.Images["ResourceGroup"]; ResourceGroupProperties properties = new ResourceGroupProperties(); await properties.Bind(this, e.Node); panel1.Controls.Add(properties); } } _statusProvider.UpdateStatus("Ready"); }