Beispiel #1
0
        /// <summary>Adds a new contact to the database</summary>
        /// <param name="sides">Sides on which contacts are being added</param>
        private async void NewContact(params Side[] sides)
        {
            DateTime replacementDate = DateTimeHelper.Parse(DateNewContact.SelectedDate);
            switch (CmbLength.SelectedItem.ToString())
            {
                case "1 week":
                    replacementDate = replacementDate.AddDays(7);
                    break;

                case "2 weeks":
                    replacementDate = replacementDate.AddDays(14);
                    break;

                case "30 days":
                    replacementDate = replacementDate.AddDays(30);
                    break;
            }
            foreach (Side side in sides)
                await AppState.AddContact(new Contact(DateTimeHelper.Parse(DateNewContact.SelectedDate), side, replacementDate));
            RefreshItemsSource();
        }