Esempio n. 1
0
    private static bool pulseGTKServer()
    {
        if (!thread.IsAlive)
        {
            sessionUploadWin.UploadFinished();
            LogB.Information("dying");
            return(false);
        }

        if (serverSessionError)
        {
            new DialogMessage(Constants.MessageTypes.WARNING, Catalog.GetString("Error uploading session to server"));
            return(false);
        }

        //need to do this, if not it crashes because chronopicWin gets died by thread ending
        sessionUploadWin = SessionUploadWindow.Show(app1);

        if (countPersons == 0)
        {
            sessionUploadWin.PulseProgressbar();
        }

        //activity on pulsebar
        sessionUploadWin.UpdatePulsebar();

        if (needUpdateServerSession && !updatingServerSession)
        {
            //prevent that FillData is called again with same data
            updatingServerSession = true;

            //update progressBar
            sessionUploadWin.UpdateProgressbar(
                Util.DivideSafeFraction(++countPersons, progressBarPersonsNum));

            //fill data
            sessionUploadWin.FillData(sessionUploadPersonData);

            //not need to update until there's more data coming from the other thread
            updatingServerSession   = false;
            needUpdateServerSession = false;
        }

        Thread.Sleep(50);
        LogB.Debug(thread.ThreadState.ToString());
        return(true);
    }