示例#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();
        }
示例#2
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();
 }