-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindowController.cs
More file actions
executable file
·117 lines (106 loc) · 2.98 KB
/
MainWindowController.cs
File metadata and controls
executable file
·117 lines (106 loc) · 2.98 KB
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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
// This file has been autogenerated from a class added in the UI designer.
using System;
using Foundation;
using AppKit;
namespace MacDatabinding
{
public partial class MainWindowController : NSWindowController
{
#region Computed Properties
public MainViewController Controller {
get { return ContentViewController as MainViewController; }
}
#endregion
#region Constructors
public MainWindowController (IntPtr handle) : base (handle)
{
}
#endregion
#region Override Methods
public override void AwakeFromNib ()
{
base.AwakeFromNib ();
// Wire-up controls
Addbutton.Active = false;
Addbutton.Activated += (sender, e) => {
// Take action based on type
switch(Controller.ViewType) {
case SubviewType.TableBinding:
case SubviewType.CollectionView:
Controller.PerformSegue("AddSegue", Controller);
break;
}
};
EditButton.Active = false;
EditButton.Activated += (sender, e) => {
// Take action based on type
switch(Controller.ViewType) {
case SubviewType.TableBinding:
var controller = Controller.ContentController as TableViewController;
controller.EditPerson(this.Window);
break;
case SubviewType.CollectionView:
// var collection = SubviewController as SubviewCollectionViewController;
// collection.EditPerson(this);
break;
}
};
DeleteButton.Active = false;
DeleteButton.Activated += (sender, e) => {
// Take action based on type
switch(Controller.ViewType) {
case SubviewType.TableBinding:
var controller = Controller.ContentController as TableViewController;
controller.DeletePerson(this.Window);
break;
case SubviewType.CollectionView:
// var collection = SubviewController as SubviewCollectionViewController;
// collection.DeletePerson(this);
break;
}
};
Search.Enabled = false;
Search.EditingEnded += (sender, e) => {
// Take action based on type
switch(Controller.ViewType) {
case SubviewType.TableBinding:
var controller = Controller.ContentController as TableViewController;
controller.FindPerson(Search.StringValue);
break;
case SubviewType.CollectionView:
// var collection = SubviewController as SubviewCollectionViewController;
// collection.FindPerson(Search.StringValue);
break;
}
};
// Attach window to view
Controller.WindowController = this;
}
#endregion
#region Public Methods
public void UpdateUI() {
// Take action on type
switch (Controller.ViewType) {
case SubviewType.TableBinding:
Addbutton.Active = true;
EditButton.Active = true;
DeleteButton.Active = true;
Search.Enabled = true;
break;
case SubviewType.CollectionView:
Addbutton.Active = true;
EditButton.Active = true;
DeleteButton.Active = true;
Search.Enabled = true;
break;
default:
Addbutton.Active = false;
EditButton.Active = false;
DeleteButton.Active = false;
Search.Enabled = false;
break;
}
}
#endregion
}
}