<controls:ChildWindow AutomationProperties.AutomationId="RA_CommonViews_PopLoading_controls_PopLoading" x:Name="ControlsPopLoading" x:Class="Microsoft.IT.Security.UI.RbacAdministration.ClientViews.CommonViews.PopLoading"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" >
<controls:ChildWindow.Template>
<ControlTemplate TargetType="controls:ChildWindow">
<Grid x:Name="Root" Margin="0" Background="Transparent">
<Grid x:Name="Overlay" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="0" Background="{TemplateBinding OverlayBrush}" Opacity="{TemplateBinding OverlayOpacity}"/>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0">
<TextBlock AutomationProperties.AutomationId="RA_CommonViews_PopLoading_controls_TextBlock10" FontSize="22" FontWeight="Bold" Foreground="DarkGray" Text="{TemplateBinding Title}"></TextBlock>
<ProgressBar Width="200" Height="20" IsIndeterminate="True" />
</StackPanel>
</Grid>
</ControlTemplate>
</controls:ChildWindow.Template>
</controls:ChildWindow>
CommonWrapper.SetBusyStatus = delegate(bool status)
{
lock (typeof(App))
{
if (status)
{
try
{
busyWcfApiCounter++;
popLoadingWindow.Show();
}
catch (Exception exception)
{
busyWcfApiCounter--;
if (busyWcfApiCounter <= 0)
{ busyWcfApiCounter = 0; }
}
}
else
{
busyWcfApiCounter--;
if (busyWcfApiCounter <= 0)
{
busyWcfApiCounter = 0;
try
{
popLoadingWindow.Close();
}
catch (Exception exception) { }
}
}
}
};
/// <summary>
/// static delegate to set this wcf wrapper's busy status
/// </summary>
public static Action<bool> SetBusyStatus;
/// <summary>
/// change this wcf wrapper's busy status to false while its present asychronus call was done
/// </summary>
public static Action<object, AsyncCompletedEventArgs> AsyncCallDone = delegate(object sender, AsyncCompletedEventArgs e)
{
if (SetBusyStatus != null)
{
SetBusyStatus(false);
}
};
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" >
<controls:ChildWindow.Template>
<ControlTemplate TargetType="controls:ChildWindow">
<Grid x:Name="Root" Margin="0" Background="Transparent">
<Grid x:Name="Overlay" HorizontalAlignment="Stretch" VerticalAlignment="Top" Margin="0" Background="{TemplateBinding OverlayBrush}" Opacity="{TemplateBinding OverlayOpacity}"/>
<StackPanel VerticalAlignment="Center" HorizontalAlignment="Center" Margin="0">
<TextBlock AutomationProperties.AutomationId="RA_CommonViews_PopLoading_controls_TextBlock10" FontSize="22" FontWeight="Bold" Foreground="DarkGray" Text="{TemplateBinding Title}"></TextBlock>
<ProgressBar Width="200" Height="20" IsIndeterminate="True" />
</StackPanel>
</Grid>
</ControlTemplate>
</controls:ChildWindow.Template>
</controls:ChildWindow>
CommonWrapper.SetBusyStatus = delegate(bool status)
{
lock (typeof(App))
{
if (status)
{
try
{
busyWcfApiCounter++;
popLoadingWindow.Show();
}
catch (Exception exception)
{
busyWcfApiCounter--;
if (busyWcfApiCounter <= 0)
{ busyWcfApiCounter = 0; }
}
}
else
{
busyWcfApiCounter--;
if (busyWcfApiCounter <= 0)
{
busyWcfApiCounter = 0;
try
{
popLoadingWindow.Close();
}
catch (Exception exception) { }
}
}
}
};
/// <summary>
/// static delegate to set this wcf wrapper's busy status
/// </summary>
public static Action<bool> SetBusyStatus;
/// <summary>
/// change this wcf wrapper's busy status to false while its present asychronus call was done
/// </summary>
public static Action<object, AsyncCompletedEventArgs> AsyncCallDone = delegate(object sender, AsyncCompletedEventArgs e)
{
if (SetBusyStatus != null)
{
SetBusyStatus(false);
}
};