void Start()
{
System.Windows.Controls.Primitives.Popup p = new System.Windows.Controls.Primitives.Popup();
p.HorizontalOffset = this.ActualWidth / 2;
p.Width = 100;
p.Height = 100;
p.VerticalOffset = this.ActualHeight / 2;
DockPanel dock = new DockPanel();
dock.Children.Add(new Button() { Content = "Обновлено" });
p.Child = dock;
p.IsOpen = true;
Thread t = new Thread(StopPopup);
t.Start(p);}
function:
private void StopPopup(object obj)
{
try
{
System.Windows.Controls.Primitives.Popup p = (System.Windows.Controls.Primitives.Popup)obj;
this.Dispatcher.Invoke(DispatcherPriority.Normal, (Action)(() =>
{
dataGrid1.DataContext = DataSetCreator.AllItems();
Thread.Sleep(1500);
p.IsOpen = false;
}));
}
catch (Exception ex) { MessageBox.Show(ex.Message); }
but why this code is triggered once = ( }