summaryrefslogtreecommitdiff
path: root/lab2/src/main.rs
diff options
context:
space:
mode:
authorAndrew Guschin <guschin.drew@gmail.com>2022-11-13 11:50:28 +0400
committerAndrew Guschin <guschin.drew@gmail.com>2022-11-13 11:50:28 +0400
commit4862c2cf3eafdb6fa017a4e86a6fad8b4fc64171 (patch)
tree6f0600b01d01b479ced7cba77e21a8970c2e0300 /lab2/src/main.rs
parent31ede18fb5752b4524868be845b88d26bda13754 (diff)
Добавлена вторая лаба
Diffstat (limited to 'lab2/src/main.rs')
-rw-r--r--lab2/src/main.rs45
1 files changed, 45 insertions, 0 deletions
diff --git a/lab2/src/main.rs b/lab2/src/main.rs
new file mode 100644
index 0000000..162666e
--- /dev/null
+++ b/lab2/src/main.rs
@@ -0,0 +1,45 @@
+mod window_state;
+
+mod compute_window;
+mod decrypt_window;
+mod encrypt_window;
+mod generate_window;
+
+mod utils;
+
+use crate::window_state::WindowState;
+use eframe::egui;
+
+fn main() {
+ let options = eframe::NativeOptions::default();
+ eframe::run_native(
+ "Криптографические методы защиты информации",
+ options,
+ Box::new(|_cc| Box::new(Application::default())),
+ );
+}
+
+struct Application {
+ labs: Vec<Box<dyn WindowState>>,
+}
+
+impl Default for Application {
+ fn default() -> Self {
+ Self {
+ labs: vec![
+ Box::new(generate_window::Window::default()),
+ Box::new(encrypt_window::Window::default()),
+ Box::new(decrypt_window::Window::default()),
+ Box::new(compute_window::Window::default()),
+ ],
+ }
+ }
+}
+
+impl eframe::App for Application {
+ fn update(&mut self, ctx: &egui::Context, _frame: &mut eframe::Frame) {
+ for window in &mut self.labs {
+ egui::Window::new(window.get_name()).show(ctx, |ui| window.update(ui));
+ }
+ }
+}