Пример #1
0
        private void onClickManagementCockpit(object sender, RibbonControlEventArgs e)
        {
            //Historische Daten auswählen
            Konfigurator view = new Konfigurator();

            view.ShowDialog();

            if (view.hasBeenCancelled == false)
            {
                LiveConnectors variant;
                DialogResult   dummyOrNot = MessageBox.Show("Möchten Sie mit echten Live-Daten (Ja) oder mit Dummy-Daten (Nein) arbeiten?", "Datentyp auswählen", MessageBoxButtons.YesNo);

                switch (dummyOrNot)
                {
                case DialogResult.Yes:
                    variant = LiveConnectors.OnVista;
                    break;

                case DialogResult.No:
                    variant = LiveConnectors.OnVistaDummy;
                    break;

                default:
                    variant = LiveConnectors.OnVistaDummy;
                    break;
                }

                TableObject       historicalDataTableObject = null;
                ProgressIndicator progress = new ProgressIndicator();
                progress.progressBar1.Maximum = 100;
                progress.progressBar1.Minimum = 0;
                progress.progressBar1.Value   = 20;
                progress.Show();
                progress.progressBar1.Value = 25;

                DataManager dataManager = DataManager.getInstance();

                progress.progressBar1.Value = 30;

                List <StockDataTransferObject> historicalRecords = dataManager.getHistoricalStockData
                                                                   (
                    view.comboBox1.SelectedItem.ToString(),
                    view.dateTimePicker1.Value,
                    view.dateTimePicker2.Value,
                    YahooFinanceAPI_Resolution.Daily
                                                                   );
                if (historicalRecords != null)
                {
                    historicalDataTableObject = new TableObject
                                                (
                        Globals.Factory.GetVstoObject
                        (
                            Globals.ThisAddIn.Application.ActiveWorkbook.ActiveSheet
                        ),
                        Globals.ThisAddIn.Application.Cells[1, 1],
                        historicalRecords,
                        dataManager.getColumnsToDraw_forYahooHistoricalData()
                                                );

                    progress.progressBar1.Value = 45;
                    historicalDataTableObject.changeSheetName("Historische Daten");
                    progress.progressBar1.Value = 55;
                    historicalDataTableObject.drawOnlyRelevantColumns();
                    progress.progressBar1.Value = 60;
                }

                //Livedaten
                TableObject liveDataTableObject = new TableObject(
                    Globals.Factory.GetVstoObject(
                        Globals.ThisAddIn.Application.ActiveWorkbook.ActiveSheet),
                    Globals.ThisAddIn.Application.Cells[1, 1]);

                progress.progressBar1.Value = 75;

                //liveDataTable.changeWorkbookName("OnVista-Livedaten");
                liveDataTableObject.createNewWorksheet("Livedaten");

                progress.progressBar1.Value = 80;
                dataManager.subscribeForLiveConnection(view.comboBox1.SelectedItem.ToString(), liveDataTableObject, variant);
                dataManager.pausePushWorkers(); //lege Worker schlafen
                progress.progressBar1.Value = 85;

                DiagramObject myDiagram = new DiagramObject(liveDataTableObject, historicalDataTableObject, view.comboBox1.SelectedItem.ToString());
                progress.progressBar1.Value = 90;

                Algo algorithmus = new Algo(Globals.ThisAddIn.ac, view.comboBox1.SelectedItem.ToString(), variant);
                Globals.ThisAddIn.SharePane.Visible = true;

                progress.progressBar1.Value = 95;
                progress.progressBar1.Value = 100;
                progress.Close();

                dataManager.pausePushWorkers(); //wecke Worker wieder auf
            }
        }
Пример #2
0
 public void subscribeForTableContent(DiagramObject diagramobject)
 {
     listOfSubscribers.Add(diagramobject);
 }