Results 1 to 5 of 5

Thread: Ho to set wallpaper on desktop in code behind

  1. #1
    Member
    Join Date
    Jan 2009
    Location
    Posts
    6

    Ho to set wallpaper on desktop in code behind



    Hi

    How can I set the wallpaper on the desktop in code/AjaxMetod

    e.g something like this:
    Code:
    [AjaxMethod]
    public void SaveSettings()
    {
        this.MyDesktop.Wallpaper = this.cbWallpaper.SelectedItem.Value;
    }
    Kind regards
    Steen

  2. #2
    Ext.NET - Dev Team Vladimir's Avatar
    Join Date
    Mar 2008
    Location
    Russia
    Posts
    15,157

    RE: Ho to set wallpaper on desktop in code behind

    Hi,

    We added support to change Wallpaper during AjaxEvent.
    Till new release you can use next code:


    MyDesktop.AddScript("{0}.getDesktop().setWallpaper ({1});",テつ*MyDesktop.ClientID, url);テつ*


    Vladimir Shcheglov
    Ext.NET, Inc.
    Development Team

    Ext.NET Examples | Ext.NET API Docs | ExtJS API Docs | Twitter | Jobs

  3. #3
    Member
    Join Date
    Jan 2009
    Location
    Posts
    6

    RE: Ho to set wallpaper on desktop in code behind

    Thanks for the reply, but I seem to miss something as this just gives an JavaScript error:

    Code:
    [AjaxMethod]
    public void SaveSettings()
    {
        mwSettings settings = new mwSettings();
        MyDesktop.AddScript("{0}.getDesktop().setWallpaper({1});", MyDesktop.ClientID, "images/wallpaper/img16.jpg"); 
        
    }
    JavaScript error is: 'images' is not defined

  4. #4
    Ext.NET - Dev Team Vladimir's Avatar
    Join Date
    Mar 2008
    Location
    Russia
    Posts
    15,157

    RE: Ho to set wallpaper on desktop in code behind

    Hi,

    you should add quoutes or JSON.Serialize


    [AjaxMethod]
    public void SaveSettings()
    {
    テつ*テつ*テつ* mwSettings settings = new mwSettings();
    テつ*テつ*テつ* MyDesktop.AddScript("{0}.getDesktop().setWallpaper ('{1}');", MyDesktop.ClientID, "images/wallpaper/img16.jpg");テつ*
    テつ*テつ*テつ*テつ*
    }テつ*


    or


    [AjaxMethod]
    public void SaveSettings()
    {
    テつ*テつ*テつ* mwSettings settings = new mwSettings();
    テつ*テつ*テつ* MyDesktop.AddScript("{0}.getDesktop().setWallpaper ({1});", MyDesktop.ClientID, JSON.Serialize("images/wallpaper/img16.jpg"));テつ*
    テつ*テつ*テつ*テつ*
    }


    Vladimir Shcheglov
    Ext.NET, Inc.
    Development Team

    Ext.NET Examples | Ext.NET API Docs | ExtJS API Docs | Twitter | Jobs

  5. #5
    Member
    Join Date
    Jan 2009
    Location
    Posts
    6

    RE: Ho to set wallpaper on desktop in code behind

    Sorry, my mistake... I just copied your code without thinking :)
    Now it works, thanks !

Similar Threads

  1. Stretching desktop wallpaper
    By feanor91 in forum 1.x Help
    Replies: 0
    Last Post: Jan 19, 2012, 10:15 AM
  2. Wallpaper halts the Desktop?
    By rlasker3 in forum Bugs
    Replies: 0
    Last Post: Feb 15, 2010, 12:56 PM
  3. Desktop: wallpaper problem
    By heysol in forum 1.x Help
    Replies: 0
    Last Post: Jan 30, 2009, 8:40 PM
  4. Desktop wallpaper cannot load
    By Nime in forum 1.x Help
    Replies: 1
    Last Post: Jan 15, 2009, 11:49 AM
  5. [CLOSED] ext:Desktop - changing Wallpaper via JS
    By Emre in forum 1.x Premium Help
    Replies: 4
    Last Post: Dec 29, 2008, 11:49 AM

Posting Permissions