-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMainWindow.xaml.cs
More file actions
68 lines (58 loc) · 2.75 KB
/
MainWindow.xaml.cs
File metadata and controls
68 lines (58 loc) · 2.75 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
using MahApps.Metro.Controls;
using Pandora.DI;
using Pandora.MVVM.ViewModels;
using Pandora.MVVM.Views;
using System;
using System.Windows;
using System.Windows.Media;
namespace Pandora
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : MetroWindow
{
MainWindowViewModel mViewModel;
public string LogoPath = AppDomain.CurrentDomain.BaseDirectory + "/resources/drawable/logo.png";
public MainWindow()
{
InitializeComponent();
LocalServiceLocator serviceLocator = new LocalServiceLocator();
mViewModel = serviceLocator.MainWindow;
content.Content = mViewModel.Content.Value;
mViewModel.Content.PropertyChanged += (sender, e) => {
content.Content = mViewModel.Content.Value;
};
String userField = serviceLocator.UserViewModel.User.Value;
if (userField != null)
{
PersonName.Content = serviceLocator.UserViewModel.User.Value.Equals("Войдите для полного доступа к моделям") ? serviceLocator.UserViewModel.User.Value : "Выйти из: " + serviceLocator.UserViewModel.User.Value;
}
serviceLocator.UserViewModel.User.PropertyChanged += (sender, e) =>
{
PersonName.Content = serviceLocator.UserViewModel.User.Value.Equals("Войдите для полного доступа к моделям")? serviceLocator.UserViewModel.User.Value : "Выйти из: " + serviceLocator.UserViewModel.User.Value;
AddButton.Visibility = serviceLocator.UserViewModel.User.Value.Equals("realityfamily") ? Visibility.Visible : Visibility.Collapsed;
};
serviceLocator.ItemInfoViewModel.ChoosedItem.PropertyChanged += (sender, e) =>
{
InfoColumn.Width = new GridLength(serviceLocator.ItemInfoViewModel.ChoosedItem.Value != null ? 532 : 0);
};
}
private void PersonName_Click(object sender, RoutedEventArgs e)
{
if (new LocalServiceLocator().ApplicationConfig.HasMax()) {
new LocalServiceLocator().UserViewModel.LogOut();
}
}
private void AddButton_Click(object sender, RoutedEventArgs e)
{
new LocalServiceLocator().ItemInfoViewModel.ChoosedItem.Value = null;
if (mViewModel.Content.Value is UploadPage) {
mViewModel.Content.Value = new GroupPage(Color.FromArgb(255, 34, 44, 63), Color.FromArgb(255, 45, 55, 73), new LocalServiceLocator().MainPage.Groups);
} else
{
mViewModel.Content.Value = new UploadPage();
}
}
}
}