Result IExternalCommand.Execute(ExternalCommandData commandData, ref string message, ElementSet elements)
        {
            try
            {
                m_app = commandData.Application;
                m_doc = m_app.ActiveUIDocument.Document;
                Log.AppendLog(LogMessageType.INFO, "Started");

                // (Konrad) We are gathering information about the addin use. This allows us to
                // better maintain the most used plug-ins or discontiue the unused ones.
                AddinUtilities.PublishAddinLog(
                    new AddinLog("MassTools-MassCommands", commandData.Application.Application.VersionNumber));

                m_app.Application.FailuresProcessing += OnFailuresProcessing;
                var linkedFilesForm = new Form_LinkedFiles(m_app);
                if (linkedFilesForm.ShowDialog() == DialogResult.OK)
                {
                    var assignForm = new Form_Assigner(m_app)
                    {
                        WorksetDictionary    = linkedFilesForm.WorksetDictionary,
                        IntegratedMassList   = linkedFilesForm.IntegratedMassList,
                        LinkedMassDictionary = linkedFilesForm.LinkedMassDictionary,
                        ElementDictionary    = linkedFilesForm.ElementDictionary,
                        ElementCategories    = linkedFilesForm.ElementCategories,
                        MassParameters       = linkedFilesForm.MassParameters,
                        SelectedSourceType   = linkedFilesForm.SelectedSourceType,
                        ParameterMaps        = linkedFilesForm.ParameterMaps
                    };

                    linkedFilesForm.Close();

                    if (assignForm.ShowDialog() == DialogResult.OK)
                    {
                        assignForm.Close();
                    }
                }

                Log.AppendLog(LogMessageType.INFO, "Ended.");
                return(Result.Succeeded);
            }
            catch (Exception ex)
            {
                Log.AppendLog(LogMessageType.EXCEPTION, ex.Message);
                return(Result.Failed);
            }
        }
        Result IExternalCommand.Execute(ExternalCommandData commandData, ref string message, Autodesk.Revit.DB.ElementSet elements)
        {
            try
            {
                m_app = commandData.Application;
                m_doc = m_app.ActiveUIDocument.Document;

                m_app.Application.FailuresProcessing += new EventHandler <FailuresProcessingEventArgs>(OnFailuresProcessing);

                Form_LinkedFiles linkedFilesForm = new Form_LinkedFiles(m_app);
                if (linkedFilesForm.ShowDialog() == DialogResult.OK)
                {
                    Form_Assigner assignForm = new Form_Assigner(m_app);
                    assignForm.WorksetDictionary    = linkedFilesForm.WorksetDictionary;
                    assignForm.IntegratedMassList   = linkedFilesForm.IntegratedMassList;
                    assignForm.LinkedMassDictionary = linkedFilesForm.LinkedMassDictionary;
                    assignForm.ElementDictionary    = linkedFilesForm.ElementDictionary;
                    assignForm.ElementCategories    = linkedFilesForm.ElementCategories;
                    assignForm.MassParameters       = linkedFilesForm.MassParameters;
                    assignForm.SelectedSourceType   = linkedFilesForm.SelectedSourceType;
                    assignForm.ParameterMaps        = linkedFilesForm.ParameterMaps;

                    linkedFilesForm.Close();

                    if (assignForm.ShowDialog() == DialogResult.OK)
                    {
                        assignForm.Close();
                    }
                }

                return(Result.Succeeded);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: cannot start Transfer Data.\n" + ex.Message, "Transfer Data");
                return(Result.Failed);
            }
        }