public void PreviewClose()
{
Application.Current.Dispatcher.Invoke(new Action(delegate()
{
Properties p = null;
foreach (var w in Application.Current.Windows)
if (w is Properties)
p = (Properties)w;
if (p != null)
p.Close();
PreviewControls.Preview.OpenPreview = null;
}));
}