Manage Winforms App from a web application

A similar question is asked before here.

... but mine is different in that I just need to control the winforms application from a web page (not bidirectional). I just need to tell the winforms application to open windows, etc., when the user clicks the links inside the web application.

It's all in a secure corporate environment, so don't worry about security.

I see two possible solutions:

1) create an ActiveX “pad” that can be easily embedded in a web page

2) start the WCF service in a WinForms application that listens for commands (REST-ful type)

Is there a dead simple solution that I am missing? Any other alternatives?

+3
source share
5 answers

2) host the WCF service in WinForms application that listens (type REST-ful) Commands

It's dead, just ... I would choose for this

0
source

Depending on the complexity of the “commands” that can be output from the web page to the WinForms application, you can simply register the custom URI scheme using the web browser that calls your application. For example, mailto:calls your email program, or itms:calls the iTunes Music Store.

Then your application recognizes that its instance is already running and passes arguments to the executable instance.

+1
source

. , xls , excel URL- xls , klick play-list, .

() ".fro" , .fro .

, , . .

, , -, winform- , , - <a href="opencustomer.fro">Open customer</a>, opencustomer.fro .

vb.net , google # - : http://bytes.com/topic/net/answers/519230-vb-net-associate-file-program

Public Class Example 

    Public Sub RegisterType() 
        Dim fileReg As New FileTypeRegistrar 

        With fileReg 
            .FullPath = Path_To_Executable 
            .FileExtension = Extension_To_Register 
            .ContentType = "application/" & Your_Description 
            .IconIndex = Icon_Index_In_Application 
            .IconPath = Path_To_Executable 
            .ProperName = Name_Of_Executable 
            .CreateType() 
        End With 

    End Sub 

End Class 

Public Class FileTypeRegistrar 

#Region "Properties & Property Variables" 
    Private _ProperName As String 
    Public Property ProperName() As String 
        Get 
            Return _ProperName 
        End Get 
        Set(ByVal Value As String) 
            _ProperName = Value 
        End Set 
    End Property 

    Private _ContentType As String 
    Public Property ContentType() As String 
        Get 
            Return _ContentType 
        End Get 
        Set(ByVal Value As String) 
            _ContentType = Value 
        End Set 
    End Property 

    Private _FullPath As String 
    Public Property FullPath() As String 
        Get 
            Return _FullPath 
        End Get 
        Set(ByVal Value As String) 
            _FullPath = Value 
        End Set 
    End Property 

    Private _FileExtension As String 
    Public Property FileExtension() As String 
        Get 
            Return _FileExtension 
        End Get 
        Set(ByVal Value As String) 
            _FileExtension = Value.Replace(".", "") 
        End Set 
    End Property 

    Private _IconPath As String 
    Public Property IconPath() As String 
        Get 
            Return _IconPath 
        End Get 
        Set(ByVal Value As String) 
            _IconPath = Value 
        End Set 
    End Property 

    Private _IconIndex As Integer 
    Public Property IconIndex() As Integer 
        Get 
            Return _IconIndex 
        End Get 
        Set(ByVal Value As Integer) 
            _IconIndex = Value 
        End Set 
    End Property 
#End Region 

#Region "Public Methods" 
    Public Sub CreateType() 
        Dim fileName As String = Path.GetFileNameWithoutExtension(FullPath) 
        Dim Ext As String = "." & FileExtension.ToLower 
        Dim extKey As RegistryKey = Registry.ClassesRoot.CreateSubKey(Ext) 

        extKey.SetValue("", fileName) 
        extKey.SetValue("Content Type", ContentType) 
        extKey.Close() 

        Dim mainKey As RegistryKey = Registry.ClassesRoot.CreateSubKey(fileName) 
        Dim defIconKey As RegistryKey = mainKey.CreateSubKey("DefaultIcon") 

        defIconKey.SetValue("", IconPath & ", " & IconIndex) 
        defIconKey.Close() 

        Dim shellKey As RegistryKey = mainKey.CreateSubKey("shell") 
        Dim OpenKey As RegistryKey = shellKey.CreateSubKey("Open") 
        Dim cmdKey As RegistryKey = OpenKey.CreateSubKey("command") 

        cmdKey.SetValue("", """" & FullPath & " %1""") 
        cmdKey.Close() 
        OpenKey.Close() 
        shellKey.Close() 
        mainKey.Close() 

    End Sub 

    Public Sub DeleteType() 
        Dim fileName As String = Path.GetFileNameWithoutExtension(FullPath) 
        Dim Ext As String = "." & FileExtension.ToLower 

        Registry.ClassesRoot.DeleteSubKey(Ext) 
        Registry.ClassesRoot.DeleteSubKey(fileName) 

    End Sub 
#End Region 

End Class 
0

winformclients - - - 2-4 , , -.

clientid, , ClientDone

, , -, winformclient, clientid commmand.

winform, winform - . , ( )

This will assume that the user registered on the website has the same client / user ID when entering the winform program.

0
source

Because you work in a corporate environment, there may be a very wide range of browsers. Have you considered creating a subtle Firefox add-on that interacts with your site and sends all the commands to your WinForms application?

0
source

Source: https://habr.com/ru/post/1716456/


All Articles