コード例 #1
0
        /// <summary>
        /// Delete the current order by removing it from orders library and then reloading the page
        /// </summary>
        private async void DeleteOrder(bool promptUser = true)
        {
            /// Prompt user to confirm whether this order should be removed.
            if (promptUser)
            {
                var result = await IoC.UI.ShowMessage(new YesNoBoxDialogViewModel
                {
                    Title    = "Confirm Deleting Order",
                    Question = "Are you sure you want to delete this order?"
                });

                if (result == DialogResult.No)
                {
                    return;
                }
            }
            // Need to create a confirmation message box with multiple possible answers
            if (OrdersList.Contains(this))
            {
                OrdersList.Remove(this);
            }
            // Remove the orders first
            IoC.Orders().RemoveAllOrdersWithID(OrderID);
        }