private void receiveMessage(object sender, MessageEvent e) { if (e.type.Contains("wpf")) { if (e.value.Contains("mainwindow")) { firstWindow.Hide(); mainWindow.Show(); } else if (e.value.Contains("firstwindow")) { mainWindow.Hide(); firstWindow.updateLast(databaseManager.getLastProjects()); firstWindow.Show(); } } else if (e.type.Contains("exit")) { Application.Current.Shutdown(); } else if (e.type.Contains("database_add")) { databaseManager.insertFile(e.value.ToString()); } else if (e.type.Contains("open")) { Console.WriteLine(e.value.ToString()); firstWindow.Hide(); mainWindow.openFile(e.value.ToString()); mainWindow.Show(); } }
public App() { databaseManager = new DatabaseManager(); firstWindow = new FirstWindow(); firstWindow.message += receiveMessage; firstWindow.updateLast(databaseManager.checkProjects()); mainWindow = new MainWindow(); mainWindow.message += receiveMessage; App.Current.MainWindow = firstWindow; firstWindow.Show(); }