as I said, I can't do all the time consuming part in DoWork because I get an exception since part of the code requires creating and initializing a new window and passing information to it. which won't work based on what I've read because i'm calling a control from MTA instead of STA...
[quote]This exception means that the thread that owns the Panel (the Panel being added) has been initialized using the MTA threading model. The drag/drop system requires that the calling thread use the STA thread model (particularly it requires that COM be initialized via OleInitialize). Threading models are an unfortunate vestige of COM, a predecessor of the .NET platform.[/quote]
http://stackoverflow.com/questions/135803/dragdrop-registration-did-not-succeed
this is the relevant portion of the code
y = new LogRecord();
xPackaged = new STFSPackage(xOut, y);
if (!xPackaged.ParseSuccess)
return;
PackageExplorer xExplorer = new PackageExplorer(xparent);
xExplorer.listBox4.Items.AddRange(y.Log);
y.WhenLogged += new LogRecord.OnLog(xExplorer.xAddLog);
xExplorer.set(ref xPackaged);
this.Dispose();
xExplorer.Show();
at the point where the new PackageExplorer window is being created, I was getting the above mentioned exception. so I moved that portion of the code to RunWorkerCompleted, and now it works, but I get the big lag in opening that isn't there if I just forego using backgroundworker and dont have an animation showing progress.
between my last thread asking for help and this one, it seems like using backgroundworker raises so many issues it really makes me wonder how much I want to show progress to the user, since it's been so much work to get this to work and now it works but not in an optimal way.
No comments:
Post a Comment