public ButtonCommands(StockChart stockChart)
 {
     this.stockChart = stockChart;
     this.stockChart.PropertyChanged += new PropertyChangedEventHandler(test_PropertyChanged);
     timer1 = new DispatcherTimer();
     tik    = 60;
 }
Exemple #2
0
 public ButtonCommands(StockChart stockChart, string _action, MainWindow mainWindow)
 {
     action          = _action;
     this.mainWindow = mainWindow;
     this.stockChart = stockChart;
     this.stockChart.PropertyChanged += new PropertyChangedEventHandler(test_PropertyChanged);
     timer1 = new DispatcherTimer();
 }
 public void Execute(object parameter)
 {
     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;
     if (buttonContent.Equals("Import"))
     {
         mainWindow.MainFrame.Content        = ImportMainPage.getInstance(mainWindow);
         mainWindow.importMenuTop.Visibility = System.Windows.Visibility.Visible;
         mainWindow.importDock.Background    = new SolidColorBrush(Color.FromRgb(198, 61, 15));
     }
     else if (buttonContent.Equals("Database"))
     {
         mainWindow.MainFrame.Content       = TransactionMain.getInstance(mainWindow, mainWindow.getTableAttributes(), mainWindow.getAccounNumber());
         mainWindow.tableMenuTop.Visibility = System.Windows.Visibility.Visible;
         mainWindow.tableDock.Background    = new SolidColorBrush(Color.FromRgb(198, 61, 15));
     }
     else if (buttonContent.Equals("stockMarketData"))
     {
         if (mainWindow.webStockStopwatch.Elapsed == TimeSpan.FromMilliseconds(0))
         {
             mainWindow.webStockStopwatch.Start();
             StockChart stockChart = new StockChart();
             //stockChart.getNewStockData();
             //stockChart.refreshChartAttributes();
             mainWindow.MainFrame.Content           = stockChart;
             mainWindow.portfolioMenuTop.Visibility = System.Windows.Visibility.Visible;
             mainWindow.stockChartDock.Background   = new SolidColorBrush(Color.FromRgb(198, 61, 15));
         }
         else
         {
             if (mainWindow.webStockStopwatch.Elapsed <= TimeSpan.FromMinutes(1.5))
             {
                 MessageBox.Show("Please wait for " + (TimeSpan.FromMinutes(1.5) - mainWindow.webStockStopwatch.Elapsed) + " seconds!");
             }
             else
             {
                 mainWindow.webStockStopwatch.Stop();
                 mainWindow.webStockStopwatch.Reset();
             }
         }
     }
     else if (buttonContent.Equals("Exit"))
     {
         mainWindow.Close();
     }
 }
Exemple #4
0
 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();
     }
 }