Exemple #1
0
        private async void treeSource_AfterCheck(object sender, TreeViewEventArgs e)
        {
            if (_sourceCascadeNode == null)
            {
                _sourceCascadeNode = e.Node;

                if (e.Node.Checked)
                {
                    await MigAzTreeView.RecursiveCheckToggleDown(e.Node, e.Node.Checked);

                    MigAzTreeView.FillUpIfFullDown(e.Node);
                    treeSource.SelectedNode = e.Node;

                    await AutoSelectDependencies(e.Node);
                }
                else
                {
                    await MigAzTreeView.RecursiveCheckToggleUp(e.Node, e.Node.Checked);

                    await MigAzTreeView.RecursiveCheckToggleDown(e.Node, e.Node.Checked);
                }

                _sourceCascadeNode = null;

                _SelectedNodes = this.GetSelectedNodes(treeSource);
                // todo                 UpdateExportItemsCount();
                this.TemplateGenerator.UpdateArtifacts(GetArmArtifacts());
            }
        }
Exemple #2
0
        private async void treeASM_AfterCheck(object sender, TreeViewEventArgs e)
        {
            if (_SourceAsmNode == null)
            {
                _SourceAsmNode = e.Node;
            }

            if (e.Node.Checked)
            {
                await AutoSelectDependencies(e.Node);
            }

            if (e.Node.Tag != null)
            {
                if (e.Node.Tag.GetType() == typeof(Azure.Asm.VirtualMachine))
                {
                    Azure.Asm.VirtualMachine asmVirtualMachine = (Azure.Asm.VirtualMachine)e.Node.Tag;

                    if (asmVirtualMachine.TargetVirtualNetwork == null)
                    {
                        asmVirtualMachine.TargetVirtualNetwork = await AzureContextSourceASM.AzureRetriever.GetAzureAsmVirtualNetwork(asmVirtualMachine.VirtualNetworkName);

                        if (asmVirtualMachine.TargetVirtualNetwork != null)
                        {
                            foreach (Azure.Asm.Subnet asmSubnect in asmVirtualMachine.TargetVirtualNetwork.Subnets)
                            {
                                if (asmSubnect.Name == asmVirtualMachine.SubnetName)
                                {
                                    asmVirtualMachine.TargetSubnet = asmSubnect;
                                }
                            }
                        }
                    }

                    if (asmVirtualMachine.OSVirtualHardDisk.TargetStorageAccount == null)
                    {
                        asmVirtualMachine.OSVirtualHardDisk.TargetStorageAccount = await AzureContextSourceASM.AzureRetriever.GetAzureAsmStorageAccount(asmVirtualMachine.OSVirtualHardDisk.StorageAccountName);
                    }

                    foreach (Azure.Asm.Disk asmDisk in asmVirtualMachine.DataDisks)
                    {
                        if (asmDisk.TargetStorageAccount == null)
                        {
                            asmDisk.TargetStorageAccount = await AzureContextSourceASM.AzureRetriever.GetAzureAsmStorageAccount(asmDisk.StorageAccountName);
                        }
                    }
                }
            }

            TreeNode resultUpdateARMTree = await UpdateARMTree(e.Node);

            if (_SourceAsmNode != null && _SourceAsmNode == e.Node)
            {
                if (e.Node.Checked)
                {
                    await MigAzTreeView.RecursiveCheckToggleDown(e.Node, e.Node.Checked);

                    MigAzTreeView.FillUpIfFullDown(e.Node);
                    treeSourceASM.SelectedNode = e.Node;
                }
                else
                {
                    await MigAzTreeView.RecursiveCheckToggleUp(e.Node, e.Node.Checked);

                    await MigAzTreeView.RecursiveCheckToggleDown(e.Node, e.Node.Checked);
                }

                _SelectedNodes = this.GetSelectedNodes(treeSourceASM);
                UpdateExportItemsCount();
                await this.TemplateGenerator.UpdateArtifacts(GetAsmArtifacts());

                _SourceAsmNode = null;

                if (resultUpdateARMTree != null)
                {
                    treeTargetARM.SelectedNode = resultUpdateARMTree;
                }
            }
        }