public override void ManageFall()
{
//boolean to know if chronopic has been disconnected
chronopicDisconnected = false;
if (simulated)
{
if (fall != -1)
{
platformState = Chronopic.Plataforma.OFF;
}
else
{
platformState = Chronopic.Plataforma.ON;
}
}
else
{
platformState = chronopicInitialValue(cp);
}
if (platformState != Chronopic.Plataforma.OFF &&
platformState != Chronopic.Plataforma.ON)
{
//UNKNOW (Chronopic disconnected, port changed, ...)
chronopicHasBeenDisconnected();
return;
}
//if we are outside
//or we are inside, but with fall == -1 (calculate fall using a previous jump (start inside))
if (
(platformState == Chronopic.Plataforma.OFF && fall != -1) ||
(platformState == Chronopic.Plataforma.ON && fall == -1)
)
{
if (fall != -1)
{
feedbackMessage = Catalog.GetString("You are OUT, JUMP when prepared!");
loggedState = States.OFF;
}
else
{
feedbackMessage = Catalog.GetString("You are IN, JUMP when prepared!");
loggedState = States.ON;
}
needShowFeedbackMessage = true;
Util.PlaySound(Constants.SoundTypes.CAN_START, volumeOn, gstreamer);
//useful also for tracking the jump phases
tc = 0;
//prepare jump for being cancelled if desired
cancel = false;
jumpPhase = jumpPhases.PRE_OR_DOING;
//in simulated mode, make the jump start just when we arrive to waitEvent at the first time
if (simulated)
{
if (fall != -1)
{
platformState = Chronopic.Plataforma.ON; //mark now that we have arrived:
}
else
{
platformState = Chronopic.Plataforma.OFF; //mark now that we have jumped
}
}
//start thread
thread = new Thread(new ThreadStart(waitEvent));
GLib.Idle.Add(new GLib.IdleHandler(PulseGTK));
LogB.ThreadStart();
thread.Start();
}
else
{
ConfirmWindow confirmWin;
string message = Catalog.GetString("You are IN, please leave the platform, and press the 'accept' button");
if (fall == -1)
{
message = Catalog.GetString("You are OUT, please enter the platform, prepare for jump and press the 'accept' button");
}
confirmWin = ConfirmWindow.Show(message, "", "");
Util.PlaySound(Constants.SoundTypes.BAD, volumeOn, gstreamer);
//we call again this function
confirmWin.Button_accept.Clicked += new EventHandler(callAgainManageFall);
//if confirmWin.Button_cancel is pressed return
confirmWin.Button_cancel.Clicked += new EventHandler(cancel_event_before_start);
}
}