Message 1 of 6
C# executable freezes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
My plug-in for Inventor freezes at some point. it's a windows forms application (WFA) made in MVS. I can't minimize or close the userwindow and it said '(is not responding)'.
I can't really figure out what causes it, it seems to work fine untill a certain point, see my comments below;
public partial class InventorInfo : Form
{
Inventor.Application _invApp;
public bool LaunchedApp = false;
public _Document oDoc;
public String newctime;
public String oldctime;
public InventorInfo() {
InitializeComponent();
}
private void BtnClose_Click(object sender, EventArgs e) {
this.Close();
}
void RunProgram(object sender, EventArgs e) { //LAUNCH BUTTON press
while (LaunchedApp == false) {
if (string.IsNullOrEmpty(textBox1.Text) || string.IsNullOrEmpty(textBox2.Text) || string.IsNullOrEmpty(textBox3.Text)) {
MessageBox.Show("Launch aborted, Fill in the required fields");
break;
//works fine
}
else
Launch_invApp();
//launches the app just fine
oDoc = _invApp.Documents.Open(textBox1.Text);
//opens the document just fine
MessageBox.Show("Launched succesfully, configurator exe is running...");
//after this point is seems to freeze...
LaunchedApp = true;
}
System.Threading.Thread.Sleep(10000);
oldctime = newctime;
while (LaunchedApp == true) {
//strange thing is it does still run this part of the program even when it sais 'not responding'
FileInfo info = new FileInfo(textBox3.Text);
DateTime ctime = info.LastWriteTime;
newctime = ctime.ToString();
if (newctime.Equals(oldctime)) {
System.Threading.Thread.Sleep(1000);
}
else
AddiLogic();
oldctime = newctime;
System.Threading.Thread.Sleep(4000);
}
}