/// <summary> /// List the current selected prime item with it's currently filled in plat value. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ConfirmListing(object sender, RoutedEventArgs e) { Main.AddLog("Trying to place listing"); try { var primeItem = (string)ComboBox.Items[ComboBox.SelectedIndex]; var platinum = int.Parse(PlatinumTextBox.Text, Main.culture); var success = Task.Run(async() => await PlaceListing(primeItem, platinum)).Result; if (success) { var newEntry = new KeyValuePair <string, RewardCollection>("successful", ScreensList[PageIndex].Value); ScreensList.RemoveAt(PageIndex); ScreensList.Insert(PageIndex, newEntry); ConfirmListingButton.IsEnabled = true; } else { var newEntry = new KeyValuePair <string, RewardCollection>("Something uncaught went wrong", ScreensList[PageIndex].Value); ScreensList.RemoveAt(PageIndex); ScreensList.Insert(PageIndex, newEntry); } SetCurrentStatus(); } catch (Exception exception) { Main.AddLog(exception.ToString()); var newEntry = new KeyValuePair <string, RewardCollection>(exception.ToString(), ScreensList[PageIndex].Value); ScreensList.RemoveAt(PageIndex); ScreensList.Insert(PageIndex, newEntry); } }
/// <summary> /// Cancels the current selection, removing it from the list /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Cancel(object sender, RoutedEventArgs e) { if (ScreensList.Count == 1 || ScreensList.Count == 0) { // if it's the last item Close(null, null); return; } if (PageIndex == 0) // if looking at the first screen { SetScreen(1); ScreensList.RemoveAt(0); } else { ScreensList.RemoveAt(PageIndex); --PageIndex; SetScreen(PageIndex); } }