public static DatabaseDataBank getInstance(MainWindow mainWindow) { if (instance == null) { instance = new DatabaseDataBank(mainWindow); } return(instance); }
public void MyAction(string commandName) { mainWindow.tableDock.Background = new SolidColorBrush(Color.FromRgb(217, 133, 59)); mainWindow.importDock.Background = new SolidColorBrush(Color.FromRgb(217, 133, 59)); mainWindow.stockChartDock.Background = new SolidColorBrush(Color.FromRgb(217, 133, 59)); mainWindow.tableMenuTop.Visibility = System.Windows.Visibility.Hidden; mainWindow.importMenuTop.Visibility = System.Windows.Visibility.Hidden; mainWindow.portfolioMenuTop.Visibility = System.Windows.Visibility.Hidden; mainWindow.bankImport.Background = Brushes.Transparent; mainWindow.stockImport.Background = Brushes.Transparent; mainWindow.bankDatabase.Background = Brushes.Transparent; mainWindow.stockDatabase.Background = Brushes.Transparent; mainWindow.stockChart.Background = Brushes.Transparent; mainWindow.stockDatagrid.Background = Brushes.Transparent; if (commandName == "bankImportPushed") { ImportPageBank.getInstance(mainWindow).setUserStatistics(mainWindow.getCurrentUser()); mainWindow.MainFrame.Content = ImportPageBank.getInstance(mainWindow); mainWindow.importMenuTop.Visibility = System.Windows.Visibility.Visible; mainWindow.importDock.Background = new SolidColorBrush(Color.FromRgb(198, 61, 15)); mainWindow.bankImport.Background = new SolidColorBrush(Color.FromRgb(255, 140, 105)); } else if (commandName == "stockImportPushed") { ImportPageStock.getInstance(mainWindow).setUserStatistics(mainWindow.getCurrentUser()); mainWindow.MainFrame.Content = ImportPageStock.getInstance(mainWindow); mainWindow.importMenuTop.Visibility = System.Windows.Visibility.Visible; mainWindow.importDock.Background = new SolidColorBrush(Color.FromRgb(198, 61, 15)); mainWindow.stockImport.Background = new SolidColorBrush(Color.FromRgb(255, 140, 105)); } else if (commandName == "bankDatabasePushed") { DatabaseDataBank.getInstance(mainWindow).setTableAttributes(); mainWindow.MainFrame.Content = DatabaseDataBank.getInstance(mainWindow); mainWindow.tableMenuTop.Visibility = System.Windows.Visibility.Visible; mainWindow.tableDock.Background = new SolidColorBrush(Color.FromRgb(198, 61, 15)); mainWindow.bankDatabase.Background = new SolidColorBrush(Color.FromRgb(255, 140, 105)); } else if (commandName == "stockDatabasePushed") { DatabaseDataStock.getInstance(mainWindow).setTableAttributes(); mainWindow.MainFrame.Content = DatabaseDataStock.getInstance(mainWindow); mainWindow.tableMenuTop.Visibility = System.Windows.Visibility.Visible; mainWindow.tableDock.Background = new SolidColorBrush(Color.FromRgb(198, 61, 15)); mainWindow.stockDatabase.Background = new SolidColorBrush(Color.FromRgb(255, 140, 105)); } else if (commandName == "stockChartPushed") { StockChart stockChart = new StockChart(mainWindow); mainWindow.MainFrame.Content = stockChart; mainWindow.portfolioMenuTop.Visibility = System.Windows.Visibility.Visible; mainWindow.stockChartDock.Background = new SolidColorBrush(Color.FromRgb(198, 61, 15)); mainWindow.stockChart.Background = new SolidColorBrush(Color.FromRgb(255, 140, 105)); } else if (commandName == "stockDatagridPushed") { mainWindow.MainFrame.Content = new StockDataGrid(mainWindow); mainWindow.portfolioMenuTop.Visibility = System.Windows.Visibility.Visible; mainWindow.stockChartDock.Background = new SolidColorBrush(Color.FromRgb(198, 61, 15)); mainWindow.stockChart.Background = new SolidColorBrush(Color.FromRgb(255, 140, 105)); } else if (commandName == "Exit") { mainWindow.Close(); } }