Hi
Hi have a singleton clase who has this properties:
private string mensaje;
private bool isDownloading;
private string progress;
#region BINDING PROPERTIES
public string Mensaje
{
get
{
return mensaje;
}
set
{
mensaje = value;
RaisePropertyChanged(() => Mensaje);
}
}
public bool IsDownloading
{
get
{
return isDownloading;
}
set
{
isDownloading = value;
RaisePropertyChanged(() => IsDownloading);
}
}
public string ProgressValue
{
get
{
return progress;
}
set
{
progress = value;
RaisePropertyChanged(() => ProgressValue);
}
}
#endregion
I have a view who uses this singleton in a way like this
<Grid
Grid.Row="4"
Grid.ColumnSpan="2"
Opacity="{Binding Opacity}"
IsEnabled="{Binding IsOnline}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Label Grid.Row="0"
HorizontalOptions="StartAndExpand"
VerticalOptions="Center"
FontSize="Small"
Text="{Binding Mensaje, Source={x:Static helpers:DescargaOffline.Current}}"
IsVisible="{Binding ISDownloading, Source={x:Static helpers:DescargaOffline.Current}}"/>
<!-- PROGRESS-->
<!--<ProgressBar Grid.Row="1" Scale="5"
IsVisible="True"
IsEnabled="True"
Progress="{Binding ProgressValue, Source={x:Static helpers:DescargaOffline.Current}}"/>-->
<!-- INDICATOR -->
<ActivityIndicator
Grid.Row="1"
HeightRequest="100"
IsRunning="{Binding ISDownloading, Source={x:Static helpers:DescargaOffline.Current}}"
IsVisible="{Binding ISDownloading, Source={x:Static helpers:DescargaOffline.Current}}"
VerticalOptions="Center"
HorizontalOptions="EndAndExpand"/>
<Button
Grid.Row="2"
HorizontalOptions="FillAndExpand"
Command="{Binding DoDownloadCommand, Source={x:Static helpers:DescargaOffline.Current}}"
Text="DESCARGAR OFFLINE"
Style="{StaticResource DefaultActionButton}"/>
<StackLayout Grid.Row="3"
Margin="0,0,0,20"
Orientation="Horizontal" HorizontalOptions="CenterAndExpand">
<Label Text="ÚLTIMA DESCARGA " FontSize="Small"/>
<Label Text="XX/XX/XXXX" FontSize="Small"/>
</StackLayout>
</Grid>
In the singleton I start a big download process who moves from diferent functions. At the start of the launch I do IsDownloading = true and in the middle of the process I change the Mensaje value and the ProgressValue.
All works ok, except the progress bar or the activity indicator.
In the case of the progress bar the bar is showed but never changes. I have a function who changes the ProgressValue like this:
private void ProgressCalculator(int current, int max)
{
double val = (double)(current + 1) / (double)max;
ProgressValue = val.ToString().Replace('.', ',');
}
In the case of the activity indicator it never becomes visible.