Beispiel #1
0
        public void newSearch(string searchItem, DataWindow window)
        {
            searchItem = searchItem.ToUpper();
            List<double> data = webInteractor.Search(searchItem);
            List<Image> charts = new List<Image>();

            StockInfo info = new StockInfo();
            Dictionary<Util.TimeType, StockInfo> newStockInformation = Calculator.calculateAllStockInfo(data);
            foreach (Util.TimeType time in Util.Domain.TIMES)
            {
                newStockInformation[time].Graph = webInteractor.getGraph(time);
                //charts.Add(webInteractor.getGraph(time));
            }
            //Dictionary<Util.TimeType, StockInfo> newStockInformation = new Dictionary<DataMiner.Util.TimeType, StockInfo>();
            window.dealWithResults(searchItem, newStockInformation);
            numWindows++;
        }
        //Warning event fires wherever you click on the page of a tab
        private void newWindow(object sender, MouseButtonEventArgs e)
        {
            TabItem currentClick = sender as TabItem;

            //This point stuff is so that the new window is only triggered near the ACTUAL tab
            GeneralTransform transform = currentClick.TransformToAncestor(this);
            Point rootPoint = transform.Transform(new Point(0, 0));
            Point tabClick = e.GetPosition(this);

            if (Math.Abs(rootPoint.X - tabClick.X) > 20)
                return;
            //Clean up dynamically assigned events, so they are not triggered for this window
            currentClick.MouseDoubleClick -= newWindow;
            foreach (UIElement elem in hasEvents)
            {
                if ( (string)((TextBox)elem).Tag == currentClick.Header.ToString().ToUpper())
                {
                    ((TextBox)elem).MouseDown -= price_MouseDown;
                }
            }
            this.StockSymbolTabs.Items.Remove(currentClick);
            Dictionary<Util.TimeType, StockInfo> storedInfo = stockInformation[currentClick.Header.ToString()];
            DataWindow newWin = new DataWindow();
            newWin.dealWithResults(currentClick.Header.ToString(), storedInfo);
            newWin.Owner = this.Owner;
            newWin.Show();
        }