UWP エクスプローラからのドラッグ&ドロップ
channel9.msdn.com
ユーザーは待っていたドラッグアンドドロップ
UWP App ファイルエクスプローラからのドラックアンドドロップアンドオープン https://t.co/dNrOyZhmEm
— くコ:彡@衰退期 (@ideaki19) 2015, 5月 3
したサンプル
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}" AllowDrop="True" DragOver="Grid_DragOver"Drop="Grid_Drop"> <TextBlock x:Name="AATextBlock" FontFamily="MS PGothic" Text="Drag & Drop Text File" VerticalAlignment="Center" HorizontalAlignment="Center"/> <FontIcon/>
private void Grid_DragOver(object sender, DragEventArgs e) { e.AcceptedOperation = Windows.ApplicationModel.DataTransfer.DataPackageOperation.Copy; e.Handled = true; } private async void Grid_Drop(object sender, DragEventArgs e) { var d = e.GetDeferral(); var files = await e.DataView.GetStorageItemsAsync(); var file = files.First(); this.AATextBlock.Text = await FileIO.ReadTextAsync(file as IStorageFile); d.Complete(); }
はてなAPI ブックマークコメントのパーマリンクを取得する
はてなブックマークエントリー情報取得APIのレスポンスから作成することができます。
http://b.hatena.ne.jp/{user}/{timestamp}/#bookmark-{eid}
使い道として、
はてなスターカウントAPIにブコメのリンクを指定して人気コメントの抽出とか。
#region 宣伝
はてなびゅぅゎぁ | Windows Phone Apps+Games Store (United States)
#endoregion
C# 動的なキーのJSONをデシリアライズする
C# LINQ 複数のDictionaryをまとめる
備忘録、、、
dics.SelectMany(d => d).ToDictionary(x => x.Key, x => x.Value);
WinRT コードビハインド書かずにWebViewにプログレスバーつける
WebViewがコンテンツをロード中にプログレスバーを出しておくとユーザに親切だったりします。
ただこれ作るのにコードビハインド書かなくちゃいけなくて、めんどうだなあと思ってました。
実はXAMLだけで簡単に書けるみたいです。
<Border> <VisualStateManager.VisualStateGroups> <VisualStateGroup x:Name="WebViewVisualStateGroup"> <VisualState x:Name="contentloading"> <Storyboard> <ObjectAnimationUsingKeyFrames Storyboard.TargetName="progressBar" Storyboard.TargetProperty="(ProgressBar.IsIndeterminate)"> <DiscreteObjectKeyFrame KeyTime="0"> <DiscreteObjectKeyFrame.Value> <x:Boolean>True</x:Boolean> </DiscreteObjectKeyFrame.Value> </DiscreteObjectKeyFrame> </ObjectAnimationUsingKeyFrames> <FadeInThemeAnimation TargetName="border" /> </Storyboard> </VisualState> <VisualState x:Name="contentloaded"> <Storyboard> <FadeOutThemeAnimation TargetName="border" /> </Storyboard> </VisualState> </VisualStateGroup> </VisualStateManager.VisualStateGroups> <Grid> <Grid.RowDefinitions> <RowDefinition Height="20" /> <RowDefinition Height="1*" /> </Grid.RowDefinitions> <WebView x:Name="WebViewObj" Grid.RowSpan="2" Source="{Binding SelectFeedItem.Uri}"> <Interactivity:Interaction.Behaviors> <Core:EventTriggerBehavior EventName="NavigationCompleted"> <Core:GoToStateAction StateName="contentloaded" /> </Core:EventTriggerBehavior> <Core:EventTriggerBehavior EventName="NavigationStarting"> <Core:GoToStateAction StateName="contentloading" /> </Core:EventTriggerBehavior> <Core:EventTriggerBehavior EventName="NavigationFailed"> <Core:GoToStateAction StateName="contentloaded" /> </Core:EventTriggerBehavior> </Interactivity:Interaction.Behaviors> </WebView> <Border x:Name="border" Background="#B2F0F8FF"> <ProgressBar x:Name="progressBar" /> </Border> </Grid> </Border>
参考になるエントリ
Blend for VS2013 RCにXAMLでのBehavior復活!!(ただしWindows 8.1のみのもよう) - かずきのBlog@hatena
MVVM開発をさらに加速させる ノンコーディングUI開発 - SSSSLIDE
GitHub始めました
モチベーション維持を期待してソースコードを公開できるGitHubを始めました。
バージョン管理システムなるものを使うのが初めてなので何一つわかりません。
ゆっくりストアアプリの開発が楽しくなるライブラリを作っていこうと思います。