private void SelectTab(DailyType type) { FlatVerticalButton button; switch (type) { case DailyType.Today: button = buttonToday; break; case DailyType.Tomorrow: button = buttonTomorrow; break; default: button = null; break; } if (selectedTab != button) { if (selectedTab != null) { selectedTab.Selected = false; } if (button != null) { button.Selected = true; } selectedTab = button; } GetDailies(type); }
private void SetTypeAndInterval(DailyType type, int interval) { Type = type; Interval = type == DailyType.EveryXDays ? interval : 1; // currently only support intervals of 1 for weekdays }
public DailyRecurrency(DateTime startDate, int numOccurrences = _Default_Occurrences, DailyType type = DailyType.EveryXDays, int interval = 1) : base(startDate, numOccurrences) { SetTypeAndInterval(type, interval); }
public DailyRecurrency(DateTime startDate, DateTime endDate, DailyType type = DailyType.EveryXDays, int interval = 1) : base(startDate, endDate) { SetTypeAndInterval(type, interval); }
private async void GetDailies(DailyType type) { currentTab = type; if ((isLoading & type) == type) { return; } isLoading |= type; if (isRetrying != DailyType.None && isRetrying != type) { isRetrying = DailyType.None; retryCount = 0; Util.ScheduledEvents.Unregister(OnScheduledRetry); } DailyAchievements.Dailies dailies; DailyAchievements.Dailies current = this.dailies[(int)type]; var sliderValue = scrollV.Value; Action onBegin = delegate { waitingBounce.Visible = true; panelContent.Visible = false; labelMessage.Visible = false; scrollV.Maximum = 0; }; switch (type) { case DailyType.Today: dailies = await da.GetToday(onBegin); if (dailies != current && current != null) { current.Dispose(); } break; case DailyType.Tomorrow: dailies = await da.GetTomorrow(onBegin); break; default: return; } var changed = this.dailies[(int)type] != dailies; this.dailies[(int)type] = dailies; isLoading &= ~type; if (type == currentTab) { waitingBounce.Visible = false; if (dailies == null) { isRetrying = type; retryCount++; if (retryCount < 5) { Util.ScheduledEvents.Register(OnScheduledRetry, 60000); } else { isRetrying = DailyType.None; retryCount = 0; } } else if (retryCount != 0) { retryCount = 0; } if (dailies != null && dailies.Count > 0) { if (this.dailies[0] != dailies) { this.dailies[0] = dailies; if (popup.Visible) { popup.Hide(); } SetupControls(dailies); } if (changed && showOnLoad && !this.Visible) { sliderValue = 0; Show(false); } panelContent.Visible = true; scrollV.Value = sliderValue; } else { labelMessage.Text = "Unable to retrieve dailies"; labelMessage.MaximumSize = new Size(panelContainer.Width * 3 / 4, panelContainer.Height); labelMessage.Location = new Point(panelContainer.Width / 2 - labelMessage.Width / 2, panelContainer.Height / 2 - labelMessage.Height / 2); labelMessage.Visible = true; panelContent.Visible = false; if (!this.Visible) { loadOnShow = true; } } } }