This file contains 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; | |
using System.Linq; | |
namespace Ignition | |
{ | |
public static class Equatable | |
{ | |
public static int GetMemberwiseHashCode(object obj) | |
{ | |
return obj.GetType().GetProperties() |
This file contains 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 Ignition | |
{ | |
partial class Extension | |
{ | |
public static void TypeMatch<T1>(this object value, Action<T1> d1) | |
{ | |
if (value is T1) | |
d1((T1)value); |
This file contains 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
// GamePad.GetAvailableGamePads() してインスタンスを取得してから | |
// Update() を呼び出してフレームごとに状態を更新しましょう。 | |
// 状態を更新後 IsDown や IsUp でボタンとかを調べられます。前フレームとの取得結果を比較することで押した瞬間や離した瞬間と比較できるでしょう。 | |
// ボタン指定とかが適当で使いづらいので要改善 | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Runtime.InteropServices; | |
using System.Security; |
This file contains 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.Collections.Generic; | |
namespace Ignition.Collections | |
{ | |
public class SortedNotifyCollection<T> : NotifyCollection<T> | |
{ | |
public IComparer<T> Comparer | |
{ | |
get; | |
set; |
This file contains 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; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Reactive.Disposables; | |
using System.Reactive.Linq; | |
using System.Windows; | |
using System.Windows.Controls.Primitives; | |
using System.Windows.Input; | |
using System.Windows.Interactivity; |
This file contains 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; | |
using System.Reactive.Linq; | |
namespace ConsoleApplication1 | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var ctx = new CoroutineContext<int>(); |
This file contains 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.Windows; | |
using System.Windows.Data; | |
using System.Windows.Media; | |
using Controls = Microsoft.Phone.Controls; | |
namespace Linearstar.Lavis.Presentation | |
{ | |
public class TurnstileTransition : Controls.TransitionElement | |
{ | |
Controls.TurnstileTransition inner = new Controls.TurnstileTransition(); |
This file contains 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
An implemention of WeakEvent pattern for WPF/Silverlight/Windows Phone | |
---- | |
Using the Model-View-ViewModel pattern, you always need to keep your events clean when they are not used. | |
In example, if the object "Foo" handles an event, when you finished using the Foo and forgot to release the event handlers, | |
the event would keep grabbing references to the Foo. This means that a memory leak is happening. | |
This page would be helpful: | |
Weak Event Patterns |
This file contains 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
/* | |
* コンソールウィンドウで XNA をドライヴする | |
* MMDX を動かしてコンソールウィンドウ上に描画、または画像ファイルに出力 | |
* ・XNA Windows Game を新規作成して、Game1.cs を消して、Program.cs にこれを突っ込む | |
* ・コンテントプロジェクトに任意のモデルと任意のモーションを追加 (既定ではモデルは Miku、モーションは TrueMyHeart となっているものを使用する) | |
*/ | |
// tmp/ フォルダを作ってそこに png を出力する | |
// undef するとコンソールウィンドウ上に描画するだけ | |
#define RENDER_TO_FILE |
OlderNewer