Lightswitch application integration steps to AVRWEbpublisher

Discussion in 'Lightswitch Integration' started by JeanM, Mar 5, 2014.

  1. JeanM

    JeanM New Member

    How can I deploy Lightswitch application AVRWebpublisher?
  2. avreporter

    avreporter Administrator Staff Member

    1) Publish LightSwitch application in Visual Studio

    Attached Files:

    • LSD1.png
      LSD1.png
      File size:
      34.8 KB
      Views:
      724
  3. avreporter

    avreporter Administrator Staff Member

    2) Configure LightSwitch Application

    Attached Files:

    • LSD2.png
      LSD2.png
      File size:
      100.8 KB
      Views:
      706
  4. avreporter

    avreporter Administrator Staff Member

    2.1) Configure database Connection

    Attached Files:

    • LSD3.png
      LSD3.png
      File size:
      78.9 KB
      Views:
      1,025
  5. avreporter

    avreporter Administrator Staff Member

    2.1) Configure database Connection

    Attached Files:

    • LSD4.png
      LSD4.png
      File size:
      73.4 KB
      Views:
      738
  6. avreporter

    avreporter Administrator Staff Member

    Anyway the database settings is included web.config file. After installation You can find this file in the installed aplication folder (root\intepub\application).
  7. avreporter

    avreporter Administrator Staff Member

    3) Finally you can click Publis application and Visual Studio generate project file (this is .ZIP file) You can find you Visual Studio project publis folder. This one ZIP file is included all of component to instllation. After that you can copy this file to server computer, WEBPublisher is installed this computer and Start IIS Manager.

    Attached Files:

    • LSD5.png
      LSD5.png
      File size:
      159.4 KB
      Views:
      733
  8. avreporter

    avreporter Administrator Staff Member

    4) Click right button on mouse, in menu select Deploy>Import Application

    Attached Files:

  9. avreporter

    avreporter Administrator Staff Member

    5) Select application (project .zip file)

    Attached Files:

    • LSD7.png
      LSD7.png
      File size:
      119.1 KB
      Views:
      765
  10. avreporter

    avreporter Administrator Staff Member

    6) Click Next Button

    Attached Files:

    • LSD8.png
      LSD8.png
      File size:
      129.6 KB
      Views:
      725
  11. avreporter

    avreporter Administrator Staff Member

    7) Click Next Button

    Attached Files:

  12. avreporter

    avreporter Administrator Staff Member

    Important!!! After installation you have to sellect application pool type.

    Attached Files:

  13. avreporter

    avreporter Administrator Staff Member

    Finally Restart IIS...
  14. JeanM

    JeanM New Member

    How can I get login in Lightswitch code username and password from WEBPublisher enviroment in AVRerport v2.5?
  15. avreporter

    avreporter Administrator Staff Member

    AVReporter v2.5 is not support direct access to actual username and password by API, but you get this parameters by URL:

    a) You can use this code in your lightswitch application and get parameters from WEBPublisher:

    Imports System.Windows.Browser
    Imports Microsoft.LightSwitch
    Imports Microsoft.LightSwitch.Threading

    Private Sub Start()
    Dim user As String = getURLParameter("username") 'Get Logged in Username
    Dim ReadO As String = getURLParameter("readonly") 'Get ReadOnly parameter
    Dim Getnamespaces As String = getURLParameter("namespaces") 'Get Enabled NameSpaces
    End Sub

    Private Function getURLParameter(parameterName As String) As String
    Dim parameterValue As String = String.Empty
    Microsoft.LightSwitch.Threading.Dispatchers.Main.Invoke(
    Sub()
    System.Windows.Browser.HtmlPage.Document.QueryString.TryGetValue(parameterName, parameterValue)
    End Sub
    )
    Return parameterValue
    End Function

    Attached Files:

  16. avreporter

    avreporter Administrator Staff Member

    b) You have to use this code in your Lightswitch application, link because It can get from Username,etc data from WEBPublisher interface and give to LightSwitch application by URL.

    embedLightSwitch.aspx
    embedLightSwitch.aspx.vb

    embedLightSwitch.aspx:

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="embedLightSwitch.aspx.vb" Inherits="_embedLightSwitch" %>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head runat="server">
    <title />
    <meta id="metaRefresh" runat="server" http-equiv="REFRESH" content="" />
    </head>
    <body />
    </html>
    embedLightSwitch.aspx.vb:

    Partial Class _embedLightSwitch
    Inherits System.Web.UI.Page
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Dim user As String = String.Empty
    Dim group As String = String.Empty
    Dim namespaces As String = String.Empty
    Dim readOnlyUser As Boolean = True
    ' Try to get user
    Try
    user = System.Web.HttpContext.Current.User.Identity.Name
    Catch ex As Exception
    ' D:
    End Try
    ' Try to get group
    Try
    group = Roles.GetRolesForUser(user)(0)
    Catch ex As Exception
    ' D:
    End Try
    ' Try to get namespaces
    Try
    For Each ns In Session.Item("avrSessionObject").NamespaceList
    namespaces &= ns.itemID & ";"
    Next
    Catch ex As Exception
    ' D:
    End Try
    ' Try to get readonly status
    Try
    If Not user Is Nothing AndAlso _
    Not String.IsNullOrEmpty(user) AndAlso _
    Not group Is Nothing AndAlso _
    Not String.IsNullOrEmpty(group) AndAlso _
    Session.Item("avrSessionObject").ActualUserSettings.AllowUpload AndAlso _
    Not Session.Item("avrSessionObject").ActualUserSettings.ReadOnlyUser Then
    readOnlyUser = False
    End If
    Catch ex As Exception
    ' D:
    End Try
    metaRefresh.Content = "0; url=http://localhost/default.htm?username=" & user & "&groupname=" & group & "&namespaces=" & namespaces & "&readonly=" & readOnlyUser.ToString
    End Sub
    End Class

    *Selected red section is your LS appliction URL

Share This Page