Beispiel #1
0
        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            DrawDataController DDC = new DrawDataController((int)(hold.Width), (int)(hold.Height));

            hold.Source = Adapter.ImageAdapter.ImageConvert(DDC.GetImage());
            List <StockHoldEntity> SHEL;

            UserPanelController.Handler().DBControllerByName(name).StockHoldReadAll(out SHEL);
            List <string> idl = SHEL.Select(s => s.id).ToList();

            NetState.IdConvert(ref idl);
            List <DrawPieEntity> DPEL = new List <DrawPieEntity>();
            DrawPieEntity        DPE  = new DrawPieEntity();

            foreach (StockHoldEntity SHE in SHEL)
            {
                string id = idl.Where(s => s.Substring(1) == SHE.id).First();
                if (id == null)
                {
                    continue;
                }
                StockView sv = new StockView(SHE.name, id);
                list.Add(sv);
                stockcolor.Add(sv.StockID, sv.brush.Color);
                DPE.name  = SHE.name;
                DPE.money = SHE.hold * NetState.PriceGet(sv.StockID);
                DPE.color = Adapter.ImageAdapter.ColorConvert(sv.brush.Color);
                DPEL.Add(DPE);
            }
            DDC = new DrawDataController((int)(pie.Width), (int)(pie.Height));
            DDC.DrawPieChart(DPEL);
            pie.Source = Adapter.ImageAdapter.ImageConvert(DDC.GetImage());
            this.StockList.Items.Refresh();
        }
Beispiel #2
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            //if (user.Content.ToString() != "(" + DBSyncController.Handler().GetUserName() + ")")
            //{
            //    MessageBox.Show("用户已改变");
            //    this.Close();
            //    return;
            //}
            List <StockHoldEntity> SHEL;

            DBC.StockHoldReadAll(out SHEL);
            if (SHEL.Count == 0)
            {
                MessageBox.Show("无任何股票");
                return;
            }
            idl = SHEL.Select(s => s.id).ToList();
            NetState.IdConvert(ref idl);

            DateTime date;
            int      days;

            try
            {
                date = Convert.ToDateTime(StartDate.Text);
                if (date > DateTime.Now)
                {
                    throw new Exception();
                }
                days = Convert.ToInt32(DateLong.Text);
            }
            catch (Exception)
            {
                MessageBox.Show("请输入正确的日期");
                return;
            }
            ThreadDate td = new ThreadDate();

            td.date   = date;
            td.days   = days;
            td.Width  = (int)yield.Width;
            td.Height = (int)yield.Height;

            Thread get = new Thread(new ParameterizedThreadStart(ThreadImageGet));

            get.Start(td);
        }