private void onUse(object sender, RoutedEventArgs e) { //When we click on use, we first need to check if we've selected anything if (listView.SelectedItem == null) { //we just do nothing. } else { //if we do have an item, we need to select the desktop that was selected, and change the desktop to that. DesktopIcons icons = new DesktopIcons(); Desktop desktop = (Desktop)listView.SelectedItem; icons.ToggleDesktopIcons(); DesktopChanger.Change_Desktop(desktop.Location); if (desktop.Background != null) { Wallpaper.Set(new Uri(desktop.Background), Wallpaper.Style.Centered); } icons.ToggleDesktopIcons(); //We also close this window and reopen the main window MainWindow window = new MainWindow(); window.Show(); Close(); } }
private void onUseClick(object sender, RoutedEventArgs e) { DesktopIcons icons = new DesktopIcons(); Desktop desktop = (Desktop)comboBox.SelectedItem; icons.ToggleDesktopIcons(); DesktopChanger.Change_Desktop(desktop.Location); Wallpaper.Set(new Uri(desktop.Background), Wallpaper.Style.Centered); icons.ToggleDesktopIcons(); }
private void onSelectionChanged(object sender, SelectionChangedEventArgs e) { //When we change we update our desktop DesktopIcons icons = new DesktopIcons(); Desktop desktop = (Desktop)comboBox.SelectedItem; icons.ToggleDesktopIcons(); DesktopChanger.Change_Desktop(desktop.Location); Wallpaper.Set(new Uri(desktop.Background), Wallpaper.Style.Centered); icons.ToggleDesktopIcons(); }
private void onDefaultClick(object sender, RoutedEventArgs e) { //The user has clicked the default button //We move to using the default desktop that's located in our desktopManager Desktop desktop = desktopManager.desktops.Where(i => i.IsDefault == true).FirstOrDefault(); //We hide icons first, to make the change more seemless DesktopIcons icons = new DesktopIcons(); icons.ToggleDesktopIcons(); DesktopChanger.Change_Desktop(desktop.Location); Wallpaper.Set(new Uri(desktop.Background), Wallpaper.Style.Centered); icons.ToggleDesktopIcons(); //We also close this window. Close(); }