void DeleteScreenshots() { for (int index = 2; index < 5; index++) { string desktopName = "Desktop" + index.ToString(); string path = ".\\" + desktopName; // If file exists and desktop do not exists, delete the file if (File.Exists(path) && !Desktops.DesktopExists(desktopName)) { File.Delete(path); } }// for }
private void DesktopInitialize(string name) { DesktopSave(); if (!Desktops.DesktopExists(name)) { Console.WriteLine("create" + name); Desktops.DesktopCreate(name); Desktops.ProcessCreate(name, System.Reflection.Assembly.GetExecutingAssembly().Location, "start"); // Start VirtualDesktop application Console.WriteLine(System.Reflection.Assembly.GetExecutingAssembly().Location); } Console.WriteLine(name + " desktop Handle ID" + Desktops.get_DesktopHandle(name)); Desktops.DesktopSwitch(name); }
private void Window_Closed(object sender, EventArgs e) { Console.WriteLine("sdlfkjsdsdfsdfsdfsdflfkj"); if (Desktops.DesktopExists("Desktop2")) { var res = Desktops.DesktopClose("Desktop2"); Console.WriteLine("desktop closed vlaue is:" + res); } if (Desktops.DesktopExists("Desktop3")) { Desktops.DesktopClose("Desktop3"); } if (Desktops.DesktopExists("Desktop4")) { Desktops.DesktopClose("Desktop4"); } Thread.Sleep(1000); this.Close(); }