internal async Task Bind(AzureContext azureContext, TargetTreeView targetTreeView, Azure.MigrationTarget.NetworkInterface targetNetworkInterface)
        {
            _AzureContext           = azureContext;
            _TargetTreeView         = targetTreeView;
            _TargetNetworkInterface = targetNetworkInterface;

            lblSourceName.Text = _TargetNetworkInterface.SourceName;
            txtTargetName.Text = _TargetNetworkInterface.TargetName;


            if (_TargetNetworkInterface.TargetNetworkInterfaceIpConfigurations.Count > 0)
            {
                cmbAllocationMethod.SelectedIndex = cmbAllocationMethod.FindString(_TargetNetworkInterface.TargetNetworkInterfaceIpConfigurations[0].TargetPrivateIPAllocationMethod);
            }

            if (_TargetNetworkInterface.SourceNetworkInterface != null)
            {
                if (_TargetNetworkInterface.SourceNetworkInterface.GetType() == typeof(Azure.Asm.NetworkInterface))
                {
                    Azure.Asm.NetworkInterface asmNetworkInterface = (Azure.Asm.NetworkInterface)_TargetNetworkInterface.SourceNetworkInterface;

                    lblVirtualNetworkName.Text = asmNetworkInterface.NetworkInterfaceIpConfigurations[0].VirtualNetworkName;
                    lblSubnetName.Text         = asmNetworkInterface.NetworkInterfaceIpConfigurations[0].SubnetName;
                    lblStaticIpAddress.Text    = asmNetworkInterface.NetworkInterfaceIpConfigurations[0].PrivateIpAddress;
                }
                else if (_TargetNetworkInterface.SourceNetworkInterface.GetType() == typeof(Azure.Arm.NetworkInterface))
                {
                    Azure.Arm.NetworkInterface armNetworkInterface = (Azure.Arm.NetworkInterface)_TargetNetworkInterface.SourceNetworkInterface;

                    lblVirtualNetworkName.Text = armNetworkInterface.NetworkInterfaceIpConfigurations[0].VirtualNetworkName;
                    lblSubnetName.Text         = armNetworkInterface.NetworkInterfaceIpConfigurations[0].SubnetName;
                    lblStaticIpAddress.Text    = armNetworkInterface.NetworkInterfaceIpConfigurations[0].PrivateIpAddress;
                }
            }

            try
            {
                List <Azure.Arm.VirtualNetwork> a = await _AzureContext.AzureRetriever.GetAzureARMVirtualNetworks();

                rbExistingARMVNet.Enabled = a.Count() > 0;
            }
            catch (Exception exc)
            {
                _AzureContext.LogProvider.WriteLog("VirtualMachineProperties.Bind", exc.Message);
                rbExistingARMVNet.Enabled = false;
            }

            if (rbExistingARMVNet.Enabled == false ||
                _TargetNetworkInterface.TargetNetworkInterfaceIpConfigurations.Count() == 0 ||
                _TargetNetworkInterface.TargetNetworkInterfaceIpConfigurations[0].TargetSubnet == null ||
                _TargetNetworkInterface.TargetNetworkInterfaceIpConfigurations[0].TargetSubnet.GetType() == typeof(Azure.MigrationTarget.Subnet)
                )
            {
                rbVNetInMigration.Checked = true;
            }
            else
            {
                rbExistingARMVNet.Checked = true;
            }
        }
        internal async Task Bind(AzureContext azureContext, TargetTreeView targetTreeView, Azure.MigrationTarget.NetworkInterface targetNetworkInterface)
        {
            _AzureContext           = azureContext;
            _TargetTreeView         = targetTreeView;
            _TargetNetworkInterface = targetNetworkInterface;
            networkSelectionControl1.PropertyChanged += NetworkSelectionControl1_PropertyChanged;

            if (_TargetNetworkInterface.TargetNetworkInterfaceIpConfigurations.Count > 0)
            {
                await networkSelectionControl1.Bind(azureContext, targetTreeView, targetTreeView.GetVirtualNetworksInMigration());

                networkSelectionControl1.VirtualNetworkTarget = _TargetNetworkInterface.TargetNetworkInterfaceIpConfigurations[0];
            }

            lblSourceName.Text = _TargetNetworkInterface.SourceName;
            txtTargetName.Text = _TargetNetworkInterface.TargetName;

            if (_TargetNetworkInterface.EnableIPForwarding)
            {
                rbIPForwardingEnabled.Checked = true;
            }
            else
            {
                rbIPForwardingDisabled.Checked = true;
            }

            if (_TargetNetworkInterface.SourceNetworkInterface != null)
            {
                if (_TargetNetworkInterface.SourceNetworkInterface.GetType() == typeof(Azure.Asm.NetworkInterface))
                {
                    Azure.Asm.NetworkInterface asmNetworkInterface = (Azure.Asm.NetworkInterface)_TargetNetworkInterface.SourceNetworkInterface;

                    lblVirtualNetworkName.Text = asmNetworkInterface.NetworkInterfaceIpConfigurations[0].VirtualNetworkName;
                    lblSubnetName.Text         = asmNetworkInterface.NetworkInterfaceIpConfigurations[0].SubnetName;
                    lblStaticIpAddress.Text    = asmNetworkInterface.NetworkInterfaceIpConfigurations[0].PrivateIpAddress;
                }
                else if (_TargetNetworkInterface.SourceNetworkInterface.GetType() == typeof(Azure.Arm.NetworkInterface))
                {
                    Azure.Arm.NetworkInterface armNetworkInterface = (Azure.Arm.NetworkInterface)_TargetNetworkInterface.SourceNetworkInterface;

                    lblVirtualNetworkName.Text = armNetworkInterface.NetworkInterfaceIpConfigurations[0].VirtualNetworkName;
                    lblSubnetName.Text         = armNetworkInterface.NetworkInterfaceIpConfigurations[0].SubnetName;
                    lblStaticIpAddress.Text    = armNetworkInterface.NetworkInterfaceIpConfigurations[0].PrivateIpAddress;
                }
            }

            virtualMachineSummary.Bind(_TargetNetworkInterface.ParentVirtualMachine, _TargetTreeView);
            networkSecurityGroup.Bind(_TargetNetworkInterface.NetworkSecurityGroup, _TargetTreeView);
        }
Exemplo n.º 3
0
        internal async Task Bind(AzureContext azureContext, TargetTreeView targetTreeView, Azure.MigrationTarget.NetworkInterface targetNetworkInterface)
        {
            _AzureContext           = azureContext;
            _TargetTreeView         = targetTreeView;
            _TargetNetworkInterface = targetNetworkInterface;

            if (_TargetNetworkInterface.TargetNetworkInterfaceIpConfigurations.Count > 0)
            {
                await networkSelectionControl1.Bind(azureContext, targetTreeView.GetVirtualNetworksInMigration());

                networkSelectionControl1.VirtualNetworkTarget = _TargetNetworkInterface.TargetNetworkInterfaceIpConfigurations[0];
            }

            lblSourceName.Text = _TargetNetworkInterface.SourceName;
            txtTargetName.Text = _TargetNetworkInterface.TargetName;


            if (_TargetNetworkInterface.TargetNetworkInterfaceIpConfigurations.Count > 0)
            {
                cmbAllocationMethod.SelectedIndex = cmbAllocationMethod.FindString(_TargetNetworkInterface.TargetNetworkInterfaceIpConfigurations[0].TargetPrivateIPAllocationMethod);
            }

            if (_TargetNetworkInterface.SourceNetworkInterface != null)
            {
                if (_TargetNetworkInterface.SourceNetworkInterface.GetType() == typeof(Azure.Asm.NetworkInterface))
                {
                    Azure.Asm.NetworkInterface asmNetworkInterface = (Azure.Asm.NetworkInterface)_TargetNetworkInterface.SourceNetworkInterface;

                    lblVirtualNetworkName.Text = asmNetworkInterface.NetworkInterfaceIpConfigurations[0].VirtualNetworkName;
                    lblSubnetName.Text         = asmNetworkInterface.NetworkInterfaceIpConfigurations[0].SubnetName;
                    lblStaticIpAddress.Text    = asmNetworkInterface.NetworkInterfaceIpConfigurations[0].PrivateIpAddress;
                }
                else if (_TargetNetworkInterface.SourceNetworkInterface.GetType() == typeof(Azure.Arm.NetworkInterface))
                {
                    Azure.Arm.NetworkInterface armNetworkInterface = (Azure.Arm.NetworkInterface)_TargetNetworkInterface.SourceNetworkInterface;

                    lblVirtualNetworkName.Text = armNetworkInterface.NetworkInterfaceIpConfigurations[0].VirtualNetworkName;
                    lblSubnetName.Text         = armNetworkInterface.NetworkInterfaceIpConfigurations[0].SubnetName;
                    lblStaticIpAddress.Text    = armNetworkInterface.NetworkInterfaceIpConfigurations[0].PrivateIpAddress;
                }
            }
        }
Exemplo n.º 4
0
        internal async Task Bind(NetworkInterface targetNetworkInterface, TargetTreeView targetTreeView)
        {
            try
            {
                _IsBinding              = true;
                _TargetTreeView         = targetTreeView;
                _TargetNetworkInterface = targetNetworkInterface;
                networkSelectionControl1.PropertyChanged += NetworkSelectionControl1_PropertyChanged;

                await networkSelectionControl1.Bind(targetTreeView);

                if (_TargetNetworkInterface.TargetNetworkInterfaceIpConfigurations.Count > 0)
                {
                    networkSelectionControl1.VirtualNetworkTarget = _TargetNetworkInterface.TargetNetworkInterfaceIpConfigurations[0];
                }

                lblSourceName.Text = _TargetNetworkInterface.SourceName;
                txtTargetName.Text = _TargetNetworkInterface.TargetName;

                if (_TargetNetworkInterface.EnableIPForwarding)
                {
                    rbIPForwardingEnabled.Checked = true;
                }
                else
                {
                    rbIPForwardingDisabled.Checked = true;
                }

                if (_TargetNetworkInterface.EnableAcceleratedNetworking)
                {
                    rbAcceleratedNetworkingEnabled.Checked = true;
                }
                else
                {
                    rbAcceleratedNetworkingDisabled.Checked = true;
                }

                if (_TargetNetworkInterface.SourceNetworkInterface != null)
                {
                    if (_TargetNetworkInterface.SourceNetworkInterface.GetType() == typeof(Azure.Asm.NetworkInterface))
                    {
                        Azure.Asm.NetworkInterface asmNetworkInterface = (Azure.Asm.NetworkInterface)_TargetNetworkInterface.SourceNetworkInterface;

                        lblVirtualNetworkName.Text = asmNetworkInterface.NetworkInterfaceIpConfigurations[0].VirtualNetworkName;
                        lblSubnetName.Text         = asmNetworkInterface.NetworkInterfaceIpConfigurations[0].SubnetName;
                        lblStaticIpAddress.Text    = asmNetworkInterface.NetworkInterfaceIpConfigurations[0].PrivateIpAddress;
                    }
                    else if (_TargetNetworkInterface.SourceNetworkInterface.GetType() == typeof(Azure.Arm.NetworkInterface))
                    {
                        Azure.Arm.NetworkInterface armNetworkInterface = (Azure.Arm.NetworkInterface)_TargetNetworkInterface.SourceNetworkInterface;

                        lblVirtualNetworkName.Text = armNetworkInterface.NetworkInterfaceIpConfigurations[0].VirtualNetworkName;
                        lblSubnetName.Text         = armNetworkInterface.NetworkInterfaceIpConfigurations[0].SubnetName;
                        lblStaticIpAddress.Text    = armNetworkInterface.NetworkInterfaceIpConfigurations[0].PrivateIpAddress;
                    }
                }

                virtualMachineSummary.Bind(_TargetNetworkInterface.ParentVirtualMachine, _TargetTreeView);
                networkSecurityGroup.Bind(_TargetNetworkInterface.NetworkSecurityGroup, _TargetTreeView);

                if (_TargetNetworkInterface.TargetNetworkInterfaceIpConfigurations.Count() > 0)
                {
                    resourceSummaryPublicIp.Bind(_TargetNetworkInterface.TargetNetworkInterfaceIpConfigurations[0].TargetPublicIp, _TargetTreeView);
                }
            }
            finally
            {
                _IsBinding = false;
            }
        }