public ABizLogic GetBiz(CMain initializedMain, System.Windows.Forms.Control control) { string assemblyFile = "YANGSYS.Biz.WHTM.DLL"; string typeName = "YANGSYS.Biz.CBiz"; ObjectHandle handle = Activator.CreateInstanceFrom(assemblyFile, typeName); if (handle == null) { _form = new SOFD.Gui.Window.frmSimpleMain(); } ABizLogic biz = handle.Unwrap() as ABizLogic; biz.Init(initializedMain, control); return(biz); }
public CLoader() { _form = GetForm(); _main = new CMain(); _main.OnProgramEnd += new SOFD.BasicCore.delegateProgramEnd(_main_OnProgramEnd); _main.Init(); _biz = GetBiz(_main, _form); //_form.ProgramName = _main.ProgramName; //_form.Version = _main.Version; //_form.ShutDown += new delegateShutDownEventHandler(form_ShutDown); //foreach (SOFD.Gui.Window.IFrame frame in _form.FrameList.Values) //{ // frame.OnRequestParentService += new SOFD.Gui.Window.delegateParentFormService(frame_OnRequestParentService); //} //if (UCBaseFrame.Widgets.ContainsKey("TITLE:COMMSTATUS")) //{ // UCWidget widget = UCBaseFrame.Widgets["TITLE:COMMSTATUS"]; // if (widget is ucConnectionStatus) // status = widget as ucConnectionStatus; //} //List<ASubsystemControl> controls = _main.GetCommControls<ASubsystemControl>(); //foreach (ASubsystemControl control in controls) //{ // //if (!string.IsNullOrEmpty(control.ConnectEQP) || control.ConnectEQP == control.ControlName) // // continue; // if (control.ModelType == "GROUP" || !(control is IComm))//!string.IsNullOrEmpty(control.ConnectEQP) || !(control is IComm)) // { // if (control.IsScanType) // control.ScanStart(); // continue; // } // IComm commControl = control as IComm; // commControl.Connected += new delegateCommEventHandler(commControl_CommStateChanged); // commControl.Disconnected += new delegateCommEventHandler(commControl_CommStateChanged); // try // { // if (status != null) // { // status.AddAlias(commControl.CommName, commControl.Alias); // status.StateChange(commControl.CommName, commControl.Enable, commControl.LogicalDisconnect); // } // } // catch (Exception ex) // { // MessageBox.Show("통신모듈이 포함된 컨트롤을 처리 중 오류가 발생 했습니다. \r\n" + ex.Message + ex.StackTrace); // } // try // { // commControl.Init(); // commControl.Open(); // if (control.IsScanType) // control.ScanStart(); // } // catch (Exception ex) // { // MessageBox.Show("통신모듈이 포함된 컨트롤을 처리 중 오류가 발생 했습니다. \r\n" + ex.Message + ex.StackTrace); // } //} }