Exemplo n.º 1
0
        /// <summary>
        /// Initialize the api paramters required for making api calls from the input text box
        /// </summary>
        void InitializeValues()
        {
            //use these values for debug mode
            //string subscriptionId = "f1b96a0f-2775-420f-b692-3f13bcdf0060";
            //string clientId = "999d16a6-aa8a-48e7-9029-f25b35b01e53";
            //string clientSecret = "H~k7mM.ifSbhr-JPW_9l0-XL~_G1qIkhJs";
            //string tenantId = "afebbe05-f314-492a-9035-3b68dee7fea1";
            //string scaleSet = "nsVmScaleSet";
            //string resourceGroup = "DEVTEST-RG";

            //use this section for actual implementation
            string subscriptionId = string.Empty;
            string clientId       = string.Empty;
            string tenantId       = string.Empty;
            string clientSecret   = string.Empty;
            string scaleSet       = string.Empty;
            string resourceGroup  = string.Empty;

            subscriptionBox.Invoke((MethodInvoker)(() => { subscriptionId = subscriptionBox.Text.Trim(); }));
            clientBox.Invoke((MethodInvoker)(() => { clientId = clientBox.Text.Trim(); }));
            tenantBox.Invoke((MethodInvoker)(() => { tenantId = tenantBox.Text.Trim(); }));
            secretBox.Invoke((MethodInvoker)(() => { clientSecret = secretBox.Text.Trim(); }));
            resourceGroupBox.Invoke((MethodInvoker)(() => { resourceGroup = resourceGroupBox.Text.Trim(); }));
            scaleSetBox.Invoke((MethodInvoker)(() => { scaleSet = scaleSetBox.Text.Trim(); }));


            if (string.IsNullOrEmpty(subscriptionId) || string.IsNullOrEmpty(clientId) || string.IsNullOrEmpty(tenantId) || string.IsNullOrEmpty(clientSecret))
            {
                MessageBox.Show("All fields must be non empty", "Invalid Field");
                return;
            }
            Vm.InitializeApiParams(subscriptionId, tenantId, clientId, clientSecret, scaleSet, resourceGroup);
        }