473,811 Members | 4,039 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Application Context

Hi,

I have an application that has a form and a few classes. Rather than the
form being the startup object "Application.Ru n(new Form1())", I would like
one of the classes to be the startup.
The startup class would then contain an instance of the form, to use as it's
UI.

To do this (and correct me if I'm wrong), I believe I need to create an
ApplicationCont ext object, and pass that to the Application.Run () method?

If so, does anyone have a sample of doing this, or some skeletal code? I
can't seem to find very good examples on the web. Which usually means I
might be on the wrong track...

TIA,
Norvin
Nov 15 '05 #1
5 9032
Norvin Laudon wrote:
I have an application that has a form and a few classes. Rather than the
form being the startup object "Application.Ru n(new Form1())", I would like
one of the classes to be the startup.
The startup class would then contain an instance of the form, to use as it's
UI.

To do this (and correct me if I'm wrong), I believe I need to create an
ApplicationCont ext object, and pass that to the Application.Run () method?

If so, does anyone have a sample of doing this, or some skeletal code? I
can't seem to find very good examples on the web. Which usually means I
might be on the wrong track...


I assume that what you want is to avoid application exit when main form
is closed. You can get example here:
http://www.nedcomp.nl/support/origdo...classtopic.htm

Nov 15 '05 #2
Hi Vad,

Thanks for the link, but it just links to the MSDN "ApplicationCon text"
topic in the documentation. Did you send the wrong link?

It seems wrong to me to have an application whose UserInterface (a form!) is
the parent of all the various classes in the project. Is this unusual?

Thanks,
Norvin

"Vadim Chekan" <re************ *****@rogers.co m> wrote in message
news:vl******** ***********@new s01.bloor.is.ne t.cable.rogers. com...
Norvin Laudon wrote:
I have an application that has a form and a few classes. Rather than the
form being the startup object "Application.Ru n(new Form1())", I would like one of the classes to be the startup.
The startup class would then contain an instance of the form, to use as it's UI.

To do this (and correct me if I'm wrong), I believe I need to create an
ApplicationCont ext object, and pass that to the Application.Run () method?
If so, does anyone have a sample of doing this, or some skeletal code? I
can't seem to find very good examples on the web. Which usually means I
might be on the wrong track...
I assume that what you want is to avoid application exit when main form
is closed. You can get example here:

http://www.nedcomp.nl/support/origdo...classtopic.htm

Nov 15 '05 #3
Norvin Laudon wrote:
Hi Vad,

Thanks for the link, but it just links to the MSDN "ApplicationCon text"
topic in the documentation. Did you send the wrong link?
It is different from the one on microsoft site in that it contains
example of usage of context to create application with more flexible
exit control.
It seems wrong to me to have an application whose UserInterface (a form!) is
the parent of all the various classes in the project. Is this unusual?


Why? I believe that 90% of all applications fillow to "main window"
conception. when you open a Word, a Outlook, <anything else here>, you
have a main window, and usually some child windows, or MDI.

If you tell what you want to achive in a long run, it would be easier to
give advice because "I would like one of the classes to be the startup"
barely can be the goal, rather a way to achive the goal :)

Vadim Chekan.

Nov 15 '05 #4
Hi Vad,

Thanks for taking the time to respond.

"Vadim Chekan" <re************ *****@rogers.co m> wrote in message
news:RoDub.2247 2
It is different from the one on microsoft site in that it contains
example of usage of context to create application with more flexible
exit control.

Sorry, I didn't realize it was different than MSDN, I'll take another look
at it...
It seems wrong to me to have an application whose UserInterface (a form!) is the parent of all the various classes in the project. Is this unusual?


Why? I believe that 90% of all applications fillow to "main window"
conception. when you open a Word, a Outlook, <anything else here>, you
have a main window, and usually some child windows, or MDI.

If you tell what you want to achive in a long run, it would be easier to
give advice because "I would like one of the classes to be the startup"
barely can be the goal, rather a way to achive the goal :)


OK, some details: I'm programming an application that interfaces with a
piece of machinery. The machine places items under an xray camera and
signals my program.
My program then snaps a picture of the items, and sends them off across the
network (via remoting) to a server. Sometime later, a decision on the image
comes back from the server, which my program then relays back to the
machinery.

In other words, there is very little human interaction. The UI is just there
for displaying a few status items for troubleshooting . All of the logic is
activated by other devices external to the program (the server, or the
machinery)

It would make sense to me to structure the program in the following way:
- have a main class (the startup class) which oversees all of the logic,
keeps track of what's been sent where, etc
- as members of this main class, have child classes to interface to the
server, the machine, and also a child class (form) for the UI

Do you agree with this general structure?

(As I typed this message, I realize that my typical application probably
differs from most in here, as there is typically no user interaction
required)

Thanks,
Norvin


Vadim Chekan.

Nov 15 '05 #5
> OK, some details: I'm programming an application that interfaces with a

[cut]
(As I typed this message, I realize that my typical application probably
differs from most in here, as there is typically no user interaction
required)


Well, now i see the point. You want to implement mostly windowless
application. Then ApplicationCont ex should be solution and I hope link I
gave you help.

But consider how user will call you application if he will want it. Or
how user will be able to shutdown (restart) your application. Probably
icon in notification area? Then I see it as something like this:
-----------------------
Form1 f = new Form1();
ApplicationCont ext cx = new ApplicationCont ext();
f.notifyIcon1.C lick += new EventHandler(f. notifyIcon1_Mou seDown);
Application.Run (cx);
---------------------
Then there will be no window (main window) after application start, only
icon in a notify area, and user will be able to call window only when
needed.

Vadim Chekan.

Nov 15 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
6088
by: Sivashankaran Vaidhyalingam | last post by:
Hi folks, I have an aspx application App A hosted in a server which is inside the intranet . I need to serve pages from this application _through_ another application App B which acts as a proxy . App B just has a HttpHandler which recieves the request for pages (actualy residing in App A), creates a HttpWebRequest object (which inturn reads the context.HttpRequest object) and serves the page with HttpWebResponse object (writing the...
2
2733
by: Uchiha Jax | last post by:
Hi, Recently had an issue with the Audio object from Microsoft.DirectX.AudioVideoPlayback. None of the events were firing from the object during tests (NUnit or Console). Knowing I had it working perfectly well in the application running on my tablet PC next to me, I managed to narrow down the defining factor between the two applications and found that it was a one line difference. Application.Run().
0
1812
by: Brett | last post by:
I am working with vb.net in a asp.net application. I have created a config file in xml format. The goal is to be able to change the config file without having to recompile the entire application. So when the Application starts I read the xml file and place each key-value pair into a Synchronized hash table. Now I want to save this hashtable to Application state for quick access and also so I don't have to open the config file a...
4
1990
by: Hari Koduru | last post by:
Hi All, I am getting the following exception in an ASP.NET application. Exception Details: System.InvalidOperationException: Application is restarting. I have been to the following Support page
5
310
by: Martin Robins | last post by:
I have never dabbled with ASP.NET until now so be warned! I have created a web application with the single default form: WebForm1.aspx and when I try to display it I get this error. My understanding was that ASP.NET was supposed to set itself up, especially as I am using Windows Server 2003. Can anybody give me instruction as to resolution; what folder should I be granting the access to? The path shown only exists as far as the...
0
905
by: pamelafluente | last post by:
I have implemented an example of HttpHandler to talk with my Windows application running on the server. I want to send some command (to do something) from IE (client) to my program running on the server. The HttpHandler is able to intercept this request and to process it. Here is the code: 'COMPLETE CODE
4
4217
by: Karl | last post by:
Hi all, I want to write an application that is launched from the context menu in Windows Explorer/Computer. That is to say, when I am browsing around my hard drive and get to any location I choose, I want to be able to select several files, right click my mouse and launch an application which will act on the selected files. However, I don't even know where to start and have a number of questions!
4
4692
by: Andrus | last post by:
For winforms application with multiple related forms it is reasonable to create Linq database context object in start of application. Context object is released only when application exits. So connection to database may remain open for all application run time. For such a long time, some routers close connection. This causes Connection is broken error in application. How to fix this ?
0
2538
by: =?Utf-8?B?UG9sbHkgQW5uYQ==?= | last post by:
Hi, I have previously used EL v 3.1 Exception Handling application block successfully. I thought I would now try to do the same with EL v 4.0. My first experiment was to replace an exception. I created a project and added the following references - 1/ Enterprise Library Exception Handling Application Block v 4.0
0
2025
by: Steve | last post by:
Hello- Your assistance with this issue is greatly appreciated. Environment: - Load-balanced IIS 6.0 servers (Win2003) - web servers point (via UNC path) to a Microsoft File Cluster on different machines. - domain ASPNET account that handles the function/permissions of the (traditionally) local machine ASP.NET account.
0
9724
marktang
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...
0
9604
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10379
jinu1996
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...
1
10394
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,...
0
10127
tracyyun
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...
0
9201
agi2029
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...
0
6882
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();...
0
5552
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...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.