- silverlightdesktop017000.zip
- Administration
- App_Code
- Webservice
- App_Data
- Bin
- de
- System.Web.Silverlight.resources.dll
- es
- System.Web.Silverlight.resources.dll
- fr
- System.Web.Silverlight.resources.dll
- ICSharpCode.SharpZipLib.dll
- it
- System.Web.Silverlight.resources.dll
- ja
- System.Web.Silverlight.resources.dll
- ko
- System.Web.Silverlight.resources.dll
- SilverlightDesktopCore.dll
- System.Web.Silverlight.dll
- System.Web.Silverlight.dll.refresh
- wsWhoAmI.dll
- zh-Hans
- System.Web.Silverlight.resources.dll
- zh-Hant
- System.Web.Silverlight.resources.dll
- ClientBin
- Default.aspx
- Default.aspx.cs
- images
- SilverlightDesktop_small.gif
- Login.aspx
- Login.aspx.cs
- SetupWizard.aspx
- SetupWizard.aspx.cs
- SilverlightDesktop
- SQLScripts
- Verify
- web.config
- WebService
|
// 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 _Default : System.Web.UI.Page
{
string strCurrentVersion = "01.70.00";
bool boolSetup = false;
protected void Page_Load(object sender, EventArgs e)
{
boolSetup = DatabaseReady();
if (boolSetup)
{
lnkLogin.Visible = !User.Identity.IsAuthenticated;
lnkLogOut.Visible = User.Identity.IsAuthenticated;
ShowSilverlightDesktopLink();
// Possibly show Administration link
if (User.Identity.IsAuthenticated && (User.Identity.AuthenticationType == "Forms"))
{
FormsIdentity id = (FormsIdentity)User.Identity;
FormsAuthenticationTicket ticket = id.Ticket;
lnkAdministration.Visible = (ticket.UserData.ToString() == "Administrators");
}
ShowDesktops();
}
else
{
lnkSetup.Visible = true;
}
}
#region ShowSilverlightDesktopLink
private void ShowSilverlightDesktopLink()
{
GeneralSettings GeneralSettings = new GeneralSettings();
if (GeneralSettings.AnonymousLogin)
{
lnkSilverlightDesktop.Visible = true;
}
else
{
lnkSilverlightDesktop.Visible = User.Identity.IsAuthenticated;
}
}
#endregion
#region DatabaseReady
private bool DatabaseReady()
{
// This method returns true if the databse exists and the table is created
bool CanConnect = true;
try
{
SilverlightDesktopDAL SilverlightDesktopDAL = new SilverlightDesktopDAL();
var result = from VersionNumber in SilverlightDesktopDAL.Versions
select VersionNumber;
CanConnect = (result.FirstOrDefault().VersionNumber == strCurrentVersion) ? true : false;
}
catch (Exception e)
{
string strError = e.Message;
CanConnect = false;
}
return CanConnect;
}
#endregion
#region ShowDesktops
private void ShowDesktops()
{
SilverlightDesktopDAL SilverlightDesktopDAL = new SilverlightDesktopDAL();
var result = from DesktopInstances in SilverlightDesktopDAL.SilverlightDesktopInstances
select DesktopInstances;
GridView1.DataSource = result.ToList();
GridView1.DataBind();
GridView1.Visible = (result.Count() > 0) ? true : false;
}
#endregion
#region LogOut
protected void lnkLogOut_Click(object sender, EventArgs e)
{
FormsAuthentication.SignOut();
Response.Redirect("Default.aspx");
}
#endregion
}
|
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.