Desktop.ascx.cs
上传用户:zhuzg88
上传日期:2018-04-24
资源大小:868k
文件大小:4k
- // SilverlightDesktop.Net - http://www.SilverlightDesktop.net
- // Copyright (c) 2008
- // by SilverlightDesktop.Net
- //
- // Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
- // documentation files (the "Software"), to deal in the Software without restriction, including without limitation
- // the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
- // to permit persons to whom the Software is furnished to do so, subject to the following conditions:
- //
- // The above copyright notice and this permission notice shall be included in all copies or substantial portions
- // of the Software.
- //
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
- // TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
- // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
- // CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- // DEALINGS IN THE SOFTWARE.
- using System;
- using System.Collections;
- using System.Configuration;
- using System.Data;
- using System.Linq;
- using System.Web;
- using System.Web.Security;
- using System.Web.UI;
- using System.Web.UI.HtmlControls;
- using System.Web.UI.WebControls;
- using System.Web.UI.WebControls.WebParts;
- using System.Xml.Linq;
- using SilverlightDesktopCore.DAL;
- public partial class Desktop : System.Web.UI.UserControl
- {
- #region Public Properties
- private int _UserID;
- private int _DesktopID;
- public int UserID
- {
- set
- {
- _UserID = value;
- }
- }
- public int DesktopID
- {
- set
- {
- _DesktopID = value;
- }
- }
- #endregion
- GeneralSettings GeneralSettings = new GeneralSettings();
- string AutoLoadModule = "0";
- protected void Page_Load(object sender, EventArgs e)
- {
- LoadDesktopInstance();
- string strIPAddress = this.Context.Request.UserHostAddress;
- int intPassword = Authendication.SetSilverlightKey(_UserID, strIPAddress);
- string strWebServiceBase = GetWebServiceBase();
- SilverlightDesktop.InitParameters =
- String.Format("PortalID={0},ModuleId={1},UserID={2},Password={3},WebServiceBase={4},AutoLoadModule={5}",
- "-1", _DesktopID.ToString(), _UserID.ToString(), intPassword.ToString(), strWebServiceBase, AutoLoadModule);
- }
- #region GetWebServiceBase
- private string GetWebServiceBase()
- {
- string strWebServiceBase = String.Format(@"{0}://", this.Request.Url.Scheme);
- strWebServiceBase = String.Format(@"{0}{1}", strWebServiceBase, this.Request.Url.Host.Replace(@"", @"/"));
- strWebServiceBase = String.Format(@"{0}{1}", strWebServiceBase, ((this.Request.Url.Port == 80) ? "" : ":" + this.Request.Url.Port.ToString()));
- strWebServiceBase = String.Format(@"{0}{1}", strWebServiceBase, this.Request.ApplicationPath.Replace(@"", ""));
- strWebServiceBase = String.Format(@"{0}/webservice/", strWebServiceBase);
- return strWebServiceBase;
- }
- #endregion
- #region LoadDesktopInstance
- private void LoadDesktopInstance()
- {
- SilverlightDesktopDAL SilverlightDesktopDAL = new SilverlightDesktopDAL();
- var result = (from Instances in SilverlightDesktopDAL.SilverlightDesktopInstances
- where Instances.ID == _DesktopID
- select Instances).FirstOrDefault();
- if (result != null)
- {
- SilverlightDesktop.Height = result.DesktopSizeHorizontal;
- SilverlightDesktop.Width = result.DesktopSizeVertical;
- SilverlightDesktop.Windowless = result.Transparent;
- AutoLoadModule = result.AutoLoadModule.ToString();
- }
- }
- #endregion
- }