/// <summary> /// Method to refresh all content panes. /// </summary> private void refreshContentPanels() { /* * Set width of left parent panel (which contains a panel for * settings and a panel for content). * The height is always stretched. */ if (currentResultType == "marketinfo") { leftParentPanel.Width = mainContentPanel.Width - menu.Width; rightPanel.Width = 0; rightPanelResults.updateSize(); } else { leftParentPanel.Width = ((mainContentPanel.Width - menu.Width) / 2) + 1; //Set width of right panel. rightPanel.Width = ((mainContentPanel.Width - menu.Width) / 2); rightPanelResults.updateSize(); } //Set height of right panel. leftPanel.Height = mainContentPanel.Height - marketPanel.Height; //Set height and width of right and left content. leftPanelResults.updateSize(); }
/// <summary> /// Method triggered when a news in list clicked /// </summary> /// <param name="sender"></param> /// <param name="e"></param> /// <param name="n"></param> private void news_clicked(object sender, System.EventArgs e, News n, int num) { // set colors setListColors(); for (int k = 0; k < listLabels.GetLength(1); k++) { listLabels[num, k].BackColor = c.mercuryBlue; listLabels[num, k].ForeColor = Color.White; } listItemClicked = num; setBlue = true; // load rightPanelResul as resultPanel ResultPanel temp = mw.rightPanelResults as ResultPanel; NewsReader newsPanel = new NewsReader(n, true); temp.Controls.Clear(); temp.setContent(newsPanel); temp.updateSize(); temp.Controls.Add(newsPanel); }
/// <summary> /// Method that handles all thread requests. /// </summary> /// <param name="sender"></param> /// <param name="resultType"></param> /// <param name="source"></param> /// <param name="n"></param> /// <param name="Market"></param> /// <param name="mainWindow"></param> private void fetchResultThread(Object sender, String resultType, String source, News n, String Market, object mainWindow) { ResultPanel panel = sender as ResultPanel; //Return result list of stocks if (resultType == "stocks") { try { //Initialize new result list ResultList list = new ResultList(resultType, source, mainWindow); //Invoke panel to clear its contents panel.Invoke((MethodInvoker)(() => panel.Controls.Clear())); panel.Controls.Clear(); //Set new contents of panel panel.setContent(list); //Update size of panel panel.updateSize(); //Invoke panel to add contents to panel panel.Invoke((MethodInvoker)(() => panel.Controls.Add(list))); } //Catch all exceptions catch (Exception e) {} } //Return result list of portfolio items else if (resultType == "portfolio") { try { ResultList list = new ResultList(resultType, source, mainWindow); panel.Invoke((MethodInvoker)(() => panel.Controls.Clear())); panel.Controls.Clear(); panel.setContent(list); panel.updateSize(); panel.Invoke((MethodInvoker)(() => panel.Controls.Add(list))); } catch (Exception e) {} } //Return result list of search results else if (resultType == "search") { try { ResultList list = new ResultList(resultType, source, mainWindow); panel.Invoke((MethodInvoker)(() => panel.Controls.Clear())); panel.Controls.Clear(); panel.setContent(list); panel.updateSize(); panel.Invoke((MethodInvoker)(() => panel.Controls.Add(list))); } catch (Exception e) {} } //Return info display of selected stock else if (resultType == "stockinfo") { try { InfoDisplay info = new InfoDisplay("stock", source, Market); panel.Invoke((MethodInvoker)(() => panel.Controls.Clear())); panel.Controls.Clear(); panel.setContent(info); panel.updateSize(); panel.Invoke((MethodInvoker)(() => panel.Controls.Add(info))); } catch (Exception e) {} } //Return info display of selected market else if (resultType == "marketinfo") { try { InfoDisplay info = new InfoDisplay("market", source, Market); panel.Invoke((MethodInvoker)(() => panel.Controls.Clear())); panel.Controls.Clear(); panel.setContent(info); panel.updateSize(); panel.Invoke((MethodInvoker)(() => panel.Controls.Add(info))); } catch (Exception e) {} } //Return news list else if (resultType == "news") { try { ResultList newsDisplay = new ResultList(resultType, source, mainWindow); panel.Invoke((MethodInvoker)(() => panel.Controls.Clear())); panel.Controls.Clear(); panel.setContent(newsDisplay); panel.updateSize(); panel.Invoke((MethodInvoker)(() => panel.Controls.Add(newsDisplay))); } catch (Exception e) {} } //Set loading of panel to false panel.setLoading(false); }