データが読み込まれるまで表示されなかったため、進行状況バーに問題がありました。
私のコードが正しいか間違っているかわかりません。この問題と私の頭を割るのを手伝ってください。どんな提案も私にとって本当に役に立ちますplzzz..
progressBar1.Minimum = 0;
progressBar1.Maximum = short.MaxValue;
progressBar1.Value = 0;
double value = 0;
UpdateProgressBarDelegate updatePbDelegate = new UpdateProgressBarDelegate(progressBar1.SetValue);
foreach (CDType ctp in dgAttributes.ItemsSource)
{
if (ctp.IsSelected == true)
{
//Mouse.OverrideCursor = Cursors.Wait;
var CDTypeID = ctp.TYPE_ID;
label3.Content = "Loading.." + CDTypeID;
SqlCommand sqlCommand = new SqlCommand(conn.ConnectionString);
sqlCommand.CommandType = CommandType.StoredProcedure;
sqlCommand.CommandText = "LOAD_DATA_SOURCE_SAVE";
sqlCommand.Parameters.AddWithValue("CDTYPE_ID", CDTypeID);
sqlConnection.Open();
sqlCommand.Connection = sqlConnection;
do
{
value += 1;
Dispatcher.Invoke(updatePbDelegate,
System.Windows.Threading.DispatcherPriority.Background,
new object[] { ProgressBar.ValueProperty, value });
//i'm not sure whether its correct way or not to give below line here..? I mean execute non query...since it was looping all the time untill its reaches Maximum value
//sqlCommand.ExecuteNonQuery();
}
while (progressBar1.Value != progressBar1.Maximum);
sqlConnection.Close();
//label3.Content = "Sucessfully Loaded..!";
}
}