Posted on listopad 17th, 2008 by vip
Beware of anonymous delegates in C#! You’ve to instanize new variable to have them in own delegate instances. If not, you’ll get the last value of variable in loop.
Short snippet for Gtk#. It creates dynamic buttons and actions from DataTable (e.g. database). Pay attention to line // [1], when “variable capturing” is used.
PLAIN TEXT
C#:
foreach(DataRow g [...]
Posted on październik 25th, 2008 by vip
Uwielbiam coś pisać (tu: wywoływanie i przechwytywanie zdarzeń), i nagle, zupełnie przypadkiem, dostać wyjątkiem w twarz. A potem szukać, debugować, przez kilka godzin, żeby się na końcu okazało, że przecież wszystko jest napisane w dokumentacji!
“Once a class has declared an event, it can treat that event just like a field of the indicated delegate type. [...]
Posted on wrzesień 30th, 2008 by vip
Jakiś czas temu chciałem napisać o tym jak zakodować swojego browsera przy pomocy biblioteki WebKit. Wstępniak zapisałem ale z braku czasu wpis odłożyłem na później (czytaj: takiego wpisu nie będzie).
Kilka miesięcy później Google wydało Chrome, co prawda nie w 200 linijkach, ale także oparte na tym silniku, więc jeżeli chciałbyś sam napisać sobie przeglądarkę przy [...]
Posted on styczeń 17th, 2008 by vip
If You’re developing Sqlite.NET application with Gecko# using Xulrunner libs, and got:
Unhandled Exception: Mono.Data.Sqlite.SqliteException: Library used incorrectly
library routine called out of sequence
at Mono.Data.Sqlite.Sqlite3.Open (System.String strFilename) [0x00000]
at Mono.Data.Sqlite.SqliteConnection.Open () [0x00000]
or
MISUSE (Library used incorrectly)
errors, here’s the resolution…
Posted on marzec 18th, 2007 by vip
The simplest method to add non-blocking ticker in C#:
PLAIN TEXT
C#:
using System.Threading;
…
public Clock()
{
System.Threading.Timer tmrThreadingTimer = new
System.Threading.Timer(new
TimerCallback(tmrThreadingTimer_TimerCallback),
null, System.Threading.Timeout.Infinite, 1000);
tmrThreadingTimer.Change(0, 1000);
}