/// <summary> /// Updates the UI buttons and slider values /// </summary> private void UpdateUI() { var muted = isMuted; var percent = volumePercent; System.Windows.Application.Current.Dispatcher.Invoke( () => { var visualBrushResource = new MahApps.Metro.IconPacks.PackIconMaterial(); if (muted) { visualBrushResource.Kind = MahApps.Metro.IconPacks.PackIconMaterialKind.VolumeOff; volumeSlider.IsEnabled = false; volumeText.Opacity = 0.7; volumeText.TextDecorations = new TextDecorationCollection(TextDecorations.Strikethrough); } else { visualBrushResource.Kind = MahApps.Metro.IconPacks.PackIconMaterialKind.VolumeHigh; volumeSlider.IsEnabled = true; volumeText.Opacity = 1; volumeText.TextDecorations = new TextDecorationCollection(); } muteButtonIcon.Visual = visualBrushResource; suppressVolSliderValueChanges++; volumeSlider.Value = percent; volumeText.Text = $"{(int)Math.Round(percent)}%"; } ); }
private void enableOnClick(object sender, RoutedEventArgs e) { PluginInfo info = manager.getPluginInfoByID(seletedPluginLabel.Content.ToString()); if (info.isActive) { manager.setPluginInfo(info.pluginID, info.position, false); seletedPluginLabel.Foreground = new SolidColorBrush(Colors.Red); MahApps.Metro.IconPacks.PackIconMaterial icon = new MahApps.Metro.IconPacks.PackIconMaterial(); icon.Kind = MahApps.Metro.IconPacks.PackIconMaterialKind.CheckboxBlankOutline; enableButton.Content = icon; } else { manager.setPluginInfo(info.pluginID, info.position, true); seletedPluginLabel.Foreground = new SolidColorBrush(Colors.Green); MahApps.Metro.IconPacks.PackIconMaterial icon = new MahApps.Metro.IconPacks.PackIconMaterial(); icon.Kind = MahApps.Metro.IconPacks.PackIconMaterialKind.CheckboxMarkedOutline; enableButton.Content = icon; } }
private void pluginSelected(object sender, RoutedEventArgs e) { if (seletedPluginLabel != null) { seletedPluginLabel.Background = new SolidColorBrush(Colors.White); } seletedPluginLabel = (Label)e.Source; seletedPluginLabel.Background = new SolidColorBrush(Colors.LightBlue); e.Handled = true; MahApps.Metro.IconPacks.PackIconMaterial icon = new MahApps.Metro.IconPacks.PackIconMaterial(); if (seletedPluginLabel.Foreground.ToString().Equals(new SolidColorBrush(Colors.Green).ToString())) { icon.Kind = MahApps.Metro.IconPacks.PackIconMaterialKind.CheckboxMarkedOutline; } else { icon.Kind = MahApps.Metro.IconPacks.PackIconMaterialKind.CheckboxBlankOutline; } enableButton.Content = icon; }
public MessageBox_Custom(string mainText, string captionText, MessageBoxButton buttons, MessageBoxImage image) { InitializeComponent(); tBlock.Text = mainText; Title = captionText; var scr = ScreenHelper.GetCurrentScreen(this); label.MaxWidth = scr.Size.Width * 0.75; label.MaxHeight = scr.Size.Height * 0.75; if (buttons.HasFlag(MessageBoxButton.OK)) { stackPanel.Children.Add(CreateOK()); } if (buttons.HasFlag(MessageBoxButton.Yes)) { stackPanel.Children.Add(CreateYes()); } if (buttons.HasFlag(MessageBoxButton.No)) { stackPanel.Children.Add(CreateNo()); } if (buttons.HasFlag(MessageBoxButton.Cancel)) { stackPanel.Children.Add(CreateCancel()); } if (image != MessageBoxImage.None) { MahApps.Metro.IconPacks.PackIconMaterial icon = new MahApps.Metro.IconPacks.PackIconMaterial() { Foreground = App.Current.Resources["AccentColor"] as Brush, Height = 64, Width = 64, VerticalAlignment = VerticalAlignment.Center, HorizontalAlignment = HorizontalAlignment.Center, Margin = new Thickness(10) }; switch (image) { case MessageBoxImage.Error: icon.Kind = MahApps.Metro.IconPacks.PackIconMaterialKind.CloseCircleOutline; break; case MessageBoxImage.Exclamation: icon.Kind = MahApps.Metro.IconPacks.PackIconMaterialKind.AlertCircleOutline; break; case MessageBoxImage.Information: icon.Kind = MahApps.Metro.IconPacks.PackIconMaterialKind.InformationOutline; break; case MessageBoxImage.Question: icon.Kind = MahApps.Metro.IconPacks.PackIconMaterialKind.HelpCircleOutline; break; } grid.Children.Add(icon); } }