This repository was archived by the owner on Nov 19, 2025. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathFormShop.cs
More file actions
80 lines (70 loc) · 2.32 KB
/
Copy pathFormShop.cs
File metadata and controls
80 lines (70 loc) · 2.32 KB
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
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 Kursova_kurs2_part2
{
public partial class FormShop : Form
{
private Themes currentTheme = Themes.Light;
private Shop shopManager;
private string filePath = @"D:\Для університету\Kursova_kurs2_part2\ProductsInShop.json";
public FormShop()
{
InitializeComponent();
shopManager = new Shop();
try
{
shopManager.ReadJSON(filePath);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void FormShop_Load(object sender, EventArgs e)
{
Theme.SetTheme(this, currentTheme);
}
private void btnProducts_Click(object sender, EventArgs e)
{
FormProducts form = new FormProducts(currentTheme, shopManager);
form.ShowDialog();
}
private void btnSoldProducts_Click(object sender, EventArgs e)
{
FormSoldProducts form = new FormSoldProducts(currentTheme, shopManager);
form.ShowDialog();
}
private void btnAudit_Click(object sender, EventArgs e)
{
MessageBox.Show(shopManager.ConductAudit(), "Audit", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
private void cbDarkMode_CheckedChanged(object sender, EventArgs e)
{
if (!Theme.IsDarkThemeEnabled())
{
currentTheme = Themes.Dark;
Theme.SetTheme(this, currentTheme);
}
else
{
currentTheme = Themes.Light;
Theme.SetTheme(this, currentTheme);
}
}
private void btnExit_Click(object sender, EventArgs e)
{
if (MessageBox.Show("Do you want to save the changes, if any?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
shopManager.WriteJSON(filePath);
}
Application.Exit();
}
}
}