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."; } }
/// <summary> /// Event that is triggered when we click on an image of the equipement /// </summary> private void Image_MouseDown(object sender, MouseButtonEventArgs e) { Image img = (Image)sender; EnchantedItem item = new EnchantedItem(); if (img.Tag != null) { item = ActualBuild.GetEquipedItemById((int)img.Tag); if (e.LeftButton == MouseButtonState.Pressed) { // Left click, we load the item stats to the user control of stats LoadItemsStatsToContent(item, true); } else if (e.RightButton == MouseButtonState.Pressed) { // Right click, we load the item stats to a new modal of stats CreateModalOfItemStats(item); } } }
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(); }