public Result 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("Utilities-RenameFamily", commandData.Application.Application.VersionNumber)); var viewModel = new RenameViewModel(commandData.Application); var window = new RenameWindow { DataContext = viewModel }; window.ShowDialog(); Log.AppendLog(LogMessageType.INFO, "Ended"); } catch (Exception ex) { Log.AppendLog(LogMessageType.EXCEPTION, ex.Message); } return(Result.Succeeded); }
private void Window_Loaded(object sender, RoutedEventArgs e) { viewModel = this.DataContext as RenameViewModel; }