// Private Methods (9) private void ButtonAdd_Click(object sender, EventArgs e) { if (LvStocks.SelectedItems.Count == 0) return; Stock selectedStock = Program.StockSource[(int)LvStocks.SelectedItems[0].Tag]; //如果UserStocks中已包含, 则返回主界面, 并选择此Stock if (Program.UserData.Stocks.Contains(selectedStock.Area + selectedStock.Code)) { StockTag = selectedStock.Area + selectedStock.Code; Close(); return; } selectedStock.ShowInTitleBar = true; FrmStockEdit frmEdit = new FrmStockEdit(selectedStock, true); frmEdit.Top = Top; frmEdit.Left = Left + Width; if (frmEdit.ShowDialog(this) != DialogResult.OK) return; DialogResult = DialogResult.OK; Close(); }
private void MiEditStock_Click(object sender, EventArgs e) { Stock stock = Program.UserData.Stocks[GvMain.CurrentRow.Tag] as Stock; FrmStockEdit frmEdit = new FrmStockEdit(stock, false); frmEdit.StartPosition = FormStartPosition.CenterParent; if (frmEdit.ShowDialog(this) == DialogResult.OK) UpdateGvMain(stock); }