Show() public static method

public static Show ( string text1, string link, string question ) : ConfirmWindow,
text1 string
link string
question string
return ConfirmWindow,
Esempio n. 1
0
    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);
        }
    }
Esempio n. 2
0
    public override void Manage()
    {
        //boolean to know if chronopic has been disconnected
        chronopicDisconnected = false;

        if (simulated)
        {
            if (hasFall)
            {
                platformState = Chronopic.Plataforma.OFF;
            }
            else
            {
                platformState = Chronopic.Plataforma.ON;
            }
        }
        else
        {
            platformState = chronopicInitialValue(cp);
        }

        if (platformState == Chronopic.Plataforma.OFF)
        {
            loggedState = States.OFF;
        }
        else if (platformState == Chronopic.Plataforma.ON)
        {
            loggedState = States.ON;
        }
        else           //UNKNOW (Chronopic disconnected, port changed, ...)
        {
            chronopicHasBeenDisconnected();
            return;
        }


        bool success = false;

        if (platformState == Chronopic.Plataforma.OFF && hasFall)
        {
            feedbackMessage         = Catalog.GetString("You are OUT, JUMP when prepared!");
            needShowFeedbackMessage = true;
            Util.PlaySound(Constants.SoundTypes.CAN_START, volumeOn, gstreamer);
            success = true;
        }
        else if (platformState == Chronopic.Plataforma.ON && !hasFall)
        {
            feedbackMessage         = Catalog.GetString("You are IN, JUMP when prepared!");
            needShowFeedbackMessage = true;
            Util.PlaySound(Constants.SoundTypes.CAN_START, volumeOn, gstreamer);
            success = true;
        }
        else
        {
            string myMessage = Catalog.GetString("You are IN, please leave the platform, and press the 'accept' button");
            if (platformState == Chronopic.Plataforma.OFF)
            {
                myMessage = Catalog.GetString("You are OUT, please enter the platform, prepare for jump and press the 'accept' button");
            }
            ConfirmWindow confirmWin;
            confirmWin = ConfirmWindow.Show(myMessage, "", "");
            Util.PlaySound(Constants.SoundTypes.BAD, volumeOn, gstreamer);

            //we call again this function
            confirmWin.Button_accept.Clicked += new EventHandler(callAgainManage);
            //if confirmWin.Button_cancel is pressed return
            confirmWin.Button_cancel.Clicked += new EventHandler(cancel_event_before_start);
        }

        if (success)
        {
            //initialize strings of TCs and TFs
            tcString     = "";
            tvString     = "";
            tcCount      = 0;
            tvCount      = 0;
            firstRjValue = true;

            //if jump starts on TF, write a "-1" in TC
            if (!hasFall)
            {
                double myTc = -1;
                tcString = myTc.ToString();
                tcCount  = 1;
            }

            //prepare jump for being cancelled if desired
            cancel = false;

            //prepare jump for being finished earlier if desired
            finish = false;

            jumpPhase = jumpPhases.PRE_OR_DOING;

            //in simulated mode, make the jump start just when we arrive to waitEvent at the first time
            //mark now that the opposite as before:
            if (simulated)
            {
                if (hasFall)
                {
                    platformState = Chronopic.Plataforma.ON;
                }
                else
                {
                    platformState = Chronopic.Plataforma.OFF;
                }
            }

            //start thread
            thread = new Thread(new ThreadStart(waitEvent));
            GLib.Idle.Add(new GLib.IdleHandler(PulseGTK));

            LogB.ThreadStart();
            thread.Start();
        }
    }
Esempio n. 3
0
    public override void Manage()
    {
        //boolean to know if chronopic has been disconnected
        chronopicDisconnected = false;

        if (simulated)
        {
            platformState = Chronopic.Plataforma.ON;
        }
        else
        {
            platformState = chronopicInitialValue(cp);
        }


        if (platformState == Chronopic.Plataforma.ON)
        {
            feedbackMessage         = Catalog.GetString("You are IN, JUMP when prepared!");
            needShowFeedbackMessage = true;
            Util.PlaySound(Constants.SoundTypes.CAN_START, volumeOn, gstreamer);

            loggedState = States.ON;

            //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
            //mark now that we have leaved platform:
            if (simulated)
            {
                platformState = Chronopic.Plataforma.OFF;
            }

            //start thread
            thread = new Thread(new ThreadStart(waitEvent));
            GLib.Idle.Add(new GLib.IdleHandler(PulseGTK));

            LogB.ThreadStart();
            thread.Start();
        }
        else if (platformState == Chronopic.Plataforma.OFF)
        {
            ConfirmWindow confirmWin;
            confirmWin = ConfirmWindow.Show(Catalog.GetString(
                                                "You are OUT, please enter the platform, prepare for jump and press the 'accept' button"), "", "");

            Util.PlaySound(Constants.SoundTypes.BAD, volumeOn, gstreamer);

            //we call again this function
            confirmWin.Button_accept.Clicked += new EventHandler(callAgainManage);

            //if confirmWin.Button_cancel is pressed return
            confirmWin.Button_cancel.Clicked += new EventHandler(cancel_event_before_start);
        }
        else           //UNKNOW (Chronopic disconnected, port changed, ...)
        {
            chronopicHasBeenDisconnected();
        }
    }
Esempio n. 4
0
    public override void Manage()
    {
        bool success = false;

        //boolean to know if chronopic has been disconnected
        chronopicDisconnected = false;

        if (simulated)
        {
            platformState = Chronopic.Plataforma.OFF;
        }
        else
        {
            platformState = chronopicInitialValue(cp);
        }


        //you should start OFF (outside) the platform
        //we record always de TC+TF (or time between we pulse platform and we pulse again)
        //we don't care about the time between the get in and the get out the platform
        if (platformState == Chronopic.Plataforma.ON)
        {
            string myMessage = Catalog.GetString("You are IN, please leave the platform, prepare for start, and press the 'accept' button!");

            ConfirmWindow confirmWin;
            confirmWin = ConfirmWindow.Show(myMessage, "", "");
            Util.PlaySound(Constants.SoundTypes.BAD, volumeOn);

            //we call again this function
            confirmWin.Button_accept.Clicked += new EventHandler(callAgainManage);

            //if confirmWin.Button_cancel is pressed retuen
            confirmWin.Button_cancel.Clicked += new EventHandler(cancel_event_before_start);
        }
        else if (platformState == Chronopic.Plataforma.OFF)
        {
            feedbackMessage         = Catalog.GetString("You are OUT, start when prepared!");
            needShowFeedbackMessage = true;
            Util.PlaySound(Constants.SoundTypes.CAN_START, volumeOn);

            loggedState = States.OFF;

            success = true;
        }
        else           //UNKNOW (Chronopic disconnected, port changed, ...)
        {
            chronopicHasBeenDisconnected();
            return;
        }

        if (success)
        {
            //initialize variables
            timesString = "";
            tracks      = 0;

            //prepare jump for being cancelled if desired
            cancel = false;

            //prepare jump for being finished earlier if desired
            finish = false;

            //mark we haven't started
            pulsePhase = pulsePhases.WAIT_FIRST_EVENT;

            //in simulated mode, make the event start just when we arrive to waitEvent at the first time
            //mark now that we have landed:
            if (simulated)
            {
                platformState = Chronopic.Plataforma.ON;
            }

            //start thread
            thread = new Thread(new ThreadStart(waitEvent));
            GLib.Idle.Add(new GLib.IdleHandler(PulseGTK));

            LogB.ThreadStart();
            thread.Start();
        }
    }
Esempio n. 5
0
    /*
     * //onTimer allow to update progressbar_time every 50 milliseconds
     * //also can change platform state in simulated mode
     * //protected void onTimer( Object source, ElapsedEventArgs e )
     * protected override void onTimer( )
     * {
     *      timerCount = timerCount + .05; //0,05 segons == 50 milliseconds, time between each call of onTimer
     * }
     */


    public override void Manage()
    {
        //boolean to know if chronopic has been disconnected
        chronopicDisconnected = false;

        if (chronopics > 0)
        {
            platformState = chronopicInitialValue(cp);

            if (platformState == Chronopic.Plataforma.ON)
            {
                loggedState  = States.ON;
                cp1StartedIn = true;
            }
            else if (platformState == Chronopic.Plataforma.OFF)
            {
                loggedState  = States.OFF;
                cp1StartedIn = false;
            }
            else                 //UNKNOW (Chronopic disconnected, port changed, ...)
            {
                chronopicHasBeenDisconnected();
                return;
            }

            //prepare jump for being cancelled if desired
            cancel = false;

            //prepare jump for being finished earlier if desired
            finish = false;

            if (chronopics > 1)
            {
                platformState2 = chronopicInitialValue(cp2);

                if (platformState2 == Chronopic.Plataforma.ON)
                {
                    loggedState2 = States.ON;
                    cp2StartedIn = true;
                }
                else if (platformState2 == Chronopic.Plataforma.OFF)
                {
                    loggedState2 = States.OFF;
                    cp2StartedIn = false;
                }
                else                     //UNKNOW (Chronopic disconnected, port changed, ...)
                {
                    chronopicHasBeenDisconnected();
                    return;
                }

                if (chronopics > 2)
                {
                    platformState3 = chronopicInitialValue(cp3);

                    if (platformState3 == Chronopic.Plataforma.ON)
                    {
                        loggedState3 = States.ON;
                        cp3StartedIn = true;
                    }
                    else if (platformState3 == Chronopic.Plataforma.OFF)
                    {
                        loggedState3 = States.OFF;
                        cp3StartedIn = false;
                    }
                    else                         //UNKNOW (Chronopic disconnected, port changed, ...)
                    {
                        chronopicHasBeenDisconnected();
                        return;
                    }

                    if (chronopics > 3)
                    {
                        platformState4 = chronopicInitialValue(cp4);

                        if (platformState4 == Chronopic.Plataforma.ON)
                        {
                            loggedState4 = States.ON;
                            cp4StartedIn = true;
                        }
                        else if (platformState4 == Chronopic.Plataforma.OFF)
                        {
                            loggedState4 = States.OFF;
                            cp4StartedIn = false;
                        }
                        else                             //UNKNOW (Chronopic disconnected, port changed, ...)
                        {
                            chronopicHasBeenDisconnected();
                            return;
                        }
                    }
                }
            }
        }

        string platformsProblems = "";

        if (type == Constants.RunAnalysisName)
        {
            string sep = "";
            if (platformState == Chronopic.Plataforma.ON)
            {
                platformsProblems = Catalog.GetString("Photocells");
                sep = ", ";
            }
            if (platformState2 == Chronopic.Plataforma.ON)
            {
                platformsProblems += sep + Catalog.GetString("Platform");
            }
        }


        if (platformsProblems.Length > 0)
        {
            ConfirmWindow confirmWin;
            confirmWin = ConfirmWindow.Show(
                string.Format(Catalog.GetString("There's contact in {0}. Please leave."), platformsProblems), "", "");

            Util.PlaySound(Constants.SoundTypes.BAD, volumeOn);

            //we call again this function
            confirmWin.Button_accept.Clicked += new EventHandler(callAgainManage);

            //if confirmWin.Button_cancel is pressed retuen
            confirmWin.Button_cancel.Clicked += new EventHandler(cancel_event_before_start);
        }
        else
        {
            firstValue = true;
            //writingStarted = false;

            //start thread
            if (chronopics > 0)
            {
                //prepare variables to allow being cancelled or finished
                if (!simulated)
                {
                    Chronopic.InitCancelAndFinish();
                }

                thread = new Thread(new ThreadStart(waitEventPre));
                if (chronopics > 1)
                {
                    thread2 = new Thread(new ThreadStart(waitEventPre2));
                    if (chronopics > 2)
                    {
                        thread3 = new Thread(new ThreadStart(waitEventPre3));
                        if (chronopics > 3)
                        {
                            thread4 = new Thread(new ThreadStart(waitEventPre4));
                        }
                    }
                }
            }

            GLib.Idle.Add(new GLib.IdleHandler(PulseGTK));

            if (chronopics > 0)
            {
                LogB.ThreadStart();
                thread.Start();

                if (chronopics > 1)
                {
                    thread2.Start();
                    if (chronopics > 2)
                    {
                        thread3.Start();
                        if (chronopics > 4)
                        {
                            thread4.Start();
                        }
                    }
                }
            }
        }
    }
Esempio n. 6
0
    protected void checkFile(string formatFile)
    {
        string exportString = "";

        if (formatFile == "report")
        {
            exportString = Catalog.GetString("Save report as...");
        }
        else
        {
            exportString = Catalog.GetString("Export session in format " + formatFile);
        }


        Gtk.FileChooserDialog fc =
            new Gtk.FileChooserDialog(exportString,
                                      app1,
                                      FileChooserAction.Save,
                                      Catalog.GetString("Cancel"), ResponseType.Cancel,
                                      Catalog.GetString("Export"), ResponseType.Accept
                                      );

        //set default name
        string nameString = mySession.Name + "_" + mySession.DateShortAsSQL;

        if (formatFile == "report")
        {
            if (UtilAll.IsWindows())
            {
                nameString += ".htm";
            }
            else
            {
                nameString += ".html";
            }
        }
        else
        {
            nameString += ".csv";
        }

        fc.CurrentName = nameString;

        if (fc.Run() == (int)ResponseType.Accept)
        {
            fileName = fc.Filename;
            if (formatFile == "report")
            {
                //add ".html" if needed, remember that on windows should be .htm
                fileName = addHtmlIfNeeded(fileName);
            }
            else
            {
                //add ".csv" if needed
                fileName = Util.AddCsvIfNeeded(fileName);
            }
            try {
                if (File.Exists(fileName))
                {
                    LogB.Warning(string.Format("File {0} exists with attributes {1}, created at {2}",
                                               fileName, File.GetAttributes(fileName), File.GetCreationTime(fileName)));
                    LogB.Information("Overwrite...");
                    ConfirmWindow confirmWin = ConfirmWindow.Show(Catalog.GetString("Are you sure you want to overwrite file: "), "", fileName);
                    confirmWin.Button_accept.Clicked += new EventHandler(on_overwrite_file_accepted);
                }
                else
                {
                    writer = File.CreateText(fileName);
                    getData();
                    printData();
                    closeWriter();

                    string myString = string.Format(Catalog.GetString("Saved to {0}"), fileName) + spreadsheetString;
                    new DialogMessage(Constants.MessageTypes.INFO, myString);
                }
            }
            catch {
                string myString = string.Format(Catalog.GetString("Cannot export to file {0} "), fileName);
                new DialogMessage(Constants.MessageTypes.WARNING, myString);
            }
        }
        else
        {
            LogB.Information("cancelled");
            //report does not currently send the appBar reference
            if (formatFile != "report")
            {
                new DialogMessage(Constants.MessageTypes.INFO, Catalog.GetString("Cancelled."));
            }
            fc.Hide();
            return;
        }

        //Don't forget to call Destroy() or the FileChooserDialog window won't get closed.
        fc.Destroy();

        return;
    }
Esempio n. 7
0
    public override void Manage()
    {
        //boolean to know if chronopic has been disconnected
        chronopicDisconnected = false;

        LogB.Error("at Manage!");

        if (simulated)
        {
            if (StartIn)
            {
                platformState = Chronopic.Plataforma.ON;
            }
            else
            {
                platformState = Chronopic.Plataforma.OFF;
            }
        }
        else
        {
            platformState = chronopicInitialValue(cp);
        }

        bool canStart = false;

        if (
            (StartIn && platformState == Chronopic.Plataforma.ON) ||
            (!StartIn && platformState == Chronopic.Plataforma.OFF))
        {
            canStart = true;
        }


        if (canStart)
        {
            feedbackMessage         = Catalog.GetString("You are IN, RELEASE when prepared!");     //TODO: change this
            needShowFeedbackMessage = true;
            Util.PlaySound(Constants.SoundTypes.CAN_START, volumeOn, gstreamer);

            if (StartIn)
            {
                loggedState = States.ON;
            }
            else
            {
                loggedState = States.OFF;
            }

            //prepare reactionTime for being cancelled if desired
            cancel = false;

            //in simulated mode, make the jump start just when we arrive to waitEvent at the first time
            //mark now that we have leaved platform:
            if (simulated)
            {
                if (StartIn)
                {
                    platformState = Chronopic.Plataforma.OFF;
                }
                else
                {
                    platformState = Chronopic.Plataforma.ON;
                }
            }

            //if discriminative, will fire the buttons
            FakeButtonReactionTimeStart.Click();
        }
        else if (!canStart && (platformState == Chronopic.Plataforma.ON || platformState == Chronopic.Plataforma.OFF))
        {
            ConfirmWindow confirmWin;
            confirmWin = ConfirmWindow.Show(
                Catalog.GetString("You are OUT, come inside and press the 'accept' button"), "", "");                         //TODO:change this
            //System.Media.SystemSounds.Beep.Play();
            Util.PlaySound(Constants.SoundTypes.BAD, volumeOn, gstreamer);

            //we call again this function
            confirmWin.Button_accept.Clicked += new EventHandler(callAgainManage);

            //if confirmWin.Button_cancel is pressed retuen
            confirmWin.Button_cancel.Clicked += new EventHandler(cancel_event_before_start);
        }
        else           //UNKNOW (Chronopic disconnected, port changed, ...) platformStart == some error
        {
            chronopicHasBeenDisconnected();
        }
    }