This commit is contained in:
Rene Schwarz
2021-04-19 06:35:17 +02:00
parent e220c09ec3
commit 981ad26b1b
59 changed files with 1198 additions and 273 deletions

View File

@@ -5,20 +5,21 @@ using System.Text;
namespace Server_Dashboard {
class DashboardModuleViewModel : BaseViewModel {
public ObservableCollection<DashboardModule> ModuleList { get; set; }
public ObservableCollection<DashboardModule> Modules { get; set; }
public DashboardModuleViewModel() {
ModuleList = new ObservableCollection<DashboardModule>();
Modules = new ObservableCollection<DashboardModule>();
for (int i = 0; i < 10; i++) {
ModuleList.Add(new DashboardModule(false) {
Modules.Add(new DashboardModule(true) {
ModulName = "TestModule",
Creator = "Username",
ModuleIcon = "../../Assets/Images/PlaceHolderModuleLight.png",
CreationDate = DateTime.Now.ToString(),
ServerInfo = new ServerInformation() {
CpuTemp = "88.88",
DeployDate = DateTime.Now.ToString(),
GpuTemp = "69.69",
HostName = "crylia",
OSHostName = "Ubuntu",
ServerName = "Ubuntu",
OSUserName = "crylia",
PrivateIpAdress = "192.168.1.1",
PublicIpAdress = "85.69.102.58",
Uptime = DateTime.Now.ToString()

View File

@@ -1,9 +1,13 @@
using System.Diagnostics;
using Server_Dashboard.Views.DashboardPages.ModuleCRUD;
using System.Collections.ObjectModel;
using System.Diagnostics;
using System.Windows;
using System.Windows.Input;
namespace Server_Dashboard {
class DashboardViewModel : BaseViewModel {
private string userName = "Username";
private DashboardModuleViewModel dmvm = new DashboardModuleViewModel();
public string UserName {
get { return userName; }
@@ -14,14 +18,38 @@ namespace Server_Dashboard {
}
}
private ObservableCollection<DashboardModule> modules;
public ObservableCollection<DashboardModule> Modules {
get { return modules; }
set {
if(value != modules)
modules = value;
OnPropertyChanged(nameof(modules));
}
}
public DashboardViewModel() {
OpenLinkCommand = new RelayCommand(OpenLink);
CreateNewModuleCommand = new RelayCommand(CreateNewModule);
Modules = dmvm.Modules;
}
public ICommand OpenLinkCommand { get; set; }
public ICommand CreateNewModuleCommand { get; set; }
private void OpenLink(object param) {
Process.Start(new ProcessStartInfo((string)param) { UseShellExecute = true });
}
private void CreateNewModule(object param) {
CreateModulePopup cmp = new CreateModulePopup {
DataContext = this
};
cmp.Owner = Application.Current.MainWindow;
cmp.WindowStartupLocation = WindowStartupLocation.CenterOwner;
cmp.ShowDialog();
}
}
}