/// <summary>
        /// Replaces the code in the Python node with the code changes made by the Migration Assistant.
        /// </summary>
        public void ChangeCode()
        {
            if (!this.CurrentViewModel.HasChanges)
            {
                if (this.PythonNode.Engine == PythonEngineVersion.CPython3)
                {
                    return;
                }
                this.PythonNode.Engine = PythonEngineVersion.CPython3;
                return;
            }

            if (!Models.DynamoModel.IsTestMode && !File.Exists(GetMigrationAssistantDisclaimerDismissFile()))
            {
                var warningMessage = new MigrationAssistantDisclaimer(this);
                warningMessage.ShowDialog();
                if (!warningMessage.DisclaimerAccepted)
                {
                    return;
                }
            }

            SavePythonMigrationBackup();
            this.PythonNode.MigrateCode(this.NewCode);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Replaces the code in the Python node with the code changes made by the Migration Assistant.
        /// </summary>
        public void ChangeCode()
        {
            if (CurrentViewModel.DiffState == State.NoChanges)
            {
                PythonNode.EngineName = PythonEngineManager.CPython3EngineName;
                return;
            }

            if (!Models.DynamoModel.IsTestMode && !File.Exists(GetMigrationAssistantDisclaimerDismissFile()))
            {
                var warningMessage = new MigrationAssistantDisclaimer(this);
                warningMessage.ShowDialog();
                if (!warningMessage.DisclaimerAccepted)
                {
                    return;
                }
            }

            SavePythonMigrationBackup();
            PythonNode.MigrateCode(this.NewCode);
        }