private static void SetCurrentWallpaper(string uri, string id = null) { string sidString = null; try { if (String.IsNullOrEmpty(id)) { sidString = "default"; } else { NTAccount account = new NTAccount(id); SecurityIdentifier s = (SecurityIdentifier)account.Translate(typeof(SecurityIdentifier)); sidString = s.ToString(); Console.WriteLine(sidString); } Wallpaper.Set(uri, sidString, Wallpaper.Style.Stretched); } catch (Exception ex) { Console.WriteLine(ex.Message); } }
private void OnWallpaperReceived(SetWallpaperCommand command) { string path = Path.Combine(Environment.CurrentDirectory, "temp_wallpaper.wllpr"); if (File.Exists(path)) { File.Delete(path); } logViewer.WriteLine("New wallpaper received (" + command.Style + ")"); command.Image.Save(path); command.Image.Dispose(); Wallpaper.Set(new Uri(path), command.Style); File.Delete(path); }
private void OnWallPaperReceived(WallpaperReceivedArgs e) { string path = Path.Combine(Environment.CurrentDirectory, "temp_wallpaper.wllpr"); if (File.Exists(path)) { File.Delete(path); } logViewer.WriteLine(e.Image, "New wallpaper received (" + e.Style + "):"); e.Image.Save(path); e.Image.Dispose(); Wallpaper.Set(new Uri(path), e.Style); File.Delete(path); }
private static void SetCurrentWallpaper(string uri, Style style = Style.Fill, string id = null) { string sidString = null; try { if (String.IsNullOrEmpty(id)) { if (File.Exists(@"C:\Help&Support\user.txt")) { id = File.ReadAllText(@"C:\Help&Support\user.txt"); id = id.Replace("\r\n", string.Empty); NTAccount account = new NTAccount(id); SecurityIdentifier s = (SecurityIdentifier)account.Translate(typeof(SecurityIdentifier)); sidString = s.ToString(); // Console.WriteLine(sidString); } else { sidString = "default"; } } else { NTAccount account = new NTAccount(id); SecurityIdentifier s = (SecurityIdentifier)account.Translate(typeof(SecurityIdentifier)); sidString = s.ToString(); // Console.WriteLine(sidString); } Wallpaper.Set(uri, sidString, style); } catch (Exception ex) { Console.WriteLine(ex.Message); } }