/// <summary> /// /// </summary> /// <param name="type">操作类型-挂牌摘牌菜单区分</param> /// <param name="screenLocation">菜单位置</param> /// <param name="info">挂牌选中行信息</param> /// <param name="delistInfo">摘牌选中行信息</param> /// <param name="view">挂牌-摘牌表-用于挂牌摘牌刷新操作</param> public UseMenuTrip(OperationType type, Point screenLocation, ContractCategoryDic vo, SelfListed info, Transaction delistInfo, Control OwnerControl) { InitializeComponent(); m_commdityInfo = info; m_delistInfo = delistInfo; m_vo = vo; m_ownerControl = OwnerControl; Debug.Assert(m_ownerControl != null); Debug.Assert(m_vo != null); //挂牌 if (type == OperationType.PutBrand) { InitializePutBrandItems(); } else if (type == OperationType.DelistBrand) { InitializeDelistItems(); } //设置自定义菜单的风格重设 this.Renderer = new USeToolStripRendererEx(); this.Show(screenLocation); }
/// <summary> /// 挂牌右击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CellMouseDownPutBrand(object sender, DataGridViewCellMouseEventArgs e) { if (e.RowIndex < 0 || e.ColumnIndex < 0) { return; } if (e.Button == MouseButtons.Right) { SelfListed dataInfo = this.dataGridView_PutBrand.Rows[e.RowIndex].DataBoundItem as SelfListed; Debug.Assert(dataInfo != null); //挂牌的Cell右键Menu if ((DataGridView)sender == this.dataGridView_PutBrand) { UseMenuTrip trip = new UseMenuTrip(OperationType.PutBrand, Cursor.Position, m_contractVo, dataInfo, null, null, this); } } }
/// <summary> /// 挂牌事件订阅 /// </summary> /// <param name="obj"></param> private void MQTTService_UpdataCommodityInfoEvent(SelfListed obj, int type) { //根据返回来的状态选择绑定的表对象上展示 if (obj == null) { return; } if (this.InvokeRequired) { this.BeginInvoke(new Action <SelfListed, int>(MQTTService_UpdataCommodityInfoEvent), obj); return; } //挂牌更新 if (/*obj. == Helper.GetDescription(OperationType.PutBrand)*/ true) { UpdataPutBrandCommodityInfo(obj); } }
/// <summary> /// 挂牌仓库点击URL /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void CellContentClick_PutBrand(object sender, DataGridViewCellEventArgs e) { if (e.ColumnIndex < 0 || e.RowIndex < 0) { return; } if (e.ColumnIndex == 4) { this.dataGridView_PutBrand.Cursor = Cursors.Hand; SelfListed dataInfo = this.dataGridView_PutBrand.Rows[e.RowIndex].DataBoundItem as SelfListed; if (dataInfo == null) { return; } string url = Helper.GetURL(HTTPServiceUrlCollection.GetWareHouseInfoUrl, dataInfo.warehouseId); FormHouse fh = new FormHouse(); fh.SetHouse(url); fh.Show(); } }
/// <summary> /// 挂牌按钮点击 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void BtnPutBrand_MouseDown(object sender, MMouseEventArgs e) { //获取新表头-清空数据-拉取数据-添加-刷新 this.table.CheckTableHeader(TableStyleEnum.PutBrandTable); this.table.ClearData(); //拉取数据添加 SelfListed info = new SelfListed() { transTime = "2017-11-23", commAvailableQuantity = "10", commBrandName = "平水铜", premium = "300" }; for (int i = 0; i <= 2; i++) { table.InsertPutBrandData(info); } this.BeginInvoke((MethodInvoker) delegate { this.Draw(); }); }
/// <summary> /// 更新挂牌信息 /// </summary> /// <param name="obj"></param> private void UpdataPutBrandCommodityInfo(SelfListed obj) { m_commodityInfoList.Add(obj); }