-
Notifications
You must be signed in to change notification settings - Fork 1
/
TabOptions.cs
1081 lines (1016 loc) · 49.6 KB
/
TabOptions.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
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace test
{
public partial class TabOptions : Form
{
public Workspace workspace_ob = new Workspace();
public Workspace workspace_ob_last = new Workspace();
List<RadioButton> radio_buttons_arr = new List<RadioButton>();
public TabOptions()
{
InitializeComponent();
List<ToolTip> t_list_tab = new List<ToolTip>(6);
for(int i = 0; i <=100; i++){
t_list_tab.Add(new ToolTip());
}
t_list_tab[0].SetToolTip(radioButton_even_odd, "Even and odd numbers randomly");
t_list_tab[1].SetToolTip(radioButton_prime_comp, "Prime and composite numbers randomly");
t_list_tab[2].SetToolTip(radioButton_mystery_dis, "In each rectangle are four numbers split by comma. \nEach next number is bigger than previously on number from key.");
t_list_tab[3].SetToolTip(textBox_alg_bas_frst, "Minimum threshold from which numbers will generate.");
t_list_tab[4].SetToolTip(textBox_alg_hard_scnd, "Maximum threshold to which numbers will generate.");
t_list_tab[5].SetToolTip(label11, "Actions that will be used in generating tasks.");
t_list_tab[6].SetToolTip(check_box_Addition, "Add the addition to list of uses actions.");
t_list_tab[7].SetToolTip(check_box_Subtraction, "Add the subtraction to list of uses actions.");
t_list_tab[8].SetToolTip(check_box_Division, "Add the division to list of uses actions.");
t_list_tab[9].SetToolTip(check_box_Mult, "Add the multiplication to list of uses actions.");
t_list_tab[10].SetToolTip(radioButton_Junior, "In this mode in each key will be two different numbers.");
t_list_tab[11].SetToolTip(radioButton_Basic, "In this mode in each key will be one number.");
t_list_tab[12].SetToolTip(radioButton_Advanced, "In this mode in each key will be range of numbers \nor couple numbers separated by comma.");
t_list_tab[13].SetToolTip(textBox_alg_simple_frst, "Minimum threshold from which numbers will generate.");
t_list_tab[14].SetToolTip(textBox_alg_simple_scnd, "Maximum threshold to which numbers will generate.");
t_list_tab[15].SetToolTip(label13, "Actions that will be used in generating tasks.");
t_list_tab[16].SetToolTip(check_box_regr_add, "Add the addition to list of uses actions.");
t_list_tab[17].SetToolTip(check_box_regr_sub, "Add the subtraction to list of uses actions.");
t_list_tab[18].SetToolTip(check_box_regr_mult, "Add the multiplication to list of uses actions.");
t_list_tab[19].SetToolTip(textBox_alg_mid_regr_frst, "Minimum threshold from which numbers will generate.");
t_list_tab[20].SetToolTip(textBox_alg_mid_regr_scnd, "Maximum threshold to which numbers will generate.");
t_list_tab[21].SetToolTip(radioButton_rounds_ten, "Randomly numbers that must be rounds to number in key.");
t_list_tab[22].SetToolTip(radioButton_rounds_hun, "Randomly numbers that must be rounds to number in key.");
t_list_tab[23].SetToolTip(radioButton_fractions, "Randomly fractions in the keys to which must be found equal fraction.");
t_list_tab[24].SetToolTip(radioButton_Percentages, "Randomly percentages in the keys to which must be found equal value.");
t_list_tab[25].SetToolTip(radioButton_decimals, "Key value in some (ten or hundred) place.");
t_list_tab[26].SetToolTip(textBox_alg_hard_frst, "Minimum threshold from which numbers will generate.");
t_list_tab[27].SetToolTip(textBox_alg_hard_scnd, "Maximum threshold to which numbers will generate.");
t_list_tab[28].SetToolTip(radioButton_angles, "Found what type of randomly chosen angle.");
t_list_tab[29].SetToolTip(radioButton_qua, "Found in which quadrant exist randomly chosen point.");
t_list_tab[30].SetToolTip(radioButton_shapes, "Answer how much angle has randomly chosen shape.");
t_list_tab[31].SetToolTip(group_box_regro, "For each color generate random range of number.");
}
private void radioButton_Junior_CheckedChanged(object sender, EventArgs e)
{
if (radioButton_Junior.Checked == true)
{
workspace_ob.op.active_complexity = Workspace.options.complexity.JUNIOR;
workspace_ob.op.game_mod = Workspace.options.g_mod.ALGEBRA_SIMP;
}
else
workspace_ob.op.active_complexity = Workspace.options.complexity.NONE;
}
private void radioButton_mystery_dis_CheckedChanged(object sender, EventArgs e)
{
if(radioButton_mystery_dis.Checked == true)
{
label6.Visible = true;
label5.Visible = true;
label4.Visible = true;
textBox_alfg_bas_scnd.Visible = true;
textBox_alg_bas_frst.Visible = true;
workspace_ob.op.game_mod = Workspace.options.g_mod.BASIC_MYST;
}
else
{
label6.Visible = false;
label5.Visible = false;
label4.Visible = false;
textBox_alfg_bas_scnd.Visible = false;
textBox_alg_bas_frst.Visible = false;
workspace_ob.op.game_mod = Workspace.options.g_mod.NONE;
}
}
private void radioButton_alg_hard_frac_equal_num_CheckedChanged(object sender, EventArgs e)
{
}
private void radioButton2_CheckedChanged(object sender, EventArgs e)
{
}
private void tabPage_basic_Click(object sender, EventArgs e)
{
}
private void TabOptions_Shown(object sender, EventArgs e)
{
comboBox1.Enabled = false;
#region last_configuration
if (workspace_ob.op.game_mod == Workspace.options.g_mod.BASIC_EVEN_ODD) radioButton_even_odd.Checked = true;
else if (workspace_ob.op.game_mod == Workspace.options.g_mod.BASIC_PRIM_COMP) radioButton_prime_comp.Checked = true;
else if (workspace_ob.op.game_mod == Workspace.options.g_mod.BASIC_MYST) {
radioButton_mystery_dis.Checked = true;
textBox_alg_bas_frst.Visible = true;
textBox_alfg_bas_scnd.Visible = true;
label4.Visible = true;
label5.Visible = true;
label6.Visible = true;
}
else if (workspace_ob.op.game_mod == Workspace.options.g_mod.ALGEBRA_SIMP)
{
algebraTab.SelectedIndex = 1;
algebra_tabs.SelectedIndex = 0;
if (workspace_ob.op.addition_act == true) check_box_Addition.Checked = true;
if (workspace_ob.op.division_act == true) check_box_Division.Checked = true;
if (workspace_ob.op.multiplication_act == true) check_box_Mult.Checked = true;
if (workspace_ob.op.subtraction_act == true) check_box_Subtraction.Checked = true;
if (workspace_ob.op.active_complexity == Workspace.options.complexity.BASIC) radioButton_Basic.Checked = true;
else if (workspace_ob.op.active_complexity == Workspace.options.complexity.JUNIOR) radioButton_Junior.Checked = true;
else if (workspace_ob.op.active_complexity == Workspace.options.complexity.ADVANCED) radioButton_Advanced.Checked = true;
else if (workspace_ob.op.active_complexity == Workspace.options.complexity.ADVANCED_COMA)
{
radioButton_Advanced.Checked = true;
comboBox_alg_simpl_adv.SelectedIndex = 0;
}
else if (workspace_ob.op.active_complexity == Workspace.options.complexity.ADVANCED_HYPHEN)
{
radioButton_Advanced.Checked = true;
comboBox_alg_simpl_adv.SelectedIndex = 1;
}
}
else if (workspace_ob.op.game_mod == Workspace.options.g_mod.ALGEBRA_MIDD_REGROPING)
{
algebraTab.SelectedIndex = 1;
algebra_tabs.SelectedIndex = 1;
if (workspace_ob.op.addition_act == true) check_box_regr_add.Checked = true;
if (workspace_ob.op.multiplication_act == true) check_box_regr_mult.Checked = true;
if (workspace_ob.op.subtraction_act == true) check_box_regr_sub.Checked = true;
}
else if (workspace_ob.op.game_mod == Workspace.options.g_mod.ALGEBRA_MIDD_ROUNDING)
{
algebraTab.SelectedIndex = 1;
algebra_tabs.SelectedIndex = 1;
if (workspace_ob.op.active_algebra_middle_round == Workspace.options.algebra_middle_round.HUNDREDS) radioButton_rounds_hun.Checked = true;
else if (workspace_ob.op.active_algebra_middle_round == Workspace.options.algebra_middle_round.TENS) radioButton_rounds_ten.Checked = true;
}
else if (workspace_ob.op.game_mod == Workspace.options.g_mod.ALGEBRA_HARD_DEC)
{
algebraTab.SelectedIndex = 1;
algebra_tabs.SelectedIndex = 2;
radioButton_decimals.Checked = true;
}
else if (workspace_ob.op.game_mod == Workspace.options.g_mod.ALGEBRA_HARD_FRAC)
{
algebraTab.SelectedIndex = 1;
algebra_tabs.SelectedIndex = 2;
radioButton_fractions.Checked = true;
if (workspace_ob.op.active_fractions_mode == Workspace.options.fractions.EQUAL_NUM) { comboBox1.SelectedIndex = 0; }
else if (workspace_ob.op.active_fractions_mode == Workspace.options.fractions.EQUAL_DEN) { comboBox1.SelectedIndex = 1; }
}
else if (workspace_ob.op.game_mod == Workspace.options.g_mod.ALGEBRA_HARD_PERC)
{
algebraTab.SelectedIndex = 1;
algebra_tabs.SelectedIndex = 2;
radioButton_Percentages.Checked = true;
if (workspace_ob.op.active_complexity == Workspace.options.complexity.BASIC)
comboBox_percent.SelectedIndex = 0;
else if(workspace_ob.op.active_complexity == Workspace.options.complexity.ADVANCED)
comboBox_percent.SelectedIndex = 1;
}
else if (workspace_ob.op.game_mod == Workspace.options.g_mod.GEOM_ANGLES)
{
algebraTab.SelectedIndex = 2;
radioButton_angles.Checked = true;
}
else if (workspace_ob.op.game_mod == Workspace.options.g_mod.GEOM_QUADR)
{
algebraTab.SelectedIndex = 2;
radioButton_qua.Checked = true;
}
else if (workspace_ob.op.game_mod == Workspace.options.g_mod.GEOM_SHAPES)
{
algebraTab.SelectedIndex = 2;
radioButton_shapes.Checked = true;
}
#endregion
update_tmpl_list();
try
{
comboBox_tmpl.SelectedIndex = workspace_ob.selectedValTmpl;
}
catch
{
comboBox_tmpl.SelectedIndex = 0;
}
}
private void check_box_regr_add_CheckedChanged(object sender, EventArgs e)
{
if (check_box_regr_add.Checked == true){
workspace_ob.op.division_act = false;
if (check_box_regr_mult.Checked == false) workspace_ob.op.multiplication_act = false;
else workspace_ob.op.multiplication_act = true;
if (check_box_regr_sub.Checked == false) workspace_ob.op.subtraction_act = false;
else workspace_ob.op.subtraction_act = true;
workspace_ob.op.addition_act = true;
workspace_ob.op.game_mod = Workspace.options.g_mod.ALGEBRA_MIDD_REGROPING;
radioButton_rounds_hun.Checked = false;
radioButton_rounds_ten.Checked = false;
}
else
workspace_ob.op.addition_act = false;
}
private void check_box_regr_sub_CheckedChanged(object sender, EventArgs e)
{
if (check_box_regr_sub.Checked == true)
{
workspace_ob.op.division_act = false;
if (check_box_regr_mult.Checked == false) workspace_ob.op.multiplication_act = false;
else workspace_ob.op.multiplication_act = true;
if (check_box_regr_add.Checked == false) workspace_ob.op.addition_act = false;
else workspace_ob.op.addition_act = true;
workspace_ob.op.subtraction_act = true;
workspace_ob.op.game_mod = Workspace.options.g_mod.ALGEBRA_MIDD_REGROPING;
radioButton_rounds_hun.Checked = false;
radioButton_rounds_ten.Checked = false;
workspace_ob.op.division_act = false;
}
else
workspace_ob.op.subtraction_act = false;
}
private void check_box_regr_mult_CheckedChanged(object sender, EventArgs e)
{
if (check_box_regr_mult.Checked == true)
{
workspace_ob.op.game_mod = Workspace.options.g_mod.ALGEBRA_MIDD_REGROPING;
workspace_ob.op.division_act = false;
workspace_ob.op.multiplication_act = true;
if (check_box_regr_add.Checked == false) workspace_ob.op.addition_act = false;
else workspace_ob.op.addition_act = true;
if (check_box_regr_sub.Checked == false) workspace_ob.op.subtraction_act = false;
else workspace_ob.op.subtraction_act = true;
radioButton_rounds_hun.Checked = false;
radioButton_rounds_ten.Checked = false;
workspace_ob.op.division_act = false;
}
else
workspace_ob.op.multiplication_act = false;
}
private void check_box_Addition_CheckedChanged(object sender, EventArgs e)
{
if (check_box_Addition.Checked == true)
workspace_ob.op.addition_act = true;
else
workspace_ob.op.addition_act = false;
}
private void check_box_Subtraction_CheckedChanged(object sender, EventArgs e)
{
if (check_box_Subtraction.Checked == true)
workspace_ob.op.subtraction_act = true;
else
workspace_ob.op.subtraction_act = false;
}
private void check_box_Mult_CheckedChanged(object sender, EventArgs e)
{
if (check_box_Mult.Checked == true)
workspace_ob.op.multiplication_act = true;
else
workspace_ob.op.multiplication_act = false;
}
private void Division_CheckedChanged(object sender, EventArgs e)
{
if (check_box_Division.Checked == true)
workspace_ob.op.division_act = true;
else
workspace_ob.op.division_act = false;
}
private void radioButton_Basic_CheckedChanged(object sender, EventArgs e)
{
if (radioButton_Basic.Checked == true)
{
workspace_ob.op.active_complexity = Workspace.options.complexity.BASIC;
workspace_ob.op.game_mod = Workspace.options.g_mod.ALGEBRA_SIMP;
}
else
workspace_ob.op.active_complexity = Workspace.options.complexity.NONE;
}
private void radioButton_Advanced_CheckedChanged(object sender, EventArgs e)
{
if (radioButton_Advanced.Checked == true)
{
workspace_ob.op.active_complexity = Workspace.options.complexity.ADVANCED;
workspace_ob.op.game_mod = Workspace.options.g_mod.ALGEBRA_SIMP;
comboBox_alg_simpl_adv.SelectedIndex = 0;
comboBox_alg_simpl_adv.Enabled = true;
}
else
{
workspace_ob.op.active_complexity = Workspace.options.complexity.NONE;
comboBox_alg_simpl_adv.Enabled = false;
}
}
private void radioButton_fractions_CheckedChanged(object sender, EventArgs e)
{
if (radioButton_fractions.Checked == true)
{
if (workspace_ob.op.active_fractions_mode == Workspace.options.fractions.EQUAL_NUM) {
comboBox1.SelectedIndex = 0;
}
else if (workspace_ob.op.active_fractions_mode == Workspace.options.fractions.EQUAL_DEN) {
comboBox1.SelectedIndex = 1;
}
else comboBox1.SelectedIndex = 0;
workspace_ob.op.game_mod = Workspace.options.g_mod.ALGEBRA_HARD_FRAC;
comboBox1.Enabled = true;
textBox_alg_hard_frst.Enabled = false;
textBox_alg_hard_scnd.Enabled = false;
}
else
{
workspace_ob.op.game_mod = Workspace.options.g_mod.NONE;
comboBox1.Enabled = false;
}
}
private void radioButton_decimals_CheckedChanged(object sender, EventArgs e)
{
if (radioButton_decimals.Checked == true)
{
workspace_ob.op.game_mod = Workspace.options.g_mod.ALGEBRA_HARD_DEC;
textBox_alg_hard_frst.Enabled = true;
textBox_alg_hard_scnd.Enabled = true;
textBox_alg_hard_frst.MaxLength = 1;
textBox_alg_hard_scnd.MaxLength = 1;
}
else
{
workspace_ob.op.game_mod = Workspace.options.g_mod.NONE;
textBox_alg_hard_frst.MaxLength = 3;
textBox_alg_hard_scnd.MaxLength = 3;
}
}
private void radioButton_Percentages_CheckedChanged(object sender, EventArgs e)
{
if (radioButton_Percentages.Checked == true)
{
comboBox_percent.Enabled = true;
comboBox_percent.SelectedIndex = 0;
workspace_ob.op.active_complexity = Workspace.options.complexity.BASIC;
workspace_ob.op.game_mod = Workspace.options.g_mod.ALGEBRA_HARD_PERC;
textBox_alg_hard_frst.Enabled = true;
textBox_alg_hard_scnd.Enabled = true;
}
else
{
workspace_ob.op.game_mod = Workspace.options.g_mod.NONE;
comboBox_percent.Enabled = false;
}
}
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox1.SelectedIndex == 0)
workspace_ob.op.active_fractions_mode = Workspace.options.fractions.EQUAL_NUM;
else if (comboBox1.SelectedIndex == 1)
workspace_ob.op.active_fractions_mode = Workspace.options.fractions.EQUAL_DEN;
}
private void button_save_Click(object sender, EventArgs e)
{
#region save_Mystery_data
if (algebraTab.SelectedTab == tabPage_basic)
{
if (radioButton_even_odd.Checked != true && radioButton_mystery_dis.Checked != true && radioButton_prime_comp.Checked != true)
{
textBox_info_error.Text = "Select some mode value.";
return;
}
if(workspace_ob.op.game_mod == Workspace.options.g_mod.BASIC_MYST)
{
try
{
int.Parse(textBox_alg_bas_frst.Text);
int.Parse(textBox_alfg_bas_scnd.Text);
}
catch
{
if(textBox_alg_bas_frst.Text == "" || textBox_alfg_bas_scnd.Text == "")
textBox_info_error.Text = "Ranges of numbers is empty.";
else
textBox_info_error.Text = "Numbers are incorrect.";
return;
}
if (int.Parse(textBox_alg_bas_frst.Text) >= int.Parse(textBox_alfg_bas_scnd.Text))
{
textBox_info_error.Text = "Second number must be bigger then first";
return;
}
if (int.Parse(textBox_alg_bas_frst.Text) < 0 || int.Parse(textBox_alfg_bas_scnd.Text) < 0)
{
textBox_info_error.Text = "Numbers must be bigger then zero.";
return;
}
workspace_ob.op.active_range_first = int.Parse(textBox_alg_bas_frst.Text);
workspace_ob.op.active_range_second = int.Parse(textBox_alfg_bas_scnd.Text);
}
}
#endregion
#region save_Algebra_simple_data
else if (algebra_tabs.SelectedTab == tabPage_alg_simple && algebraTab.SelectedTab == tabPage_alg)
{
if((radioButton_Advanced.Checked != true && radioButton_Junior.Checked != true && radioButton_Basic.Checked != true)
|| (check_box_Addition.Checked != true && check_box_Mult.Checked != true && check_box_Subtraction.Checked != true && check_box_Division.Checked != true))
{
textBox_info_error.Text = "Select some complexity and/or actions value.";
return;
}
try
{
int.Parse(textBox_alg_simple_frst.Text);
int.Parse(textBox_alg_simple_scnd.Text);
}
catch
{
if (textBox_alg_simple_frst.Text == "" || textBox_alg_simple_scnd.Text == "")
textBox_info_error.Text = "Ranges of numbers is empty.";
else
textBox_info_error.Text = "Numbers are incorrect.";
return;
}
if (int.Parse(textBox_alg_simple_frst.Text) >= int.Parse(textBox_alg_simple_scnd.Text))
{
textBox_info_error.Text = "Second number must be bigger then first";
return;
}
if (int.Parse(textBox_alg_simple_frst.Text) == 0 || int.Parse(textBox_alg_simple_scnd.Text) == 0)
{
textBox_info_error.Text = "You can`t enter zero.";
return;
}
if (int.Parse(textBox_alg_simple_frst.Text) < 0 || int.Parse(textBox_alg_simple_scnd.Text) < 0)
{
textBox_info_error.Text = "Numbers must be bigger then zero.";
return;
}
if ((int.Parse(textBox_alg_simple_scnd.Text) - int.Parse(textBox_alg_simple_frst.Text)) < workspace_ob.keys.Count)
{
textBox_info_error.Text = "In this mode difference between numbers must be bigger than count of keys.";
return;
}
if (radioButton_Advanced.Checked == true && comboBox_alg_simpl_adv.SelectedIndex == 1 && ((int.Parse(textBox_alg_simple_scnd.Text) - int.Parse(textBox_alg_simple_frst.Text)) < workspace_ob.keys.Count * 2))
{
textBox_info_error.Text = "In this mode difference between numbers must be bigger than count of keys multiplicated by 2.";
return;
}
if (radioButton_Junior.Checked)
{
if (int.Parse(textBox_alg_simple_scnd.Text) - int.Parse(textBox_alg_simple_frst.Text) < workspace_ob.keys.Count*2)
{
DialogResult result1 = MessageBox.Show("With this numbers some keys will stay without value. Continue?",
"Empty keys",
MessageBoxButtons.YesNo);
if (result1 == System.Windows.Forms.DialogResult.No)
{
textBox_info_error.Text = "Enter some other numbers.";
return;
}
}
}
workspace_ob.op.active_range_first = int.Parse(textBox_alg_simple_frst.Text);
workspace_ob.op.active_range_second = int.Parse(textBox_alg_simple_scnd.Text);
}
#endregion
#region save_Algebra_Middle_data
else if (algebra_tabs.SelectedTab == tabPage_alg_middle && algebraTab.SelectedTab == tabPage_alg)
{
if ((check_box_regr_add.Checked != true && check_box_regr_mult.Checked != true && check_box_regr_sub.Checked != true)
&& (radioButton_rounds_ten.Checked != true && radioButton_rounds_hun.Checked != true))
{
textBox_info_error.Text = "Select some actions value.";
return;
}
try
{
int.Parse(textBox_alg_mid_regr_frst.Text);
int.Parse(textBox_alg_mid_regr_scnd.Text);
}
catch
{
if (textBox_alg_mid_regr_frst.Text == "" || textBox_alg_mid_regr_scnd.Text == "")
textBox_info_error.Text = "Ranges of numbers is empty.";
else
textBox_info_error.Text = "Numbers are incorrect.";
return;
}
if (radioButton_rounds_ten.Checked == true && (int.Parse(textBox_alg_mid_regr_frst.Text) < 10 || int.Parse(textBox_alg_mid_regr_scnd.Text) < 10))
{
textBox_info_error.Text = "In this mode numbers must be bigger than 10.";
return;
}
else if((radioButton_rounds_hun.Checked == true && (int.Parse(textBox_alg_mid_regr_frst.Text) < 100 || int.Parse(textBox_alg_mid_regr_scnd.Text) < 100)))
{
textBox_info_error.Text = "In this mode numbers must be bigger than 100.";
return;
}
if (int.Parse(textBox_alg_mid_regr_frst.Text) >= int.Parse(textBox_alg_mid_regr_scnd.Text))
{
textBox_info_error.Text = "Second number must be bigger then first";
return;
}
if (int.Parse(textBox_alg_mid_regr_frst.Text) < 0 || int.Parse(textBox_alg_mid_regr_scnd.Text) < 0)
{
textBox_info_error.Text = "Numbers must be bigger then zero.";
return;
}
if (radioButton_rounds_ten.Checked == true && ((int.Parse(textBox_alg_mid_regr_scnd.Text) - int.Parse(textBox_alg_mid_regr_frst.Text)) < 10))
{
textBox_info_error.Text = "In this mode difference between numbers must be bigger than 10.";
return;
}
if (radioButton_rounds_hun.Checked == true && ((int.Parse(textBox_alg_mid_regr_scnd.Text) - int.Parse(textBox_alg_mid_regr_frst.Text)) < 100))
{
textBox_info_error.Text = "In this mode difference between numbers must be bigger than 100.";
return;
}
if ((int.Parse(textBox_alg_mid_regr_scnd.Text) - int.Parse(textBox_alg_mid_regr_frst.Text)) < workspace_ob.keys.Count)
{
textBox_info_error.Text = "In this mode difference between numbers must be bigger than count of keys.";
return;
}
workspace_ob.op.active_range_first = int.Parse(textBox_alg_mid_regr_frst.Text);
workspace_ob.op.active_range_second = int.Parse(textBox_alg_mid_regr_scnd.Text);
}
#endregion
#region save_Algebra_Hard_data
else if (algebra_tabs.SelectedTab == tabPage_alg_hard && algebraTab.SelectedTab == tabPage_alg)
{
if (radioButton_fractions.Checked != true && radioButton_decimals.Checked != true && radioButton_Percentages.Checked != true)
{
textBox_info_error.Text = "Select some value.";
return;
}
if (radioButton_fractions.Checked != true)
{
try
{
int.Parse(textBox_alg_hard_frst.Text);
int.Parse(textBox_alg_hard_scnd.Text);
}
catch
{
if (textBox_alg_hard_frst.Text == "" || textBox_alg_hard_scnd.Text == "")
textBox_info_error.Text = "Ranges of numbers is empty.";
else
textBox_info_error.Text = "Numbers are incorrect.";
return;
}
if (int.Parse(textBox_alg_hard_frst.Text) >= int.Parse(textBox_alg_hard_scnd.Text))
{
textBox_info_error.Text = "Second number must be bigger then first";
return;
}
if (int.Parse(textBox_alg_hard_frst.Text) <= 0 || int.Parse(textBox_alg_hard_scnd.Text) <= 0)
{
textBox_info_error.Text = "Numbers must be bigger then zero.";
return;
}
if ((int.Parse(textBox_alg_hard_scnd.Text) - int.Parse(textBox_alg_hard_frst.Text)) < workspace_ob.keys.Count)
{
textBox_info_error.Text = "In this mode difference between numbers must be bigger than count of keys.";
return;
}
workspace_ob.op.active_range_first = int.Parse(textBox_alg_hard_frst.Text);
workspace_ob.op.active_range_second = int.Parse(textBox_alg_hard_scnd.Text);
}
}
#endregion
#region save_Geom_data
else if (algebraTab.SelectedTab == tabPage_geom)
{
if (radioButton_angles.Checked != true && radioButton_qua.Checked != true && radioButton_shapes.Checked != true)
{
textBox_info_error.Text = "Select some mode value.";
return;
}
}
#endregion
#region generate_new_keys
if (workspace_ob.keys.Count != 0)
{
if (workspace_ob.keys.Count < 2)
{
return;
}
else
{
foreach (Workspace.key a in workspace_ob.keys)
{
a.str = "";
}
GenereteNumbers.workspace = workspace_ob;
GenereteNumbers.Generate_Number();
}
}
#endregion
this.DialogResult = System.Windows.Forms.DialogResult.OK;
Close();
}
private void button_cancel_Click(object sender, EventArgs e)
{
Close();
}
private void radioButton_prime_comp_CheckedChanged(object sender, EventArgs e)
{
workspace_ob.op.game_mod = Workspace.options.g_mod.BASIC_PRIM_COMP;
}
private void radioButton_even_odd_CheckedChanged(object sender, EventArgs e)
{
workspace_ob.op.game_mod = Workspace.options.g_mod.BASIC_EVEN_ODD;
}
private void radioButton_angles_CheckedChanged(object sender, EventArgs e)
{
workspace_ob.op.game_mod = Workspace.options.g_mod.GEOM_ANGLES;
}
private void radioButton_qua_CheckedChanged(object sender, EventArgs e)
{
workspace_ob.op.game_mod = Workspace.options.g_mod.GEOM_QUADR;
}
private void radioButton_shapes_CheckedChanged(object sender, EventArgs e)
{
workspace_ob.op.game_mod = Workspace.options.g_mod.GEOM_SHAPES;
}
private void tabPage_basic_CursorChanged(object sender, EventArgs e)
{
textBox_info_error.Text = "";
}
private void tabPage_basic_MouseMove(object sender, MouseEventArgs e)
{
textBox_info_error.Text = "";
}
private void tabPage4_MouseMove(object sender, MouseEventArgs e)
{
textBox_info_error.Text = "";
}
private void tabPage_alg_middle_MouseMove(object sender, MouseEventArgs e)
{
textBox_info_error.Text = "";
}
private void tabPage_alg_hard_MouseMove(object sender, MouseEventArgs e)
{
textBox_info_error.Text = "";
}
private void radioButton_rounds_ten_CheckedChanged(object sender, EventArgs e)
{
if (radioButton_rounds_ten.Checked == true)
{
workspace_ob.op.game_mod = Workspace.options.g_mod.ALGEBRA_MIDD_ROUNDING;
workspace_ob.op.active_algebra_middle_round = Workspace.options.algebra_middle_round.TENS;
check_box_regr_add.Checked = false;
check_box_regr_mult.Checked = false;
check_box_regr_sub.Checked = false;
}
else
{
workspace_ob.op.game_mod = Workspace.options.g_mod.NONE;
workspace_ob.op.active_algebra_middle_round = Workspace.options.algebra_middle_round.TENS;
}
}
private void radioButton_rounds_hun_CheckedChanged(object sender, EventArgs e)
{
if (radioButton_rounds_hun.Checked == true)
{
workspace_ob.op.game_mod = Workspace.options.g_mod.ALGEBRA_MIDD_ROUNDING;
workspace_ob.op.active_algebra_middle_round = Workspace.options.algebra_middle_round.HUNDREDS;
check_box_regr_add.Checked = false;
check_box_regr_mult.Checked = false;
check_box_regr_sub.Checked = false;
}
else
{
workspace_ob.op.game_mod = Workspace.options.g_mod.NONE;
workspace_ob.op.active_algebra_middle_round = Workspace.options.algebra_middle_round.HUNDREDS;
}
}
private void comboBox_alg_simpl_adv_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox_alg_simpl_adv.SelectedIndex == 0) { workspace_ob.op.active_complexity = Workspace.options.complexity.ADVANCED_COMA; }
else if (comboBox_alg_simpl_adv.SelectedIndex == 1) { workspace_ob.op.active_complexity = Workspace.options.complexity.ADVANCED_HYPHEN; }
}
private void comboBox_percent_SelectedIndexChanged(object sender, EventArgs e)
{
if (comboBox_percent.SelectedIndex == 0)
{
workspace_ob.op.active_complexity = Workspace.options.complexity.BASIC;
}
else if (comboBox_percent.SelectedIndex == 1)
{
workspace_ob.op.active_complexity = Workspace.options.complexity.ADVANCED;
}
}
private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
if (comboBox_tmpl.Text == "Custom")
{
textBox_info_error.Text = "You can`t save file with that name.";
return;
}
Workspace workspace = workspace_ob;
#region save_Mystery_data
if (algebraTab.SelectedTab == tabPage_basic)
{
if (radioButton_even_odd.Checked != true && radioButton_mystery_dis.Checked != true && radioButton_prime_comp.Checked != true)
{
textBox_info_error.Text = "Select some mode value.";
return;
}
if(workspace.op.game_mod == Workspace.options.g_mod.BASIC_MYST)
{
try
{
int.Parse(textBox_alg_bas_frst.Text);
int.Parse(textBox_alfg_bas_scnd.Text);
}
catch
{
textBox_info_error.Text = "Please, enter the numbers.";
return;
}
if (int.Parse(textBox_alg_bas_frst.Text) >= int.Parse(textBox_alfg_bas_scnd.Text))
{
textBox_info_error.Text = "Second number must be bigger then first";
return;
}
if (int.Parse(textBox_alg_bas_frst.Text) < 0 || int.Parse(textBox_alfg_bas_scnd.Text) < 0)
{
textBox_info_error.Text = "Numbers must be bigger then zero.";
return;
}
if ((int.Parse(textBox_alfg_bas_scnd.Text) - int.Parse(textBox_alg_bas_frst.Text)) < workspace_ob.keys.Count)
{
textBox_info_error.Text = "In this mode difference between numbers must be bigger than count of keys.";
return;
}
workspace.op.active_range_first = int.Parse(textBox_alg_bas_frst.Text);
workspace.op.active_range_second = int.Parse(textBox_alfg_bas_scnd.Text);
}
}
#endregion
#region save_Algebra_simple_data
else if (algebra_tabs.SelectedTab == tabPage_alg_simple && algebraTab.SelectedTab == tabPage_alg)
{
if((radioButton_Advanced.Checked != true && radioButton_Junior.Checked != true && radioButton_Basic.Checked != true)
|| (check_box_Addition.Checked != true && check_box_Mult.Checked != true && check_box_Subtraction.Checked != true && check_box_Division.Checked != true))
{
textBox_info_error.Text = "Select some complexity and/or actions value.";
return;
}
try
{
int.Parse(textBox_alg_simple_frst.Text);
int.Parse(textBox_alg_simple_scnd.Text);
}
catch
{
textBox_info_error.Text = "Please, enter the numbers.";
return;
}
if (int.Parse(textBox_alg_simple_frst.Text) >= int.Parse(textBox_alg_simple_scnd.Text))
{
textBox_info_error.Text = "Second number must be bigger then first";
return;
}
if (int.Parse(textBox_alg_simple_frst.Text) >= int.Parse(textBox_alg_simple_scnd.Text))
{
textBox_info_error.Text = "Second number must be bigger then first";
return;
}
if (int.Parse(textBox_alg_simple_frst.Text) < 0 || int.Parse(textBox_alg_simple_scnd.Text) < 0)
{
textBox_info_error.Text = "Numbers must be bigger then zero.";
return;
}
if ((int.Parse(textBox_alg_simple_scnd.Text) - int.Parse(textBox_alg_simple_frst.Text)) < workspace_ob.keys.Count)
{
textBox_info_error.Text = "In this mode difference between numbers must be bigger than count of keys.";
return;
}
workspace.op.active_range_first = int.Parse(textBox_alg_simple_frst.Text);
workspace.op.active_range_second = int.Parse(textBox_alg_simple_scnd.Text);
}
#endregion
#region save_Algebra_Middle_data
else if (algebra_tabs.SelectedTab == tabPage_alg_middle && algebraTab.SelectedTab == tabPage_alg)
{
if ((check_box_regr_add.Checked != true && check_box_regr_mult.Checked != true && check_box_regr_sub.Checked != true)
&& (radioButton_rounds_ten.Checked != true && radioButton_rounds_hun.Checked != true))
{
textBox_info_error.Text = "Select some actions value.";
return;
}
try
{
int.Parse(textBox_alg_mid_regr_frst.Text);
int.Parse(textBox_alg_mid_regr_scnd.Text);
}
catch
{
textBox_info_error.Text = "Please, enter the numbers.";
return;
}
if (radioButton_rounds_ten.Checked == true && (int.Parse(textBox_alg_mid_regr_scnd.Text) < 10 || int.Parse(textBox_alg_mid_regr_scnd.Text) < 10))
{
textBox_info_error.Text = "In this mode numbers must be bigger than 10.";
return;
}
else if ((radioButton_rounds_hun.Checked == true && (int.Parse(textBox_alg_mid_regr_scnd.Text) < 100 || int.Parse(textBox_alg_mid_regr_scnd.Text) < 100)))
{
textBox_info_error.Text = "In this mode numbers must be bigger than 100.";
return;
}
if (int.Parse(textBox_alg_mid_regr_frst.Text) >= int.Parse(textBox_alg_mid_regr_scnd.Text))
{
textBox_info_error.Text = "Second number must be bigger then first";
return;
}
if (int.Parse(textBox_alg_mid_regr_frst.Text) < 0 || int.Parse(textBox_alg_mid_regr_scnd.Text) < 0)
{
textBox_info_error.Text = "Numbers must be bigger then zero.";
return;
}
if ((int.Parse(textBox_alg_mid_regr_scnd.Text) - int.Parse(textBox_alg_mid_regr_frst.Text)) < workspace_ob.keys.Count)
{
textBox_info_error.Text = "In this mode difference between numbers must be bigger than count of keys.";
return;
}
workspace.op.active_range_first = int.Parse(textBox_alg_mid_regr_frst.Text);
workspace.op.active_range_second = int.Parse(textBox_alg_mid_regr_scnd.Text);
}
#endregion
#region save_Algebra_Hard_data
else if (algebra_tabs.SelectedTab == tabPage_alg_hard && algebraTab.SelectedTab == tabPage_alg)
{
if (radioButton_fractions.Checked != true && radioButton_decimals.Checked != true && radioButton_Percentages.Checked != true)
{
textBox_info_error.Text = "Select some mode value.";
return;
}
if (radioButton_fractions.Checked != true)
{
try
{
int.Parse(textBox_alg_hard_frst.Text);
int.Parse(textBox_alg_hard_scnd.Text);
}
catch
{
textBox_info_error.Text = "Please, enter the numbers.";
return;
}
if (int.Parse(textBox_alg_hard_frst.Text) >= int.Parse(textBox_alg_hard_scnd.Text))
{
textBox_info_error.Text = "Second number must be bigger then first";
return;
}
if (int.Parse(textBox_alg_hard_frst.Text) < 0 || int.Parse(textBox_alg_hard_scnd.Text) < 0)
{
textBox_info_error.Text = "Numbers must be bigger then zero.";
return;
}
if ((int.Parse(textBox_alg_hard_scnd.Text) - int.Parse(textBox_alg_hard_frst.Text)) < workspace_ob.keys.Count)
{
textBox_info_error.Text = "In this mode difference between numbers must be bigger than count of keys.";
return;
}
workspace.op.active_range_first = int.Parse(textBox_alg_hard_frst.Text);
workspace.op.active_range_second = int.Parse(textBox_alg_hard_scnd.Text);
}
}
#endregion
#region save_Geom_data
else if (algebraTab.SelectedTab == tabPage_geom)
{
if (radioButton_angles.Checked != true && radioButton_qua.Checked != true && radioButton_shapes.Checked != true)
{
textBox_info_error.Text = "Select some mode value.";
return;
}
}
#endregion
if (comboBox_tmpl.Text == "")
{
textBox_info_error.Text = "Enter the name of new template.";
return;
}
object ob = comboBox_tmpl.Text;
if (comboBox_tmpl.Items.Contains(ob))
{
DialogResult result1 = MessageBox.Show("Do you want replace \"" + comboBox_tmpl.Text + ".cnf\"?",
"Save new template",
MessageBoxButtons.YesNo);
if (result1 == System.Windows.Forms.DialogResult.No)
{
textBox_info_error.Text = "Enter some other name of new template.";
return;
}
}
string dest = ".\\configtmpl" + "\\" + comboBox_tmpl.Text + ".cnf";
string for_save = OpenSave.saves_string_for_save_conf(workspace);
System.IO.File.WriteAllText(@dest, for_save);
update_tmpl_list();
}
private void update_tmpl_list()
{
workspace_ob.list_of_cnf_files = System.IO.Directory.GetFiles(@".\configtmpl", "*.cnf");
for (int i = 0; i < workspace_ob.list_of_cnf_files.Count(); i++)
{
string[] tmp_str = workspace_ob.list_of_cnf_files[i].Split('\\');
tmp_str = tmp_str[tmp_str.Count() - 1].Split('.');
workspace_ob.list_of_cnf_files[i] = tmp_str[tmp_str.Count() - 2];
}
comboBox_tmpl.Items.Clear();
comboBox_tmpl.Items.Add("Custom");
foreach (string str in workspace_ob.list_of_cnf_files)
{
comboBox_tmpl.Items.Add(str);
}
}
private void button2_Click(object sender, EventArgs e)
{
int slctd_in = comboBox_tmpl.SelectedIndex;
if (slctd_in == -1)
{
if (comboBox_tmpl.Items.Count != 0)
textBox_info_error.Text = "Select some template.";
else
textBox_info_error.Text = "List of templates is empty.";
return;
}
else if (slctd_in == 0)
{
textBox_info_error.Text = "You can delete custom template.";
return;
}
System.IO.File.Delete(".\\configtmpl" + "\\" + workspace_ob.list_of_cnf_files[slctd_in - 1] + ".cnf");