I am writting a program to manage DTS packages which is based on the code
example at the following link
http:\\ www.support.microsoft.com/?kbid=319985.
I need to do things in a Windows Forms Application when various things occur
in the package so I have written some custom events to reraise the events
caught in the PackageEventsSi nk class.
I also have a listview in details mode with several columns, my problem is
that when I try and iterate through the listbox items when inside the event
handler for the StartPackage event the application hangs. Also when I do a
quickview on the listbox, when I expand the items object if I scroll down
through the list it hangs when I get to "expectingMouse Up", which is set to
false.
I have no idea what could be causing this, and it is *really* annoying
becuase the program is almost finished!
I hope someone can help
Cheers
Simon 5 3264
Hi Simon,
Does your "eventhandl er for the StartPackage event" mean OnStart method of
DTS.PackageEven ts?
What is your "expectingMouse Up"?
Normally, the WinForm UI hang is caused by the long-time IO operation in
the main thread, which blocks the refresh of the UI.
I think you should check in your code which manipulates the UI, do not do
synchronization operation with UI.
Also, you can invoke Invalidate method of the control to force it refresh.
I think a better design is manipulate the data operation in a seperate
worker thread, then use control.invoke or control.BeginIn voke.
The articles below talks about the design-pattern of mainpulate WinForm UI
in multiThread: http://msdn.microsoft.com/msdnmag/is...g/default.aspx
Hope this helps,
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Jeffrey,
Thanks for your reply. I have upload my code to www.oursadlives.com\dts\ManagedDTS.cs and www.oursadlives.com\dts\DeployToolDlg.cs. The important UI methods are
"PrepPackage()" , "RunPackage ()" and "PackageStarted (object sender,
PackageEventsSi nk.PackageEvent Args e)"
The PackageEventsSi nk.OnStart method raises a custom event OnPackageStart
which I have hooked into in the dialog class. It is in the handler for the
OnPackageStart event where I am having problems (everything works fine if I
don't try and do stuff with the listview as I output stuff to the console to
tell me what's going on) if I try and step through the code it never gets
into the loop it hangs on the foreach(...) statement. As for
expectingMouseU p, as far as I know this is just a property of
ListView.Items, all I have been able to verify is that if I expand Items in
watch, then I can scoll up and down fine unless I let
ListView.Items. expectingMouseU p appear in which case it causes Visual Studio
to hang until I kill the running app through taskmanager.
I have tried executing the DTS class in another thread and that doesn't
change anything. Also I have noticed that if I am looping through the
listview then I receive no more console messages after the OnStart call.
I have read the document that you posted a link to, perhaps I haven't
totally understood it yet but surely I can't do the work on the listview in
a separate thread becuase it was created on the UI thread?
I hope this better explains my situation.
Cheers
Simon Does your "eventhandl er for the StartPackage event" mean OnStart method of DTS.PackageEven ts? What is your "expectingMouse Up"? Normally, the WinForm UI hang is caused by the long-time IO operation in the main thread, which blocks the refresh of the UI. I think you should check in your code which manipulates the UI, do not do synchronization operation with UI. Also, you can invoke Invalidate method of the control to force it refresh. I think a better design is manipulate the data operation in a seperate worker thread, then use control.invoke or control.BeginIn voke. The articles below talks about the design-pattern of mainpulate WinForm UI in multiThread: http://msdn.microsoft.com/msdnmag/is...g/default.aspx
Hope this helps,
Best regards, Jeffrey Tan Microsoft Online Partner Support Get Secure! - www.microsoft.com/security This posting is provided "as is" with no warranties and confers no rights.
Hi Simon,
Thanks for your feedback.
I found your problem strange. As you said, your application hangs at
"foreach(ListVi ewItem item in TasksListView.I tems)", I think this statement
should work fine.
I think you should set a break point before this statement and in the
PackageStarted method, then in the debugger "watch window" watch if
TasksListView.I tems collection is the correct value. Also, you can try to
invoke PackageStarted method in another method(such as button's click
event), if the problem still arise.
For the "expectingMouse Up", I have found it in debugger "watch window", I
think it is an internal field for .Net, I do now know why you care about
this field. Acutally, there is no document for the usage of this field.
For multiThreading modal, the listview is created in Main UI thread, but
you can expose a public method for the operation of listview, then in your
worker thread, you can use Control.BeginIn voke to execute this method from
worker thread. The method's execute is asynchronized.
Hope this helps,
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.
Comments embedded below... Thanks for your feedback. I found your problem strange. As you said, your application hangs at "foreach(ListVi ewItem item in TasksListView.I tems)", I think this
statement should work fine.
Good!
I think you should set a break point before this statement and in the PackageStarted method, then in the debugger "watch window" watch if TasksListView.I tems collection is the correct value. Also, you can try to invoke PackageStarted method in another method(such as button's click event), if the problem still arise.
I'll try that
For the "expectingMouse Up", I have found it in debugger "watch window", I think it is an internal field for .Net, I do now know why you care about this field. Acutally, there is no document for the usage of this field.
I do not care about in the slightest I mentioned it only becuase it seemed
that Visual Studio crashed only when you try to and scroll past that field
in the debugger "watch window"
For multiThreading modal, the listview is created in Main UI thread, but you can expose a public method for the operation of listview, then in your worker thread, you can use Control.BeginIn voke to execute this method from worker thread. The method's execute is asynchronized.
I'll do this and get back to you
Cheers Simon
Hi Simon,
If you have any further question, feel free to tell me, I will work with
you.
For "expectingMouse Up" in watch window, in my VS.net IDE, I can watch this
field, and its value is false, but when I view and scroll pass that value,
nothing special happens and the IDE will not crash.
Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: tony kulik |
last post by:
This code works fine in ie and opera but not at all in Mozilla.
Anybody got a clue as to how to get it right?
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<script language="JavaScript" type="text/javascript">
function show(that)
{
if (box.style.visibility=='hidden') { that.style.visibility =
'visible'};
}
|
by: Philip Townsend |
last post by:
I have a user control that displays the contents of a shopping cart. I
want this control to update its contents whenever an item is added to
the cart. Currently, the cart only updates if it is forced to do so
through a page reload or clicking a button within the user control
itself (thereby reloading the user control). I want to raise an event in
the user control whenever an item is added to the cart. This event
should cause the current...
|
by: Michael D. Ober |
last post by:
Is there anyway to raise an event from a class and require that any program
using that class (not just inheritance) have an event handler for specific
events in the class? In my case, some events don't need to be handled, but
some must be handled by the program that uses the class.
I'm looking for something along the lines of
Class MyClass
Event OptionalEvent(parms)
Event RequiredEvent(parms)
|
by: Mike Hofer |
last post by:
I've noticed that some of my server-side event handlers are firing
twice.
I should point out that my web forms are derived from a custom base
class that derives from System.Web.UI.Page. The custom base class
doesn't override anything, and doesn't handle any of Page's events; it
just adds properties and methods.
None of the pages in the system have AutoEventwireup set to True.
|
by: Hamed |
last post by:
Hello
I am developing a utility to be reused in other programs. It
I have an object of type Control (a TextBox, ComboBox, etc.) that other
programmers use it in applications. they may set some of properties or
assign event handlers. I need to be able to clone the manipulated control at
runtime.
I could use the Clone method of some objects (like Font, Style, String,
| |
by: Hamed |
last post by:
Hello
It seems that I should implement ICloneable to implement my own clone
object. the critical point for me is to make a control object based on
another control object that all of its event handlers are set like the old
one. Is there a way to do this job?
For example, is there a way to use EventInfo object to get all event
handlers of the old control in runtime and set my new cloned control events
to the event handlers of the old...
|
by: zlf |
last post by:
I have an UserControl created by other component, its creator attachs some
event handlers to MouseDoubleClick event, but I do not like those events to
be triggered while it is db-clicked. I want to know how to clear up them?
Thanks
BTW: I do not know what specific event handlers are attached, so I cannot
use Banner_MouseDoubleClick -= XXX to unregister it.
|
by: Arthur Dent |
last post by:
Anyone know, in VB.NET (2005) how to prevent duplicate occurrences of the
same event handler on an event?
e.g... I have some object which raises an event, and some other class which
consumes them. So in essence what I want to do is something like this in the
consumer class...
If Not objEventSource.SomeEvent.Handlers.Contains(AddressOf me.EventHandler)
Then _
AddHandler objEventSource.SomeEvent, AddressOf me.EventHandler
|
by: Phil Townsend |
last post by:
I have an application that needs to respond to events that occur outside
of the application itself. My project, called "ShowDetection" declares
the event. I have a console app called "TestEvent" that I would like to
use to test the event handler. Any action in the console app would be
acceptable, such as a keystroke. I am at a loss on how to go about
detecting and raising this event in my Winform. cn anybody help?
Thanks!
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |