コード例 #1
0
ファイル: MainPage.xaml.cs プロジェクト: bauerslab/Oven
        private async void SendRecipe_Click(object sender, RoutedEventArgs e)
        {   //Send the current recipe to the oven
            SendRecipe.IsEnabled = false;
            if (Recipe.Steps.Count < MinSteps)
            {
                await ShowError($"Recipe has too few steps. Minimum is {MinSteps}.");

                SendRecipe.IsEnabled = true;
                return;
            }

            if (await Oven.SetRecipe(Recipe))
            {
                await ShowSuccess("Recipe sent successfully.");
            }
            else
            {
                await ShowError($"Recipe failed to send.{(Oven.ErrorMessage != null ? Environment.NewLine + Oven.ErrorMessage : "")}");
            }
            SendRecipe.IsEnabled = true;
        }