/// <summary> /// Obter sessão do servidor /// </summary> /// <returns></returns> public SessionClass GetServerSession() { SessionClass oResult = (from a in Sessions where a.SessionType == eSessionType.Server select a).FirstOrDefault(); return(oResult); }
/// <summary> /// Obter sessão do servidor /// </summary> /// <returns></returns> public SessionClass GetUserSession(string sHostId) { SessionClass oResult = (from a in Sessions where a.SessionType == eSessionType.Client from b in a.Users where b.HostId == sHostId select a).FirstOrDefault(); return(oResult); }
/// <summary> /// Adicionar sessão /// </summary> /// <param name="pSessions">Sessões</param> /// <param name="pSessionType">Tipo</param> /// <param name="pUser">Usuário dono da sessão</param> /// <returns></returns> public static SessionClass Add(this List <SessionClass> pSessions, eSessionType pSessionType, UserClass pUser) { SessionClass oSession = new SessionClass(pSessionType, pUser); if (pUser != null) { oSession.Users.Add(pUser); } pSessions.Add(oSession); return(oSession); }
/// <summary> /// Salva tela no buffer da sessão /// </summary> /// <returns></returns> public bool SetScreen(SessionClass oSession, Int64 oQuality, bool bGrayScale) { bool bResult = true; ImageWrapper oImageWrapper = null; Graphics oGraphics; int iScreenWidth = Screen.PrimaryScreen.Bounds.Width; int iScreenHeight = Screen.PrimaryScreen.Bounds.Height; //armazena a imagem no bitmap Bitmap oBitmap = new Bitmap(iScreenWidth, iScreenHeight); //copia a tela no bitmap oGraphics = Graphics.FromImage(oBitmap); oGraphics.CopyFromScreen(Point.Empty, Point.Empty, Screen.PrimaryScreen.Bounds.Size); //atribui a imagem ao picturebox exibindo-a oBitmap.SetResolution(72, 72); oImageWrapper = new ImageWrapper(oBitmap, oQuality, bGrayScale); oSession.SessionBuffer.Write(oImageWrapper.Bytes); return(bResult); }
/// <summary> /// Recupera tela do buffer da sessão /// </summary> /// <param name="oSession"></param> /// <returns></returns> public ImageWrapper GetScreen(SessionClass oSession) { ImageWrapper oImageWrapper = new ImageWrapper(oSession.SessionBuffer.Read()); return(oImageWrapper); }
/// <summary> /// Entrar numa sessão especifica /// </summary> /// <param name="User"></param> /// <param name="Session"></param> /// <returns></returns> public bool EnterSession(UserClass User, SessionClass Session) { Session.Users.Add(User); return(true); }