private async void UpdateStkBasicallyData_BarButtonItem1_ItemClick( object sender, DevExpress.XtraBars.ItemClickEventArgs e) { DBUpdate_barSubItem1.Enabled = false; CatchStkData cd = new CatchStkData(); string[] msgFormat = { "更新股票代碼中...UpdateStkCodeProgress%" }; ShowReportProgressMsg srpm = new ShowReportProgressMsg(stateListBox, msgFormat); //取得更新資料庫進度 Progress <RptStructure> progress = new Progress <RptStructure>(srpm.DisplayMsgToUserCtrl); try { await Task.Run(() => cd.MultiCatch(progress)); } catch (NullReferenceException nullEx) { stateListBox.Items.Add("股票代碼更新失敗!"); stateListBox.Items.Add(nullEx.Message); } UserControlItemUpdateAndRemove userControlItemUpdateAndRemove = new UserControlItemUpdateAndRemove(); userControlItemUpdateAndRemove.UpdateListBoxControlItem(stockListBox, stateListBox, notifyIcon1); DBUpdate_barSubItem1.Enabled = true; }
private void Form1_Load(object sender, EventArgs e) { UserControlItemUpdateAndRemove userControlItemUpdateAndRemove = new UserControlItemUpdateAndRemove(); userControlItemUpdateAndRemove.UpdateListBoxControlItem(stockListBox, stateListBox, notifyIcon1); }