Click here to Skip to main content
15,924,901 members
Home / Discussions / C#
   

C#

 
QuestionWeird focus problem Pin
kensai9-May-08 3:34
kensai9-May-08 3:34 
AnswerRe: Weird focus problem Pin
CodingYoshi9-May-08 11:35
CodingYoshi9-May-08 11:35 
GeneralRe: Weird focus problem Pin
kensai10-May-08 2:50
kensai10-May-08 2:50 
GeneralRe: Weird focus problem Pin
CodingYoshi10-May-08 9:41
CodingYoshi10-May-08 9:41 
GeneralRe: Weird focus problem Pin
kensai10-May-08 12:53
kensai10-May-08 12:53 
AnswerRe: Weird focus problem Pin
Dave Sexton10-May-08 0:30
Dave Sexton10-May-08 0:30 
GeneralRe: Weird focus problem Pin
kensai10-May-08 2:35
kensai10-May-08 2:35 
QuestionI need help starting multiple and communicating between application domains [modified] Pin
Togakangaroo9-May-08 3:15
Togakangaroo9-May-08 3:15 
Hello, I am going to have a Windows Forms project start in a day or two that will need me to have an application that will be able to reset itself to its initial state if the database connection is lost. What I would like to do is to create the process so it contains 2 application domains - one (the child) where the bulk of the application will be running and another (the parent) which monitors the database connection and restarts the child appdomain if connectivity is lost. I also need the ability to send simple messages between the two appdomains.

I don't expect anyone to write any code for me, I just have had trouble finding concrete examples of how to do all this online and I would like someone to confirm whether I've got the general idea right or not. That being said, is this how you would do it:
1) Create two windows forms projects; the child and the parent. Set the parent as the starting project.
2) In the child application have a method something like:
public class Form1 {
  public static Form1() StartApplication() {
      Form1 f = new Form1();
  }
}

3) The parent runs in the default application domain. When the parent is started, Create a new domain using d=AppDomain.CreateDomain("new domain"), load the executable created by the child project into it using d.Load(filename), and then use .NET remoting (which I still need to read up on) to call Form1.StartApplication()
4) Communicate between the domains using a .NET Remoting Channel (what is the best option for communicating between 2 appdomains in the same process?)
5) To restart the other domain call AppDomain.Unload(d), then create a new domain and load assembly as before.

I need to use certain proprietary controls in the application so I would prefer to keep with .NET 1.1 - if that poses any particular problems however I suppose it shouldn't be a tremendous amount of trouble to upgrade.
Once the project starts, I'm not going to have a lot of time to research and I don't have a Guru to go to so I put myself at your mercy. Am I missing anything here? Is this how you would do it? Is there any online tutorials you guys can recommend?

modified on Friday, May 9, 2008 9:53 AM

AnswerRe: I need help starting multiple and communicating between application domains Pin
CodingYoshi9-May-08 11:44
CodingYoshi9-May-08 11:44 
GeneralRe: I need help starting multiple and communicating between application domains Pin
Togakangaroo9-May-08 14:37
Togakangaroo9-May-08 14:37 
GeneralRe: I need help starting multiple and communicating between application domains Pin
CodingYoshi9-May-08 17:10
CodingYoshi9-May-08 17:10 
GeneralRe: I need help starting multiple and communicating between application domains Pin
Togakangaroo10-May-08 8:44
Togakangaroo10-May-08 8:44 
GeneralRe: I need help starting multiple and communicating between application domains Pin
CodingYoshi10-May-08 9:45
CodingYoshi10-May-08 9:45 
QuestionBinding WebService to DataSet Pin
Aggressor9-May-08 2:26
Aggressor9-May-08 2:26 
AnswerRe: Binding WebService to DataSet Pin
CodingYoshi9-May-08 11:49
CodingYoshi9-May-08 11:49 
QuestionRemoving the parent node in an xml document Pin
dangquoctrang9-May-08 1:29
dangquoctrang9-May-08 1:29 
AnswerRe: Removing the parent node in an xml document [modified] Pin
webtips9-May-08 4:12
webtips9-May-08 4:12 
QuestionKeeping constant strings Pin
N a v a n e e t h9-May-08 1:04
N a v a n e e t h9-May-08 1:04 
AnswerRe: Keeping constant strings Pin
Christian Graus9-May-08 1:08
protectorChristian Graus9-May-08 1:08 
GeneralRe: Keeping constant strings Pin
N a v a n e e t h9-May-08 1:15
N a v a n e e t h9-May-08 1:15 
AnswerRe: Keeping constant strings Pin
Kalvin @ Work9-May-08 2:45
Kalvin @ Work9-May-08 2:45 
GeneralRe: Keeping constant strings Pin
N a v a n e e t h9-May-08 3:14
N a v a n e e t h9-May-08 3:14 
GeneralRe: Keeping constant strings Pin
Roger Alsing10-May-08 4:15
Roger Alsing10-May-08 4:15 
GeneralRe: Keeping constant strings Pin
N a v a n e e t h10-May-08 23:22
N a v a n e e t h10-May-08 23:22 
GeneralRe: Keeping constant strings [modified] Pin
PIEBALDconsult11-May-08 7:12
mvePIEBALDconsult11-May-08 7:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.