/// <summary> /// This class should be created and passed into Application.Run( ... ) /// </summary> public JCAppContext() { CurrentAppContext = this; InitializeContext(); invokeControl = new Control(); // force to create window handle invokeControl.CreateControl(); }
public JCChildForm(JCAppContext _appContext, int _idx) : base() { appContext = _appContext; idx = _idx; componentConfig.forms[idx] = this; componentConfig.formStates[idx].active = true; appContext.writeConfig(); this.FormClosed += _formClosed; }
static void Main() { bool isSingle; using (var mutex = new System.Threading.Mutex(true, "JeromeControlAppId", out isSingle)) if (isSingle) { GC.KeepAlive(mutex); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); /* try * {*/ var applicationContext = new JCAppContext(); Application.Run(applicationContext); /* } * catch (Exception ex) * { * MessageBox.Show(ex.Message, "Program Terminated Unexpectedly", * MessageBoxButtons.OK, MessageBoxIcon.Error); * }*/ } }