C# TaskDialog.Show

Hi All,

I have spent more time than I care to admit on this.

How can I get a TaskDialog.Show to show my entire list for ViewPlan.Name?

I am using the builtin MacroManager, SharpDevelop

Thanks

/*
 * Created by SharpDevelop.
 * User: aclarke
 * Date: 9/23/2019
 * Time: 10:07 AM
 * 
 * To change this template use Tools | Options | Coding | Edit Standard Headers.
 */
using System;
using Autodesk.Revit.UI;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI.Selection;
using System.Collections.Generic;
using System.Linq;

namespace MyTools
{
    [Autodesk.Revit.Attributes.Transaction(Autodesk.Revit.Attributes.TransactionMode.Manual)]
    [Autodesk.Revit.DB.Macros.AddInId("68646703-C7DA-4901-AC25-1A5C77654362")]
	public partial class ThisDocument
	{
		private void Module_Startup(object sender, EventArgs e)
		{

		}

		private void Module_Shutdown(object sender, EventArgs e)
		{

		}

		#region Revit Macros generated code
		private void InternalStartup()
		{
			this.Startup += new System.EventHandler(Module_Startup);
			this.Shutdown += new System.EventHandler(Module_Shutdown);
		}
		#endregion
		public void CreateSheets()
		{
			
			//Current Document
			Document doc = this.Application.ActiveUIDocument.Document;
			
			//Build Collector
			List<ViewPlan> collectedViewPlans = new FilteredElementCollector(doc)
				.OfClass(typeof(ViewPlan))
				.Cast<ViewPlan>()
				.ToList();
			
			List<String> strViewPlans = new List<String>();
			
			foreach (ViewPlan vp in collectedViewPlans)
			{
				strViewPlans.Add(vp.Name);
				//strViewPlans.Append(vp.Name);
				//TaskDialog.Show("Title", vp.Name);
			}
			
			TaskDialog.Show("Title", strViewPlans.ToString());
							
		}
	}
}

string message = “”;

foreach()
{
message += view.Name;
}

TaskDialog.Show(“Names”, message);

1 Like

Thanks Sean,
I feel I understand the message/taskbox now. it takes a ‘string’ and only a single string. I kept feeding it a list of strings.

We are concatenating the string, not appending, or adding or joining. I could not find or figure this out.
Thanks
AlanC.

//Current Document
    			Document doc = this.Application.ActiveUIDocument.Document;
    			
    			//Build Collector
    			List<ViewPlan> collectedViewPlans = new FilteredElementCollector(doc)
    				.OfClass(typeof(ViewPlan))
    				.Cast<ViewPlan>()
    				.ToList();
    			
    			string strViewPlans = "";
    			
    			foreach (ViewPlan vp in collectedViewPlans)
    			{
    				strViewPlans += vp.Name + "\n";
    			}
    			
    			TaskDialog.Show("Title", strViewPlans);
    							
    		}
1 Like