public void loadConnection(int index) { if (currentConnection == config.connections[index]) { return; } disconnect(); currentConnection = config.connections[index]; formState.currentConnection = index; currentTemplate = getTemplate(currentConnection.deviceType); if (currentConnection.limitsSerialize != null) { currentConnection.limits = new Dictionary <int, int> { { 1, currentConnection.limitsSerialize[0] }, { -1, currentConnection.limitsSerialize[1] } }; } if (currentTemplate.adc != 0 && currentConnection.limits[1] == currentConnection.limits[-1]) { currentConnection.calibrated = false; } writeConfig(); System.Diagnostics.Debug.WriteLine("Rotator connnection loaded"); connect(); pMap.Refresh(); }
private void loadConnection(int index) { currentConnection = config.connections[index]; config.currentConnection = index; if (!formSPmodified) { formSPfromConnection(index); } currentTemplate = getTemplate(currentConnection.deviceType); if (currentConnection.limitsSerialize != null) { currentConnection.limits = new Dictionary <int, int> { { 1, currentConnection.limitsSerialize[0] }, { -1, currentConnection.limitsSerialize[1] } }; } writeConfig(); connect(); pMap.Refresh(); }