/
ImpRoom.cs
577 lines (539 loc) · 26.6 KB
/
ImpRoom.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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using NPLab.Models;
namespace NPLab
{
public partial class ImpRoom : Form
{
Rooms currRoom = new Rooms();
El_2 EL2Ref;
Main M;
BindingSource ImpBindingSource = new BindingSource();
Panel[] counts = new Panel[3];
Panel[] amps = new Panel[3];
ListBox[] names = new ListBox[3];
int sector, floor, room;
bool isNew, showMsg = false;
public ImpRoom(Main M, Rooms currRoom, El_2 El2Ref, int sector, int floor, int room, bool isNew)
{
this.currRoom = currRoom;
//this.currRoom.ListOfInstallations.Clear();
this.EL2Ref = El2Ref;
this.M = M;
this.sector = sector;
this.floor = floor;
this.room = room;
this.isNew = isNew;
InitializeComponent();
}
private void ImpRoom_Load(object sender, EventArgs e)
{
//EditContacts.DataSource = currRoom.ListOfInstallations;
//Main.Stats = new StaticClass();
foreach (InstallationItem item in Main.Stats.Items)
{
if ((int)item.Type == 0) { ContList.Items.Add(item.Name); ContList.Items.Add(""); }
if ((int)item.Type == 1 && item.Id < 4000) { LightList.Items.Add(item.Name); LightList.Items.Add(""); }
if ((int)item.Type == 1 && item.Id >= 4000) { LumList.Items.Add(item.Name); LumList.Items.Add(""); }
if ((int)item.Type == 2) PowAmpCollection.Items.Add(item.Name);
}
CurrProg.AutoGenerateColumns = false;
ImpBindingSource = new BindingSource();
foreach(Installations inst in currRoom.ListOfInstallations) ImpBindingSource.Add(inst);
CurrProg.DataSource = ImpBindingSource;
CurrProg.Columns[0].DataPropertyName = "InstallationName";
CurrProg.Columns[1].DataPropertyName = "Amperage";
CurrProg.Columns[2].DataPropertyName = "Coefficient";
CurrProg.Columns[3].DataPropertyName = "Impedance";
CurrProg.Columns[4].DataPropertyName = "Max";
foreach (Control con in this.Controls)
{
if (con is Panel) { (con as Panel).AutoScroll = false; (con as Panel).AutoSize = true; }
//if (con is GroupBox) (con as GroupBox).Sc = true;
}
Rooms t = currRoom;
M.SuccRoom = false;
currRoom = M.tempImp.ListOfSectors.ElementAt(sector).ListOfFloors.ElementAt(floor).ListOfRooms.ElementAt(room);
LoadRoom(currRoom);
showMsg = true;
//currRoom = t;
CurrProg.Update();
CurrProg.Refresh();
}
private void LoadRoom(Rooms r)
{
CurrProg.DataSource = new BindingSource();
RoomName.Text = r.RoomName;
counts = new Panel[3]{ ContCount, LightCount, PowAmp };
amps = new Panel[3]{ ContAmp, LightAmp, PowAmperage };
names = new ListBox[3] { ContList, LightList, PowAmpList };
foreach(Installations inst in r.ListOfInstallations)
{
InstallationItem it = inst.Item;
int type = (int)inst.Item.Type;
int sec = Main.Stats.Items.FindAll(x => (int)x.Type == type).IndexOf(it);
if (type == 2)
{
PowAmpCollection.SetItemChecked(sec, true);
sec = PowAmpList.Items.IndexOf(it.Name);
}
(counts[type].Controls[sec] as NumericUpDown).Value++;
if((counts[type].Controls[sec] as NumericUpDown).Value == 1)
(amps[type].Controls[sec] as NumericUpDown).Value = System.Convert.ToDecimal(inst.Amperage);
}
ImpBindingSource = new BindingSource();
foreach (Installations inst in r.ListOfInstallations)
{
ImpBindingSource.Add(inst);
CurrProg.Columns[0].DataPropertyName = "InstallationName";
CurrProg.Columns[1].DataPropertyName = "Amperage";
CurrProg.Columns[2].DataPropertyName = "Coefficient";
CurrProg.Columns[3].DataPropertyName = "Impedance";
CurrProg.Columns[4].DataPropertyName = "Max";
CurrProg.DataSource = ImpBindingSource;
}
CurrProg.Update();
CurrProg.Refresh();
}
private void Count_ValueChanged(object sender, EventArgs e)
{
NumericUpDown temp = sender as NumericUpDown;
int value = System.Convert.ToInt32(temp.Value);
Panel container = counts.First<Panel>(p => p.Controls.IndexOf(temp) > -1);
int prim = counts.ToList<Panel>().IndexOf(container);
int sec = container.Controls.IndexOf(temp);
string name = names[prim].Items[sec * 2].ToString();
InstallationItem item = Main.Stats.Items.First<InstallationItem>(i => i.Name == name);
int type = Main.Stats.Items.IndexOf(item);
//if (Main.Stats.Items[type].Id >= 4000) prim = 3;
//Panel[]
Installations firstInst = currRoom.ListOfInstallations.FirstOrDefault(i => i.Item == item);
int first = currRoom.FirstIndex(type);
if(firstInst == null) first = -1;
int count = currRoom.ListOfInstallations.Count(i => i.Item == item);
int last = first + count - 1;
List<Installations> ofType = (from p in currRoom.ListOfInstallations
where p.Item == item
select p).ToList<Installations>();
Random r = new Random();
if (value < count)
{
DialogResult dialogResult;
if (showMsg) dialogResult = MessageBox.Show("По този начин ще изтриете вече въведени съоръжения. Сигурни ли сте, че искате да продължите?", "Изтриване на съоръжения", MessageBoxButtons.YesNo);
else dialogResult = System.Windows.Forms.DialogResult.Yes;
if (dialogResult == DialogResult.Yes)
{
for (int i = value; i < count; i++)
{
Installations instToDel = ofType.ElementAt(value);
currRoom.ListOfInstallations.Remove(instToDel);
//ImpBindingSource.RemoveAt(first + value);
CurrProg.DataSource = ImpBindingSource;
}
ImpBindingSource.Clear();
foreach (Installations inst in currRoom.ListOfInstallations) ImpBindingSource.Add(inst);
CurrProg.DataSource = ImpBindingSource;
CurrProg.Columns[0].DataPropertyName = "InstallationName";
CurrProg.Columns[1].DataPropertyName = "Amperage";
CurrProg.Columns[2].DataPropertyName = "Coefficient";
CurrProg.Columns[3].DataPropertyName = "Impedance";
CurrProg.Columns[4].DataPropertyName = "Max";
CurrProg.Update();
CurrProg.Refresh();
}
}
else
{
Installations tempInst = new Installations();
Control ContainerCount = new Control(), ContainerType = new Control(), ContainerAmp = new Control();
if (prim == 0) { ContainerCount = ContCount; ContainerType = TypePro; ContainerAmp = ContAmp; }
if (prim == 1) { ContainerCount = LightCount; ContainerType = LightTypePro; ContainerAmp = LightAmp; }
if (prim == 2) { ContainerCount = PowAmp; ContainerType = PowIsAuto; ContainerAmp = PowAmperage; }
if (prim == 3) { ContainerCount = Rows; ContainerType = LumIsAuto; ContainerAmp = LumAmp; }
int typeThis = ContainerCount.Controls.IndexOf(temp);
if (count == 0)
{
for (int i = 0; i < value; i++)
{
tempInst = new Installations();
tempInst.Item = Main.Stats.Items[type];
tempInst.isAutomaticProtector = ((ContainerType.Controls[typeThis] as GroupBox).Controls[1] as RadioButton).Checked;
tempInst.Impedance = r.NextDouble() * (EL2Ref.MaxMeasured - EL2Ref.MinMeasured) + EL2Ref.MinMeasured;
tempInst.Amperage = System.Convert.ToDouble((ContainerAmp.Controls[typeThis] as NumericUpDown).Value);
tempInst.Coefficient = EL2Ref.Coefficent;
tempInst.Ofazen = false;
tempInst.Reset = true;
tempInst.Max = Main.Stats.lambda / (tempInst.Amperage * tempInst.Coefficient);
tempInst.FollowsRequirements = (tempInst.Impedance < tempInst.Max) && tempInst.Reset && !tempInst.Ofazen;
tempInst.NumberOfInstallation = i + 1;
tempInst.NumberOfProtector = -1;
//tempInst.Id = currRoom.ListOfInstallations.Count;
if (value > 1) tempInst.InstallationName = Main.Stats.Items[type].Name + " №" + (tempInst.NumberOfInstallation).ToString();
else tempInst.InstallationName = Main.Stats.Items[type].Name;
AddInst(tempInst);
ImpBindingSource.Add(tempInst);
CurrProg.DataSource = ImpBindingSource;
CurrProg.Columns[0].DataPropertyName = "InstallationName";
CurrProg.Columns[1].DataPropertyName = "Amperage";
CurrProg.Columns[2].DataPropertyName = "Coefficient";
CurrProg.Columns[3].DataPropertyName = "Impedance";
CurrProg.Columns[4].DataPropertyName = "Max";
}
}
else
{
for (int i = last; i < last + value - count; i++)
{
tempInst = new Installations();
tempInst.Item = Main.Stats.Items[type];
tempInst.isAutomaticProtector = ((ContainerType.Controls[typeThis] as GroupBox).Controls[1] as RadioButton).Checked;
tempInst.Impedance = r.NextDouble() * (EL2Ref.MaxMeasured - EL2Ref.MinMeasured) + EL2Ref.MinMeasured;
tempInst.Amperage = System.Convert.ToDouble((ContainerAmp.Controls[typeThis] as NumericUpDown).Value);
tempInst.Coefficient = EL2Ref.Coefficent;
tempInst.Ofazen = false;
tempInst.Reset = true;
tempInst.Max = Main.Stats.lambda / (tempInst.Amperage * tempInst.Coefficient);
tempInst.FollowsRequirements = (tempInst.Impedance < tempInst.Max) && tempInst.Reset && !tempInst.Ofazen;
tempInst.NumberOfInstallation = i + 1 - first;
tempInst.NumberOfProtector = -1;
//tempInst.Id = currRoom.ListOfInstallations.Count;
if (value > 1) tempInst.InstallationName = Main.Stats.Items[type].Name + " №" + (tempInst.NumberOfInstallation).ToString();
else tempInst.InstallationName = Main.Stats.Items[type].Name;
currRoom.Insert(i + 1, tempInst);
ImpBindingSource.Insert(i + 1, tempInst);
CurrProg.DataSource = ImpBindingSource;
CurrProg.Columns[0].DataPropertyName = "InstallationName";
CurrProg.Columns[1].DataPropertyName = "Amperage";
CurrProg.Columns[2].DataPropertyName = "Coefficient";
CurrProg.Columns[3].DataPropertyName = "Impedance";
CurrProg.Columns[4].DataPropertyName = "Max";
}
}
}
CurrProg.Update();
CurrProg.Refresh();
}
private void Amperage_ValueChanged(object sender, EventArgs e)
{
NumericUpDown temp = sender as NumericUpDown;
double value = System.Convert.ToDouble(temp.Value);
int sign = 1;
int ind = Main.Stats.Prots.IndexOf(System.Math.Round(value - 0.1, 1));
if (ind == -1) { ind = Main.Stats.Prots.IndexOf(value + 0.1); sign = -1; }
int type = ContAmp.Controls.IndexOf(temp);
if (ContAmp.Controls.IndexOf(temp) == -1) type = ContAmp.Controls.Count;
if (LightAmp.Controls.IndexOf(temp) == -1 && type >= ContAmp.Controls.Count) type += LightAmp.Controls.Count;
if (LightAmp.Controls.IndexOf(temp) != -1 && type >= ContAmp.Controls.Count) type += LightAmp.Controls.IndexOf(temp);
if (PowAmperage.Controls.IndexOf(temp) != -1) type += PowAmpCollection.Items.IndexOf(PowAmpList.Items[PowAmperage.Controls.IndexOf(temp)]);
if (type == -1) type += PowAmpCollection.Items.Count + LumAmp.Controls.IndexOf(temp);
int last = currRoom.LastIndex(type);
int first = currRoom.FirstIndex(type);
if (first < 0) { (sender as NumericUpDown).Value = System.Convert.ToDecimal(Main.Stats.Prots[ind]); return; }
int count = last - first + 1;
if (Main.Stats.Prots.IndexOf(value) != -1)
{
for (int i = first; i <= last; i++ ) currRoom.ListOfInstallations.ElementAt(i).Amperage = value;
return;
}
(sender as NumericUpDown).Value = System.Convert.ToDecimal(Main.Stats.Prots[ind + sign]);
CurrProg.Update();
CurrProg.Refresh();
}
private void isAutoCheckedChanged(object sender, EventArgs e)
{
RadioButton rad = sender as RadioButton;
GroupBox temp = rad.Parent as GroupBox;
bool isChecked = rad.Checked;
int type = TypePro.Controls.IndexOf(temp);
if (TypePro.Controls.IndexOf(temp) == -1) type = TypePro.Controls.Count;
if (LightTypePro.Controls.IndexOf(temp) == -1 && type >= TypePro.Controls.Count) type += TypePro.Controls.Count;
if (LightTypePro.Controls.IndexOf(temp) != -1 && type >= TypePro.Controls.Count) type += LightTypePro.Controls.IndexOf(temp);
if (PowIsAuto.Controls.IndexOf(temp) != -1) type += PowAmpCollection.Items.IndexOf(PowAmpList.Items[PowIsAuto.Controls.IndexOf(temp)]);
int last = currRoom.LastIndex(type);
int first = currRoom.FirstIndex(type);
int count = last - first + 1;
if (last < 0) { return; }
for (int i = first; i < count; i++) currRoom.ListOfInstallations.ElementAt(i).isAutomaticProtector = isChecked;
}
private void PowAmpCollection_ItemCheck(object sender, ItemCheckEventArgs e)
{
int indexChanging = e.Index;
if (e.NewValue == CheckState.Checked)
{
NewPow(PowAmp.Controls.Count - 1);
PowAmpList.Items.Add(PowAmpCollection.Items[indexChanging]);
PowAmpList.Items.Add("");
}
else
{
int ind = PowAmpList.Items.IndexOf(PowAmpCollection.Items[indexChanging]);
DelPow(ind / 2);
PowAmpList.Items.RemoveAt(ind + 1);
PowAmpList.Items.Remove(PowAmpCollection.Items[indexChanging]);
}
}
private void DelPow(int ind)
{
int type = ind + ContAmp.Controls.Count + Light.Controls.Count;
if (currRoom.FirstIndex(type) != -1) currRoom.RemoveType(type);
PowAmp.Controls.RemoveAt(ind);
PowAmperage.Controls.RemoveAt(ind);
PowIsAuto.Controls.RemoveAt(ind);
for (int i = ind; i < PowAmp.Controls.Count; i++)
{
PowAmp.Controls[i].Top -= 26;
PowAmperage.Controls[i].Top -= 26;
PowIsAuto.Controls[i].Top -= 26;
}
}
private void NewPow(int ind)
{
NumericUpDown num = new NumericUpDown
{
Top = (ind + 1) * 26,
Left = 2,
Size = MonoPhase.Size,
Minimum = 0,
Maximum = 500,
Increment = 1,
Value = 0,
DecimalPlaces = 0,
Visible = true
};
num.ValueChanged += new EventHandler(Count_ValueChanged);
PowAmp.Controls.Add(num);
NumericUpDown amp = new NumericUpDown
{
Top = (ind + 1) * 26,
Left = 2,
Size = MonoPhase.Size,
Minimum = 4,
Maximum = 500,
Increment = 0.1M,
Value = 25,
DecimalPlaces = 0,
Visible = true
};
amp.ValueChanged += new EventHandler(Amperage_ValueChanged);
PowAmperage.Controls.Add(amp);
GroupBox gr = new GroupBox
{
Top = (ind + 1) * 26,
Left = 2,
Size = groupBox8.Size,
Visible = true
};
PowIsAuto.Controls.Add(gr);
RadioButton rad1 = new RadioButton
{
Top = 0,
Left = 2,
AutoSize = true,
Text = "Автоматичен прекъсвач",
Visible = true,
Checked = EL2Ref.isAuto
};
rad1.CheckedChanged += new EventHandler(isAutoCheckedChanged);
RadioButton rad2 = new RadioButton
{
Top = 0,
Left = 156,
AutoSize = true,
Text = "Стопяем предпазител",
Visible = true,
Checked = !EL2Ref.isAuto
};
gr.Controls.Add(rad1);
gr.Controls.Add(rad2);
}
private void NewLot_Click(object sender, EventArgs e)
{
string text = (sender as Button).Text;
string lum = "";
if (text == "Нов ЛОТ") lum = "ЛОТ ";
else lum = "Осв. тяло ";
LumList.Items.Add(lum + System.Convert.ToInt32(StickNum.Value) + "x" + System.Convert.ToInt32(Power.Value) + "W");
LumList.Items.Add("");
InstallationItem newIt = new InstallationItem
{
Name = LumList.Items[LumList.Items.Count - 1].ToString(),
Id = 4000 + LumList.Items.Count,
Type = (InstallationType)1
};
Main.Stats.Items.Add(newIt);
int ind = LumList.Items.Count/2 - 1;
TextBox num = new TextBox
{
Name = "Lum" + LumList.Items.Count,
Size = MonoPhase.Size,
Top = ind * 26,
Left = 2,
Multiline = true,
Text = "0",
Visible = true
};
num.TextChanged += new EventHandler(rows_TextChanged);
Rows.Controls.Add(num);
NumericUpDown amp = new NumericUpDown
{
Top = ind * 26,
Left = 2,
Size = MonoPhase.Size,
Minimum = 4,
Maximum = 500,
Increment = 0.1M,
Value = 25,
DecimalPlaces = 0,
Visible = true
};
amp.ValueChanged += new EventHandler(Amperage_ValueChanged);
LumAmp.Controls.Add(amp);
GroupBox gr = new GroupBox
{
Top = ind * 26,
Left = 2,
Size = groupBox8.Size,
Visible = true
};
LumIsAuto.Controls.Add(gr);
RadioButton rad1 = new RadioButton
{
Top = 0,
Left = 2,
AutoSize = true,
Text = "Автоматичен прекъсвач",
Visible = true,
Checked = EL2Ref.isAuto
};
rad1.CheckedChanged += new EventHandler(isAutoCheckedChanged);
RadioButton rad2 = new RadioButton
{
Top = 0,
Left = 156,
AutoSize = true,
Text = "Стопяем предпазител",
Visible = true,
Checked = !EL2Ref.isAuto
};
gr.Controls.Add(rad1);
gr.Controls.Add(rad2);
}
private void rows_TextChanged(object sender, EventArgs e)
{
TextBox temp = sender as TextBox;
if (temp.Text.IndexOf("\r\n") == -1 || temp.Text == "") return;
temp.Text = temp.Text.Replace("\r\n", "");
temp.Text = temp.Text.Replace(" ", "");
int type = Rows.Controls.IndexOf(temp);
string[] sp = temp.Text.Split(',');
Installations lum = new Installations();
Random r = new Random();
//try
//{
foreach (Installations inst in currRoom.ListOfInstallations)
{
if (inst.Item.Id > 4000) currRoom.ListOfInstallations.Remove(inst);
}
foreach (string s in sp)
{
currRoom.ListOfInstallations.Add(new Installations());
for (int i = 0; i < System.Convert.ToInt32(s); i++ )
{
lum.isAutomaticProtector = ((LumIsAuto.Controls[type] as GroupBox).Controls[1] as RadioButton).Checked;
lum.Impedance = r.NextDouble() * (EL2Ref.MaxMeasured - EL2Ref.MaxMeasured) + EL2Ref.MaxMeasured;
lum.Amperage = System.Convert.ToDouble((LumAmp.Controls[type] as NumericUpDown).Value);
lum.Coefficient = EL2Ref.Coefficent;
lum.Ofazen = false;
lum.Reset = true;
lum.Max = (Main.Stats.lambda * lum.Coefficient) / lum.Amperage;
lum.FollowsRequirements = (lum.Impedance < lum.Max) && lum.Reset && !lum.Ofazen;
lum.NumberOfInstallation = i;
lum.NumberOfProtector = -1;
lum.Id = currRoom.ListOfInstallations.Count;
lum.InstallationName = Main.Stats.Items[type + ContCount.Controls.Count + LightCount.Controls.Count + PowAmpCollection.Controls.Count].Name + " №" + lum.NumberOfInstallation.ToString();
lum.Item = Main.Stats.Items[type + ContCount.Controls.Count + LightCount.Controls.Count + PowAmpCollection.Controls.Count];
currRoom.ListOfInstallations.Add(lum);
}
}
//}
//catch
//{
// MessageBox.Show("Грешно въведени данни за редовете. Използвайте числа, разделени със запетаи!");
// temp.Text = "";
//}
}
private void AddInst(Installations inst)
{
currRoom.ListOfInstallations.Add(inst);
}
private void CurrProg_CellEndEdit(object sender, DataGridViewCellEventArgs e)
{
if (e.ColumnIndex == 1)
{
List<Installations> list = new List<Installations>();
foreach (Installations inst in currRoom.ListOfInstallations) list.Add(inst);
int index = e.RowIndex;
int type = Main.Stats.Items.IndexOf(currRoom.ListOfInstallations.ElementAt(index).Item);
for (int i = index; i <= currRoom.LastIndex(type); i++)
{
currRoom.ListOfInstallations.ElementAt(i).Amperage = currRoom.ListOfInstallations.ElementAt(index).Amperage;
}
CurrProg.Update();
CurrProg.Refresh();
}
}
private void Save_Click(object sender, EventArgs e)
{
//M.refRoom = currRoom;
M.SuccRoom = true;
//this.FormClosing += new FormClosingEventHandler(M.ImpRoom_FormClosing);
this.Close();
}
private void Cancel_Click(object sender, EventArgs e)
{
M.SuccRoom = false;
this.Close();
}
private void Light_Enter(object sender, EventArgs e)
{
}
private void Contacts_Enter(object sender, EventArgs e)
{
}
private void RoomName_TextChanged(object sender, EventArgs e)
{
currRoom.RoomName = RoomName.Text;
}
private void Luiminaires_Enter(object sender, EventArgs e)
{
}
private void PowerEl_Enter(object sender, EventArgs e)
{
}
private void newLum_Enter(object sender, EventArgs e)
{
}
private void ImpRoom_FormClosing(object sender, FormClosingEventArgs e)
{
if (!M.SuccRoom)
{
if(isNew)
{
Rooms r = M.tempImp.ListOfSectors.ElementAt(sector).ListOfFloors.ElementAt(floor).ListOfRooms.ElementAt(room);
M.tempImp.ListOfSectors.ElementAt(sector).ListOfFloors.ElementAt(floor).ListOfRooms.Remove(r);
M.RemoveImpRoom(sector, floor, room);
}
return;
}
M.tempImp.ListOfSectors.ElementAt(sector).ListOfFloors.ElementAt(floor).ListOfRooms.ElementAt(room).ListOfInstallations = currRoom.ListOfInstallations;
M.tempImp.ListOfSectors.ElementAt(sector).ListOfFloors.ElementAt(floor).ListOfRooms.ElementAt(room).RoomName = currRoom.RoomName;
M.ImpTreeSelect(sector, floor, room, isNew, currRoom.RoomName);
}
}
}