private DataSourceHolder dataSourceHolder; // holds data sources /// <summary> /// Initializes a new instance of the class. /// </summary> public CoreLogic(CommConfig config, CommDirs appDirs, ILog log) { Config = config ?? throw new ArgumentNullException(nameof(config)); AppDirs = appDirs ?? throw new ArgumentNullException(nameof(appDirs)); Log = log ?? throw new ArgumentNullException(nameof(log)); BaseDataSet = null; SharedData = null; infoFileName = Path.Combine(appDirs.LogDir, CommUtils.InfoFileName); commLineLock = new object(); thread = null; terminated = false; utcStartDT = DateTime.MinValue; startDT = DateTime.MinValue; serviceStatus = ServiceStatus.Undefined; lastInfoLength = 0; maxLineTitleLength = -1; commLines = null; commLineMap = null; deviceMap = null; commandReader = null; driverHolder = null; dataSourceHolder = null; }
private CoreLogic coreLogic; // the Communicator logic instance /// <summary> /// Initializes a new instance of the class. /// </summary> public Manager() { log = LogStub.Instance; coreLogic = null; AppDirs = new CommDirs(); AppDomain.CurrentDomain.UnhandledException += OnUnhandledException; }
private void cbDevice_SelectedIndexChanged(object sender, EventArgs e) { // create a user interface of the selected device CnlPrototypes = null; if (cbDevice.SelectedItem is KP kp) { if (deviceItems.TryGetValue(kp.KPNum, out DeviceItem deviceItem) && deviceItem.Instance != null) { try { if (deviceItem.KPView == null) { CommDirs commDirs = new CommDirs( appData.AppSettings.PathOptions.CommDir, deviceItem.Instance); deviceItem.KPView = KPFactory.GetKPView( Path.Combine(commDirs.KPDir, deviceItem.KPSettings.Dll), kp.KPNum); deviceItem.KPView.KPProps = new KPView.KPProperties( deviceItem.CommLineSettings.CustomParams, deviceItem.KPSettings.CmdLine); deviceItem.KPView.AppDirs = commDirs; } CnlPrototypes = deviceItem.KPView.DefaultCnls; int inCnlCnt = CnlPrototypes == null ? 0 : CnlPrototypes.InCnls.Count; int ctrlCnlCnt = CnlPrototypes == null ? 0 : CnlPrototypes.CtrlCnls.Count; txtInfo.Text = string.Format(AppPhrases.DeviceInfo, deviceItem.KPSettings.Dll, deviceItem.Instance.Name, inCnlCnt, ctrlCnlCnt); pbStatus.Image = inCnlCnt > 0 || ctrlCnlCnt > 0 ? Properties.Resources.success : Properties.Resources.warning; } catch (Exception ex) { txtInfo.Text = ex.Message; pbStatus.Image = Properties.Resources.error; } } else { txtInfo.Text = AppPhrases.DeviceNotFound; pbStatus.Image = Properties.Resources.warning; } } else { txtInfo.Text = AppPhrases.NoDeviceSelected; pbStatus.Image = Properties.Resources.warning; } OnSelectedDeviceChanged(); }