/// <summary> /// 登录成功 /// </summary> public void LoginSuccess() { DataTable dt = SQLiteHelper.ExecuteDataset(SQLiteHelper.DBPath, CommandType.Text, "select * from AutoStopLoss where UserID='" + UserInfoHelper.UserId + "'").Tables[0]; if (dt != null && dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { string ContractID = dr["ContractID"].ToString(); string PostionID = dr["PostionID"].ToString(); object lossprice = dr["LossPrice"]; double losspriced = 0; if (lossprice != null) { losspriced = Convert.ToDouble(lossprice); } object newprice = dr["NewPrice"]; double newpriced = 0; if (lossprice != null) { newpriced = Convert.ToDouble(lossprice); } if (!ContractVariety.ContracPostionID.ContainsKey(ContractID)) { continue;//不在设置的合约中就不添加进来 } ContractVariety.ContracPostionID[ContractID].Add(PostionID); if (!ContractVariety.PostionPrice.ContainsKey(PostionID)) { ContractVariety.PostionPrice.Add(PostionID, new AutoLossPrice()); } ContractVariety.PostionPrice[PostionID].LossPrice = losspriced; ContractVariety.PostionPrice[PostionID].NewPrice = newpriced; } } LoginBtnIsEnabled = true; //给界面自选赋值 SetOptionalList(); _mainVM.TradePanelViewModel = TradePanelViewModel.GetInstance(_mainVM); _mainVM.TradeLoginVisibility = Visibility.Collapsed; ContractVariety.IsLoginSuccess = true; UserInfoHelper.IsHaveLogin = true; SendPotion(false); SendOrderCancel(false); SendConditionBill(false); ToDayTrade(false); //给界面资金赋值 var fundsmodel = FundsViewModel.GetInstance(); var dataModel = TradeInfoHelper.FundsDataModel; fundsmodel.LoginName = UserInfoHelper.LoginName; fundsmodel.AccountName = UserInfoHelper.AccountName; fundsmodel.AbleFund = dataModel.able_fund; fundsmodel.CurrentEquity = dataModel.current_equity; fundsmodel.Floatprofitloss = dataModel.float_profit_loss; if (_mainVM.SelectItemViewModel != null) { TransactionViewModel.Instance().SetXamlValues(_mainVM.SelectItemViewModel); } }
public TradePanelViewModel(MainViewModel mainVM) { _mainVM = mainVM; TransactionViewModel = TransactionViewModel.Instance(); TransactionPannel = new TransactionPannelViewModel(); ConditionBill = UCConditionBillViewModel.Instance(); PositionAll = PositionAllViewModel.Instance(); OrderCancel = OrderCancelViewModel.Instance(); TodayTrader = TodayTraderViewModels.Instance(); FundsViewModel = FundsViewModel.GetInstance(); }