Example #1
0
 public bool Change(string id, int hold, double money)
 {
     foreach (StockStateBox SSB in canvas.Children)
     {
         if (SSB.stockid == id)
         {
             SSB.hold.Text = hold.ToString();
             SSB.basemoney = money;
             NetSyncController.Handler().GetStockInfoNow();
             return(true);
         }
     }
     return(false);
 }
Example #2
0
        public void StockBoxInit()
        {
            StockStateBox.pre = null;
            canvasbox.Clear();
            canvas.Children.Clear();
            List <StockHoldEntity> SHEL;

            DBSyncController.Handler().StockHoldReadAll(out SHEL);
            foreach (StockHoldEntity SHE in SHEL)
            {
                StockStateBoxController.Handler().Add(SHE.id, SHE.name, SHE.hold, SHE.money);
            }
            NetSyncController.Handler().StartRefresh();
        }
Example #3
0
        public bool Add(string id, string name, int hold, double money)
        {
            double height = -5;

            if (StockStateBox.pre != null)
            {
                height = StockStateBox.pre.Margin.Top + StockStateBox.pre.Height;
            }
            StockStateBox box = new StockStateBox(new StockStateBox.ChangeValues(ID.change));

            box.Margin  = new Thickness(5, height + 10, 0, 0);
            box.stockid = id;

            string StockID = "";
            string netname;

            if (NetState.CheckName("0" + id, out netname) == NET_ERROR.NET_REQ_OK)
            {
                StockID            = "0" + id;
                box.StockName.Text = netname.Insert(2, "\r\n");
            }
            else if (NetState.CheckName("1" + id, out netname) == NET_ERROR.NET_REQ_OK)
            {
                StockID            = "1" + id;
                box.StockName.Text = netname.Insert(2, "\r\n");
            }
            else
            {
                MessageBox.Show("股票编号:" + id + "错误!");
                box.StockName.Text = name.Insert(2, "\r\n");
                return(false);
            }

            box.hold.Text = hold.ToString();
            box.basemoney = money;
            NetDataController.sync s = new NetDataController.sync(box.UpdataSync);
            if (!NetSyncController.Handler().StockRefreshAdd(StockID, ref s))
            {
                NetSyncController.Handler().StockRefreshDelete(StockID);
                NetSyncController.Handler().StockRefreshAdd(StockID, ref s);
            }

            canvas.Children.Add(box);
            canvasbox.Add(box);
            return(true);
        }
Example #4
0
        private void setNetDataController(string name)
        {
            if (NDCmark != null)
            {
                NDCmark.StopRefresh();
            }
            NetDataController NDC;

            if (NetDict.ContainsKey(name))
            {
                NDC = NetDict[name];
                NetSyncController.setNetDataController(ref NDC);
            }
            else
            {
                NDC = new NetDataController();
                NetDict.Add(name, NDC);
                NetSyncController.setNetDataController(ref NDC);
            }
            NDC.StartRefresh();
            NDCmark = NDC;
        }