-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml.cs
153 lines (131 loc) · 5.27 KB
/
MainWindow.xaml.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
using BeautySolutions.View.ViewModel;
using MaterialDesignThemes.Wpf;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Projet.CirSim;
using Projet.Views;
using Projet.Chronogrammes;
using Projet.Controleurs;
using System.Threading;
namespace Projet
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public Wire filActif;
Thread threadCycle;
ChronosWindow windowChronos;
//Thread threadEvaluation;
public MainWindow()
{
InitializeComponent();
windowChronos = new ChronosWindow();
var menuRegister = new List<SubItem>();
menuRegister.Add(new NotSubItem("NON"));
menuRegister.Add(new BoxShowSubItem("ET", typeof(And)));
menuRegister.Add(new BoxShowSubItem_Or("OU", typeof(Or)));
menuRegister.Add(new BoxShowSubItem_Or("XOR", typeof(XOR)));
menuRegister.Add(new BoxShowSubItem_Or("NOR", typeof(Nor)));
menuRegister.Add(new BoxShowSubItem("NAND", typeof(Nand)));
var item0 = new ItemMenu("PLogiques", menuRegister);
var menuScheduler = new List<SubItem>();
menuScheduler.Add(new AddUnSubItem("ADD", typeof(ADD)));
menuScheduler.Add(new AddUnSubItem("ADC", typeof(ADC)));
menuScheduler.Add(new AddNSubItem("ADnbits"));
menuScheduler.Add(new BoxShowSubItem("Decodeur", typeof(Decodeur)));
menuScheduler.Add(new BoxShowSubItem("Encodeur", typeof(Encodeur)));
menuScheduler.Add(new MuxSubItem("Mux", typeof(Mux)));
menuScheduler.Add(new MuxSubItem("Demux", typeof(Demux)));
var item1 = new ItemMenu("Combinatoires ", menuScheduler);
var menuReports = new List<SubItem>();
menuReports.Add(new SeqSubItem("Bascule T", typeof(T)));
menuReports.Add(new SeqSubItem("Bascule D", typeof(D)));
menuReports.Add(new SeqSubItem("Bascule RST", typeof(RST)));
menuReports.Add(new SeqSubItem("Bascule JK", typeof(JK)));
menuReports.Add(new SeqSubItem("Compteurs", typeof(Compteur)));
menuReports.Add(new SeqSubItem("Registres", typeof(JK)));
var item2 = new ItemMenu("Sequentils ", menuReports);
var menuExpenses = new List<SubItem>();
//menuExpenses.Add(new SubItem("File", typeof(Lampe)));
menuExpenses.Add(new LampeSubItem("Lampe"));
menuExpenses.Add(new PinSubItem("Pin"));
menuExpenses.Add(new ClockSubItem("Horloge"));
var item3 = new ItemMenu("Outils", menuExpenses);
Menu.Children.Add(new UserControlMenuItem(item0, this));
Menu.Children.Add(new UserControlMenuItem(item1, this));
Menu.Children.Add(new UserControlMenuItem(item2, this));
Menu.Children.Add(new UserControlMenuItem(item3, this));
}
private void icon_MouseEnter(object sender, MouseEventArgs e)
{
(sender as Path).Fill = Brushes.Turquoise;
}
private void icon_MouseLeave(object sender, MouseEventArgs e)
{
(sender as Path).Fill = Brushes.White;
}
private void Arreter_MouseEnter(object sender, MouseEventArgs e)
{
(sender as Rectangle).Fill = Brushes.Red;
}
private void Arreter_MouseLeave(object sender, MouseEventArgs e)
{
(sender as Rectangle).Fill = Brushes.White;
}
private void simuler_MouseDown(object sender, MouseButtonEventArgs e)
{
simuler.Fill = Brushes.Turquoise;
arreter.IsEnabled = true;
Circuit.traiter(windowChronos);
if (Circuit.Horloge != null)
{
Chrono.IsEnabled = true;
//Circuit.Horloge.stop = false;
threadCycle = new Thread(Circuit.Horloge.cycle);
// threadEvaluation = new Thread(Circuit.Horloge.evaluation);
threadCycle.Start();
//threadEvaluation.Start();
}
}
private void tabv_MouseDown(object sender, MouseButtonEventArgs e)
{
if (Circuit.pins.Count != 0)
{
if (Circuit.Horloge == null)
{
TvWindow t = new TvWindow();
t.Show();
}
else
{
TvWindow t = new TvWindow("frontM");
t.Show();
}
}
}
private void arreter_MouseDown(object sender, MouseButtonEventArgs e)
{
if (Circuit.Horloge != null) Circuit.Horloge.stop = true;
}
private void Chrono_MouseDown(object sender, MouseButtonEventArgs e)
{
(sender as Path).Fill = Brushes.Turquoise;
windowChronos.Show();
windowChronos.ActiverChrono();
}
}
}