private void button1_Click(object sender, EventArgs e) { if (changeValues != null) { if (T_From_Name.Text != BiStation.FromStation.Name || T_From_Loc.Text != BiStation.FromStation.Location || T_To_Name.Text != BiStation.ToStation.Name || T_To_Loc.Text != BiStation.ToStation.Location) { DialogResult messageboxResult = MessageBox.Show("确认变更?", "注意", MessageBoxButtons.YesNo, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2); if (messageboxResult == DialogResult.Yes) { //from Form1.StationAndLocation from = new Form1.StationAndLocation(BiStation.FromStation.ID.ToString(), T_From_Name.Text.Replace(" ", "").ToString(), T_From_Loc.Text.ToUpper()); //to Form1.StationAndLocation to = new Form1.StationAndLocation(BiStation.ToStation.ID.ToString(), T_To_Name.Text.Replace(" ", "").ToString(), T_To_Loc.Text.ToUpper()); NewBiStation = new Form1.BinoStation(from, to); Index_NewBiStation = new index_BinoStation(indexThis, NewBiStation); } } changeValues(this, EventArgs.Empty); //当窗体触发事件,传递自身引用 MessageBox.Show(BiStation.FromStation.Name + "-->" + T_From_Name.Text + System.Environment.NewLine + BiStation.FromStation.Location + "-->" + T_From_Loc.Text + System.Environment.NewLine + BiStation.ToStation.Name + "-->" + T_To_Name.Text + System.Environment.NewLine + BiStation.ToStation.Location + "-->" + T_To_Loc.Text, "已修改"); } }
public FormModif(int index, Form1.BinoStation B_S) { InitializeComponent(); indexThis = index; BiStation = B_S; T_From_Name.Text = BiStation.FromStation.Name; T_From_Loc.Text = BiStation.FromStation.Location; T_To_Name.Text = BiStation.ToStation.Name; T_To_Loc.Text = BiStation.ToStation.Location; }
public index_BinoStation(int Index, Form1.BinoStation BiStation) { this.index = Index; this.biStation = BiStation; }