protected void waitChronopicStart()
{
if(currentCp == 1) {
// simulated = false;
// SqlitePreferences.Update("simulated", simulated.ToString(), false);
if(connected)
return;
}
SerialPort sp2;
SerialPort sp3;
SerialPort sp4;
string message = "";
string myPort = "";
bool success = false;
if(currentCp == 1) {
myPort = ((ChronopicPortData) cpd[0]).Port;
cpDoing = cp;
connected = chronopicInit.Do(currentCp, out cpDoing, out sp, platformState, myPort, out message, out success);
cp = cpDoing;
if(success)
connectionSucceded(1, true);
}
else if(currentCp == 2) {
myPort = ((ChronopicPortData) cpd[1]).Port;
cpDoing = cp2;
connected = chronopicInit.Do(currentCp, out cpDoing, out sp2, platformState2, myPort, out message, out success);
cp2 = cpDoing;
if(success)
connectionSucceded(2, true);
}
else if(currentCp == 3) {
myPort = ((ChronopicPortData) cpd[2]).Port;
cpDoing = cp3;
connected = chronopicInit.Do(currentCp, out cpDoing, out sp3, platformState3, myPort, out message, out success);
cp3 = cpDoing;
if(success)
connectionSucceded(3, true);
}
else if(currentCp == 4) {
myPort = ((ChronopicPortData) cpd[3]).Port;
cpDoing = cp4;
connected = chronopicInit.Do(currentCp, out cpDoing, out sp4, platformState4, myPort, out message, out success);
cp4 = cpDoing;
if(success)
connectionSucceded(4, true);
}
LogB.Information(string.Format("wait_chronopic_start {0}", message));
if(success) {
Util.PlaySound(Constants.SoundTypes.GOOD, volumeOn);
updateChronopicWinValuesState= true; //connected
updateChronopicWinValuesMessage= message;
} else {
Util.PlaySound(Constants.SoundTypes.BAD, volumeOn);
updateChronopicWinValuesState= false; //disconnected
updateChronopicWinValuesMessage= message;
}
foreach(ChronopicPortData a in cpd)
LogB.Information(a.Num + ", " + a.Port + ", " + a.Connected);
needUpdateChronopicWin = true;
}