private void Update() { var windows = application.GetWindows(); WindowPanel.Children.Clear(); foreach (var window in windows) { var button = new ApplicationButton(application, window); button.Clicked += (o, args) => window.Activate(); WindowPanel.Children.Add(button); } if (WindowPanel.Children.Count == 0) { ApplicationName.Visibility = Visibility.Collapsed; ApplicationButton.Visibility = Visibility.Visible; } else { ApplicationName.Visibility = Visibility.Visible; ApplicationButton.Visibility = Visibility.Collapsed; } }
private void InitializeApplicationControl() { var button = new ApplicationButton(application); application.WindowsChanged += Application_WindowsChanged; button.Clicked += (o, args) => application.Start(); ApplicationName.Text = application.Name; ApplicationName.Visibility = Visibility.Collapsed; ApplicationButton.Content = button; }