public virtual Task Clean() { return(Task.Run(() => { lastParameter = null; Initlize(); //W32.SetParent(cacheMainHandle, cacheParent); if (process != null) { try { process.Kill(); } catch (Exception) { } process = null; } if (!string.IsNullOrEmpty(_defaultBG)) { ImgWallpaper.SetBG(_defaultBG); _defaultBG = null; } //var resul = W32.RedrawWindow(workerw, IntPtr.Zero, IntPtr.Zero, RedrawWindowFlags.Invalidate); //var temp = W32.GetParent(workerw); //W32.SendMessage(temp, 0x000F, 0, IntPtr.Zero); //W32.SendMessage(workerw, 0x000F, 0, IntPtr.Zero); //W32.SendMessage(workerw, W32.WM_CHANGEUISTATE, 2, IntPtr.Zero); //W32.SendMessage(workerw, W32.WM_UPDATEUISTATE, 2, IntPtr.Zero); })); }
public override bool Equals(Object obj) { //Check for null and compare run-time types. if ((obj == null) || !this.GetType().Equals(obj.GetType())) { return(false); } else { WallpapaerParameter p = (WallpapaerParameter)obj; return((Dir == p.Dir) && (Args == p.Args) && (EnterPoint == p.EnterPoint)); } }
public override Task Show(WallpapaerParameter para) { var browserPath = Services.AppService.ApptEntryDir; var url = para.Args; if (url.StartsWith("\\Wallpapers\\")) { url = Services.AppService.ApptEntryDir + url; } return(base.Show(new WallpapaerParameter() { Dir = browserPath, EnterPoint = "Browser\\Browser.exe", Args = url })); }
public override Task Show(WallpapaerParameter para) { var browserPath = Services.AppService.ApptEntryDir; var path = para.Args; if (path.StartsWith("\\Wallpapers\\")) { path = Services.AppService.ApptEntryDir + path; } if (path.Contains(" ")) { path = $"\"{path}\""; } return(base.Show(new WallpapaerParameter() { Dir = browserPath, EnterPoint = "VideoPlayer\\VideoPlayer.exe", Args = path })); }
public virtual async Task Show(WallpapaerParameter model) { if (model == null || model.Equals(lastParameter)) { return; } lastParameter = model; bool isOk = await Task.Run(() => Initlize()); if (!isOk) { return; } KillOldProcess(); _defaultBG = await ImgWallpaper.GetCurrentBG(); bool isInt = int.TryParse(model.Dir, out int Pid); if (isInt) { process = Process.GetProcessById(Pid); } else { string name = Path.GetFileNameWithoutExtension(model.Dir); foreach (Process exe in Process.GetProcessesByName(name)) { try { if (exe.MainModule.FileName == model.Dir) { process = exe; break; } } catch (Exception) { continue; } } if (process == null) { var tempDir = model.Dir; if (model.Dir.StartsWith("\\Wallpapers\\")) { tempDir = Services.AppService.ApptEntryDir + model.Dir; } ProcessStartInfo startInfo = new ProcessStartInfo(Path.Combine(tempDir, model.EnterPoint)); startInfo.WindowStyle = ProcessWindowStyle.Maximized; double x = Screen.AllScreens[0].Bounds.Width; double y = Screen.AllScreens[0].Bounds.Height; startInfo.Arguments = $"{model.Args} -popupwindow -screen-height {y} -screen-width {x}"; //startInfo.Arguments = $" -popupwindow -screen-width {y1}"; process = Process.Start(startInfo); //NativeWindowHandler windowHandler = new NativeWindowHandler(); //windowHandler.MaximizeWindow(process.Handle.ToInt32()); //process = Process.Start(path); } } cacheMainHandle = await TryGetMainWindowHandle(process); cacheParent = W32.GetParent(cacheMainHandle); W32.SetParent(cacheMainHandle, workerw); }
public async Task Show(WallpapaerParameter para) { _defaultBG = await GetCurrentBG(); await SetBG(para.ToString()); }