public void CreateEvent(object sender, EventArgs e)
        {
            if (EntryTitle.Text == "")
            {
                EntryTitle.Focus();
                return;
            }
            else if (EntryDesc.Text == "")
            {
                EntryDesc.Focus();
                return;
            }

            DateTime dateAndTime = new DateTime(CalendarDate.Date.Year, CalendarDate.Date.Month, CalendarDate.Date.Day,
                                                CalendarTime.Time.Hours, CalendarTime.Time.Minutes, 0);

            Random random          = new Random(DateTime.Now.Millisecond);
            CalendarInlineEvent ev = new CalendarInlineEvent()
            {
                StartTime = dateAndTime,
                EndTime   = dateAndTime.AddSeconds(1),
                Subject   = EntryTitle.Text,
                Color     = Globals.calendarColors[(int)Math.Round(random.NextDouble() * Globals.calendarColors.Length)]
            };

            PlanBase.GetInstance().Add(new Plan(EntryTitle.Text, EntryDesc.Text, dateAndTime, (string)PriorityPicker.SelectedItem, ev));
            CalendarEvents.GetInstance().Add(ev);
            tabbedPage.CurrentPage = tabbedPage.Children[0];
        }
Example #2
0
 public static PlanBase GetInstance()
 {
     if (instance == null)
     {
         instance = new PlanBase();
     }
     return(instance);
 }
        public int CompareTo(Plan other)
        {
            if (PlanBase.GetInstance().sortMode == 0)
            {
                return(time.CompareTo(other.time));
            }
            List <string> priorities = new List <String>(Globals.priorities);

            return(-priorities.IndexOf(priority).CompareTo(priorities.IndexOf(other.priority)));
        }
        public Tab3_EventList()
        {
            InitializeComponent();
            BindingContext = this;
            List<string> items = new List<string>();
            items.Add("Date");
            items.Add("Priority");
            SortMode.ItemsSource = items;
            SortMode.SelectedIndex = 0;
            //Attach item source

            EventList.ItemsSource = PlanBase.GetInstance().plans;
            
        }
        //DELETE PLAN using context menu
        async void MenuItem_Clicked(System.Object sender, System.EventArgs e)
        {
            //TODO:For CONTEXT MENU.. This will need to delete the Event from the list
            MenuItem mi = (MenuItem)sender;


            //Need help on what to do here, Not sure what PlanBase Object to use??
            //
            bool res = await DisplayAlert("ALERT","Are you sure you want to delete this event?","NO","YES");

            if (res) return; //IF THEY ANSWER NO, RETURN AND DO NOT REMOVE;
            

            PlanBase.GetInstance().Remove((Plan)mi.CommandParameter);
        }
 protected override void OnStart()
 {
     // Handle when your app starts
     PlanBase.GetInstance().OnStart();
 }
 public void OnPickerChanged(object sender, EventArgs e)
 {
     PlanBase.GetInstance().sortMode = SortMode.SelectedIndex;
     PlanBase.GetInstance().Sort();
 }