Esempio n. 1
0
 public async Task <object> Invoke(object input)
 {
     return(DesktopWallpaperWrapper.Factory());
 }
Esempio n. 2
0
    public static DesktopWallpaperWrapper Factory()
    {
        IDesktopWallpaper dw = (IDesktopWallpaper) new DesktopWallpaper();

        DesktopWallpaperWrapper dww = new DesktopWallpaperWrapper();

        dww.SetWallpaper = (async(dynamic input) =>
        {
            dw.SetWallpaper((string)input.monitorID, (string)input.wallpaper);
            return(null);
        });
        dww.GetWallpaper              = (async(dynamic input) => dw.GetWallpaper((string)input.monitorID));
        dww.GetMonitorDevicePathAt    = (async(dynamic input) => dw.GetMonitorDevicePathAt((uint)input.monitorIndex));
        dww.GetMonitorDevicePathCount = (async(dynamic input) => dw.GetMonitorDevicePathCount());
        dww.GetMonitorRECT            = (async(dynamic input) => dw.GetMonitorRECT((string)input.monitorID));
        dww.SetBackgroundColor        = (async(dynamic input) =>
        {
            dw.SetBackgroundColor((uint)input.color);
            return(null);
        });
        dww.GetBackgroundColor = (async(dynamic input) => dw.GetBackgroundColor());
        dww.SetPosition        = (async(dynamic input) =>
        {
            dw.SetPosition((int)input.position);
            return(null);
        });
        dww.GetPosition = (async(dynamic input) => dw.GetPosition());

        /*
         * dww.SetSlideshow
         * dww.GetSlideshow
         * Not supported
         */
        dww.SetSlideshow = (async(dynamic input) => {
            throw new NotSupportedException("SetSlideshow Not Supported");
        });
        dww.GetSlideshow = (async(dynamic input) => {
            throw new NotSupportedException("GetSlideshow Not Supported");
        });
        dww.SetSlideshowOptions = (async(dynamic input) =>
        {
            dw.SetSlideshowOptions((int)input.options, (uint)input.slideshowTick);
            return(null);
        });
        dww.GetSlideshowOptions = (async(dynamic input) =>
        {
            int options;
            uint slideshowTick;
            uint retval = dw.GetSlideshowOptions(out options, out slideshowTick);
            if (retval != 0)
            {
                throw new Exception("Invoking GetSlideshowOptions failed");
            }
            return(new { options = options, slideshowTick = slideshowTick });
        });
        dww.AdvanceSlideshow = (async(dynamic input) =>
        {
            dw.AdvanceSlideshow((string)input.monitorID, (int)input.direction);
            return(null);
        });
        dww.GetStatus = (async(dynamic input) => dw.GetStatus());
        dww.Enable    = (async(dynamic input) =>
        {
            dw.Enable((bool)input.enable);
            return(null);
        });
        return(dww);
    }