I have a little scinario and I was wondering if someone could point me
in the best direction for coding it.
I have a custom user control that plays a DVD and it starts another
thread that listens for events in the DVD such as chapter change or
position change. When the event occurs it Invokes a function in the
creatting thread to raise an event. This means that the user of the
control does not need to worry about the fact that the event originated
in another thread.
As I do not want any user code to completely kill my thread listening
for events, I put all event calls in an unfiltered catch block.
My problem is what do I do with the exceptrion now, I want to notify
the user of the control that an exception occured but I do not want to
kill my event listening thread (this is what would happen if I just
left the exception).
In the program I use the control I have a global exception handling
system but this never has a chance to handle the exception.
Any advice would be apreciated.
Olie 2 1843
Create an "error" delegate. The user of the control will have to code in
this "event" or "delegate" into his code (something you should inform him
of), of course. He has the option of ignoring the code also. By raising
events, he can decide what to do. That avoids the exception issue.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
*************** *************** *************** ****
Think outside the box!
*************** *************** *************** ****
"Olie" <ow****@gmail.c omwrote in message
news:11******** *************@m 73g2000cwd.goog legroups.com...
>I have a little scinario and I was wondering if someone could point me
in the best direction for coding it.
I have a custom user control that plays a DVD and it starts another
thread that listens for events in the DVD such as chapter change or
position change. When the event occurs it Invokes a function in the
creatting thread to raise an event. This means that the user of the
control does not need to worry about the fact that the event originated
in another thread.
As I do not want any user code to completely kill my thread listening
for events, I put all event calls in an unfiltered catch block.
My problem is what do I do with the exceptrion now, I want to notify
the user of the control that an exception occured but I do not want to
kill my event listening thread (this is what would happen if I just
left the exception).
In the program I use the control I have a global exception handling
system but this never has a chance to handle the exception.
Any advice would be apreciated.
Olie
I was wondering about this approach but it does not seem to fit in with
the philosophy of exceptions. I understood that exceptions forced a
developer to handle them rather than giving them an option. This
approach means that a developer can quite easily be oblivious to the
exception occuring in his event code.
I did think about Invoking the exception in the creatting thread but I
thought this would be a bit confusing as an exception that occured in
his event handling code would appear to happen in my control.
Cowboy (Gregory A. Beamer) wrote:
Create an "error" delegate. The user of the control will have to code in
this "event" or "delegate" into his code (something you should inform him
of), of course. He has the option of ignoring the code also. By raising
events, he can decide what to do. That avoids the exception issue.
--
Gregory A. Beamer
MVP; MCP: +I, SE, SD, DBA
*************** *************** *************** ****
Think outside the box!
*************** *************** *************** ****
"Olie" <ow****@gmail.c omwrote in message
news:11******** *************@m 73g2000cwd.goog legroups.com...
I have a little scinario and I was wondering if someone could point me
in the best direction for coding it.
I have a custom user control that plays a DVD and it starts another
thread that listens for events in the DVD such as chapter change or
position change. When the event occurs it Invokes a function in the
creatting thread to raise an event. This means that the user of the
control does not need to worry about the fact that the event originated
in another thread.
As I do not want any user code to completely kill my thread listening
for events, I put all event calls in an unfiltered catch block.
My problem is what do I do with the exceptrion now, I want to notify
the user of the control that an exception occured but I do not want to
kill my event listening thread (this is what would happen if I just
left the exception).
In the program I use the control I have a global exception handling
system but this never has a chance to handle the exception.
Any advice would be apreciated.
Olie
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dave |
last post by:
Hello all,
Unfortunately, the reference I have is a bit slim on describing how to
create user-defined exceptions derived from std::exception. I think what I
have below will work, but is it the way the mechanism was intended to be
used?
Thanks,
Dave
|
by: Iain |
last post by:
Hey folks,
(I posted this in microsoft.public.dotnet.csharp.general yesterday,
but it appears that this group is rather more lively)
For the application I am developing, I have a data access layer that
handles all the talking to the database. There are only certain
exceptions that I want to excape from this class, and all of them
should have sensible meanings - for instance, there should be a "The
database is not happy" and "There is...
|
by: Robert Rotstein |
last post by:
It appears that exception handling at the top-most level of a C#
program, in the static void Main() method, differs depending on whether
the program is run in debug mode or not. That is, code such as the
following
try
{
Application.Run(new something());
}
catch
|
by: Prince Mathew |
last post by:
Hi All,
I have a requirement. I am throwing an exception from my user control I want
to catch this in my container page. Is this possible?
I don't want any event to be raised.
PLEASE HELP ME.
|
by: BoloBaby |
last post by:
OK, check this out...
I have a form with a panel control and button on it (outside the panel
control).
I have two event handlers - one handles the click event of the button on the
form. The other handles a custom "CardInserted" event for a class I wrote
that watches for smart cards to be inserted into an attached smart card
reader.
| |
by: Segfahlt |
last post by:
I need a little help here please.
I have 2 win forms user controls in 2 different projects that I'm hosting in
2 different virtual directories. The controls have been test and operate okay
in both projects.
Both controls(dlls) have been signed using SN.exe and I've set up the
appropriate .Net assembly permissions using those Strong Names
The DLL's have been copied to the /bin directory in both web virtual
directories.
|
by: mark.norgate |
last post by:
I've run into a few problems trying to use generics for user controls
(classes derived from UserControl). I'm using the Web Application model
rather than the Web Site model.
The first problem I'm having is that the partial class signature in my
projectDetails.ascx.cs file looks like this:
public partial class ProjectDetailsControl<TEntryServiceProvider:
UserControl, INamingContainer where TEntryServiceProvider :
IEntryServiceProvider...
|
by: Alexander Eisenhuth |
last post by:
Hallo Alltogether,
I've searched in this mailing list, but it seems to me that there is no general
approach to pass exceptions from one thread to another.
I think most application do a unique way of handling "unhandled exceptions", at
least they (should) try to log them.
The following discussion seems to me most valuable (Sorry for the long URL, I
don't know a way of shorter)
|
by: Efi Merdler |
last post by:
Hi,
I created a user control, but instead of handling exception in the
user control level I prefer to handle them in the containing form.
In the load event of the containing form I'm using:
entryWindow.Error += new EventHandler(Page_Error);
when entryWindow is my user control.
Two questions:
|
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: 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: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
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: 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...
| |