private void InitializeControl() { TotalCovidContent = new CovidContent(); Worker = new BackgroundWorker(); Worker.DoWork += Worker_DoWork; Worker.RunWorkerCompleted += Worker_RunWorkerCompleted; mcb_location.Items.AddRange(Enum.GetNames(typeof(Sido))); mcb_location.SelectedIndex = 0; }
private void SetContentOnDashBoard() { // no data if (!SidosData.IsAny()) { return; } var selectedSido = SidosData.Where(sido => sido.Gubun == mcb_location.Text).Select(sido => { return(new { Date = $"{sido.CreateDt:d}", Sido = sido }); }); // get difference values var content = new CovidContent(); foreach (var sido in selectedSido) { if (sido.Date == SelectedDate) { content.InitializeData(sido.Sido, Type.Current); } else { content.InitializeData(sido.Sido, Type.Previous); } } // todo - refactoring // set graph cg_def.CircleTextIn = $"{content:DEF}"; cg_death.CircleTextIn = $"{content:DEATH}"; cg_isollng.CircleTextIn = $"{content:ISOLING}"; cg_isolclear.CircleTextIn = $"{content:ISOLCLEAR}"; ClearCircleProperty(cg_def); cg_def.MaxValue = TotalCovidContent.DefCnt.Value; cg_def.Value = content.DefCnt.Value; ClearCircleProperty(cg_death); cg_death.MaxValue = TotalCovidContent.DeathCnt.Value; cg_death.Value = content.DeathCnt.Value; ClearCircleProperty(cg_isollng); cg_isollng.MaxValue = TotalCovidContent.IsolIngCnt.Value; cg_isollng.Value = content.IsolIngCnt.Value; ClearCircleProperty(cg_isolclear); cg_isolclear.MaxValue = TotalCovidContent.IsolClearCnt.Value; cg_isolclear.Value = content.IsolClearCnt.Value; // set total dashboard db_total.Title = nameof(Sido.합계); db_total.DefCnt = $"{TotalCovidContent:DEF}"; db_total.DeathCnt = $"{TotalCovidContent:DEATH}"; db_total.Isoling = $"{TotalCovidContent:ISOLING}"; db_total.IsolClear = $"{TotalCovidContent:ISOLCLEAR}"; db_total.Rate = $"{TotalCovidContent:RATE}"; // set selected location dashboard db_location.DefCnt = cg_def.CircleTextIn; db_location.DeathCnt = cg_death.CircleTextIn; db_location.Isoling = cg_isollng.CircleTextIn; db_location.IsolClear = cg_isolclear.CircleTextIn; db_location.Rate = $"{content:RATE}"; }