private void InitAll() { gb_Embedded.Visible = EmbeddedMode; lbl_OrderNumber.Text = ""; tb_ShowInformation.Clear(); _setting = new SettingHook(); _plcIpAddress = _setting.GetPlcIpAdress(); _traceabilityEnabled = _setting.GetEnableTraceability(); _plcScanRate = _setting.GetPlcScanRate(); EnableVirtualIndexer = _setting.GetVirtualIndexer(); _uniqueIdentityLength = _setting.GetUniqueIdLength(); _databaseConnection = _setting.GetDatabaseConnectionString(); _serverIp = TestConnection.ParseIpAddress(_databaseConnection); if (_serverIp != "") { tmrPingServer_Tick(tmrPingServer, null); tmrPingServer.Start(); } SetLabelText(lblServerIp, _serverIp); ScanTimerInitialize(); DaqReInitialize(); MachineHookInitialize(); SetMachineInformation(); SetProductInformation(); MachineDataReInitialize(); VirtualIndexerToListBox(lb_Indexer); try { lbl_PlcConnection.Text = @"Connected"; if (!EnableVirtualIndexer) { lbl_VirtualIndexer.Text = @"Not Used"; } _dataAcquisition.SetUniqueIdentityLength(_uniqueIdentityLength); _dataAcquisition.UpdateProductInUnloadingStatus(ProductStatus.TraceabilityStatusNotUpdated); _dataAcquisition.SetVirtualIndexer( EnableVirtualIndexer ? VirtualIndexerStates.WaitingTraceabilityStatusCheck : VirtualIndexerStates.NotIndexed); SetTraceabilityStates(_traceabilityEnabled? TraceabilityStates.WaitingForReference: TraceabilityStates.ByPassed); btn_ByPass2.Text = _traceabilityEnabled ? "&By Pass" : "&Activate"; if (!EnableVirtualIndexer) { _machineData.ActiveReference = ReadActiveReference(); } tmr_Scanner.Start(); } catch (Exception exception) { ShowInformation("Initialize : " + exception.Message); } }
public bool Initialize() { _setting = new SettingHook(); try { _dbConnection = _setting.GetDatabaseConnectionString(); _traceabilityIsEnabled = _setting.GetEnableTraceability(); _machineSerialNumber = _setting.MachineSerialNumber(); _uniqueIdLength = _setting.GetUniqueIdLength(); _allowCrossWorkOrder = _setting.GetAllowCrossWorkOrder(); } catch (Exception exception) { MachineHookException?.Invoke(exception.Message); return(false); } var result = GetMachineBySerialNumber(_machineSerialNumber, _dbConnection, out _thisMachine); return(CheckIfInitialized()); }
private void ReloadSetting() { _setting = new SettingHook(); tb_MachineSerialNumber.Text = _setting.MachineSerialNumber(); tb_NumberOfStation.Text = _setting.GetNumberOfStation().ToString(); tb_UniqueIdentityLength.Text = _setting.GetUniqueIdLength().ToString(); cb_EnableTraceability.Checked = _setting.GetEnableTraceability(); tb_PlcIpAddress.Text = _setting.GetPlcIpAdress(); if (_login) { tb_DbConnectionString.Text = _setting.GetDatabaseConnectionString(); tb_AdminPassword.Text = _setting.GetAdminPassword(); } else { tb_DbConnectionString.Clear(); tb_AdminPassword.Clear(); } }