Intersoft WebDesktop Documentation
Adding new Shortcut at Client Side
See Also Send Feedback
Intersoft WebDesktop > WebDesktopManager > Tutorials > Adding new Shortcut at Client Side

Glossary Item Box

Objectives

This tutorial shows how to add a new shortcut via Client-side code. It will create an image on the TaskBar left which will invoke onclick event from client-side code to implement adding a new shortcut.

  1. Drag WebDesktopManager from Toolbox into a WebForm page. 


     
  2. On the upper-right corner, click the arrow next to Add Window TaskBar. It is known as WebDesktopManager Tasks.
  3. Click Edit Templates.



  4. Click the DropDownArrow and choose TaskBarLeft.
  5. Drag a HTML Image control from the ToolBox to the TaskBarLeft. You may customize the image from its properties according to your needs. 



  6. In the client-side, add the following codes:

    Javascript Copy Code
    <script language="javascript" type="text/javascript">
    function AddShorcut()
    {  
        // To add a Shortcut Icon
        var dm = ISGetDesktopManager();
        var shortcut1 = new WebDesktopShortcut();
        shortcut1.Name = "WebDesktopShortcut1";
        shortcut1.Text = "Welcome to WebDesktop.NET";
        shortcut1.Image = "../Images/welcome-32.gif";
        shortcut1.TargetURL = "../About.aspx";
        shortcut1.ToolTip = "Display Welcome Screen."; 
        shortcut1.WindowName = "wndWelcome";
        
        dm.ShortcutIcons.Add(shortcut1);
        dm.ShortcutIconsVisible = true;
        shortcut1.Show();
    }
    
    function window::onload()
    {
        // To add a Window
        var dm = ISGetDesktopManager();
        var wnd = dm.GetWindow("wndAboutDM");
        wnd = new WebDesktopWindow();
        wnd.Text = "About DesktopManager";
        wnd.Name = "wndWelcome";
        wnd.ControlBoxImage = "is_webdesktop-16.gif";
        wnd.ContentURL = "../About.aspx";
        wnd.ContentMode = "UseIFrame";
        wnd.AllowMinimize = "Yes";
        wnd.AllowMaximize = "Yes";
        
        dm.Windows.Add(wnd);
        wnd.Hide();
        wnd.Activate();
        wnd.MoveToCenterDesktop();
    }
    </script>
    

  7. Invoke AddShorcut() function from the image's onclick event.

    Script Copy Code
    <taskbarlefttemplate>    
       <img src="../Images/WebDesktopIconRound.png" onclick="AddShorcut()" style="CURSOR: pointer" title="New Shortcut"> 
    </taskbarlefttemplate>
    

  8. Run the project and click the image on the bottom-left corner, which is indicated as New Shortcut.



  9. It will display a new shortcut like the following.



  10. When you double-click on the shortcut icon, it will directly link to the new window created in the client-side.






See Also

Related Articles
{Creating Simple Desktop}

© 2012 Intersoft Solutions Corp. All Rights Reserved.