-
Notifications
You must be signed in to change notification settings - Fork 64
/
Copy pathFormFilter.cs
247 lines (213 loc) · 7.84 KB
/
FormFilter.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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
// Name: FormFilter.cs
// Description: Dialog box for filtering items
// Author: Tim Chipman
// Origination: Work performed for BuildingSmart by Constructivity.com LLC.
// Copyright: (c) 2013 BuildingSmart International Ltd.
// License: http://www.buildingsmart-tech.org/legal
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using IfcDoc.Schema.DOC;
namespace IfcDoc
{
public partial class FormFilter : Form
{
DocProject m_project;
public FormFilter()
{
InitializeComponent();
}
public FormFilter(DocProject project) : this()
{
this.m_project = project;
}
private void buttonTemplate_Click(object sender, EventArgs e)
{
using (FormSelectTemplate form = new FormSelectTemplate(null, this.m_project, null))
{
if (form.ShowDialog(this) == DialogResult.OK && form.SelectedTemplate != null)
{
this.radioButtonTemplateAll.Checked = false;
this.radioButtonTemplateNone.Checked = false;
this.textBoxTemplate.Text = form.SelectedTemplate.Name;
this.textBoxTemplate.Tag = form.SelectedTemplate;
}
}
}
private void buttonView_Click(object sender, EventArgs e)
{
using (FormSelectView form = new FormSelectView(this.m_project))
{
if (form.ShowDialog(this) == DialogResult.OK && form.Selection != null)
{
this.radioButtonViewAll.Checked = false;
this.radioButtonViewNone.Checked = false;
this.textBoxView.Text = form.Selection.Name;
this.textBoxView.Tag = form.Selection;
}
}
}
private void buttonSchema_Click(object sender, EventArgs e)
{
using (FormSelectSchema form = new FormSelectSchema(this.m_project))
{
if (form.ShowDialog(this) == DialogResult.OK && form.Selection != null)
{
this.radioButtonSchemaAll.Checked = false;
this.radioButtonSchemaNone.Checked = false;
this.textBoxSchema.Text = form.Selection.ToString();
this.textBoxSchema.Tag = form.Selection;
}
}
}
private void buttonLocale_Click(object sender, EventArgs e)
{
using (FormSelectLocale form = new FormSelectLocale())
{
if (form.ShowDialog(this) == DialogResult.OK && form.SelectedLocale != null)
{
this.radioButtonLocaleAll.Checked = false;
this.radioButtonLocaleNone.Checked = false;
this.textBoxLocale.Text = form.SelectedLocale.ToString();
this.textBoxLocale.Tag = form.SelectedLocale;
}
}
}
private void radioButtonTemplateAll_CheckedChanged(object sender, EventArgs e)
{
this.textBoxTemplate.Text = String.Empty;
}
private void radioButtonTemplateNone_CheckedChanged(object sender, EventArgs e)
{
this.textBoxTemplate.Text = String.Empty;
}
private void radioButtonViewAll_CheckedChanged(object sender, EventArgs e)
{
this.textBoxView.Text = String.Empty;
}
private void radioButtonViewNone_CheckedChanged(object sender, EventArgs e)
{
this.textBoxView.Text = String.Empty;
}
private void radioButtonSchemaAll_CheckedChanged(object sender, EventArgs e)
{
this.textBoxSchema.Text = String.Empty;
}
private void radioButtonSchemaNone_CheckedChanged(object sender, EventArgs e)
{
this.textBoxSchema.Text = String.Empty;
}
private void radioButtonLocaleAll_CheckedChanged(object sender, EventArgs e)
{
this.textBoxLocale.Text = String.Empty;
}
private void radioButtonLocaleNone_CheckedChanged(object sender, EventArgs e)
{
this.textBoxLocale.Text = String.Empty;
}
public DocTemplateDefinition[] FilterTemplate
{
get
{
if (this.radioButtonTemplateNone.Checked)
{
return new DocTemplateDefinition[0];
}
else if (this.textBoxTemplate.Tag is DocTemplateDefinition)
{
return new DocTemplateDefinition[] { (DocTemplateDefinition)this.textBoxTemplate.Tag };
}
return null;
}
}
public DocModelView[] FilterView
{
get
{
if (this.radioButtonViewNone.Checked)
{
return new DocModelView[0];
}
else if (this.textBoxView.Tag is DocModelView)
{
return new DocModelView[] { (DocModelView)this.textBoxView.Tag };
}
return null;
}
}
public DocSchema[] FilterSchema
{
get
{
if (this.radioButtonSchemaNone.Checked)
{
return new DocSchema[0];
}
else if (this.textBoxSchema.Tag is DocSchema)
{
return new DocSchema[] { (DocSchema)this.textBoxSchema.Tag };
}
return null;
}
}
public string[] FilterLocale
{
get
{
if (this.radioButtonLocaleNone.Checked)
{
return new string[0];
}
else if (!String.IsNullOrEmpty(this.textBoxLocale.Text))
{
return new string[] { this.textBoxLocale.Text };
}
return null;
}
}
private void radioButtonTemplateAll_Click(object sender, EventArgs e)
{
this.radioButtonTemplateAll.Checked = true;
this.radioButtonTemplateNone.Checked = false;
}
private void radioButtonTemplateNone_Click(object sender, EventArgs e)
{
this.radioButtonTemplateAll.Checked = false;
this.radioButtonTemplateNone.Checked = true;
}
private void radioButtonViewAll_Click(object sender, EventArgs e)
{
this.radioButtonViewAll.Checked = true;
this.radioButtonViewNone.Checked = false;
}
private void radioButtonViewNone_Click(object sender, EventArgs e)
{
this.radioButtonViewAll.Checked = false;
this.radioButtonViewNone.Checked = true;
}
private void radioButtonSchemaAll_Click(object sender, EventArgs e)
{
this.radioButtonSchemaAll.Checked = true;
this.radioButtonSchemaNone.Checked = false;
}
private void radioButtonSchemaNone_Click(object sender, EventArgs e)
{
this.radioButtonSchemaAll.Checked = false;
this.radioButtonSchemaNone.Checked = true;
}
private void radioButtonLocaleAll_Click(object sender, EventArgs e)
{
this.radioButtonLocaleAll.Checked = true;
this.radioButtonLocaleNone.Checked = false;
}
private void radioButtonLocaleNone_Click(object sender, EventArgs e)
{
this.radioButtonLocaleAll.Checked = false;
this.radioButtonLocaleNone.Checked = true;
}
}
}