private void btnConnect_Click(Object sender, EventArgs e) { SaveConfig(); if (btnConnect.Text == "打开") { var name = cbConn.Text; if (name.IsNullOrEmpty()) { return; } Dal = DAL.Create(name); XTrace.WriteLine("[{0}] [{1}] {2}", Dal.ConnName, Dal.DbType, Dal.ConnStr); _DS = new DataSimulation <DemoEntity>(); pnlSetting.Enabled = false; pnlAction.Enabled = true; btnConnect.Text = "关闭"; } else { _DS = null; pnlSetting.Enabled = true; pnlAction.Enabled = false; btnConnect.Text = "打开"; } }
public override void OnEnter() { base.OnEnter(); MasterStageParam master_stage = simulator.masterStage.list.Find(p => p.stage_id == stage_id.Value); DataSimulation dataSimulation = new DataSimulation(); dataSimulation.SetSaveFilename("data_simulation"); if (dataSimulation.LoadMulti()) { DataSimulationParam param = dataSimulation.list.Find(p => p.stage_id == stage_id.Value && p.level == level.Value); if (param == null) { param = new DataSimulationParam(); param.stage_id = stage_id.Value; param.level = level.Value; dataSimulation.list.Add(param); } param.count += 1; switch (wave.Value) { case 1: param.wave_1 += 1; break; case 2: param.wave_2 += 1; break; case 3: param.wave_3 += 1; break; case 4: param.wave_4 += 1; break; case 5: param.wave_5 += 1; break; } if (is_boss.Value) { param.arrive_boss += 1; } if (is_clear.Value) { param.clear += 1; param.clear_play_count += play_count.Value; param.clear_reload_count += reload_count.Value; } } dataSimulation.Save(); Finish(); }