예제 #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();
 }