private void tmClock_Tick(object sender, EventArgs e)
{
bool update_text = FOptions.showClock;
if (last_show_clock && !update_text)//when the user changes the options to no longer show the clock we need to know to hide it.
update_text = true;
last_show_clock = FOptions.showClock;
string S = FOptions.showClock ? DateTime.Now + " - " : "";
string display_name = "";
if ((Host != null) && (Host.MainWindow != null) && (Host.Database != null)) {
if (!Host.MainWindow.IsFileLocked(null)) {
display_name = UrlUtil.StripExtension(UrlUtil.GetFileName(Host.Database.IOConnectionInfo.Path));
if (Host.Database.Modified) display_name += "*";
}
else // Locked
{
display_name = UrlUtil.StripExtension(UrlUtil.GetFileName(Host.MainWindow.DocumentManager.ActiveDocument.LockedIoc.Path));
display_name += " [" + KPRes.Locked + "]";
}
}
if (quick_anim != 0)
{
switch (quick_anim)
{
case 3:
display_name += " :)";
break;
case 2:
display_name += " :|";
break;
case 1:
display_name += " :O";
break;
}
quick_anim--;
}
if (FLastName != display_name) {
toolStripMenuSaveDatabase.Enabled = Host != null && Host.Database != null && Host.Database.IsOpen;
FLastName = display_name;
TopMost = true;
update_text = true;
}
if (display_name != "")
S += display_name;
if (update_text)
lbClock.Text = S;
}