-
Notifications
You must be signed in to change notification settings - Fork 0
/
JobBoardsList.cs
77 lines (71 loc) · 2.5 KB
/
JobBoardsList.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
using Job_Application_Database.IO;
using Job_Application_Database.Singleton;
using System.Windows;
namespace Job_Application_Database.Classes
{
/// <summary>
/// Class For Displaying Job Boards Lists
/// </summary>
public class JobBoardsList : BaseList
{
/// <summary>
/// Base Constructor
/// </summary>
public JobBoardsList() : base("Job Board", JobBoards.Instance.AllObjects()) { }
/// <summary>
/// Add Job Board To Boards List
/// </summary>
protected override void Add()
{
JobBoardCreation bc = new JobBoardCreation();
bc.ShowDialog();
if (bc.Exit == Enum.ExitStatus.Ok)
{
JobBoards.Instance.AddObject(bc.Info);
Files.Instance.SaveBoardFile();
RefreshListView(JobBoards.Instance);
}
}
/// <summary>
/// Edit Board From Job Boards List
/// </summary>
protected override void Edit()
{
JobBoard b = BaseListWindow.listviewCurrent.SelectedItem as JobBoard;
if (b != null)
{
JobBoardCreation bc = new JobBoardCreation(b);
bc.ShowDialog();
Files.Instance.SaveBoardFile();
RefreshListView(JobBoards.Instance);
}
}
/// <summary>
/// Delete Board From Job Boards List
/// </summary>
protected override void Delete()
{
if (BaseListWindow.listviewCurrent.SelectedItem != null)
{
string msg;
if (BaseListWindow.listviewCurrent.SelectedItems.Count > 1)
{
msg = "these " + BaseListWindow.listviewCurrent.SelectedItems.Count + " Boards?";
}
else
{
msg = (BaseListWindow.listviewCurrent.SelectedItems[0] as IBaseInfo).Name + "?";
}
if (MessageBox.Show("Are you sure you want to delete " + msg, "Question", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.Yes)
{
foreach (BaseInfo info in BaseListWindow.listviewCurrent.SelectedItems)
{
JobBoards.Instance.RemoveObject(info);
}
Files.Instance.SaveBoardFile();
RefreshListView(JobBoards.Instance);
}
}
}
}
}