private void ProfileImage_Edit_MouseUp(object sender, MouseEventArgs e) { Image img = sender as Image; Profiles.Application profile = img.Tag as Profiles.Application; profile.Settings.Hidden = !profile.Settings.Hidden; img.Opacity = profile.Settings.Hidden ? 0.5 : 1; }
private void ContextMenu_Opened(object sender, RoutedEventArgs e) { ContextMenu context = (ContextMenu)e.OriginalSource; if (!(context.PlacementTarget is Image)) { return; } Image img = (Image)context.PlacementTarget; Profiles.Application profile = img.Tag as Profiles.Application; context.DataContext = profile; /* * this.mbtnEnabled.IsChecked = profile.Settings.isEnabled; * this.mbtnHidden.IsChecked = profile.Settings.Hidden;*/ }
protected void ShowHiddenChanged(bool value) { profile_hidden.Source = value ? _visible : _not_visible; foreach (FrameworkElement ctrl in profiles_stack.Children) { Image img = ctrl as Image ?? (ctrl is Grid ? ((Grid)ctrl).Children[0] as Image : null); if (img != null) { Profiles.Application profile = img.Tag as Profiles.Application; if (profile != null) { img.Visibility = profile.Settings.Hidden && !value ? Visibility.Collapsed : Visibility.Visible; img.Opacity = profile.Settings.Hidden ? 0.5 : 1; } } } //profile_add.Visibility = value ? Visibility.Collapsed : Visibility.Visible; }
private static void FocusedProfileChanged(DependencyObject source, DependencyPropertyChangedEventArgs e) { ConfigUI th = source as ConfigUI; Profiles.Application value = e.NewValue as Profiles.Application; //th.ctrlLayerManager.Visibility = value == null ? Visibility.Collapsed : Visibility.Visible; //th.ctrlProfileManager.Visibility = value == null ? Visibility.Collapsed : Visibility.Visible; th.gridManagers.Visibility = value == null ? Visibility.Collapsed : Visibility.Visible; if (value == null) { return; } /*th.content_grid.Children.Clear(); * UIElement element = value.GetUserControl(); * //th.content_grid.DataContext = element; * th.content_grid.MinHeight = ((UserControl)element).MinHeight; * th.content_grid.Children.Add(element); * th.content_grid.UpdateLayout();*/ th.SelectedControl = value.Control; //th.content_grid.UpdateLayout(); }
private void GenerateProfileStack(string focusedKey = null) { selected_item = null; this.profiles_stack.Children.Clear(); /*Image profile_desktop = new Image * { * Tag = Global.Configuration.desktop_profile, * Source = new BitmapImage(new Uri(@"Resources/desktop_icon.png", UriKind.Relative)), * ToolTip = "Desktop Settings", * Margin = new Thickness(0, 5, 0, 0) * }; * profile_desktop.MouseDown += ProfileImage_MouseDown; * this.profiles_stack.Children.Add(profile_desktop);*/ //Included Game Profiles foreach (string profile_k in Global.Configuration.ProfileOrder) { if (!Global.LightingStateManager.Events.ContainsKey(profile_k)) { continue; } Profiles.Application application = (Profiles.Application)Global.LightingStateManager.Events[profile_k]; ImageSource icon = application.Icon; UserControl control = application.Control; if (icon != null && control != null) { Image profile_image; if (application is GenericApplication) { GenericApplicationSettings settings = (application.Settings as GenericApplicationSettings); profile_image = new Image { Tag = application, Source = icon, ToolTip = settings.ApplicationName + " Settings", Margin = new Thickness(0, 5, 0, 0) }; profile_image.MouseDown += ProfileImage_MouseDown; Image profile_remove = new Image { Source = new BitmapImage(new Uri(@"Resources/removeprofile_icon.png", UriKind.Relative)), ToolTip = $"Remove {settings.ApplicationName} Profile", HorizontalAlignment = HorizontalAlignment.Right, VerticalAlignment = VerticalAlignment.Bottom, Height = 16, Width = 16, Visibility = Visibility.Hidden, Tag = profile_k }; profile_remove.MouseDown += RemoveProfile_MouseDown; Grid profile_grid = new Grid { Background = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)), Margin = new Thickness(0, 5, 0, 0), Tag = profile_remove }; profile_grid.MouseEnter += Profile_grid_MouseEnter; profile_grid.MouseLeave += Profile_grid_MouseLeave; profile_grid.Children.Add(profile_image); profile_grid.Children.Add(profile_remove); this.profiles_stack.Children.Add(profile_grid); } else { profile_image = new Image { Tag = application, Source = icon, ToolTip = application.Config.Name + " Settings", Margin = new Thickness(0, 5, 0, 0), Visibility = application.Settings.Hidden ? Visibility.Collapsed : Visibility.Visible }; profile_image.MouseDown += ProfileImage_MouseDown; this.profiles_stack.Children.Add(profile_image); } if (application.Config.ID.Equals(focusedKey)) { this.FocusedApplication = application; this.TransitionToProfile(profile_image); } } } //Add new profiles button profile_add = new Image { Source = new BitmapImage(new Uri(@"Resources/addprofile_icon.png", UriKind.Relative)), ToolTip = "Add a new Lighting Profile", Margin = new Thickness(0, 5, 0, 0) }; profile_add.MouseDown += AddProfile_MouseDown; this.profiles_stack.Children.Add(profile_add); //Show hidden profiles button profile_hidden = new Image { Source = _not_visible, ToolTip = "Toggle Hidden profiles' visibility", Margin = new Thickness(0, 5, 0, 0) }; profile_hidden.MouseDown += HiddenProfile_MouseDown; this.profiles_stack.Children.Add(profile_hidden); }