private void JoinChatButton_Click(object sender, RoutedEventArgs e) { foreach (var element in Client.NotificationGrid.Children) if (element.GetType() == typeof(JoinPublicChat)) { Client.ClearNotification(typeof(JoinPublicChat)); return; } JoinPublicChat pop = new JoinPublicChat(); pop.HorizontalAlignment = HorizontalAlignment.Right; pop.VerticalAlignment = VerticalAlignment.Bottom; Client.NotificationGrid.Children.Add(pop); }
private void JoinChatButton_Click(object sender, RoutedEventArgs e) { if ( Client.NotificationGrid.Children.Cast <object>() .Any(element => element.GetType() == typeof(JoinPublicChat))) { Client.ClearNotification(typeof(JoinPublicChat)); return; } var pop = new JoinPublicChat { HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Bottom }; Client.NotificationGrid.Children.Add(pop); }