private void RemoveItemToBuild(object sender, RoutedEventArgs e) { // To access to the selected item we have to get the UcStatsItems that triggered this event Button btn = (Button)sender; Grid grid = (Grid)btn.Parent; UcStatsItems ucStatsParent = (UcStatsItems)grid.Parent; ActualBuild.RemoveItem(ucStatsParent.ActualItem); UcActualBuildStats.UpdateView(); }
/// <summary> /// Try to equip the selected item to the build /// </summary> private void EquipItemToBuild(object sender, RoutedEventArgs e) { // To access to the selected item we have to get the UcStatsItems that triggered this event Button btn = (Button)sender; Grid grid = (Grid)btn.Parent; UcStatsItems ucStatsParent = (UcStatsItems)grid.Parent; if (ucStatsParent.ActualItem.ConditionsRespected) { ucStatsParent.LblInfo.Content = String.Empty; // If it's not a ring, then we can try to equip it directly if (ucStatsParent.ActualItem.IdType != Build.ID_RING) { if (!ActualBuild.EquipItem(ucStatsParent.ActualItem)) { // TODO: show error message when the item can't be equiped } } else { // else we have to determine if the user want to equip the ring to the left or right hand FrmChooseSideRing frmChooseSideRing = new FrmChooseSideRing(this); frmChooseSideRing.ShowDialog(); if (InsertRingToLeft != null) { if (InsertRingToLeft == true) { ActualBuild.EquipRingLeft(ucStatsParent.ActualItem); } else { ActualBuild.EquipRingRight(ucStatsParent.ActualItem); } } } UcActualBuildStats.UpdateView(); } else { ucStatsParent.LblInfo.Content = "Pas assez d'éléments sélectionnées."; } }
private void MenuReset_Click(object sender, RoutedEventArgs e) { ActualBuild.ResetBuild(); UcActualBuildStats.UpdateView(); }
private void BtnRemoveAllItems_Click(object sender, RoutedEventArgs e) { // TODO: Add messagebox of confirmation ActualBuild.RemoveAllItem(); UcActualBuildStats.UpdateView(); }