Skip to content

Instantly share code, notes, and snippets.

Avatar

綾野ちい (Chii Ayano) ChiiAyano

View GitHub Profile
@ChiiAyano
ChiiAyano / MyMediaPlayer.cs
Last active Oct 6, 2019
MediaDataStream を使う
View MyMediaPlayer.cs
public class MyMediaPlayer
{
private Android.Media.MediaPlayer MediaPlayerInstance { get; set; }
public void CreateMediaPlayer()
{
this.MediaPlayerInstance = new Android.Media.MediaPlayer();
}
public void Play(System.IO.Stream stream)
View MainPage.xaml
<Page
x:Class="App1.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:notv1709="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractNotPresent(Windows.Foundation.UniversalApiContract, 5)"
xmlns:v1709="http://schemas.microsoft.com/winfx/2006/xaml/presentation?IsApiContractPresent(Windows.Foundation.UniversalApiContract, 5)"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
@ChiiAyano
ChiiAyano / MainPage.xaml.cs
Last active Mar 5, 2018
MapControl の表示を良い感じにするやつ
View MainPage.xaml.cs
public sealed partial class MainPage : Page
{
public MainPage()
{
this.InitializeComponent();
}
protected override void OnNavigatedTo(NavigationEventArgs e)
{
this.Map.Loaded += Map_Loaded;
View GpsClient.cs
using System;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Devices.Enumeration;
using Windows.Devices.Geolocation;
using Windows.Devices.SerialCommunication;
@ChiiAyano
ChiiAyano / MainPage.xaml.cs
Created Aug 2, 2017
AccessViolationException で死ぬのを回避できたコード
View MainPage.xaml.cs
private string text =
"<Canvas xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" Height=\"99.681\" Width=\"111.169\">\r\n" +
"</Canvas>";
@ChiiAyano
ChiiAyano / MainPage.xaml
Created Aug 2, 2017
AccessViolationException で死ぬコード
View MainPage.xaml
<Page
x:Class="App11.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:App11"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">
<Grid Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
@ChiiAyano
ChiiAyano / gist:04c5057206390931b12c
Created Dec 23, 2014
これじゃダメだわな
View gist:04c5057206390931b12c
public static IEnumerable<HogeCategory> CreateDummyCategories()
{
var result = Enumerable.Range(0, 5)
.Select(s => new HogeItemCategory
{
Name = string.Format("Dummy {0:00}", s),
Items = Enumerable.Range(1, 10)
.Select(t => new HogeItem
{
ID = (10 * s) + t,
View TaskDelay
private async static void DelayTest()
{
for (int i = 0; i < 1000; i += 10)
{
Console.WriteLine("Delay Start! Delay Time: " + i);
var delay1Time = DateTime.Now;
await Task.Delay(i);
Console.WriteLine("OK Time: " + (DateTime.Now - delay1Time).TotalMilliseconds);
}
}
View test 1
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Net;
namespace ConsoleApplication3
{
class Program
View gist:8156235
public async Task<HttpResponseMessage> SendAsync(IDictionary<string, object> parameter, AsyncOAuth.AccessToken accessToken, string footer)
{
var client = new HttpClient();
var boundary = DateTime.Now.ToString("MMddHHmmss") + new Random().Next().ToString();
var content = new MultipartFormDataContent(boundary);
foreach (var item in parameter)
{
if (item.Value is string)
{
content.Add(new StringContent(item.Value as string), "\"" + this.MessageKeyName + "\"");
You can’t perform that action at this time.