-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainWindow.xaml.cs
129 lines (111 loc) · 3.6 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
using FastFood.Entites.Users;
using FastFood.Enums;
using FastFood.Pages.AddProducts;
using FastFood.Pages.AlItems;
using FastFood.Pages.ColdDrinks;
using FastFood.Pages.Disserts;
using FastFood.Pages.Foods;
using FastFood.Pages.HotDrinks;
using FastFood.Pages.OrderPages;
using System.Windows;
using System.Windows.Input;
namespace FastFood;
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public static User User { get; set; } = new User();
public MainWindow(IdentityRole Role, long userId)
{
InitializeComponent();
Check(Role, userId);
}
private void Check(IdentityRole Role, long userId)
{
// Is_Admin
User.Role = Role;
User.Id = userId;
if (User.Role is IdentityRole.Admin)
{
rbCreateProducts.Visibility = Visibility.Visible;
PageResultNavigator.Visibility = Visibility.Collapsed;
drResult.Visibility = Visibility.Collapsed;
}
else
{
rbCreateProducts.Visibility = Visibility.Collapsed;
PageResultNavigator.Visibility = Visibility.Visible;
drResult.Visibility = Visibility.Visible;
}
}
private void btnMinimize_Click(object sender, RoutedEventArgs e)
{
this.WindowState = WindowState.Minimized;
}
private void btnMaximize_Click(object sender, RoutedEventArgs e)
{
if (this.WindowState == WindowState.Maximized)
this.WindowState = WindowState.Normal;
else this.WindowState = WindowState.Maximized;
}
private void btnClose_Click(object sender, RoutedEventArgs e)
{
Application.Current.Shutdown();
}
private void brDragable_MouseDown(object sender, MouseButtonEventArgs e)
{
this.DragMove();
}
private void rbColdDrinks_Click(object sender, RoutedEventArgs e)
{
ColdDrinksPage coldDrinksPage = new ColdDrinksPage(User.Id);
PageNavigator.Content = coldDrinksPage;
ConnectOrderPage();
}
private void rbHotDrinks_Click(object sender, RoutedEventArgs e)
{
HotDrinksPage hotDrinksPage = new HotDrinksPage(User.Id);
PageNavigator.Content = hotDrinksPage;
ConnectOrderPage();
}
private void rb_Food_Click(object sender, RoutedEventArgs e)
{
FoodPage foodPage = new FoodPage(User.Id);
PageNavigator.Content = foodPage;
ConnectOrderPage();
}
private void rb_AllItems_Click(object sender, RoutedEventArgs e)
{
AllItemsPage allItemsPage = new AllItemsPage(User.Id);
PageNavigator.Content = allItemsPage;
ConnectOrderPage();
}
private void rbDisserts_Click(object sender, RoutedEventArgs e)
{
DissertsPage dissertsPage = new DissertsPage(User.Id);
PageNavigator.Content = dissertsPage;
ConnectOrderPage();
}
private void rbCreateProduct_Click(object sender, RoutedEventArgs e)
{
PageResultNavigator.Visibility = Visibility.Collapsed;
CreateProductPage createProductPage = new CreateProductPage();
PageNavigator.Content = createProductPage;
}
private void rbLogout_Click(object sender, RoutedEventArgs e)
{
LoginWindow loginWindow = new LoginWindow();
loginWindow.Show();
this.Close();
}
private void ConnectOrderPage()
{
OrderPage orderPage = new OrderPage(User.Id);
PageResultNavigator.Content = orderPage;
}
private void PayForOrders_Click(object sender, RoutedEventArgs e)
{
OrderPage orderPage = new(User.Id);
}
}