55 lines
1.5 KiB
C#
55 lines
1.5 KiB
C#
|
|
using Autodesk.Revit.DB;
|
|||
|
|
using Autodesk.Revit.UI;
|
|||
|
|
using System;
|
|||
|
|
using System.Collections.Generic;
|
|||
|
|
using System.Linq;
|
|||
|
|
using System.Text;
|
|||
|
|
using System.Threading.Tasks;
|
|||
|
|
|
|||
|
|
namespace CivilModelCreator
|
|||
|
|
{
|
|||
|
|
class CDMToExcelModeless
|
|||
|
|
{
|
|||
|
|
ExternalEvent ExternalEvent { get; set; }
|
|||
|
|
|
|||
|
|
List<CDMData> cdmData { get; set; }
|
|||
|
|
string path { get; set; }
|
|||
|
|
|
|||
|
|
public CDMToExcelModeless(string path, List<CDMData> cdm)
|
|||
|
|
{
|
|||
|
|
cdmData = cdm;
|
|||
|
|
this.path = path;
|
|||
|
|
}
|
|||
|
|
internal void ProgressModeless()
|
|||
|
|
{
|
|||
|
|
if (cdmData == null)
|
|||
|
|
throw new Exception("无数据");
|
|||
|
|
|
|||
|
|
ProgressMonitorView currentUI = new ProgressMonitorView();
|
|||
|
|
|
|||
|
|
ProcessEventHandler progressEventHandler = new ProcessEventHandler
|
|||
|
|
{
|
|||
|
|
CdmData = cdmData,
|
|||
|
|
CurrentUI = currentUI,
|
|||
|
|
Path = path
|
|||
|
|
};
|
|||
|
|
ProgressMonitorControl currentControl = new ProgressMonitorControl();
|
|||
|
|
|
|||
|
|
currentControl.MaxValue = cdmData.Count;
|
|||
|
|
progressEventHandler.CurrentControl = currentControl;
|
|||
|
|
|
|||
|
|
ExternalEvent = ExternalEvent.Create(progressEventHandler);
|
|||
|
|
|
|||
|
|
currentUI.DataContext = currentControl;
|
|||
|
|
currentUI.ContentRendered += CurrentUI_ContentRendered;
|
|||
|
|
currentUI.Topmost = true;
|
|||
|
|
currentUI.Show();
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
private void CurrentUI_ContentRendered(object sender, EventArgs e)
|
|||
|
|
{
|
|||
|
|
ExternalEvent.Raise();
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|