I have a long running WCF service and a client that consumes it via WPF. Am using a Progress Bar to notify the client of the percentage completion for a particular process (a method in WCF: I need to be able to display the percentage based on the looping counter in the service)
I have used Background Worker to display progress percentage but it does not display the progress correctly. (displays just 0 and 100 not the in between values) Everything works fine in DEBUG mode but not in RELEASE mode! (Progress bar is updated sequentially in DEBUG mode)
I tried using callbacks/wsDualHttpBinding but have some difficulty in getting this incorporated for all clients. So, had to drop this option.
working on async/await. I have googled quite a few links but nothing helps with my problem.
Please guide me on how to get the current/running value from a method that is not complete yet from a WCF service so I could populate the progress bar percentage based on this value. (in between values)
P.S: WCF service uses wsHttpBinding
sample code below:
public Progress(){// Start the BackgroundWorker. myBGWorker.WorkerReportsProgress = true; myBGWorker.WorkerSupportsCancellation = false; myBGWorker.DoWork += myBGWorker_DoWork; myBGWorker.ProgressChanged += myBGWorker_ProgressChanged;}public void ShowProgress(){ myBGWorker.RunWorkerAsync();}private void myBGWorker_DoWork(object sender, DoWorkEventArgs e){// fetches a static value from the service string value = _client.Progress();int p=0;for (int i = 1; i <= 100; i++){// Report progress. p = Convert.ToInt32(_client.Progress()); _logger.Debug("Progress5:" + p.ToString()); myBGWorker.ReportProgress(p, i);}}private void myBGWorker_ProgressChanged(object sender, ProgressChangedEventArgs e){this.Dispatcher.BeginInvoke(new Action(delegate{ progressBar1.Value = e.ProgressPercentage;}), DispatcherPriority.ContextIdle);}
Hello,
I have a number of progress bars in a bound listbox (MVVM) and I would like to animate each Progress Bar from 0 to "Value" when the Value property changes in the item it is bound to. I understand that I should be using the VisualStateManager but am unsure how to do this with an item in a bound list (I have very little experience with the VisualStateManager and animations).
Would this be possible?
Thanks.
var wolist = Newtonsoft.Json.JsonConvert.DeserializeObject<List<workorder>>(e2.Result);
List<SaWOProcess> list =
new
List<SaWOProcess>();
lbSaProcess.ItemsSource =
null
;
foreach
(var item
in
wolist)
{
double
v = 0.0;
double
qty = item.Qty ?? 0.0;
if
(item.CompletedQty !=
null
)
{
v = (
double
)item.CompletedQty / (
double
)item.Qty * 100.0;
}
list.Add(
new
SaWOProcess() { Qty = qty, WOId = item.Id, WOName = item.WOName, CurrentValue = Convert.ToInt32(v) , TotalInfo =
string
.Format(
"{0}/{1}"
, item.CompletedQty, qty) });
}
lbSaProcess.ItemsSource = list;
lbSaProcess.UpdateLayout();
<
UserControl.Resources
>
<
DataTemplate
x:Key
=
"dataTemplate"
>
<
Canvas
VerticalAlignment
=
"Center"
Margin
=
"10"
Height
=
"50"
>
<
TextBlock
Foreground
=
"#FF393838"
x:Name
=
"loadingPercentage"
VerticalAlignment
=
"Center"
Canvas.Top
=
"16"
Text
=
"{Binding WOName}"
FontSize
=
"15"
/>
<
telerik:RadProgressBar
x:Name
=
"pb"
Canvas.Top
=
"16"
VerticalAlignment
=
"Center"
Canvas.Left
=
"100"
Width
=
"500"
Height
=
"22"
Minimum
=
"0"
Value
=
"{Binding CurrentValue}"
Maximum
=
"100"
/>
<
TextBlock
Canvas.Left
=
"630"
Canvas.Top
=
"16"
VerticalAlignment
=
"Center"
Foreground
=
"#FF393838"
x:Name
=
"tbTotal"
Text
=
"{Binding TotalInfo}"
FontSize
=
"15"
/>
<
Button
x:Name
=
"btnViewDetail"
Canvas.Top
=
"16"
VerticalAlignment
=
"Center"
Tag
=
"{Binding WOId}"
Canvas.Left
=
"685"
HorizontalAlignment
=
"Right"
Foreground
=
"Black"
Content
=
"ViewDetail"
Click
=
"btnViewDetail_Click_1"
/>
</
Canvas
>
</
DataTemplate
>
</
UserControl.Resources
>
<
ListBox
Name
=
"lbSaProcess"
Grid.Row
=
"1"
ItemTemplate
=
"{StaticResource dataTemplate}"
BorderThickness
=
"0"
Width
=
"790"
Height
=
"750"
>
</
ListBox
>
public
class
SaWOProcess
{
public
int
WOId {
get
;
set
; }
public
string
WOName {
get
;
set
; }
public
int
CurrentValue {
get
;
set
; }
public
string
TotalInfo {
get
;
set
; }
public
double
Qty {
get
;
set
; }
}
Hi,
I have a RadTreeListView and on 'SelectionChanged' event of it, I am calling a webservice and populating the child nodes. Since this webservice takes some time to load , I am using a RadProgressBar to show 'loading' image. Once webservice is over, I am closing the progress bar. Progress bar closes but it doesnt enable the parent window.
<
telerik:RadProgressBar IsIndeterminate="True" Grid.Column="0" Margin="0,0,0,0" />
Thanks,
Divya