Inheritance: System.Windows.Forms.Form
Ejemplo n.º 1
0
        private bool GuardTargetName()
        {
            if (string.IsNullOrEmpty(targetName) || targetName.Equals("?"))
            {
                if (targetName.Equals("?"))
                {
                    TelemetryClient.TrackEvent("DeployFromArduinoIde", new Dictionary <string, string>()
                    {
                    });
                }

                // Use last successful deployment target as default
                string initialTargetValue = "";
                using (var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\IotCoreAppDeployment"))
                {
                    if (key != null)
                    {
                        initialTargetValue = key.GetValue("Target") as string;
                    }
                }

                // Let user specify target
                TargetNameForm targetNameForm = new TargetNameForm(initialTargetValue);
                var            result         = targetNameForm.ShowDialog();
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    targetName = targetNameForm.TargetName;
                }

                if (string.IsNullOrEmpty(targetName))
                {
                    Console.Write(Resource.DeploymentWorker_TargetMissing);
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 2
0
        private bool GuardTargetName()
        {
            if (string.IsNullOrEmpty(targetName) || targetName.Equals("?"))
            {
                if (targetName.Equals("?"))
                {
                    TelemetryClient.TrackEvent("DeployFromArduinoIde", new Dictionary<string, string>() { });
                }

                // Use last successful deployment target as default
                string initialTargetValue = "";
                using (var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\IotCoreAppDeployment"))
                {
                    if (key != null)
                    {
                        initialTargetValue = key.GetValue("Target") as string;
                    }
                }

                // Let user specify target
                TargetNameForm targetNameForm = new TargetNameForm(initialTargetValue);
                var result = targetNameForm.ShowDialog();
                if (result == System.Windows.Forms.DialogResult.OK)
                {
                    targetName = targetNameForm.TargetName;
                }

                if (string.IsNullOrEmpty(targetName))
                {
                    Console.Write(Resource.DeploymentWorker_TargetMissing);
                    return false;
                }
            }

            return true;
        }