Skip to content

Instantly share code, notes, and snippets.

View damirarh's full-sized avatar

Damir Arh damirarh

View GitHub Profile
@damirarh
damirarh / UpdateAWStats.ps1
Created October 4, 2015 14:05
Script for downloading IIS logs from Azure and updating AWStats
# FTP details
$ftpServer = ''
$ftpUsername = ''
$ftpPassword = ''
# local paths
$perlPath = 'C:\Perl\bin\perl.exe'
$awstatsPath = 'C:\WWW\Internal\awstats-7.3\wwwroot\cgi-bin\awstats.pl'
$downloadDir = 'C:\WWW\_Logs\Azure'
public class IncrementalLoadingBehavior : Behavior<LongListSelector>
{
public ICommand LoadCommand { get; set; }
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.ItemRealized += OnItemRealized;
}
<i:Interaction.Behaviors>
<b:IncrementalLoadingBehavior LoadCommand="{Binding LoadCommand}" />
</i:Interaction.Behaviors>
<phone:LongListSelector cal:Message.Attach="[Event ItemRealized]=[Action LoadMoreItems($eventArgs)]" />
public class IncrementalLoadingTrigger : TriggerBase<LongListSelector>
{
protected override void OnAttached()
{
base.OnAttached();
AssociatedObject.ItemRealized += OnItemRealized;
}
private void OnItemRealized(object sender, ItemRealizationEventArgs e)
{
<i:Interaction.Triggers>
<t:IncrementalLoadingTrigger>
<cal:ActionMessage MethodName="LoadMoreItems"/>
</t:IncrementalLoadingTrigger>
</i:Interaction.Triggers>
public class BooleanToVisibilityConverter : IValueConverter
{
public bool Inverted { get; set; }
public object Convert(object value, Type targetType, object parameter, string language)
{
if (!(value is bool))
{
return Visibility.Collapsed;
}
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<ProgressBar Value="{Binding Progress}"
Minimum="0"
Maximum="1"
Visibility="{Binding Initialized, Converter={StaticResource InvertedBoolToVisibilityConverter}}"/>
<TextBlock Text="{Binding Text}"
TextWrapping="Wrap"
Visibility="{Binding Initialized, Converter={StaticResource BoolToVisibilityConverter}}"
Style="{StaticResource BasicTextStyle}" />
</Grid>
public ViewModel()
{
Init();
}
private async void Init()
{
var file = await Package.Current.InstalledLocation.GetFileAsync(@"Assets\Text.txt");
Text = await FileIO.ReadTextAsync(file);
}
private readonly Task _initializingTask;
public ViewModel()
{
_initializingTask = Init();
}
private async Task Init()
{
var file = await Package.Current.InstalledLocation.GetFileAsync(@"Assets\Text.txt");