Beispiel #1
0
        /// <summary>
        /// Callback for when the Add Bedding button is clicked.
        /// </summary>
        /// <param name="sender">Object that triggered the event.</param>
        /// <param name="e">Arguments for the click event.</param>
        private async void AddBeddingButton_Clicked(object sender,
                                                    EventArgs e)
        {
            // Check if the maximum number of entries for the day is
            // already reached
            if (this.entries.Count >= MAX_ENTRIES_PER_DAY)
            {
                ToastController.ShortToast("Cannot add any more records for the day!");
                return;
            }

            // Create a new record book entry and insert it into the
            // database to obtain a unique Id
            BeddingRecordEntry entry = new BeddingRecordEntry()
            {
                HorseId = HorseManager.GetInstance().ActiveHorse.Id,
                Date    = date
            };
            await AppDatabase.GetInstance().Save <BeddingRecordEntry>(entry);

            // Add a new record view to the stack
            this.entries.Add(entry);
            BeddingRecordView view = new BeddingRecordView(entry);

            this.BeddingRecordStack.Children.Add(view);
        }
Beispiel #2
0
        /// <summary>
        /// Default constructor for the page.
        /// </summary>
        public BeddingRecordEditPage(BeddingRecordEntry entry)
        {
            // Initialize the page
            NavigationPage.SetHasNavigationBar(this, false);
            this.BindingContext = this.Entry = entry;
            InitializeComponent();

            // Set the modified property of the page to "false"
            this._modified = false;
        }