public ItemPanel(FileDataFeed fileData, string _filePath, GraphControl _control) { filePath = _filePath; Feed = fileData; graphControl = _control; InitializeComponent(); }
void PrintDataFunc(string fileName, FileDataFeed fileData) { if (UseUIWindow == true) { panel = new ItemPanel(fileData, fileName, graph) { Dock = DockStyle.Fill }; var panelThread = new Thread(() => { AddItemPanel(panel); }); panelThread.SetApartmentState(ApartmentState.STA); panelThread.Start(); } }
void btnUpload_Click(object sender, EventArgs e) { var filePath = string.Empty; using (OpenFileDialog openFileDialog = new OpenFileDialog()) { openFileDialog.RestoreDirectory = true; if (openFileDialog.ShowDialog() == DialogResult.OK) { filePath = openFileDialog.FileName.Substring(openFileDialog.FileName.LastIndexOf('\\') + 1); FileDataFeed fileData = new FileDataFeed(filePath); ConcurrentQueue <StockData> AAPLDataQueue = new ConcurrentQueue <StockData>(); graph.SetActionsControlVisible(); var thread = new Thread(() => { PrintDataFunc(filePath, fileData); }); thread.SetApartmentState(ApartmentState.STA); thread.Start(); } } }