static void Main(string[] args) { dataStorage = new DataStorage(); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(dataStorage.GetHost().FirstName + " " + dataStorage.GetHost().LastName); Console.ResetColor(); Console.WriteLine(dataStorage.GetHost().Description); Console.WriteLine(); schedule = dataStorage.GenerateSchedule(DateTime.Now.AddDays(-5), DateTime.Now.AddDays(5)); activeDate = DateTime.Now.Date; ShowSchedule(); int todayIndex = schedule.FindIndex(p => p.Day.Date == DateTime.Now.Date); ShowAppointmentsFor(todayIndex); Console.WriteLine("Enter command 'app [index]' to see appointments."); Console.WriteLine("Enter command 'more' to load next 5 days."); Console.WriteLine("Enter command 'exit' to quit."); string command = string.Empty; while (command != "exit") { // 'app 3' or 'app 4' if (command.StartsWith("app ")) { try { string[] words = command.Split(' '); int relativeIndex = int.Parse(words[1]); int index = -1; index = relativeIndex + todayIndex; if (index >= 0) { activeDate = schedule[index].Day.Date; ShowSchedule(); ShowAppointmentsFor(index); } } catch (Exception ex) { Console.WriteLine(ex.Message); } } else if (command == "more") { List<ScheduleItem> moreItems = dataStorage.GenerateSchedule(schedule[schedule.Count - 1].Day.AddDays(1), schedule[schedule.Count - 1].Day.AddDays(6)); schedule.AddRange(moreItems); ShowSchedule(); } command = Console.ReadLine(); } }
protected override void OnCreate(Bundle bundle) { dataStorage = new DataStorage (); Window.AddFlags (WindowManagerFlags.Fullscreen); Window.ClearFlags (WindowManagerFlags.ForceNotFullscreen); this.Window.SetFlags (WindowManagerFlags.KeepScreenOn, WindowManagerFlags.KeepScreenOn); base.OnCreate (bundle); SetContentView (Resource.Layout.Main); FillHostSummary (dataStorage.GetHost()); appointmentsListView = FindViewById<ListView> (Resource.Id.appointmentsListView); EndlessScrollView scrollView = FindViewById<EndlessScrollView> (Resource.Id.scroll); datesLayout = FindViewById<LinearLayout> (Resource.Id.datesLayout); schedule = dataStorage.GenerateSchedule (DateTime.Now.AddDays(0), DateTime.Now.AddDays (LOAD_NUMBER)); scrollView.ScrollReachedRight += (sender, args) => { LoadMoreRight (LOAD_NUMBER); }; for (var i = 0; i < schedule.Count; i++) { ScheduleItem item = schedule [i]; View view = InflateScheduleItem (this, item); view.Click += (sender, e) => { DateClick (sender, item.Appointments, item.Day.DayOfWeek); }; datesLayout.AddView (view); } int todayIndex = FindTodayIndex(); // Can't scroll right away, it needs time to render element first ScrollTo (todayIndex, scrollView); Button saveButton = FindViewById<Button> (Resource.Id.saveButton); saveButton.Click += (object sender, EventArgs e) => { }; saveButton.Clickable = false; }