Ejemplo n.º 1
0
    //Init the InhaTimes list and fill it with the physiotherapy times from activetherapies
    void InitInhaTimes()
    {
        TherapiePlanManager manager = TherapiePlanManager.instance;

        inhaTimes = new List <float>();
        foreach (float time in manager.AktiveTherapieZeiten)
        {
            int dayOfWeek = (int)System.DateTime.Now.DayOfWeek - 1;
            dayOfWeek = dayOfWeek < 0 ? 6 : dayOfWeek;

            //If the time is from yesterday
            if (time > System.DateTime.Now.Hour)
            {
                dayOfWeek -= 1;
                dayOfWeek  = dayOfWeek < 0 ? 6 : dayOfWeek;
            }

            foreach (TherapiePlan.TherapieInfo therapieInfo in manager.TherapiePlan.GetTherapieInfoFor(dayOfWeek, time))
            {
                Therapie   t    = manager.TherapiePlan.Therapien[therapieInfo.index];
                Inhalation inha = t as Inhalation;
                if (inha != null)
                {
                    inhaTimes.Add(time);
                    int i = inha.Times.IndexOf(time);
                    m_fLengthInhalationMin = inha.Durations[i];
                }
            }
        }
    }
Ejemplo n.º 2
0
    public void AddTherapie()
    {
        switch (therapieTyp)
        {
        case TherapieTyp.MEDIKAMENT:
            Medikament medi = new Medikament(therapieName, description, weekdays, times, imageIndex, colorsImage[colorIndex], counts);
            manager.TherapiePlan.AddMedikament(medi);
            therapiePanel.AddElement(medi);
            break;

        case TherapieTyp.INHALATION:
            Inhalation inha = new Inhalation(therapieName, description, weekdays, times, durations);
            manager.TherapiePlan.AddInhalation(inha);
            therapiePanel.AddElement(inha);
            break;

        case TherapieTyp.PHYSIOTHERAPIE:
            Physiotherapie physio = new Physiotherapie(weekdays, times, sportTyp);
            manager.TherapiePlan.AddPhysiotherapie(physio);
            therapiePanel.AddElement(physio);
            break;

        default:
            break;
        }
        therapieNeuCanvas.SetActive(false);
        therapiePlanCanvas.SetActive(true);
        Reset();
        manager.needsToSave = true;
    }
Ejemplo n.º 3
0
    //Aufbau des internen Therapiekalenders
    public void BuildCalendar()
    {
        //Initialization
        calendar = new Dictionary <float, List <TherapieInfo> > [7];
        for (int i = 0; i < 7; i++)
        {
            calendar[i] = new Dictionary <float, List <TherapieInfo> >();
        }

        foreach (Therapie therapie in therapieListe)
        {
            if (therapie.Times.Count == 0)
            {
                continue;
            }

            int therapieIndex = therapieListe.IndexOf(therapie);
            for (int weekday = 0; weekday < 7; weekday++)
            {
                if (therapie.Weekdays[weekday])
                {
                    for (int time = 0; time < therapie.Times.Count; time++)
                    {
                        float        t = therapie.Times[time];
                        TherapieInfo ti;
                        ti.index = therapieIndex;

                        Medikament medi = therapie as Medikament;
                        ti.count = (medi != null && medi.Counts.Count > 0)? medi.Counts[time] : 0;

                        Inhalation inha = therapie as Inhalation;
                        ti.duration = (inha != null && inha.Durations.Count > 0) ? inha.Durations[time] : 0;

                        //Debug.Log("Adding Therapy" + therapie.Name + " medi|" + (medi != null) + " inha|" + (inha != null));

                        if (calendar[weekday].ContainsKey(t))
                        {
                            calendar[weekday][t].Add(ti);
                            //Debug.Log("Added TherapyNo" + therapieIndex + "to Day" + i + "at time " + t);
                        }
                        else
                        {
                            calendar[weekday].Add(t, new List <TherapieInfo>());
                            calendar[weekday][t].Add(ti);
                            //Debug.Log("Added TherapyNo" + therapieIndex + "to Day" + i + "at time " + t);
                        }
                    }
                }
            }
        }
    }
Ejemplo n.º 4
0
    public void EditTherapie(Therapie _therapie)
    {
        Reset();
        therapieName   = _therapie.Name;
        inputName.text = therapieName;

        times = _therapie.Times;
        _therapie.Weekdays.CopyTo(weekdays, 0);

        for (int i = 0; i < 7; i++)
        {
            tgWeekDays[i].isOn = weekdays[i];
        }

        if (_therapie is Medikament)
        {
            therapieTyp = TherapieTyp.MEDIKAMENT;
            Medikament medi = (_therapie as Medikament);
            counts     = medi.Counts;
            imageIndex = medi.ImageIndex;
            FindColorIndex(medi.Color);
            ShowActiveColor();
            manager.TherapiePlan.RemoveMedikament(medi);
        }
        else if (_therapie is Inhalation)
        {
            therapieTyp = TherapieTyp.INHALATION;
            Inhalation inha = (_therapie as Inhalation);
            durations = inha.Durations;
            manager.TherapiePlan.RemoveInhalation(inha);
        }
        else
        {
            therapieTyp = TherapieTyp.PHYSIOTHERAPIE;
            manager.TherapiePlan.RemovePhysiotherapie(_therapie as Physiotherapie);
        }
        ShowActiveImage();
        therapiePlanCanvas.SetActive(false);
        therapieNeuCanvas.SetActive(true);
        timesListPanel.UpdateList(times, counts, durations);
        therapiePanel.UpdateList(manager.TherapiePlan.Therapien);
        manager.needsToSave = true;
    }
Ejemplo n.º 5
0
 public void AddInhalation(Inhalation _inhalation)
 {
     inhalationListe.Add(_inhalation);
     AddTherapie(_inhalation);
 }
Ejemplo n.º 6
0
 public void RemoveInhalation(Inhalation _inhalation)
 {
     inhalationListe.Remove(_inhalation);
     RemoveTherapie(_inhalation);
 }