public static bool SlideLeft() { try { if (current != null) { current = current.Next; } if (current == null) { current = head; if (head == null) { CurrentMonth = noData; CurrentYear = noData; return(false); } } CurrentMonth = current.Month; CurrentYear = current.Year; return(MonthlyData.Count() >= 1 ? true : false); } catch (Exception ex) { var logged = new LoggedException.LoggedException("error in MonthlyControlHelper.cs", ex); logged.LoggAPI(); } return(false); }
public static async Task ReloadAPIData() { try { current = null; tail = null; head = null; MonthlyData = null; if (forceReload == false) { return; } if (MonthlyData == null) { MonthlyData = new Dictionary <int, List <string> >(); } MonthlyAPIService monthlyService = new MonthlyAPIService(); MonthlyData = await monthlyService.GetMonthlyCalenderAPI(URLConfig.MonthlyCalenderAPI); var selectedNode = new MonthNode(); foreach (int year in MonthlyData.Keys) { foreach (string month in MonthlyData[year]) { if (head == null) { head = new MonthNode { Month = month, Year = year.ToString(), Next = null, Previous = null }; selectedNode = head; current = head; } else { var newNode = new MonthNode { Month = month, Year = year.ToString(), }; newNode.Next = null; newNode.Previous = selectedNode; selectedNode.Next = newNode; tail = newNode; selectedNode = tail; } CurrentMonth = selectedNode.Month; CurrentYear = selectedNode.Year; } } current = head; } catch (Exception ex) { var logged = new LoggedException.LoggedException("Error in while trying to load monthly calender API data", ex); await logged.LoggAPI(); } }