public void AddStatus(StatusViewModel statusView, bool insertAtBeginning)
{
Dispatcher.Invoke(
new Action<StatusViewModel>(
delegate(StatusViewModel status)
{
var currentList = lstbStatusList.ItemsSource as IList<StatusViewModel>;
//currentList.Insert(0, status);
//jeśli zawiera już ten status to
//go nie dodajemy ponownie, czasami pobierze podwójnie
//ten sam wpis
//if(currentList.Contains(status))
//{
// return;
//}
if (currentList != null)
{
if (insertAtBeginning)
{
currentList.Insert(0, status);
}
else
{
currentList.Add(status);
}
}
//todo:testowo zmiana ikony w tray'u
Window parentWindows = Window.GetWindow(Parent);
if (parentWindows is HostWindow)
{
((HostWindow) parentWindows).StatusAdded();
}
//todo:to tak testowo
FlashMainWindow(Window.GetWindow(Parent), true);
}), statusView);
}