示例#1
0
文件: Shell.cs 项目: levi1994/LitDev
        /// <summary>Shows a folder selection dialog.</summary>
        /// <param name="title">The title to show on the dialog.</param>
        /// <param name="initDir">The start folder when the dialog opens or "" for last selected folder (default: Computer).</param>
        /// <returns>The full folder path after selection or "" when canceled, else "FAILED".</returns>
        public static Primitive SelectFolder(Primitive title, Primitive initDir)
        {
            string result = "";
            string iDir   = lastFolder;

            if (!String.IsNullOrEmpty(initDir))
            {
                iDir = initDir;
            }

            if (!Directory.Exists(initDir))
            {
                iDir = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer);
            }
            try
            {
                Shell32.Shell   shell = new Shell32.Shell();
                Shell32.Folder2 fold  = (Shell32.Folder2)shell.BrowseForFolder(0, (string)title, 0x10, (string)iDir);
                if (fold == null)
                {
                    return(string.Empty);
                }
                result     = fold.Self.Path;
                lastFolder = result;
                return(result);
            }
            catch
            { return("FAILED"); }
        }
示例#2
0
文件: Shell.cs 项目: levi1994/LitDev
 // UNSURE if the returned values are really correct, resp. which values are returned at all from "1", "2", "4" etc.
 // http://msdn.microsoft.com/library/windows/desktop/gg537739.aspx		Shell.GetSetting method
 /// <summary>Gets values for global Shell settings (s. folder opions-view, CheckedStatus).</summary>
 /// <param name="value">An integer constant for the value to get (eg. 1, 2, 4, "8", "32" etc.).</param>
 /// <returns>"True" or "False" on success, else "FAILED".</returns>
 /// <example>http://msdn.microsoft.com/library/windows/desktop/gg537739.aspx
 /// ShowAllObjects = SBShell.GetSetting(1)
 /// ShowExtensions = SBShell.GetSetting(2)
 /// ShowInfoTip = SBShell.GetSetting(8192)
 /// ShowSuperHidden = SBShell.GetSetting(262144)</example>
 public static Primitive GetSetting(Primitive value)
 {
     if (String.IsNullOrEmpty(value) || value < 1)
     {
         return("FAILED");
     }
     try
     {
         // http://dotnetdud.blogspot.co.at/2008/10/convert-string-to-long-using-c.html
         // long longStr = Int64.Parse(value);	// = Convert.ToInt64(value);
         Shell32.Shell shell = new Shell32.Shell();
         return(shell.GetSetting(value)); // Convert.ToInt32((string)value, 16);
     }
     catch
     { return("FAILED"); }
 }
示例#3
0
文件: Shell.cs 项目: levi1994/LitDev
        // http://msdn.microsoft.com/library/windows/desktop/gg537740.aspx		Shell.GetSystemInformation method
        /// <summary>Gets a given Systeminformation.</summary>
        /// <param name="info">The name of the value to get. Options:
        /// "DirectoryServiceAvailable", "DoubleClickTime", "ProcessorLevel", "ProcessorSpeed", "ProcessorArchitecture", "PhysicalMemoryInstalled", "IsOS_DomainMember"
        /// (Only XP: "IsOS_Professional", "IsOS_Personal").</param>
        /// <returns>The queried value on success, else "" or "FAILED".</returns>
        public static Primitive GetSystemInfo(Primitive info)
        {
            string val = info;

            if (string.IsNullOrEmpty(val))
            {
                return("FAILED");
            }
            try
            {
                Shell32.Shell shell    = new Shell32.Shell();
                var           objShell = shell;
                return(objShell.GetSystemInformation(val.Trim()).ToString());
            }
            catch
            { return("FAILED"); }
        }
示例#4
0
文件: Shell.cs 项目: levi1994/LitDev
        /// <summary>Opens explorer with the given file-/folder path (parent folder for existing file path). In new tab in QTTabBar.</summary>
        /// <param name="path">Opens the specified folder (file path opens parent folder). The folder must exist.</param>
        public static void OpenFolder(Primitive path)
        {
            string dir;

            if (String.IsNullOrEmpty(path))
            {
                dir = Program.Directory;
            }
            else
            {
                dir = Environment.ExpandEnvironmentVariables(path);
            }

            if (System.IO.File.Exists(dir))
            {
                dir = Path.GetDirectoryName(dir);
            }
            if (Directory.Exists(dir))
            {
                Shell32.Shell shell = new Shell32.Shell();
                shell.Open(dir);
            }
        }
示例#5
0
文件: Shell.cs 项目: litdev1/LitDev
 /// <summary>Restores all minimized windows in the taskbar (after ShowDesktop, TileAll.., CascadeWindows) again.</summary>
 public static void RestoreWindows()
 {
     Shell32.Shell shell = new Shell32.Shell();
     shell.UndoMinimizeALL();
 }
示例#6
0
文件: Shell.cs 项目: litdev1/LitDev
 // http://msdn.microsoft.com/library/windows/desktop/gg537740.aspx		Shell.GetSystemInformation method
 /// <summary>Gets a given Systeminformation.</summary>
 /// <param name="info">The name of the value to get. Options:
 /// "DirectoryServiceAvailable", "DoubleClickTime", "ProcessorLevel", "ProcessorSpeed", "ProcessorArchitecture", "PhysicalMemoryInstalled", "IsOS_DomainMember"
 /// (Only XP: "IsOS_Professional", "IsOS_Personal").</param>
 /// <returns>The queried value on success, else "" or "FAILED".</returns>
 public static Primitive GetSystemInfo(Primitive info)
 {
     string val = info;
     if (string.IsNullOrEmpty(val)) return "FAILED";
     try
     {
         Shell32.Shell shell = new Shell32.Shell();
         var objShell = shell;
         return objShell.GetSystemInformation(val.Trim()).ToString();
     }
     catch
     { return "FAILED"; }
 }
示例#7
0
文件: Shell.cs 项目: litdev1/LitDev
        /// <summary>Opens explorer with the given file-/folder path (parent folder for existing file path). In new tab in QTTabBar.</summary>
        /// <param name="path">Opens the specified folder (file path opens parent folder). The folder must exist.</param>
        public static void OpenFolder(Primitive path)
        {
            string dir;
            if (String.IsNullOrEmpty(path)) dir = Program.Directory;
            else dir = Environment.ExpandEnvironmentVariables(path);

            if (System.IO.File.Exists(dir)) dir = Path.GetDirectoryName(dir);
            if (Directory.Exists(dir))
            {
                Shell32.Shell shell = new Shell32.Shell();
                shell.Open(dir);
            }
        }
示例#8
0
文件: Shell.cs 项目: levi1994/LitDev
 /// <summary>Orders all opened windows vertically tiled on the desktop (Revert with RestoreWindows).</summary>
 public static void TileAllVert()
 {
     Shell32.Shell shell = new Shell32.Shell();
     shell.TileVertically();
 }
示例#9
0
文件: Shell.cs 项目: litdev1/LitDev
 // UNSURE if the returned values are really correct, resp. which values are returned at all from "1", "2", "4" etc.
 // http://msdn.microsoft.com/library/windows/desktop/gg537739.aspx		Shell.GetSetting method
 /// <summary>Gets values for global Shell settings (s. folder opions-view, CheckedStatus).</summary>
 /// <param name="value">An integer constant for the value to get (eg. 1, 2, 4, "8", "32" etc.).</param>
 /// <returns>"True" or "False" on success, else "FAILED".</returns>
 /// <example>http://msdn.microsoft.com/library/windows/desktop/gg537739.aspx
 /// ShowAllObjects = SBShell.GetSetting(1)
 /// ShowExtensions = SBShell.GetSetting(2)
 /// ShowInfoTip = SBShell.GetSetting(8192)
 /// ShowSuperHidden = SBShell.GetSetting(262144)</example>
 public static Primitive GetSetting(Primitive value)
 {
     if (String.IsNullOrEmpty(value) || value < 1) return "FAILED";
     try
     {
         // http://dotnetdud.blogspot.co.at/2008/10/convert-string-to-long-using-c.html
         // long longStr = Int64.Parse(value);	// = Convert.ToInt64(value);
         Shell32.Shell shell = new Shell32.Shell();
         return shell.GetSetting(value);	// Convert.ToInt32((string)value, 16);
     }
     catch
     { return "FAILED"; }
 }
示例#10
0
文件: Shell.cs 项目: litdev1/LitDev
 /// <summary>Minimizes all opened windows into the taskbar and showes the desktop (Revert with RestoreWindows).</summary>
 public static void ShowDesktop()
 {
     Shell32.Shell shell = new Shell32.Shell();
     shell.MinimizeAll();
 }
示例#11
0
文件: Shell.cs 项目: litdev1/LitDev
 /// <summary>Orders all opended windows in a 3D stack on the desktop to select through (with arrow keys).</summary>
 public static void Switch3D()
 {
     Shell32.Shell shell = new Shell32.Shell();
     shell.WindowSwitcher();
 }
示例#12
0
文件: Shell.cs 项目: levi1994/LitDev
 /// <summary>Shows the dialog for date- and time settings.</summary>
 public static void DateTimeSettings()
 {
     Shell32.Shell shell = new Shell32.Shell();
     shell.SetTime();
 }
示例#13
0
文件: Shell.cs 项目: levi1994/LitDev
 /// <summary>Shows the dialog for startmenü/taskbar settings.</summary>
 public static void StartSettings()
 {
     Shell32.Shell shell = new Shell32.Shell();
     shell.TrayProperties();
 }
示例#14
0
文件: Shell.cs 项目: levi1994/LitDev
 /// <summary>Orders all opended windows in a 3D stack on the desktop to select through (with arrow keys).</summary>
 public static void Switch3D()
 {
     Shell32.Shell shell = new Shell32.Shell();
     shell.WindowSwitcher();
 }
示例#15
0
文件: Shell.cs 项目: levi1994/LitDev
 /// <summary>Shows the Run(box) Dialog.</summary>
 public static void RunBox()
 {
     Shell32.Shell shell = new Shell32.Shell();
     shell.FileRun();
 }
示例#16
0
文件: Shell.cs 项目: levi1994/LitDev
 /// <summary>Toggles the view of the (windowless) desktop on and off (s. ShowDesktop/RestoreWindows).</summary>
 public static void ToggleDesktop()
 {
     Shell32.Shell shell = new Shell32.Shell();
     shell.ToggleDesktop();
 }
示例#17
0
文件: Shell.cs 项目: levi1994/LitDev
 /// <summary>Restores all minimized windows in the taskbar (after ShowDesktop, TileAll.., CascadeWindows) again.</summary>
 public static void RestoreWindows()
 {
     Shell32.Shell shell = new Shell32.Shell();
     shell.UndoMinimizeALL();
 }
示例#18
0
文件: Shell.cs 项目: levi1994/LitDev
 /// <summary>Orders all opended windows in cascades on the desktop (Revert with RestoreWindows).</summary>
 public static void CascadeWindows()
 {
     Shell32.Shell shell = new Shell32.Shell();
     shell.CascadeWindows();
 }
示例#19
0
文件: Shell.cs 项目: litdev1/LitDev
 /// <summary>Shows the Run(box) Dialog.</summary>
 public static void RunBox()
 {
     Shell32.Shell shell = new Shell32.Shell();
     shell.FileRun();
 }
示例#20
0
文件: Shell.cs 项目: litdev1/LitDev
 /// <summary>Orders all opened windows vertically tiled on the desktop (Revert with RestoreWindows).</summary>
 public static void TileAllVert()
 {
     Shell32.Shell shell = new Shell32.Shell();
     shell.TileVertically();
 }
示例#21
0
文件: Shell.cs 项目: litdev1/LitDev
        /// <summary>Shows a folder selection dialog.</summary>
        /// <param name="title">The title to show on the dialog.</param>
        /// <param name="initDir">The start folder when the dialog opens or "" for last selected folder (default: Computer).</param>
        /// <returns>The full folder path after selection or "" when canceled, else "FAILED".</returns>
        public static Primitive SelectFolder(Primitive title, Primitive initDir)
        {
            string result = "";
            string iDir = lastFolder;
            if (!String.IsNullOrEmpty(initDir)) iDir = initDir;

            if (!Directory.Exists(initDir)) iDir = Environment.GetFolderPath(Environment.SpecialFolder.MyComputer);
            try
            {
                Shell32.Shell shell = new Shell32.Shell();
                Shell32.Folder2 fold = (Shell32.Folder2)shell.BrowseForFolder(0, (string)title, 0x10, (string)iDir);
                if (fold == null) return string.Empty;
                result = fold.Self.Path;
                lastFolder = result;
                return result;
            }
            catch
            { return "FAILED"; }
        }
示例#22
0
文件: Shell.cs 项目: levi1994/LitDev
 /// <summary>Minimizes all opened windows into the taskbar and showes the desktop (Revert with RestoreWindows).</summary>
 public static void ShowDesktop()
 {
     Shell32.Shell shell = new Shell32.Shell();
     shell.MinimizeAll();
 }
示例#23
0
文件: Shell.cs 项目: litdev1/LitDev
 /// <summary>Shows the dialog for startmenü/taskbar settings.</summary>
 public static void StartSettings()
 {
     Shell32.Shell shell = new Shell32.Shell();
     shell.TrayProperties();
 }
示例#24
0
文件: Shell.cs 项目: litdev1/LitDev
 /// <summary>Shows the dialog for date- and time settings.</summary>
 public static void DateTimeSettings()
 {
     Shell32.Shell shell = new Shell32.Shell();
     shell.SetTime();
 }
示例#25
0
文件: Shell.cs 项目: litdev1/LitDev
 /// <summary>Orders all opened windows horizontally tiled on the desktop (Revert with RestoreWindows).</summary>
 public static void TileAllHoriz()
 {
     Shell32.Shell shell = new Shell32.Shell();
     shell.TileHorizontally();
 }
示例#26
0
文件: Shell.cs 项目: levi1994/LitDev
 /// <summary>Orders all opened windows horizontally tiled on the desktop (Revert with RestoreWindows).</summary>
 public static void TileAllHoriz()
 {
     Shell32.Shell shell = new Shell32.Shell();
     shell.TileHorizontally();
 }
示例#27
0
文件: Shell.cs 项目: litdev1/LitDev
 /// <summary>Toggles the view of the (windowless) desktop on and off (s. ShowDesktop/RestoreWindows).</summary>
 public static void ToggleDesktop()
 {
     Shell32.Shell shell = new Shell32.Shell();
     shell.ToggleDesktop();
 }
示例#28
0
文件: Shell.cs 项目: litdev1/LitDev
 /// <summary>Orders all opended windows in cascades on the desktop (Revert with RestoreWindows).</summary>
 public static void CascadeWindows()
 {
     Shell32.Shell shell = new Shell32.Shell();
     shell.CascadeWindows();
 }