This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
IntPtr srcIntPtr = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(length); | |
try | |
{ | |
// ここに処理を記載する | |
} | |
finally | |
{ | |
System.Runtime.InteropServices.Marshal.FreeCoTaskMem(srcIntPtr); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// ポーリング間隔:1分 | |
/// </summary> | |
private static readonly int PollingInterval = 60 * 1000; | |
static void Main(string[] args) | |
{ | |
while (true) | |
{ | |
// 一定時間スリープする |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
System.Windows.Input.Keyboard.ClearFocus(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Authorize] | |
public class TodoItemController : TableController<TodoItem> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public App() | |
{ | |
// The root page of your application | |
MainPage = new MapPage(); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <summary> | |
/// 検索条件入力コントロール。入力された値をイベントハンドラ内から取得するためメンバ変数に保持しておく | |
/// </summary> | |
private SearchBar searchBar; | |
/// <summary> | |
/// 地図コントロール。検索結果から該当地点へ移動などを行うためメンバ変数に保持しておく | |
/// </summary> | |
private Map map; | |
/// <summary> | |
/// Geocoding処理は非同期で実施するため、ローカル変数ではなくメンバ変数に保持しておく |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public MapPage() | |
{ | |
// 検索バーと地図コントロールを作成し、StackLayoutへ設定する | |
searchBar = new SearchBar(); | |
map = new Map { IsShowingUser = true }; | |
var stack = new StackLayout(); | |
stack.Children.Add(searchBar); | |
stack.Children.Add(map); | |
// ページコンテンツとしてStackLayoutを登録する | |
Content = stack; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private async void OnSearchButtonPressed(object sender, EventArgs e) | |
{ | |
// 検索バーから入力された地名から緯度・経度を取得する | |
var positions = await geocoder.GetPositionsForAddressAsync(searchBar.Text); | |
// 座標は複数とれる可能性があるが、今回は先頭の座標を利用する | |
var position = positions.FirstOrDefault(); | |
// 座標が一つ以上とれていた場合のみ以下を処理する | |
if (position != null) | |
{ | |
// 該当地点へ移動する |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public MapPage() | |
{ | |
// パディングを追加する | |
Padding = new Thickness(0, Device.OnPlatform(20, 0, 0), 0, 0); | |
// 検索バーと地図コントロールを作成し、StackLayoutへ設定する | |
searchBar = new SearchBar(); | |
map = new Map { IsShowingUser = true }; | |
var stack = new StackLayout(); | |
stack.Children.Add(searchBar); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
namespace SingletonSample | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
SingletonClass.Instance.Initialize(); |
OlderNewer