First create solution
This commit is contained in:
@@ -0,0 +1,117 @@
|
||||
Imports System
|
||||
Imports System.ComponentModel
|
||||
|
||||
Imports DevExpress.Xpo
|
||||
Imports DevExpress.Data.Filtering
|
||||
|
||||
Imports DevExpress.ExpressApp
|
||||
Imports DevExpress.Persistent.Base
|
||||
Imports DevExpress.Persistent.BaseImpl
|
||||
Imports DevExpress.Persistent.Validation
|
||||
Imports Newtonsoft.Json
|
||||
Public Enum eChatDirection
|
||||
eIn = 0
|
||||
eOut = 1
|
||||
End Enum
|
||||
<DefaultClassOptions(), NavigationItem(False), CreatableItem(False), NonPersistent()> _
|
||||
Public Class SISChat
|
||||
Inherits BaseObject
|
||||
|
||||
Private _User As User
|
||||
Private _HTMLBody As String
|
||||
Private _HTMLEvents As String
|
||||
Public Sub New(ByVal session As Session)
|
||||
MyBase.New(session)
|
||||
' This constructor is used when an object is loaded from a persistent storage.
|
||||
' Do not place any code here or place it only when the IsLoading property is false:
|
||||
' if (!IsLoading){
|
||||
' It is now OK to place your initialization code here.
|
||||
' }
|
||||
' or as an alternative, move your initialization code into the AfterConstruction method.
|
||||
End Sub
|
||||
Public Overrides Sub AfterConstruction()
|
||||
MyBase.AfterConstruction()
|
||||
' Place here your initialization code.
|
||||
End Sub
|
||||
|
||||
Property User As User
|
||||
Get
|
||||
Return _User
|
||||
End Get
|
||||
Set(value As User)
|
||||
SetPropertyValue("User", _User, value)
|
||||
End Set
|
||||
End Property
|
||||
<Size(-1), ImmediatePostData()> _
|
||||
Property HTMLBody As String
|
||||
Get
|
||||
Return _HTMLBody
|
||||
End Get
|
||||
Set(value As String)
|
||||
SetPropertyValue("HTMLBody", _HTMLBody, value)
|
||||
End Set
|
||||
End Property
|
||||
<Size(-1)> _
|
||||
Property HTMLEvents As String
|
||||
Get
|
||||
Return _HTMLEvents
|
||||
End Get
|
||||
Set(value As String)
|
||||
SetPropertyValue("HTMLEvents", _HTMLEvents, value)
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Public Function CreateCompressedChat(_InputString As String) As String
|
||||
Dim mem As New IO.MemoryStream
|
||||
Dim gz As New System.IO.Compression.GZipStream(mem, IO.Compression.CompressionMode.Compress)
|
||||
Dim sw As New IO.StreamWriter(gz)
|
||||
Dim _OutputString As String = ""
|
||||
sw.Write(_InputString)
|
||||
sw.Flush()
|
||||
mem.Seek(0, IO.SeekOrigin.Begin)
|
||||
Dim sr As New IO.BinaryReader(mem)
|
||||
|
||||
Dim _Bytes As Byte()
|
||||
Dim _Byte As Byte
|
||||
_Bytes = sr.ReadBytes(CInt(mem.Length))
|
||||
|
||||
For Each _Byte In _Bytes
|
||||
_OutputString += Chr(_Byte)
|
||||
Next
|
||||
|
||||
sw.Close()
|
||||
Return _OutputString
|
||||
End Function
|
||||
Function CreateJSONSerialize(_InputString As String, _ChatDirection As eChatDirection) As String
|
||||
Dim _JSON As String = ""
|
||||
Dim _JSNOChat As New JSONChat
|
||||
|
||||
_JSNOChat.ChatDirection = _ChatDirection
|
||||
_JSNOChat.EMail = _User.Email
|
||||
_JSNOChat.HTMLBody = _InputString
|
||||
_JSNOChat.IsReaded = False
|
||||
_JSON = JsonConvert.SerializeObject(_JSNOChat)
|
||||
|
||||
Return _JSON
|
||||
End Function
|
||||
Function GetLastChat() As String
|
||||
Dim _JSON As String = ""
|
||||
Dim _JSNOChat As New JSONChat
|
||||
|
||||
_JSNOChat.ChatDirection = eChatDirection.eOut
|
||||
_JSNOChat.EMail = _User.Email
|
||||
_JSNOChat.HTMLBody = "*"
|
||||
_JSON = JsonConvert.SerializeObject(_JSNOChat)
|
||||
|
||||
Return _JSON
|
||||
End Function
|
||||
Function CreateHTMLEvents(_JSON As String) As String
|
||||
Return "Ready"
|
||||
End Function
|
||||
End Class
|
||||
Public Class JSONChat
|
||||
Property ChatDirection As eChatDirection
|
||||
Property EMail As String
|
||||
Property HTMLBody As String
|
||||
Property IsReaded As Boolean
|
||||
End Class
|
||||
@@ -0,0 +1,69 @@
|
||||
Partial Class SISChatVC
|
||||
|
||||
<System.Diagnostics.DebuggerNonUserCode()> _
|
||||
Public Sub New(ByVal Container As System.ComponentModel.IContainer)
|
||||
MyClass.New()
|
||||
|
||||
'Required for Windows.Forms Class Composition Designer support
|
||||
Container.Add(Me)
|
||||
|
||||
End Sub
|
||||
|
||||
'Component overrides dispose to clean up the component list.
|
||||
<System.Diagnostics.DebuggerNonUserCode()> _
|
||||
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
|
||||
If disposing AndAlso components IsNot Nothing Then
|
||||
components.Dispose()
|
||||
End If
|
||||
MyBase.Dispose(disposing)
|
||||
End Sub
|
||||
|
||||
'Required by the Component Designer
|
||||
Private components As System.ComponentModel.IContainer
|
||||
|
||||
'NOTE: The following procedure is required by the Component Designer
|
||||
'It can be modified using the Component Designer.
|
||||
'Do not modify it using the code editor.
|
||||
<System.Diagnostics.DebuggerStepThrough()> _
|
||||
Private Sub InitializeComponent()
|
||||
Me.components = New System.ComponentModel.Container()
|
||||
Me.aSISChatSubmit = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
|
||||
Me.aSISChat = New DevExpress.ExpressApp.Actions.SimpleAction(Me.components)
|
||||
'
|
||||
'aSISChatSubmit
|
||||
'
|
||||
Me.aSISChatSubmit.ActionMeaning = DevExpress.ExpressApp.Actions.ActionMeaning.Accept
|
||||
Me.aSISChatSubmit.Caption = "aSISChat Submit"
|
||||
Me.aSISChatSubmit.Category = "aSISChatSubmit"
|
||||
Me.aSISChatSubmit.ConfirmationMessage = Nothing
|
||||
Me.aSISChatSubmit.Id = "aSISChatSubmit"
|
||||
Me.aSISChatSubmit.ImageName = Nothing
|
||||
Me.aSISChatSubmit.Shortcut = Nothing
|
||||
Me.aSISChatSubmit.Tag = Nothing
|
||||
Me.aSISChatSubmit.TargetObjectsCriteria = Nothing
|
||||
Me.aSISChatSubmit.TargetObjectType = GetType(Nuvolar.[Module].SISChat)
|
||||
Me.aSISChatSubmit.TargetViewId = Nothing
|
||||
Me.aSISChatSubmit.TargetViewType = DevExpress.ExpressApp.ViewType.DetailView
|
||||
Me.aSISChatSubmit.ToolTip = Nothing
|
||||
Me.aSISChatSubmit.TypeOfView = GetType(DevExpress.ExpressApp.DetailView)
|
||||
'
|
||||
'aSISChat
|
||||
'
|
||||
Me.aSISChat.Caption = "aSISChat"
|
||||
Me.aSISChat.Category = "Menu"
|
||||
Me.aSISChat.ConfirmationMessage = Nothing
|
||||
Me.aSISChat.Id = "aSISChat"
|
||||
Me.aSISChat.ImageName = Nothing
|
||||
Me.aSISChat.Shortcut = Nothing
|
||||
Me.aSISChat.Tag = Nothing
|
||||
Me.aSISChat.TargetObjectsCriteria = Nothing
|
||||
Me.aSISChat.TargetViewId = Nothing
|
||||
Me.aSISChat.TargetViewType = DevExpress.ExpressApp.ViewType.ListView
|
||||
Me.aSISChat.ToolTip = Nothing
|
||||
Me.aSISChat.TypeOfView = GetType(DevExpress.ExpressApp.ListView)
|
||||
|
||||
End Sub
|
||||
Protected WithEvents aSISChatSubmit As DevExpress.ExpressApp.Actions.SimpleAction
|
||||
Friend WithEvents aSISChat As DevExpress.ExpressApp.Actions.SimpleAction
|
||||
|
||||
End Class
|
||||
@@ -0,0 +1,129 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="aSISChatSubmit.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>116, 17</value>
|
||||
</metadata>
|
||||
<metadata name="aSISChat.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>254, 17</value>
|
||||
</metadata>
|
||||
<metadata name="$this.TrayLargeIcon" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<value>False</value>
|
||||
</metadata>
|
||||
</root>
|
||||
@@ -0,0 +1,110 @@
|
||||
Imports System
|
||||
Imports System.ComponentModel
|
||||
Imports System.Collections.Generic
|
||||
Imports System.Diagnostics
|
||||
Imports System.Text
|
||||
|
||||
Imports DevExpress.ExpressApp
|
||||
Imports DevExpress.ExpressApp.Actions
|
||||
Imports DevExpress.Persistent.Base
|
||||
|
||||
Imports DevExpress.ExpressApp.SystemModule
|
||||
Imports DevExpress.Persistent.BaseImpl
|
||||
Imports DevExpress.Data.Filtering
|
||||
|
||||
Imports System.Net
|
||||
Imports System.IO
|
||||
|
||||
Public Class SISChatVC
|
||||
Inherits DevExpress.ExpressApp.ViewController
|
||||
#If DEBUG Then
|
||||
Private _SISChatURL As String = "http://192.168.1.102/SISChat/SISChat.ashx?id="
|
||||
#Else
|
||||
Private _SISChatURL As String = "http://sis-r.hu/SISChat/SISChat.ashx?id="
|
||||
#End If
|
||||
|
||||
Public Event MyAutoscroll(sender As Object, e As EventArgs)
|
||||
|
||||
Public Sub New()
|
||||
MyBase.New()
|
||||
|
||||
'This call is required by the Component Designer.
|
||||
InitializeComponent()
|
||||
RegisterActions(components)
|
||||
|
||||
End Sub
|
||||
Protected Overrides Sub OnActivated()
|
||||
MyBase.OnActivated()
|
||||
|
||||
If View.Id = "SISChat_DetailView" Then
|
||||
'Frame.GetController(Of DialogController).AcceptAction.Active.SetItemValue("", False)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Overrides Sub OnDeactivated()
|
||||
MyBase.OnDeactivated()
|
||||
If View.Id = "SISChat_DetailView" Then
|
||||
'Frame.GetController(Of DialogController).AcceptAction.Active.SetItemValue("", False)
|
||||
End If
|
||||
End Sub
|
||||
Private Sub aSISChatSubmit_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aSISChatSubmit.Execute
|
||||
Dim _ocur As Xpo.XPObjectSpace = TryCast(View.ObjectSpace, Xpo.XPObjectSpace)
|
||||
Dim _SISChat As SISChat = TryCast(View.SelectedObjects(0), SISChat)
|
||||
Dim _JSON As String
|
||||
|
||||
|
||||
_JSON = _SISChat.CreateJSONSerialize(_SISChat.HTMLBody, eChatDirection.eIn)
|
||||
_SISChat.HTMLBody = ""
|
||||
View.Refresh()
|
||||
|
||||
Try
|
||||
Dim URL As String = _SISChatURL & _JSON
|
||||
Dim request As HttpWebRequest = TryCast(WebRequest.Create(URL), HttpWebRequest)
|
||||
|
||||
Dim response As HttpWebResponse = TryCast(request.GetResponse, HttpWebResponse)
|
||||
|
||||
Dim reader As StreamReader = New StreamReader(response.GetResponseStream())
|
||||
Dim str As String = reader.ReadToEnd
|
||||
|
||||
_SISChat.HTMLEvents = str
|
||||
RaiseEvent MyAutoscroll(sender, TryCast(e, System.EventArgs))
|
||||
Catch exp As Exception
|
||||
_SISChat.HTMLEvents = exp.Message
|
||||
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Private Sub aSISChat_Execute(sender As System.Object, e As DevExpress.ExpressApp.Actions.SimpleActionExecuteEventArgs) Handles aSISChat.Execute
|
||||
Dim _onew As Xpo.XPObjectSpace = Application.CreateObjectSpace
|
||||
Dim _SISChat As SISChat
|
||||
Dim _JSON As String
|
||||
|
||||
_SISChat = _onew.CreateObject(Of SISChat)()
|
||||
_SISChat.User = _onew.FindObject(Of User)(CriteriaOperator.Parse("Oid=?", SecuritySystem.CurrentUser.oid))
|
||||
|
||||
_JSON = _SISChat.GetLastChat
|
||||
Try
|
||||
Dim URL As String = _SISChatURL & _JSON
|
||||
Dim request As HttpWebRequest = TryCast(WebRequest.Create(URL), HttpWebRequest)
|
||||
|
||||
Dim response As HttpWebResponse = TryCast(request.GetResponse, HttpWebResponse)
|
||||
|
||||
Dim reader As StreamReader = New StreamReader(response.GetResponseStream())
|
||||
Dim str As String = reader.ReadToEnd
|
||||
|
||||
_SISChat.HTMLEvents = str
|
||||
Catch exp As Exception
|
||||
_SISChat.HTMLEvents = exp.Message
|
||||
|
||||
End Try
|
||||
|
||||
|
||||
Dim _ShowViewParameters As New ShowViewParameters
|
||||
Dim _ShowViewSource As New ShowViewSource(Frame, Nothing)
|
||||
|
||||
_ShowViewParameters.CreatedView = Application.CreateDetailView(_onew, "SISChat_DetailView", False, _SISChat)
|
||||
_ShowViewParameters.NewWindowTarget = NewWindowTarget.Separate
|
||||
_ShowViewParameters.TargetWindow = TargetWindow.NewWindow
|
||||
Application.ShowViewStrategy.ShowView(_ShowViewParameters, _ShowViewSource)
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user