Пример #1
0
    //jump execution
    public JumpRjExecute(int personID, string personName,
                         int sessionID, string type, double fall, double weight,
                         double limitAsDouble, bool jumpsLimited,
                         Chronopic cp, Gtk.Window app, int pDN, bool allowFinishAfterTime,
                         bool volumeOn, Preferences.GstreamerTypes gstreamer,
                         RepetitiveConditionsWindow repetitiveConditionsWin,
                         double progressbarLimit, ExecutingGraphData egd
                         )
    {
        this.personID      = personID;
        this.personName    = personName;
        this.sessionID     = sessionID;
        this.type          = type;
        this.fall          = fall;
        this.weight        = weight;
        this.limitAsDouble = limitAsDouble;

        this.jumpsLimited = jumpsLimited;
        if (jumpsLimited)
        {
            this.limited = limitAsDouble.ToString() + "J";
        }
        else
        {
            //this.limited = limitAsDouble.ToString() + "T"; define later, because it can be higher if allowFinishRjAfterTime is defined
        }

        this.cp  = cp;
        this.app = app;

        this.pDN = pDN;
        this.allowFinishAfterTime    = allowFinishAfterTime;
        this.volumeOn                = volumeOn;
        this.gstreamer               = gstreamer;
        this.repetitiveConditionsWin = repetitiveConditionsWin;
        this.progressbarLimit        = progressbarLimit;
        this.egd = egd;

        if (TypeHasFall)
        {
            hasFall = true;
        }
        else
        {
            hasFall = false;
        }

        fakeButtonUpdateGraph = new Gtk.Button();
        fakeButtonThreadDyed  = new Gtk.Button();

        simulated = false;

        needUpdateEventProgressBar = false;
        needUpdateGraph            = false;

        timesForSavingRepetitive = 10;         //number of times that this repetive event needs for being recorded in temporal table

        //initialize eventDone as a JumpRj
        eventDone = new JumpRj();
    }
Пример #2
0
    static public RepetitiveConditionsWindow Create()
    {
        if (RepetitiveConditionsWindowBox == null)
        {
            RepetitiveConditionsWindowBox = new RepetitiveConditionsWindow();
        }

        //don't show until View is called
        //RepetitiveConditionsWindowBox.repetitive_conditions.Hide ();

        return(RepetitiveConditionsWindowBox);
    }
Пример #3
0
    public void View(Constants.BellModes bellMode, bool volumeOn)
    {
        //this.volumeOn = volumeOn;

        //when user "deleted_event" the window
        if (RepetitiveConditionsWindowBox == null)
        {
            RepetitiveConditionsWindowBox = new RepetitiveConditionsWindow();
        }
        RepetitiveConditionsWindowBox.showWidgets(bellMode);
        RepetitiveConditionsWindowBox.repetitive_conditions.Show();
        RepetitiveConditionsWindowBox.volumeOn = volumeOn;
    }
    public void View(Constants.BellModes bellMode, bool volumeOn, Preferences.GstreamerTypes gstreamer,
                     Constants.EncoderVariablesCapture encoderMainVariable, EncoderRhythm encoderRhythm)
    {
        //when user "deleted_event" the window
        if (RepetitiveConditionsWindowBox == null)
        {
            RepetitiveConditionsWindowBox = new RepetitiveConditionsWindow();
        }
        RepetitiveConditionsWindowBox.showWidgets(bellMode, encoderMainVariable, encoderRhythm);

        RepetitiveConditionsWindowBox.repetitive_conditions.Show();
        RepetitiveConditionsWindowBox.volumeOn  = volumeOn;
        RepetitiveConditionsWindowBox.gstreamer = gstreamer;
    }
Пример #5
0
    // run interval
    // distanceTotal is passed because it can change in variable distances test
    public void PrepareRunIntervalGraph(double distance, double lastTime, string timesString, double distanceTotal, string distancesString,
			bool volumeOn, RepetitiveConditionsWindow repetitiveConditionsWin)
    {
        //check graph properties window is not null (propably user has closed it with the DeleteEvent
        //then create it, but not show it
        if(eventGraphConfigureWin == null)
            eventGraphConfigureWin = EventGraphConfigureWindow.Show(false);

        bool paintTime = false; //paint speed
        if(eventGraphConfigureWin.RunsTimeActive)
            paintTime = true;

        //search MAX
        double maxValue = 0;
        int topMargin = 10;
        //if max value of graph is automatic
        if(eventGraphConfigureWin.Max == -1) {
            if(paintTime)
                maxValue = Util.GetMax(timesString);
            else {
                if(distancesString == "")
                    maxValue = distance / Util.GetMin(timesString); //getMin because is on the "denominador"
                else
                    maxValue = Util.GetRunIVariableDistancesSpeeds(distancesString, timesString, true);
            }
        } else {
            maxValue = eventGraphConfigureWin.Max;
            topMargin = 0;
        }

        //search min
        double minValue = 1000;
        int bottomMargin = 10;
        //if min value of graph is automatic
        if(eventGraphConfigureWin.Min == -1) {
            if(paintTime)
                minValue = Util.GetMin(timesString);
            else {
                if(distancesString == "")
                    minValue = distance / Util.GetMax(timesString); //getMax because is in the "denominador"
                else
                    minValue = Util.GetRunIVariableDistancesSpeeds(distancesString, timesString, false);
            }
        } else {
            minValue = eventGraphConfigureWin.Min;
            bottomMargin = 10;
        }

        int tracks = Util.GetNumberOfJumps(timesString, true);

        //paint graph
        paintRunInterval (event_execute_drawingarea, paintTime, distance, distanceTotal, distancesString,
                lastTime, timesString, Util.GetAverage(timesString),
                maxValue, minValue, tracks, topMargin, bottomMargin,
                Util.GetPosMax(timesString), Util.GetPosMin(timesString),
                volumeOn, repetitiveConditionsWin);

        // -- refresh
        event_execute_drawingarea.QueueDraw();
    }
Пример #6
0
    // Reactive jump
    public void PrepareJumpReactiveGraph(double lastTv, double lastTc, string tvString, string tcString, 
			bool volumeOn, RepetitiveConditionsWindow repetitiveConditionsWin)
    {
        //check graph properties window is not null (propably user has closed it with the DeleteEvent
        //then create it, but not show it
        if(eventGraphConfigureWin == null)
            eventGraphConfigureWin = EventGraphConfigureWindow.Show(false);

        Log.WriteLine("Preparing reactive A");

        //search MAX
        double maxValue = 0;
        int topMargin = 10;
        //if max value of graph is automatic
        if(eventGraphConfigureWin.Max == -1)
            maxValue = Util.GetMax(tvString + "=" + tcString);
        else {
            maxValue = eventGraphConfigureWin.Max;
            topMargin = 0;
        }

        //search min
        double minValue = 1000;
        int bottomMargin = 10;
        //if min value of graph is automatic
        if(eventGraphConfigureWin.Min == -1)
            minValue = Util.GetMin(tvString + "=" + tcString);
        else {
            minValue = eventGraphConfigureWin.Min;
            bottomMargin = 10;
        }

        int jumps = Util.GetNumberOfJumps(tvString, true);

        //paint graph
        paintJumpReactive (event_execute_drawingarea, lastTv, lastTc, tvString, tcString, Util.GetAverage(tvString), Util.GetAverage(tcString),
                maxValue, minValue, jumps, topMargin, bottomMargin,
                bestOrWorstTvTcIndex(true, tvString, tcString), bestOrWorstTvTcIndex(false, tvString, tcString),
                volumeOn, repetitiveConditionsWin);

        // -- refresh
        event_execute_drawingarea.QueueDraw();
    }
Пример #7
0
    private void paintRunInterval(Gtk.DrawingArea drawingarea, bool paintTime, double distance, double distanceTotal, string distancesString, double lastTime, 
			string timesString, double avgTime, double maxValue, double minValue, int tracks, int topMargin, int bottomMargin, 
			int hightValuePosition, int lowValuePosition,
			bool volumeOn, RepetitiveConditionsWindow repetitiveConditionsWin)
    {
        //int topMargin = 10;
        int ancho=drawingarea.Allocation.Width;
        int alto=drawingarea.Allocation.Height;

        event_execute_erasePaint(drawingarea);

        writeMarginsText(maxValue, minValue, alto);

        //check now here that we will have not division by zero problems
        if(maxValue - minValue > 0) {

            if(tracks > 1) {
                if(paintTime)
                    //red time average discountinuos line
                    drawGuideOrAVG(pen_rojo_discont, avgTime, alto, ancho, topMargin, bottomMargin, maxValue, minValue);
                else
                    //blue speed average discountinuos line
                    drawGuideOrAVG(pen_azul_discont, distance/avgTime, alto, ancho, topMargin, bottomMargin, maxValue, minValue);
            }

            //paint reference guide black and green if needed
            drawGuideOrAVG(pen_negro_discont, eventGraphConfigureWin.BlackGuide, alto, ancho, topMargin, bottomMargin, maxValue, minValue);
            drawGuideOrAVG(pen_green_discont, eventGraphConfigureWin.GreenGuide, alto, ancho, topMargin, bottomMargin, maxValue, minValue);

            string [] myTimesStringFull = timesString.Split(new char[] {'='});
            int count = 0;
            double oldValue = 0;
            double myTimeDouble = 0;

            Gdk.GC myPen = pen_rojo; //default value
            double myValue = 0;

            foreach (string myTime in myTimesStringFull) {
                myTimeDouble = Convert.ToDouble(myTime);
                if(myTimeDouble < 0)
                    myTimeDouble = 0;

                if(paintTime) {
                    //red time evolution
                    myPen = pen_rojo;
                    myValue = myTimeDouble;
                } else {
                    //blue speed evolution
                    myPen = pen_azul;

                    //if distances are variable
                    if(distancesString == "")
                        myValue = distance / myTimeDouble;
                    else
                        myValue = Util.GetRunIVariableDistancesStringRow(distancesString, count) / myTimeDouble;
                }

                if (count > 0) {
                    event_execute_pixmap.DrawLine(myPen,
                            Convert.ToInt32((ancho - event_execute_rightMargin) *(count-.5)/tracks), calculatePaintHeight(oldValue, alto, maxValue, minValue, topMargin, bottomMargin),
                            Convert.ToInt32((ancho - event_execute_rightMargin) *(count+.5)/tracks), calculatePaintHeight(myValue, alto, maxValue, minValue, topMargin, bottomMargin));
                }

                //paint Y lines
                if(eventGraphConfigureWin.VerticalGrid)
                    event_execute_pixmap.DrawLine(pen_beige_discont, Convert.ToInt32((ancho - event_execute_rightMargin) *(count+.5)/tracks), topMargin, Convert.ToInt32((ancho - event_execute_rightMargin) *(count+.5)/tracks), alto-topMargin);

                oldValue = myValue;
                count ++;
            }

            drawCircleAndWriteValue(myPen, myValue, --count, tracks, ancho, alto, maxValue, minValue, topMargin, bottomMargin);

            //bells & images
            event_execute_image_run_interval_time_good.Hide();
            event_execute_image_run_interval_time_bad.Hide();
            bool showTimeGood = false;
            bool showTimeBad = false;

            //sounds of best & worst
            if(count > 0) {
                if(repetitiveConditionsWin.RunTimeBest && lowValuePosition == count)
                    showTimeGood = true;
                else if(repetitiveConditionsWin.RunTimeWorst && hightValuePosition == count)
                    showTimeBad = true;
            }

            if(repetitiveConditionsWin.RunTimeLower && lastTime < repetitiveConditionsWin.RunTimeLowerValue)
                showTimeGood = true;
            if(repetitiveConditionsWin.RunTimeGreater && lastTime > repetitiveConditionsWin.RunTimeGreaterValue)
                showTimeBad = true;

            if(showTimeGood) {
                Util.PlaySound(Constants.SoundTypes.GOOD, volumeOn);
                event_execute_image_run_interval_time_good.Show();
            }
            if(showTimeBad) {
                Util.PlaySound(Constants.SoundTypes.BAD, volumeOn);
                event_execute_image_run_interval_time_bad.Show();
            }
        }

        event_execute_label_run_interval_time_now.Text = Util.TrimDecimals(lastTime.ToString(), prefsDigitsNumber);
        event_execute_label_run_interval_time_avg.Text = Util.TrimDecimals(avgTime.ToString(), prefsDigitsNumber);
        event_execute_label_run_interval_speed_now.Text = Util.TrimDecimals((distance / lastTime).ToString(), prefsDigitsNumber);
        event_execute_label_run_interval_speed_avg.Text = Util.TrimDecimals((distanceTotal / Util.GetTotalTime(timesString)).ToString(), prefsDigitsNumber);
    }
Пример #8
0
    private void paintJumpReactive(Gtk.DrawingArea drawingarea, double lastTv, double lastTc, string tvString, string tcString, 
			double avgTV, double avgTC, double maxValue, double minValue, int jumps, 
			int topMargin, int bottomMargin, int posMax, int posMin, bool volumeOn,
			RepetitiveConditionsWindow repetitiveConditionsWin)
    {
        //int topMargin = 10;
        int ancho=drawingarea.Allocation.Width;
        int alto=drawingarea.Allocation.Height;

        event_execute_erasePaint(drawingarea);

        writeMarginsText(maxValue, minValue, alto);

        //check now here that we will have not division by zero problems
        if(maxValue - minValue > 0) {

            if(jumps > 1) {
                //blue tf average discountinuos line
                drawGuideOrAVG(pen_azul_discont, avgTV, alto, ancho, topMargin, bottomMargin, maxValue, minValue);

                //red tc average discountinuos line
                drawGuideOrAVG(pen_rojo_discont, avgTC, alto, ancho, topMargin, bottomMargin, maxValue, minValue);
            }

            //paint reference guide black and green if needed
            drawGuideOrAVG(pen_negro_discont, eventGraphConfigureWin.BlackGuide, alto, ancho, topMargin, bottomMargin, maxValue, minValue);
            drawGuideOrAVG(pen_green_discont, eventGraphConfigureWin.GreenGuide, alto, ancho, topMargin, bottomMargin, maxValue, minValue);

            //blue tf evolution
            string [] myTVStringFull = tvString.Split(new char[] {'='});
            int count = 0;
            double oldValue = 0;
            double myTVDouble = 0;

            foreach (string myTV in myTVStringFull) {
                myTVDouble = Convert.ToDouble(myTV);
                if(myTVDouble < 0)
                    myTVDouble = 0;

                if (count > 0)
                    event_execute_pixmap.DrawLine(pen_azul, //blue for TF
                            Convert.ToInt32((ancho-event_execute_rightMargin)*(count-.5)/jumps), calculatePaintHeight(oldValue, alto, maxValue, minValue, topMargin, bottomMargin),
                            Convert.ToInt32((ancho-event_execute_rightMargin)*(count+.5)/jumps), calculatePaintHeight(myTVDouble, alto, maxValue, minValue, topMargin, bottomMargin));

                //paint Y lines
                if(eventGraphConfigureWin.VerticalGrid)
                    event_execute_pixmap.DrawLine(pen_beige_discont, Convert.ToInt32((ancho - event_execute_rightMargin) *(count+.5)/jumps), topMargin, Convert.ToInt32((ancho - event_execute_rightMargin) *(count+.5)/jumps), alto-topMargin);

                oldValue = myTVDouble;
                count ++;
            }

            drawCircleAndWriteValue(pen_azul, myTVDouble, --count, jumps, ancho, alto, maxValue, minValue, topMargin, bottomMargin);

            //read tc evolution
            string [] myTCStringFull = tcString.Split(new char[] {'='});
            count = 0;
            oldValue = 0;
            double myTCDouble = 0;

            foreach (string myTC in myTCStringFull) {
                myTCDouble = Convert.ToDouble(myTC);

                //if we are at second value (or more), and first was not a "-1"
                //-1 means here that first jump has not TC (started inside)
                if (count > 0 && oldValue != -1)
                    event_execute_pixmap.DrawLine(pen_rojo, //red for TC
                            Convert.ToInt32((ancho-event_execute_rightMargin)*(count-.5)/jumps), calculatePaintHeight(oldValue, alto, maxValue, minValue, topMargin, bottomMargin),
                            Convert.ToInt32((ancho-event_execute_rightMargin)*(count+.5)/jumps), calculatePaintHeight(myTCDouble, alto, maxValue, minValue, topMargin, bottomMargin));

                oldValue = myTCDouble;
                count ++;
            }

            drawCircleAndWriteValue(pen_rojo, myTCDouble, --count, jumps, ancho, alto, maxValue, minValue, topMargin, bottomMargin);

            //draw best tv/tc
            event_execute_pixmap.DrawLine(pen_brown_bold,
                    Convert.ToInt32((ancho-event_execute_rightMargin)*(posMax+.5)/jumps), calculatePaintHeight(Convert.ToDouble(myTVStringFull[posMax]), alto, maxValue, minValue, topMargin, bottomMargin),
                    Convert.ToInt32((ancho-event_execute_rightMargin)*(posMax+.5)/jumps), calculatePaintHeight(Convert.ToDouble(myTCStringFull[posMax]), alto, maxValue, minValue, topMargin, bottomMargin));
            //draw worst tv/tc
            event_execute_pixmap.DrawLine(pen_violet_bold,
                    Convert.ToInt32((ancho-event_execute_rightMargin)*(posMin+.5)/jumps), calculatePaintHeight(Convert.ToDouble(myTVStringFull[posMin]), alto, maxValue, minValue, topMargin, bottomMargin),
                    Convert.ToInt32((ancho-event_execute_rightMargin)*(posMin+.5)/jumps), calculatePaintHeight(Convert.ToDouble(myTCStringFull[posMin]), alto, maxValue, minValue, topMargin, bottomMargin));

            //bells & images
            event_execute_image_jump_reactive_tf_good.Hide();
            event_execute_image_jump_reactive_tf_bad.Hide();
            event_execute_image_jump_reactive_tc_good.Hide();
            event_execute_image_jump_reactive_tc_bad.Hide();
            event_execute_image_jump_reactive_tf_tc_good.Hide();
            event_execute_image_jump_reactive_tf_tc_bad.Hide();
            bool showTfGood = false;
            bool showTfBad = false;
            bool showTcGood = false;
            bool showTcBad = false;
            bool showTfTcGood = false;
            bool showTfTcBad = false;

            //sounds of best & worst
            if(count > 0) {
                if(repetitiveConditionsWin.TfTcBest && posMax == count)
                    showTfTcGood = true;
                else if(repetitiveConditionsWin.TfTcWorst && posMin == count)
                    showTfTcBad = true;
            }

            if(repetitiveConditionsWin.TfGreater && lastTv > repetitiveConditionsWin.TfGreaterValue)
                showTfGood = true;
            if(repetitiveConditionsWin.TfLower && lastTv < repetitiveConditionsWin.TfLowerValue)
                showTfBad = true;

            if(repetitiveConditionsWin.TcGreater && lastTc > repetitiveConditionsWin.TcGreaterValue)
                showTcBad = true;
            if(repetitiveConditionsWin.TcLower && lastTc < repetitiveConditionsWin.TcLowerValue)
                showTcGood = true;

            if(lastTc > 0 && repetitiveConditionsWin.TfTcGreater && lastTv/lastTc > repetitiveConditionsWin.TfTcGreaterValue)
                showTfTcGood = true;
            if(lastTc > 0 && repetitiveConditionsWin.TfTcLower && lastTv/lastTc < repetitiveConditionsWin.TfTcLowerValue)
                showTfTcGood = true;

            if(showTfGood || showTcGood || showTfTcGood)
                Util.PlaySound(Constants.SoundTypes.GOOD, volumeOn);
            if(showTfBad || showTcBad || showTfTcBad)
                Util.PlaySound(Constants.SoundTypes.BAD, volumeOn);

            if(showTfGood)
                event_execute_image_jump_reactive_tf_good.Show();
            if(showTfBad)
                event_execute_image_jump_reactive_tf_bad.Show();
            if(showTcGood)
                event_execute_image_jump_reactive_tc_good.Show();
            if(showTcBad)
                event_execute_image_jump_reactive_tc_bad.Show();
            if(showTfTcGood)
                event_execute_image_jump_reactive_tf_tc_good.Show();
            if(showTfTcBad)
                event_execute_image_jump_reactive_tf_tc_bad.Show();
        }

        /*
         * these Log.writeLines are useful to don't "get the thread dead"
         * without them , sometimes drawingarea is not painted
         */
        event_execute_label_jump_reactive_tc_now.Text = Util.TrimDecimals(lastTc.ToString(), prefsDigitsNumber);
        event_execute_label_jump_reactive_tc_avg.Text = Util.TrimDecimals(avgTC.ToString(), prefsDigitsNumber);
        event_execute_label_jump_reactive_tf_now.Text = Util.TrimDecimals(lastTv.ToString(), prefsDigitsNumber);
        event_execute_label_jump_reactive_tf_avg.Text = Util.TrimDecimals(avgTV.ToString(), prefsDigitsNumber);
        if(lastTc > 0)
            event_execute_label_jump_reactive_tf_tc_now.Text = Util.TrimDecimals((lastTv/lastTc).ToString(), prefsDigitsNumber);
        else
            event_execute_label_jump_reactive_tf_tc_now.Text = "0";
        if(avgTC > 0)
            event_execute_label_jump_reactive_tf_tc_avg.Text = Util.TrimDecimals((avgTV/avgTC).ToString(), prefsDigitsNumber);
        else
            event_execute_label_jump_reactive_tf_tc_avg.Text = "0";
    }
Пример #9
0
    public ChronoJumpWindow(string progVersion, string progName, string runningFileName)
    {
        this.progVersion = progVersion;
        this.progName = progName;
        this.runningFileName = runningFileName;

        Glade.XML gxml;
        gxml = Glade.XML.FromAssembly (Util.GetGladePath() + "chronojump.glade", "app1", null);
        gxml.Autoconnect(this);

        //put an icon to window
        UtilGtk.IconWindow(app1);

        //show chronojump logo on down-left area
        changeTestImage("", "", "LOGO");

        //white bg
        eventbox_image_test.ModifyBg(StateType.Normal, UtilGtk.WHITE);

        //new DialogMessage(Constants.MessageTypes.INFO, UtilGtk.ScreenHeightFitted(false).ToString() );
        //UtilGtk.ResizeIfNeeded(stats_window);
        app1.Maximize();

        report = new Report(-1); //when a session is loaded or created, it will change the report.SessionID value
        //TODO: check what happens if a session it's deleted
        //i think report it's deactivated until a new session is created or loaded,
        //but check what happens if report window is opened

        //preferencesLoaded is a fix to a gtk#-net-windows-bug where radiobuttons raise signals
        //at initialization of chronojump and gives problems if this signals are raised while preferences are loading
        loadPreferences ();

        createTreeView_persons (treeview_persons);

        createTreeView_jumps (treeview_jumps);
        createTreeView_jumps_rj (treeview_jumps_rj);
        createTreeView_runs (treeview_runs);
        createTreeView_runs_interval (treeview_runs_interval);
        createTreeView_reaction_times (treeview_reaction_times);
        createTreeView_pulses (treeview_pulses);
        createTreeView_multi_chronopic (treeview_multi_chronopic);

        createComboJumps();
        createComboJumpsRj();
        createComboRuns();
        createComboRunsInterval();
        //reaction_times has no combo
        createComboPulses();
        //createComboMultiChronopic();
        createdStatsWin = false;

        repetitiveConditionsWin = RepetitiveConditionsWindow.Create();
        repetitiveConditionsWin.FakeButtonClose.Clicked += new EventHandler(on_repetitive_conditions_closed);

        createChronopicWindow(false);

        on_extra_window_multichronopic_test_changed(new object(), new EventArgs());
        on_extra_window_pulses_test_changed(new object(), new EventArgs());
        on_extra_window_reaction_times_test_changed(new object(), new EventArgs());
        on_extra_window_runs_interval_test_changed(new object(), new EventArgs());
        on_extra_window_runs_test_changed(new object(), new EventArgs());
        on_extra_window_jumps_rj_test_changed(new object(), new EventArgs());
        on_extra_window_jumps_test_changed(new object(), new EventArgs());
        //changeTestImage("", "", "LOGO");

        //We have no session, mark some widgets as ".Sensitive = false"
        sensitiveGuiNoSession();
        definedSession = false;

        rand = new Random(40);

        putNonStandardIcons();
        eventExecutePutNonStandardIcons();
        //eventExecuteCreateComboGraphResultsSize();

        /*

        if(chronopicPort != Constants.ChronopicDefaultPortWindows &&
                (chronopicPort != Constants.ChronopicDefaultPortLinux && File.Exists(chronopicPort))
          ) {
            ConfirmWindow confirmWin = ConfirmWindow.Show(Catalog.GetString("Do you want to connect to Chronopic now?"), "", "");
            confirmWin.Button_accept.Clicked += new EventHandler(chronopicAtStart);
        }
        */

        stats_win_create();
        createdStatsWin = true;
        //stats_win_initializeSession();

        encoderInitializeStuff();

        presentationInit();
    }
Пример #10
0
    //run execution
    public RunIntervalExecute(int personID, int sessionID, string type, double distanceInterval, double limitAsDouble, bool tracksLimited,  
			Chronopic cp, Gtk.Label event_execute_label_message, Gtk.Window app, int pDN, bool metersSecondsPreferred, 
			bool volumeOn, RepetitiveConditionsWindow repetitiveConditionsWin,
			double progressbarLimit, ExecutingGraphData egd ,
			Constants.DoubleContact checkDoubleContactMode, int checkDoubleContactTime, 
			bool speedStartArrival
			)
    {
        this.personID = personID;
        this.sessionID = sessionID;
        this.type = type;
        this.distanceInterval = distanceInterval;
        this.limitAsDouble = limitAsDouble;
        this.tracksLimited = tracksLimited;

        //if distances are variable
        distancesString = "";
        if(distanceInterval == -1) {
            RunType runType = SqliteRunIntervalType.SelectAndReturnRunIntervalType(type, false);
            distancesString = runType.DistancesString;
        }

        if(tracksLimited) {
            this.limited = limitAsDouble.ToString() + "R"; //'R'uns (don't put 'T'racks for not confusing with 'T'ime)
        } else {
            this.limited = limitAsDouble.ToString() + "T";
            timeTotal = limitAsDouble;
        }

        this.cp = cp;
        this.event_execute_label_message = event_execute_label_message;
        this.app = app;

        this.metersSecondsPreferred = metersSecondsPreferred;
        this.pDN = pDN;
        this.volumeOn = volumeOn;
        this.repetitiveConditionsWin = repetitiveConditionsWin;
        this.progressbarLimit = progressbarLimit;
        this.egd = egd;
        this.checkDoubleContactMode = checkDoubleContactMode;
        this.checkDoubleContactTime = checkDoubleContactTime;
        this.speedStartArrival = speedStartArrival;

        fakeButtonUpdateGraph = new Gtk.Button();
        fakeButtonEventEnded = new Gtk.Button();
        fakeButtonFinished = new Gtk.Button();
        fakeButtonThreadDyed = new Gtk.Button();

        simulated = false;

        needUpdateEventProgressBar = false;
        needUpdateGraph = false;

        timesForSavingRepetitive = 1; //number of times that this repetive event needs for being recorded in temporal table

        //initialize eventDone as a RunInterval
        eventDone = new RunInterval();
    }
Пример #11
0
    //jump execution
    public JumpRjExecute(int personID, string personName, 
			int sessionID, string type, double fall, double weight, 
			double limitAsDouble, bool jumpsLimited, 
			Chronopic cp, Gtk.TextView event_execute_textview_message, Gtk.Window app, int pDN, bool allowFinishAfterTime, 
			bool volumeOn, RepetitiveConditionsWindow repetitiveConditionsWin,
			double progressbarLimit, ExecutingGraphData egd 
			)
    {
        this.personID = personID;
        this.personName = personName;
        this.sessionID = sessionID;
        this.type = type;
        this.fall = fall;
        this.weight = weight;
        this.limitAsDouble = limitAsDouble;

        this.jumpsLimited = jumpsLimited;
        if(jumpsLimited) {
            this.limited = limitAsDouble.ToString() + "J";
        } else {
            //this.limited = limitAsDouble.ToString() + "T"; define later, because it can be higher if allowFinishRjAfterTime is defined
        }

        this.cp = cp;
        this.event_execute_textview_message = event_execute_textview_message;
        this.app = app;

        this.pDN = pDN;
        this.allowFinishAfterTime = allowFinishAfterTime;
        this.volumeOn = volumeOn;
        this.repetitiveConditionsWin = repetitiveConditionsWin;
        this.progressbarLimit = progressbarLimit;
        this.egd = egd;

        if(TypeHasFall) { hasFall = true; }
        else { hasFall = false; }

        fakeButtonUpdateGraph = new Gtk.Button();
        fakeButtonEventEnded = new Gtk.Button();
        fakeButtonFinished = new Gtk.Button();

        simulated = false;

        needUpdateEventProgressBar = false;
        needUpdateGraph = false;

        timesForSavingRepetitive = 10; //number of times that this repetive event needs for being recorded in temporal table

        //initialize eventDone as a JumpRj
        eventDone = new JumpRj();
    }
Пример #12
0
    public ChronoJumpWindow(string progVersion, string progName, string runningFileName)
    {
        this.progVersion = progVersion;
        this.progName = progName;
        this.runningFileName = runningFileName;

        Glade.XML gxml;
        gxml = Glade.XML.FromAssembly (Util.GetGladePath() + "app1.glade", "app1", "chronojump");
        gxml.Autoconnect(this);

        //put an icon to window
        UtilGtk.IconWindow(app1);

        //show chronojump logo on down-left area
        changeTestImage("", "", "LOGO");

        //white bg
        eventbox_image_test.ModifyBg(StateType.Normal, UtilGtk.WHITE);

        //start with the Mode selector
        notebook_start.CurrentPage = 0;

        //new DialogMessage(Constants.MessageTypes.INFO, UtilGtk.ScreenHeightFitted(false).ToString() );
        //UtilGtk.ResizeIfNeeded(stats_window);

        //app1.Maximize(); //this was for starting at fullscreen

        report = new Report(-1); //when a session is loaded or created, it will change the report.SessionID value
        //TODO: check what happens if a session it's deleted
        //i think report it's deactivated until a new session is created or loaded,
        //but check what happens if report window is opened

        //put videoOn as false before loading preferences to start always without the camera
        //this is good if camera produces crash
        SqlitePreferences.Update("videoOn", "False", false);

        //preferencesLoaded is a fix to a gtk#-net-windows-bug where radiobuttons raise signals
        //at initialization of chronojump and gives problems if this signals are raised while preferences are loading
        loadPreferences ();

        createTreeView_persons (treeview_persons);

        createTreeView_jumps (treeview_jumps);
        createTreeView_jumps_rj (treeview_jumps_rj);
        createTreeView_runs (treeview_runs);
        createTreeView_runs_interval (treeview_runs_interval);
        createTreeView_reaction_times (treeview_reaction_times);
        createTreeView_pulses (treeview_pulses);
        createTreeView_multi_chronopic (false, treeview_multi_chronopic);

        createComboSelectJumps(true);
        createComboSelectJumpsRj(true);
        createComboSelectRuns(true);
        createComboSelectRunsInterval(true);

        createComboResultJumps();
        createComboResultJumpsRj();
        createComboResultRuns();
        createComboResultRunsInterval();

        //reaction_times has no combo
        createComboPulses();
        //createComboMultiChronopic();
        createdStatsWin = false;

        repetitiveConditionsWin = RepetitiveConditionsWindow.Create();
        repetitiveConditionsWin.FakeButtonClose.Clicked += new EventHandler(on_repetitive_conditions_closed);

        //createChronopicWindow(false, "");
        //wizardPortContacts = "";
        //wizardPortEncoder = "";

        on_extra_window_multichronopic_test_changed(new object(), new EventArgs());
        on_extra_window_pulses_test_changed(new object(), new EventArgs());
        on_extra_window_reaction_times_test_changed(new object(), new EventArgs());
        on_extra_window_runs_interval_test_changed(new object(), new EventArgs());
        on_extra_window_runs_test_changed(new object(), new EventArgs());
        on_extra_window_jumps_rj_test_changed(new object(), new EventArgs());
        on_extra_window_jumps_test_changed(new object(), new EventArgs());
        //changeTestImage("", "", "LOGO");

        //We have no session, mark some widgets as ".Sensitive = false"
        sensitiveGuiNoSession();
        definedSession = false;

        rand = new Random(40);

        formatModeMenu();
        putNonStandardIcons();
        eventExecutePutNonStandardIcons();
        //eventExecuteCreateComboGraphResultsSize();

        /*

        if(chronopicPort != Constants.ChronopicDefaultPortWindows &&
                (chronopicPort != Constants.ChronopicDefaultPortLinux && File.Exists(chronopicPort))
          ) {
            ConfirmWindow confirmWin = ConfirmWindow.Show(Catalog.GetString("Do you want to connect to Chronopic now?"), "", "");
            confirmWin.Button_accept.Clicked += new EventHandler(chronopicAtStart);
        }
        */

        stats_win_create();
        createdStatsWin = true;
        //stats_win_initializeSession();

        encoderInitializeStuff();

        //presentationInit();

        videoCaptureInitialize();

        //leave empty on new releases
        //string buildDate = " (2016-07-27)";
        string buildVersion = UtilAll.ReadVersionFromBuildInfo();
        label_version.Text = buildVersion;
        LogB.Information("Build version:" + buildVersion);

        LeastSquares ls = new LeastSquares();
        ls.Test();
        LogB.Information(string.Format("coef = {0} {1} {2}", ls.Coef[0], ls.Coef[1], ls.Coef[2]));

        //these are constructed only one time
        threshold = new Threshold();
        cp2016 = new Chronopic2016();

        restTime = new RestTime();
        updatingRestTimes = true;
        //GLib.Timeout.Add(5000, new GLib.TimeoutHandler(updateRestTimes)); //each 5s
        GLib.Timeout.Add(1000, new GLib.TimeoutHandler(updateRestTimes)); //each s, better for don't have problems sorting data on treeview

        /*
         * start a ping in other thread
         * http://www.mono-project.com/docs/gui/gtksharp/responsive-applications/
         * Gtk.Application.Invoke
         */
        pingThread = new Thread (new ThreadStart (pingAtStart));
        pingThread.Start();

        //moveStartTestInitial();
    }
Пример #13
0
    public void View(Constants.BellModes bellMode, bool volumeOn)
    {
        //this.volumeOn = volumeOn;

        //when user "deleted_event" the window
        if (RepetitiveConditionsWindowBox == null) {
            RepetitiveConditionsWindowBox = new RepetitiveConditionsWindow ();
        }
        RepetitiveConditionsWindowBox.showWidgets(bellMode);
        RepetitiveConditionsWindowBox.repetitive_conditions.Show ();
        RepetitiveConditionsWindowBox.volumeOn = volumeOn;
    }
Пример #14
0
    public static RepetitiveConditionsWindow Create()
    {
        if (RepetitiveConditionsWindowBox == null) {
            RepetitiveConditionsWindowBox = new RepetitiveConditionsWindow ();
        }

        //don't show until View is called
        //RepetitiveConditionsWindowBox.repetitive_conditions.Hide ();

        return RepetitiveConditionsWindowBox;
    }
 void on_delete_event(object o, DeleteEventArgs args)
 {
     RepetitiveConditionsWindowBox.repetitive_conditions.Hide();
     RepetitiveConditionsWindowBox = null;
 }
Пример #16
0
    //run execution
    public RunIntervalExecute(int personID, int sessionID, string type, double distanceInterval, double limitAsDouble, bool tracksLimited,
                              Chronopic cp, Gtk.Label event_execute_label_message, Gtk.Window app, int pDN, bool metersSecondsPreferred,
                              bool volumeOn, RepetitiveConditionsWindow repetitiveConditionsWin,
                              double progressbarLimit, ExecutingGraphData egd,
                              Constants.DoubleContact checkDoubleContactMode, int checkDoubleContactTime,
                              bool speedStartArrival
                              )
    {
        this.personID         = personID;
        this.sessionID        = sessionID;
        this.type             = type;
        this.distanceInterval = distanceInterval;
        this.limitAsDouble    = limitAsDouble;
        this.tracksLimited    = tracksLimited;

        //if distances are variable
        distancesString = "";
        if (distanceInterval == -1)
        {
            RunType runType = SqliteRunIntervalType.SelectAndReturnRunIntervalType(type, false);
            distancesString = runType.DistancesString;
        }


        if (tracksLimited)
        {
            this.limited = limitAsDouble.ToString() + "R";             //'R'uns (don't put 'T'racks for not confusing with 'T'ime)
        }
        else
        {
            this.limited = limitAsDouble.ToString() + "T";
            timeTotal    = limitAsDouble;
        }


        this.cp = cp;
        this.event_execute_label_message = event_execute_label_message;
        this.app = app;

        this.metersSecondsPreferred = metersSecondsPreferred;
        this.pDN      = pDN;
        this.volumeOn = volumeOn;
        this.repetitiveConditionsWin = repetitiveConditionsWin;
        this.progressbarLimit        = progressbarLimit;
        this.egd = egd;
        this.checkDoubleContactMode = checkDoubleContactMode;
        this.checkDoubleContactTime = checkDoubleContactTime;
        this.speedStartArrival      = speedStartArrival;

        fakeButtonUpdateGraph = new Gtk.Button();
        fakeButtonEventEnded  = new Gtk.Button();
        fakeButtonFinished    = new Gtk.Button();
        fakeButtonThreadDyed  = new Gtk.Button();

        simulated = false;

        needUpdateEventProgressBar = false;
        needUpdateGraph            = false;

        timesForSavingRepetitive = 1;         //number of times that this repetive event needs for being recorded in temporal table

        //initialize eventDone as a RunInterval
        eventDone = new RunInterval();
    }