Click here to Skip to main content
15,896,154 members
Articles / Hosted Services / Azure

RESTful WCF + Azure AppFabric Service Bus = Access to Remote Desktop from Browser

Rate me:
Please Sign up or sign in to vote.
4.92/5 (42 votes)
11 Dec 2010CPOL6 min read 75.9K   2.6K   78  
Technique combining RESTful WCF with Azure AppFabric Service Bus enables browser access to remote desktop with minimum code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ScreenShare
{
    public enum DataType
    {
        Html,
        Image,
    }

    public class State
    {
        public double clientScreenSizeFactor = double.NaN;
    }

    public class RequestInfo
    {
        public static Dictionary<double, State> dctRequestInfo = new Dictionary<double, State>();

        private DataType dataType;

        public RequestInfo(DataType dataType, Dictionary<string, string> dctArgs)
        {
            this.dataType = dataType;
 
            int x = -1; 
            int y  =-1; 
            Text = string.Empty; 
            IsFullSize = false; 
            Browser = string.Empty; 
            SessionId = double.NaN;

            if (dctArgs != null)
            {
                X = dctArgs.ContainsKey("x") && int.TryParse(dctArgs["x"], out x) ? x : -1;
                Y = dctArgs.ContainsKey("y") && int.TryParse(dctArgs["y"], out y) ? y : -1;
                
                if (dctArgs.ContainsKey("text"))
                    Text = dctArgs["text"];
                
                if (dctArgs.ContainsKey("full"))
                    IsFullSize = dctArgs["full"] == "1";
               
                if (dctArgs.ContainsKey("browser"))
                    Browser = dctArgs["browser"];
                
                if (dctArgs.ContainsKey("sessionid"))
                    SessionId = double.Parse(dctArgs["sessionid"]);
            }
        }

        public bool IsImage
        {
            get { return dataType == DataType.Image; }
        }

        public int X { private set; get; }
        public int Y  { private set; get; }
        public string Text { private set; get; }
        public bool IsFullSize { private set; get; }
        public string Browser { private set; get; }
        public double SessionId { private set; get; }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
Israel Israel


  • Nov 2010: Code Project Contests - Windows Azure Apps - Winner
  • Feb 2011: Code Project Contests - Windows Azure Apps - Grand Prize Winner



Comments and Discussions