コード例 #1
0
 public void Start(PeerCastApplication app)
 {
     System.Windows.Forms.Application.EnableVisualStyles();
       mainThread = new Thread(() => {
     mainForm = new MainForm(app.PeerCast);
     System.Windows.Forms.Application.ApplicationExit += (sender, args) => {
       app.Stop();
     };
     System.Windows.Forms.Application.Run(mainForm);
     mainForm = null;
       });
       mainThread.SetApartmentState(ApartmentState.STA);
       mainThread.Start();
 }
コード例 #2
0
 protected override void OnStart()
 {
     System.Windows.Forms.Application.EnableVisualStyles();
       mainThread = new Thread(() => {
     mainForm = new MainForm(Application);
     if (!mainForm.IsHandleCreated) {
       //ハンドルを強制的に作らせる
       var handle = mainForm.Handle;
     }
     System.Windows.Forms.Application.ApplicationExit += (sender, args) => {
       Application.Stop();
     };
     System.Windows.Forms.Application.Run();
     mainForm = null;
       });
       mainThread.SetApartmentState(ApartmentState.STA);
       mainThread.Start();
 }