예제 #1
0
    private void on_combo_sports_changed(object o, EventArgs args)
    {
        if (o == null)
        {
            return;
        }

        //LogB.Information("changed");
        try {
            int sportID = Convert.ToInt32(Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_sports), sports));
            sport = SqliteSport.Select(false, sportID);

            if (Catalog.GetString(sport.Name) == Catalog.GetString(Constants.SportAny))
            {
                //if sport is undefined, level should be undefined, and unsensitive
                try {
                    combo_levels.Active = UtilGtk.ComboMakeActive(levels,
                                                                  Constants.LevelUndefinedID.ToString() + ":" +
                                                                  Catalog.GetString(Constants.LevelUndefined));
                    combo_levels.Sensitive     = false;
                    combo_speciallities.Active = UtilGtk.ComboMakeActive(speciallitiesTranslated,
                                                                         Catalog.GetString(Constants.SpeciallityUndefined));
                    label_speciallity.Hide();
                    combo_speciallities.Hide();
                }
                catch { LogB.Warning("do later"); }
            }
            else if (Catalog.GetString(sport.Name) == Catalog.GetString(Constants.SportNone))
            {
                //if sport is none, level should be sedentary and unsensitive
                try {
                    combo_levels.Active = UtilGtk.ComboMakeActive(levels,
                                                                  Constants.LevelSedentaryID.ToString() + ":" +
                                                                  Catalog.GetString(Constants.LevelSedentary));
                    combo_levels.Sensitive = false;

                    combo_speciallities.Active = UtilGtk.ComboMakeActive(speciallitiesTranslated,
                                                                         Catalog.GetString(Constants.SpeciallityUndefined));

                    label_speciallity.Hide();
                    combo_speciallities.Hide();
                }
                catch { LogB.Warning("do later"); }
            }
            else
            {
                //sport is not undefined and not none

                //if level is "sedentary", then change level to "undefined"
                if (UtilGtk.ComboGetActive(combo_levels) ==
                    Constants.LevelSedentaryID.ToString() + ":" +
                    Catalog.GetString(Constants.LevelSedentary))
                {
                    combo_levels.Active = UtilGtk.ComboMakeActive(levels,
                                                                  Constants.LevelUndefinedID.ToString() + ":" +
                                                                  Catalog.GetString(Constants.LevelUndefined));
                }

                //show level
                combo_levels.Sensitive = true;

                if (sport.HasSpeciallities)
                {
                    combo_speciallities.Destroy();
                    createComboSpeciallities(sport.UniqueID);
                    label_speciallity.Show();
                    combo_speciallities.Show();
                }
                else
                {
                    LogB.Information("hide");
                    combo_speciallities.Active = UtilGtk.ComboMakeActive(speciallitiesTranslated,
                                                                         Catalog.GetString(Constants.SpeciallityUndefined));
                    label_speciallity.Hide();
                    combo_speciallities.Hide();
                }
            }
        } catch {
            //LogB.Warning("do later");
        }

        on_entries_required_changed(new object(), new EventArgs());
        LogB.Information(sport.ToString());
    }
예제 #2
0
    protected void fillDialog(Event myEvent)
    {
        fillWindowTitleAndLabelHeader();

        string id = myEvent.UniqueID.ToString();

        if (myEvent.Simulated == Constants.Simulated)
        {
            label_simulated.Show();
        }

        label_event_id_value.Text      = id;
        label_event_id_value.UseMarkup = true;

        if (showTv)
        {
            fillTv(myEvent);
        }
        else
        {
            label_tv_title.Hide();
            entry_tv_value.Hide();
            label_tv_units.Hide();
        }

        if (showTc)
        {
            fillTc(myEvent);
        }
        else
        {
            label_tc_title.Hide();
            entry_tc_value.Hide();
            label_tc_units.Hide();
        }

        if (showFall)
        {
            fillFall(myEvent);
        }
        else
        {
            label_fall_title.Hide();
            entry_fall_value.Hide();
            label_fall_units.Hide();
        }

        if (showDistance)
        {
            fillDistance(myEvent);
        }
        else
        {
            label_distance_title.Hide();
            entry_distance_value.Hide();
            label_distance_units.Hide();
        }

        if (showTime)
        {
            fillTime(myEvent);
        }
        else
        {
            label_time_title.Hide();
            entry_time_value.Hide();
            label_time_units.Hide();
        }

        if (showSpeed)
        {
            fillSpeed(myEvent);
        }
        else
        {
            label_speed_title.Hide();
            label_speed_value.Hide();
            label_speed_units.Hide();
        }

        if (showWeight)
        {
            fillWeight(myEvent);
        }
        else
        {
            label_weight_title.Hide();
            entry_weight_value.Hide();
            label_weight_units.Hide();
        }

        if (showLimited)
        {
            fillLimited(myEvent);
        }
        else
        {
            label_limited_title.Hide();
            label_limited_value.Hide();
        }

        if (showAngle)
        {
            fillAngle(myEvent);
        }
        else
        {
            label_angle_title.Hide();
            entry_angle_value.Hide();
            label_angle_units.Hide();
        }

        if (!showMistakes)
        {
            label_mistakes.Hide();
            spin_mistakes.Hide();
        }


        //also remove new line for old descriptions that used a textview
        string temp = Util.RemoveTildeAndColonAndDot(myEvent.Description);

        entry_description.Text = Util.RemoveNewLine(temp, true);

        createComboEventType(myEvent);

        if (!showType)
        {
            label_type_title.Hide();
            combo_eventType.Hide();
        }

        if (showRunStart)
        {
            fillRunStart(myEvent);
        }
        else
        {
            label_run_start_title.Hide();
            label_run_start_value.Hide();
        }

        ArrayList persons = SqlitePersonSession.SelectCurrentSessionPersons(
            myEvent.SessionID,
            false);                     //means: do not returnPersonAndPSlist

        string [] personsStrings = new String[persons.Count];
        int       i = 0;

        foreach (Person person in persons)
        {
            personsStrings[i++] = person.IDAndName(":");
        }

        combo_persons = ComboBox.NewText();
        UtilGtk.ComboUpdate(combo_persons, personsStrings, "");
        combo_persons.Active = UtilGtk.ComboMakeActive(personsStrings, myEvent.PersonID + ":" + myEvent.PersonName);

        oldPersonID = myEvent.PersonID;

        hbox_combo_person.PackStart(combo_persons, true, true, 0);
        hbox_combo_person.ShowAll();

        //show video if available
        videoFileName = Util.GetVideoFileName(myEvent.SessionID, typeOfTest, myEvent.UniqueID);
        if (File.Exists(videoFileName))
        {
            label_video_yes.Visible      = true;
            label_video_no.Visible       = false;
            button_video_watch.Sensitive = true;
            button_video_url.Sensitive   = true;
        }
        else
        {
            label_video_yes.Visible      = false;
            label_video_no.Visible       = true;
            button_video_watch.Sensitive = false;
            button_video_url.Sensitive   = false;
        }
    }
예제 #3
0
    private void setDefaultValues()
    {
        label_connect_contacts.Text      = "<b>" + label_connect_contacts.Text + "</b>";
        label_connect_encoder.Text       = "<b>" + label_connect_encoder.Text + "</b>";
        label_connect_contacts.UseMarkup = true;
        label_connect_encoder.UseMarkup  = true;


        check_multichronopic_show.Active = false;
        table_multi_chronopic.Visible    = false;

        check_multitest_show.Active    = false;
        check_multitest_show.Sensitive = false;

        if (isWindows)
        {
            combo_linux1.Hide();
            combo_linux2.Hide();
            combo_linux3.Hide();
            combo_linux4.Hide();
            combo_linux_encoder.Hide();

            combo_windows2.Sensitive = false;
            combo_windows3.Sensitive = false;
            combo_windows4.Sensitive = false;
        }
        else
        {
            combo_windows1.Hide();
            combo_windows2.Hide();
            combo_windows3.Hide();
            combo_windows4.Hide();
            combo_windows_encoder.Hide();

            combo_linux2.Sensitive = false;
            combo_linux3.Sensitive = false;
            combo_linux4.Sensitive = false;
        }

        button_connect_cp1.Sensitive = false;
        button_connect_cp2.Sensitive = false;
        button_connect_cp3.Sensitive = false;
        button_connect_cp4.Sensitive = false;

        connected = false;
        foreach (ChronopicPortData a in cpd)
        {
            if (a.Connected)
            {
                connected = true;
            }
        }

        image_cp1_yes.Hide();
        image_cp2_yes.Hide();
        image_cp3_yes.Hide();
        image_cp4_yes.Hide();

        //encoderPort = "";
        //fakeButtonCancelled = new Gtk.Button();
    }