Growlについては、以前こちらに書いた記事を参照のこと。
手順
- (Growlインストール済であることを前提とします)
- Growl公式サイト -> Developer Information -> [C#/VB.NET or any .NET compatible language] をクリックする
- Growl_NET_Connector_SDK.zip がダウンロードされるので、適当な場所に解凍
- C#開発環境で、プロジェクトファイル
Growl_NET_Connector_SDK\Sample App\Csharp Example.csproj
を開く(私は VisualStudioではなく SharpDevelop を使いました) - プロジェクトのプロパティ -> コンパイル -> ターゲットCPU=32bit に変更
- Form1.cs -> Form1_Load() 内のコメントを以下のように変更する
Form1.cs
this.growl = new GrowlConnector();
//this.growl = new GrowlConnector("password"); // use this if you need to set a password - you can also pass null or an empty string to this constructor to use no password
↓
Form1.cs
//this.growl = new GrowlConnector();
this.growl = new GrowlConnector("password"); // use this if you need to set a password - you can also pass null or an empty string to this constructor to use no password
成功!
あとはこのサンプルをよしなに再利用すれば良いのではなかろうか。
注意点
私は以下の点でつまづきました。
- ビルド時にターゲットCPUは32bit CPUにする(Growlのライブラリが64bit対応していない)
- Windows では、Growlに必ずpasswordを渡してあげないと通知されない