I have a non-fullscreen window with 3 text blocks displaying system time ticks. Then I programmatically move the window by changing its X and Y coordinates.
Result is terrible!
Please consider the code:
public class Program
{
static Window window;
public static void Main()
{
string xml;
xml = "<Glide Version=\"" + Glide.Version + "\">";
xml += "<Window Name=\"window\" Width=\"300\" Height=\"90\" BackColor=\"eeeeee\">";
xml += "</Window>";
xml += "</Glide>";
Glide.FitToScreen = false;
// and here we keep seeing this crapy "loading" image at the background!!!
window = GlideLoader.LoadWindow(xml);
for (int i = 0; i < 3; i++)
window.AddChild(new TextBlock("lbl", 255, 10, 20 * i, 250, 20));
Glide.MainWindow = window;
new Thread(delegate()
{
while (true)
{
DateTime dt = DateTime.Now;
for (int j = 0; j < window.NumChildren; j++)
{
TextBlock lbl = (TextBlock)window[j];
lbl.Text = dt.Ticks.ToString();
window.FillRect(lbl.Rect);
lbl.Invalidate();
}
Thread.Sleep(10);
}
}
).Start();
new Thread(delegate()
{
while (true)
{
window.X += 10;
window.Y += 10;
if (window.X >= Microsoft.SPOT.Presentation.SystemMetrics.ScreenWidth - 50)
window.X = 0;
if (window.Y >= Microsoft.SPOT.Presentation.SystemMetrics.ScreenHeight - 50)
window.Y = 0;
window.Invalidate();
Thread.Sleep(10);
}
}
).Start();
Thread.Sleep(-1);
}
}
:wall: :wall: :wall:
:snooty: :snooty: :snooty:
From DisplayObject.cs:
public virtual void Invalidate()
{
Render();
Glide.Flush(this);
}
From Glide.cs:
:o :o :o Who could write this?
public static void Flush(DisplayObject displayObject)
{
Flush(displayObject.Parent.X + displayObject.X, displayObject.Parent.Y + displayObject.Y, displayObject.Width, displayObject.Height);
}
Where is handling repainting of previously occupied area???
Guys!
You assumed the UI will be always static???
I’ve lost in words…
The same is with .NET Clix!