添加项目文件。
This commit is contained in:
54
CivilModelCreator/CDMToExcelModeless.cs
Normal file
54
CivilModelCreator/CDMToExcelModeless.cs
Normal file
@@ -0,0 +1,54 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user