public OverlayProgressBar(string htmlText, ProgressBarTypeEnum progressBarType, string currentAmount, string goalAmount, int resetAfterDays, string progressColor,
                           string backgroundColor, string textColor, string textFont, int width, int height, CustomCommand goalReachedCommand)
     : this(htmlText, progressBarType, resetAfterDays, progressColor, backgroundColor, textColor, textFont, width, height, goalReachedCommand)
 {
     this.CurrentAmountCustom = currentAmount;
     this.GoalAmountCustom    = goalAmount;
 }
        private void GoalTypeComboBox_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
        {
            this.StartingAmountTextBox.IsEnabled = true;
            this.GoalAmountTextBox.IsEnabled     = true;
            this.ResetAfterDaysTextBox.IsEnabled = true;

            this.TotalFollowsGrid.Visibility    = Visibility.Collapsed;
            this.TotalFollowsCheckBox.IsChecked = false;

            if (this.GoalTypeComboBox.SelectedIndex >= 0)
            {
                ProgressBarTypeEnum type = EnumHelper.GetEnumValueFromString <ProgressBarTypeEnum>((string)this.GoalTypeComboBox.SelectedItem);
                if (type == ProgressBarTypeEnum.Milestones)
                {
                    this.StartingAmountTextBox.IsEnabled = false;
                    this.GoalAmountTextBox.IsEnabled     = false;
                    this.ResetAfterDaysTextBox.IsEnabled = false;
                }
                else if (type == ProgressBarTypeEnum.Followers)
                {
                    this.TotalFollowsCheckBox.IsChecked = true;
                    this.TotalFollowsGrid.Visibility    = Visibility.Visible;
                }
            }
        }
 private OverlayProgressBar(string htmlText, ProgressBarTypeEnum progressBarType, int resetAfterDays, string progressColor, string backgroundColor, string textColor,
                            string textFont, int width, int height, CustomCommand goalReachedCommand)
     : base(CustomItemType, htmlText)
 {
     this.ProgressBarType    = progressBarType;
     this.ResetAfterDays     = resetAfterDays;
     this.ProgressColor      = progressColor;
     this.BackgroundColor    = backgroundColor;
     this.TextColor          = textColor;
     this.TextFont           = textFont;
     this.Width              = width;
     this.Height             = height;
     this.GoalReachedCommand = goalReachedCommand;
     this.LastReset          = DateTimeOffset.Now;
 }
        public override OverlayItemBase GetItem()
        {
            if (this.GoalTypeComboBox.SelectedIndex >= 0 && !string.IsNullOrEmpty(this.StartingAmountTextBox.Text) && !string.IsNullOrEmpty(this.GoalAmountTextBox.Text))
            {
                ProgressBarTypeEnum type = EnumHelper.GetEnumValueFromString <ProgressBarTypeEnum>((string)this.GoalTypeComboBox.SelectedItem);

                string startingAmount = "0";
                string goalAmount     = "0";
                int    resetAfterDays = 0;
                if (type != ProgressBarTypeEnum.Milestones)
                {
                    if (!(type == ProgressBarTypeEnum.Followers && this.TotalFollowsCheckBox.IsChecked.GetValueOrDefault()))
                    {
                        startingAmount = this.StartingAmountTextBox.Text;
                    }

                    goalAmount = this.GoalAmountTextBox.Text;

                    if (!string.IsNullOrEmpty(this.ResetAfterDaysTextBox.Text))
                    {
                        if (!int.TryParse(this.ResetAfterDaysTextBox.Text, out resetAfterDays))
                        {
                            return(null);
                        }
                    }
                }

                string progressColor = this.ProgressColorComboBox.Text;
                if (ColorSchemes.ColorSchemeDictionary.ContainsKey(progressColor))
                {
                    progressColor = ColorSchemes.ColorSchemeDictionary[progressColor];
                }

                string backgroundColor = this.BackgroundColorComboBox.Text;
                if (ColorSchemes.ColorSchemeDictionary.ContainsKey(backgroundColor))
                {
                    backgroundColor = ColorSchemes.ColorSchemeDictionary[backgroundColor];
                }

                string textColor = this.TextColorComboBox.Text;
                if (ColorSchemes.ColorSchemeDictionary.ContainsKey(textColor))
                {
                    textColor = ColorSchemes.ColorSchemeDictionary[textColor];
                }

                if (string.IsNullOrEmpty(this.TextFontComboBox.Text))
                {
                    return(null);
                }

                if (string.IsNullOrEmpty(this.WidthTextBox.Text) || !int.TryParse(this.WidthTextBox.Text, out int width) ||
                    string.IsNullOrEmpty(this.HeightTextBox.Text) || !int.TryParse(this.HeightTextBox.Text, out int height))
                {
                    return(null);
                }

                if (string.IsNullOrEmpty(this.HTMLText.Text))
                {
                    return(null);
                }

                if (double.TryParse(startingAmount, out double startingAmountNumber) && double.TryParse(goalAmount, out double goalAmountNumber))
                {
                    return(new OverlayProgressBar(this.HTMLText.Text, type, startingAmountNumber, goalAmountNumber, resetAfterDays, progressColor, backgroundColor, textColor, this.TextFontComboBox.Text, width, height, this.command));
                }
                else
                {
                    return(new OverlayProgressBar(this.HTMLText.Text, type, startingAmount, goalAmount, resetAfterDays, progressColor, backgroundColor, textColor, this.TextFontComboBox.Text, width, height, this.command));
                }
            }
            return(null);
        }