Skip to content

Instantly share code, notes, and snippets.

@biac
Created June 11, 2012 09:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save biac/2909212 to your computer and use it in GitHub Desktop.
Save biac/2909212 to your computer and use it in GitHub Desktop.
Kujian - SplitPage.xaml.cs (STOP ボタン)
private async void Button_Click_2(object sender, RoutedEventArgs e)
{
_isContinue = false;
while (!_isBreaking)
await Task.Delay(50);
itemListView.Background = new SolidColorBrush(Colors.DarkGray);
int remain = 5000;
int span = 50;
var rnd = new Random();
while(remain > 0)
{
await Task.Delay(span);
SelectNext();
remain -= span;
span = (int)(span * (1.0 + rnd.NextDouble()));
}
// ここで音を出したかった!!
var orgColor = itemListView.Background;
var hiColor = new SolidColorBrush(Colors.Red);
for (int i = 0; i < 3; i++)
{
itemListView.Background = orgColor;
await Task.Delay(150);
itemListView.Background = hiColor;
await Task.Delay(150);
}
itemListView.Background = new SolidColorBrush(Colors.WhiteSmoke);
_isBreaking = false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment