private async void ToolbarItem_Clicked_1(object sender, EventArgs e) { string newName = await DisplayPromptAsync("Save Settings", "Input the name for your new fractal", "OK", "Cancel", "Fractal Name"); if (newName != null && newName != "") { var recipe = new FractalRecipe { FractalName = newName, SavedComplex = ciSlider.Value, SavedLength = lSlider.Value, SavedReal = riSlider.Value }; await _connection.InsertAsync(recipe); SavedFractals.Add(recipe); Refresh(); } }
//Gives choices of preset private async void ImageButton_Clicked_1(object sender, EventArgs e) { string[] fractalOptions = fractalList.ToArray(); string option = await DisplayActionSheet("Fractal Type", "Cancel", null, fractalOptions); bool clicked = false; if (option != "Cancel" && option != "OK" && option != "") { int setItem = fractalOptions.IndexOf(option); clicked = true; if (setItem <= 12) { string action = await DisplayActionSheet("Fractal Actions", "Cancel", null, "Set Fractal", "Info", "Advanced"); if (action == "Set Fractal") { item = setItem; await DisplayAlert("Fractal Set", "The current set fractal is: " + fractalOptions[item], "OK"); } else if (action == "Info") { await DisplayAlert("Fractal Info", "X Value (Real value on complex plane): " + varList1[setItem] + "\nY Value (Complex value on complex plane): " + varList2[setItem] + "\nSize (Length of pixel intervals): " + varList3[setItem], "OK"); } else if (action == "Advanced") { carouselPage.CurrentPage = carouselPage.Children[1]; riSlider.Value = varList1[setItem]; ciSlider.Value = varList2[setItem]; lSlider.Value = varList3[setItem]; } } else { string action = await DisplayActionSheet("Fractal Actions", "Cancel", null, "Set Fractal", "Delete", "Info", "Rename", "Advanced"); if (action == "Set Fractal") { item = setItem; await DisplayAlert("Fractal Set", "The current set fractal is: " + fractalOptions[item], "OK"); } else if (action == "Delete") { bool deleteCheck = await DisplayAlert("Delete", "Are you sure you would like to delete?", "OK", "Cancel"); if (deleteCheck) { var recipeDelete = SavedFractals[setItem - 13]; await _connection.DeleteAsync(recipeDelete); SavedFractals.Remove(recipeDelete); if (item == setItem) { item = 0; } } Refresh(); } else if (action == "Info") { await DisplayAlert("Fractal Info", "X Value (Real value on complex plane): " + SavedFractals[setItem - 13].SavedReal + "\nY Value (Complex value on complex plane): " + SavedFractals[setItem - 13].SavedComplex + "\nSize (Length of pixel intervals): " + SavedFractals[setItem - 13].SavedLength, "OK"); } else if (action == "Rename") { string newFractal = await DisplayPromptAsync("Rename Fractal", "What would you like to rename " + SavedFractals[setItem - 13].FractalName + "?", "OK", "Cancel", SavedFractals[setItem - 13].FractalName); if (newFractal != null && newFractal != "" && newFractal != SavedFractals[setItem - 13].FractalName) { double realCache = SavedFractals[setItem - 13].SavedReal; double complexCache = SavedFractals[setItem - 13].SavedComplex; double lengthCache = SavedFractals[setItem - 13].SavedLength; var recipe = SavedFractals[setItem - 13]; await _connection.DeleteAsync(recipe); SavedFractals.Remove(recipe); recipe = new FractalRecipe { FractalName = newFractal, SavedComplex = complexCache, SavedLength = lengthCache, SavedReal = realCache }; await _connection.InsertAsync(recipe); SavedFractals.Add(recipe); Refresh(); } } else if (action == "Advanced") { carouselPage.CurrentPage = carouselPage.Children[1]; riSlider.Value = SavedFractals[setItem - 13].SavedReal; ciSlider.Value = SavedFractals[setItem - 13].SavedComplex; lSlider.Value = SavedFractals[setItem - 13].SavedLength; } } } if (clicked) { AdvancedModes.createAdvanced = false; } }