示例#1
0
        private void languageButtonMenuItem_Click(object sender, EventArgs e)
        {
            var pair = (KeyValuePair <string, string>)((sender as ToolStripMenuItem).Tag);

            if (TEXT.ApplyLanguageFile(pair.Key, pair.Value))
            {
                this.ReReadTranslations();
                UpdateDayInformationIfFocused(monthControl.FocusDate);
                monthControl.ReReadTranslations();
                RedrawCalendar();
            }
        }
示例#2
0
        public string GenerateWomanInformation()
        {
            StringBuilder sb = new StringBuilder();

            int usedDays = Program.CurrentWoman.AveragePeriodLength == 0 ? 28 : Program.CurrentWoman.AveragePeriodLength;

            sb.Append(TEXT.Get["My_auto_cycle"]);
            sb.Append(usedDays);
            sb.Append(' ');
            sb.Append(TEXT.GetDaysString(usedDays));

            return(sb.ToString());
        }
示例#3
0
        public void ReReadTranslations()
        {
            this.ttExcreta.ToolTipTitle = TEXT.Get["Excreta_amount"];
            this.ttExcreta.SetToolTip(this.sliderEgestaAmount, EgestasCollection.EgestasNames[EgestaSliderValue]);
            this.ttLength.ToolTipTitle = TEXT.Get["Menses_length"];
            var lengthMessage = TEXT.Get["Please_set_menses_length"];

            this.ttLength.SetToolTip(this.pnlSurround, lengthMessage);
            this.ttLength.SetToolTip(this.lblLength, lengthMessage);
            this.ttLength.SetToolTip(this.lblDays, lengthMessage);
            this.ttLength.SetToolTip(this.numLength, lengthMessage);
            this.grpMenstr.Text      = TEXT.Get["Menses"];
            this.lblLength.Text      = TEXT.Get["Length_cycle"];
            this.lblDays.Text        = TEXT.GetDaysString(Length);
            this.verticalLabel1.Text = TEXT.Get["Intensity"];
        }
示例#4
0
        private void numMenstruationPeriod_ValueChanged(object sender, EventArgs e)
        {
            int newValue = (int)numMenstruationPeriod.Value;

            if (Program.CurrentWoman.ManualPeriodLength <= MenstruationPeriod.NormalMaximalPeriod &&
                newValue > MenstruationPeriod.NormalMaximalPeriod)
            {
                if (!MsgBox.YesNo(
                        TEXT.Get.Format("Cycle_more_than", MenstruationPeriod.NormalMaximalPeriod),
                        TEXT.Get["What_a_cycle"]))
                {
                    numMenstruationPeriod.Value = Program.CurrentWoman.ManualPeriodLength;
                    lblMyCycle2.Text            = TEXT.GetDaysString(Program.CurrentWoman.ManualPeriodLength);
                    return;
                }
            }

            Program.CurrentWoman.ManualPeriodLength = newValue;
            lblMyCycle2.Text = TEXT.GetDaysString(newValue);
            RedrawCalendar();
        }
示例#5
0
 private void languageButton_Click(object sender, EventArgs e)
 {
     this.languageButton.DropDownItems.Clear();
     foreach (var langFilePair in TEXT.FindAllLangFiles())
     {
         CultureInfo cult;
         try
         {
             cult = CultureInfo.GetCultureInfo(langFilePair.Key);
         }
         catch
         {
             continue;
         }
         var menuItem = new ToolStripMenuItem();
         menuItem.Name    = cult.EnglishName;
         menuItem.Text    = cult.NativeName;
         menuItem.Tag     = langFilePair;
         menuItem.Click  += languageButtonMenuItem_Click;
         menuItem.Enabled = CultureInfo.CurrentUICulture.TwoLetterISOLanguageName != langFilePair.Key;
         this.languageButton.DropDownItems.Add(menuItem);
     }
 }
示例#6
0
 private static void ApplyDictionaries(
     Dictionary <string, string> defaultDic,
     Dictionary <string, string> translations,
     string translationsLang)
 {
     Get = new TEXT(defaultDic, translations);
     Program.Settings.ApplicationLanguage = translationsLang;
     try
     {
         foreach (var ci in CultureInfo.GetCultures(CultureTypes.SpecificCultures))
         {
             if (ci.TwoLetterISOLanguageName == translationsLang)
             {
                 System.Threading.Thread.CurrentThread.CurrentCulture   = ci;
                 System.Threading.Thread.CurrentThread.CurrentUICulture = ci;
                 break;
             }
         }
     }
     catch
     {
     }
 }
示例#7
0
 public override string ToString()
 {
     return(string.Format("{0}: {1} - {2} ({3} {4})",
                          Number, Start.ToString("d"), Stop.ToString("d"), Length, TEXT.GetDaysString(Length)));
 }
        /// <summary>
        /// Adds one more cycle to the collection. Interacts with user if something.
        /// </summary>
        /// <param name="date">The red days start.</param>
        /// <param name="length">The egesting number of days.</param>
        /// <returns>True if sucsessfully added.</returns>
        public bool Add(DateTime date, int length)
        {
            MenstruationPeriod newPeriod     = new MenstruationPeriod(date, length);
            MenstruationPeriod closestPeriod = this.GetClosestPeriodAfterDay(date);

            if (closestPeriod != null)
            {
                if (!MsgBox.YesNo(
                        TEXT.Get["Menstr_after_day"] + TEXT.Get["Are_you_sure_capital"],
                        TEXT.Get["Are_you_crazy"]))
                {
                    return(false);
                }

                int distance = (closestPeriod.StartDay - date).Days;
                if (distance < length)
                {
                    newPeriod.SetLength(distance);
                }

                this.Insert(IndexOf(closestPeriod), newPeriod); // we must always keep the collection sorted.
            }
            else
            {
                string askMessage = string.Empty;
                closestPeriod = this.GetClosestPeriodBeforeDay(date);
                if (closestPeriod != null)
                {
                    int distance = (date - closestPeriod.StartDay).Days;
                    if (distance < MenstruationPeriod.NormalMinimalPeriod)
                    {
                        askMessage += TEXT.Get.Format(
                            "Msg_short_menstr_period",
                            MenstruationPeriod.NormalMinimalPeriod,
                            TEXT.GetDaysString(MenstruationPeriod.NormalMinimalPeriod));
                    }
                    else if (distance > MenstruationPeriod.NormalMaximalPeriod)
                    {
                        askMessage += TEXT.Get.Format(
                            "Msg_large_menstr_period",
                            MenstruationPeriod.NormalMaximalPeriod,
                            TEXT.GetDaysString(MenstruationPeriod.NormalMaximalPeriod));
                    }
                }

                if (date > DateTime.Today)
                {
                    askMessage += "\n" + TEXT.Get["Future_day_question"];
                }

                if (!string.IsNullOrEmpty(askMessage) &&
                    !MsgBox.YesNo(
                        askMessage + TEXT.Get["Are_you_sure_capital"],
                        TEXT.Get["What_a_situation"]))
                {
                    return(false);
                }

                this.Add(newPeriod);
            }

            return(true);
        }
示例#9
0
 private void numLength_ValueChanged(object sender, EventArgs e)
 {
     lblDays.Text = TEXT.GetDaysString(Length);
 }
示例#10
0
        /// <summary>
        /// Create the string which is shown to user as the full day description. May have lots of text.
        /// </summary>
        /// <param name="date">The day to describe.</param>
        /// <returns>The day descruption.</returns>
        public string GenerateDayInfo(DateTime date)
        {
            StringBuilder sb = new StringBuilder();

            sb.Append(TEXT.Get["Date_double_colon"]);
            sb.Append(date.ToShortDateString());
            if (date == DateTime.Today)
            {
                sb.Append(TEXT.Get["Today_parentheses"]);
            }

            MenstruationPeriod period = this.Menstruations.GetPeriodByDate(date);

            if (period != null)
            {
                sb.AppendLine();
                sb.AppendLine(TEXT.Get.Format("This_is_N_menstr_day", (date - period.StartDay).Days + 1));
                sb.Append(EgestasCollection.EgestasNames[period.Egestas[date]]);
            }

            if (this.IsPregnancyDay(date))
            {
                sb.AppendLine();

                int week = this.Conceptions.GetPregnancyWeekNumber(date);
                if (week > 0)
                {
                    sb.AppendLine(TEXT.Get.Format("Preg_week_number_N", week));
                }

                if (this.IsConceptionDay(date))
                {
                    sb.AppendLine(TEXT.Get["Conception_day"]);
                }

                var      concPeriod     = this.Conceptions.GetConceptionByDate(date);
                DateTime conceptionDate = concPeriod.StartDay;
                DateTime dateOfBirth    = conceptionDate.AddDays(ConceptionPeriod.StandardLength);
                sb.AppendLine(TEXT.Get.Format("Probable_birth_date", dateOfBirth.ToLongDateString()));
                sb.Append(TEXT.Get.Format("Zodiac_will_be", HoroscopDatePair.GetZodiacSignName(dateOfBirth)));

                string gender = string.Empty;
                if (this.IsPredictedAsBoyDay(concPeriod.StartDay))
                {
                    gender = TEXT.Get["Boy"];
                }
                else if (this.IsPredictedAsGirlDay(concPeriod.StartDay))
                {
                    gender = TEXT.Get["Girl"];
                }

                if (!string.IsNullOrEmpty(gender))
                {
                    sb.AppendLine();
                    sb.Append(TEXT.Get.Format("Child_gender_will_be", gender));
                }
            }
            else
            {
                var closestBefore = this.Menstruations.GetClosestPeriodBeforeDay(date);
                if (closestBefore != null && period == null)
                {
                    sb.AppendLine();
                    sb.Append(TEXT.Get.Format("Cycle_day_number_N", ((date - closestBefore.StartDay).Days + 1).ToString()));
                }

                var closestAfter = this.Menstruations.GetClosestPeriodAfterDay(date);
                closestBefore = this.Menstruations.GetClosestPeriodBeforeDay(date.AddDays(1));
                if (closestBefore != null && closestAfter != null)
                {
                    int days = (closestAfter.StartDay - closestBefore.StartDay).Days;
                    sb.AppendLine();
                    sb.Append(TEXT.Get.Format("Cycle_length_days", days.ToString(), TEXT.GetDaysString(days)));
                }

                if (this.IsPredictedAsMenstruationDay(date))
                {
                    sb.AppendLine();
                    sb.Append(TEXT.Get["Possible_menst"]);
                }

                if (this.IsPredictedAsOvulationDay(date))
                {
                    sb.AppendLine();
                    sb.Append(TEXT.Get["Estimated_ovulation_day"]);
                }

                string gender = string.Empty;
                if (this.IsPredictedAsBoyDay(date))
                {
                    sb.AppendLine();
                    sb.Append(TEXT.Get["Boy_conception_day"]);
                }
                else if (this.IsPredictedAsGirlDay(date))
                {
                    sb.AppendLine();
                    sb.Append(TEXT.Get["Girl_conception_day"]);
                }

                if (this.HadSexList.ContainsKey(date))
                {
                    DateTime dateOfBirth = date.AddDays(ConceptionPeriod.StandardLength);
                    sb.AppendLine();
                    sb.Append(TEXT.Get.Format(
                                  "If_conceive_info",
                                  dateOfBirth.ToLongDateString(),
                                  HoroscopDatePair.GetZodiacSignName(dateOfBirth)));
                }
            }

            // got to be last
            string text;

            if (this.Notes.TryGetValue(date, out text))
            {
                sb.AppendLine();
                sb.Append(TEXT.Get["Note_semicolon"]);
                sb.Append(text);
            }

            return(sb.ToString());
        }
示例#11
0
        public static void InitializeEnvironmentStuff()
        {
            Settings = ApplicationSettings.Read(SettingsFileName);

            TEXT.InitializeLanguage(Settings.ApplicationLanguage);
        }