I wrote a component for hard long time calculation,and begin a new thread for this calculation.
and i also need a Message to show the realtime procedure of this calculation.such as “Now is 50%”,and “Finish!”
and when use this component,i found it show the procedure can not update self automatically,only if you click the blank area of canvas,or zoom in/out,the message can update itself.
so can you have some idea of making the message automatically update itself?thank you very much!
protected override void RegisterInputParams(GH_Component.GH_InputParamManager pManager)
{ }
protected override void RegisterOutputParams(GH_Component.GH_OutputParamManager pManager)
{ }
Thread CalcuThread;
protected override void SolveInstance(IGH_DataAccess DA)
{
double A = 1;
CalcuThread = new Thread(() => LongTimeCalculate(A));
CalcuThread.Start();
}
private void LongTimeCalculate(double a)
{
for(int i=0;i<100;i++)
{
//do some hard calculation....
for(long j=0;j<1000000;j++)
{
double c = Math.Sin(a * i) * Math.Cos(a * i);
}
//do some hard calculation....
Message = $"Now is {i}% ";
}
Message = "Finish!";
}