forked from Slazanger/SMT
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CharactersWindow.xaml.cs
98 lines (82 loc) · 3.05 KB
/
CharactersWindow.xaml.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace SMT
{
/// <summary>
/// Interaction logic for Characters.xaml
/// </summary>
public partial class CharactersWindow : Window
{
public CharactersWindow()
{
InitializeComponent();
}
private void characterLV_Selected(object sender, RoutedEventArgs e)
{
characterInfoGrid.DataContext = characterLV.SelectedItem;
characterInfoGrid.Visibility = Visibility.Visible;
}
private void Window_Closed(object sender, EventArgs e)
{
foreach (EVEData.LocalCharacter lc in EVEData.EveManager.Instance.LocalCharacters)
{
lc.warningSystemsNeedsUpdate = true;
}
}
private void AddCharacter_Click(object sender, RoutedEventArgs e)
{
MainWindow mw = Owner as MainWindow;
mw.AddCharacter();
}
private void dangerzone_ValueChanged(object sender, RoutedPropertyChangedEventArgs<object> e)
{
EVEData.LocalCharacter lc = characterInfoGrid.DataContext as EVEData.LocalCharacter;
if (lc != null)
{
lc.warningSystemsNeedsUpdate = true;
}
}
private void dangerZoneEnabled_Checked(object sender, RoutedEventArgs e)
{
EVEData.LocalCharacter lc = characterInfoGrid.DataContext as EVEData.LocalCharacter;
if (lc != null)
{
lc.warningSystemsNeedsUpdate = true;
}
}
private void deleteBtn_Click(object sender, RoutedEventArgs e)
{
EVEData.LocalCharacter lc = characterInfoGrid.DataContext as EVEData.LocalCharacter;
if(lc != null)
{
MessageBoxResult result = MessageBox.Show("Would you like to Delete \"" + lc.Name + " ?", "Delete Character?", MessageBoxButton.YesNo, MessageBoxImage.Warning);
if(result == MessageBoxResult.Yes)
{
MainWindow mw = Owner as MainWindow;
mw.ActiveCharacter = null;
mw.FleetMembersList.ItemsSource = null;
mw.CurrentActiveCharacterCombo.SelectedIndex = -1;
mw.RegionsViewUC.ActiveCharacter = null;
mw.RegionUC.ActiveCharacter = null;
mw.RegionUC.UpdateActiveCharacter();
mw.UniverseUC.ActiveCharacter = null;
mw.OnCharacterSelectionChanged();
mw.EVEManager.LocalCharacters.Remove(lc);
characterLV.Items.Refresh();
characterInfoGrid.Visibility = Visibility.Hidden;
}
}
}
}
}