text
stringlengths 2
5.77M
|
---|
'------------------------------------------------------------------------------
' <auto-generated>
' Dieser Code wurde von einem Tool generiert.
' Laufzeitversion: 4.0.30319.42000
'
' Änderungen an dieser Datei können fehlerhaftes Verhalten verursachen und gehen verloren, wenn
' der Code erneut generiert wird.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
#Region "Funktion zum automatischen Speichern von My.Settings"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.HVIFControl.My.MySettings
Get
Return Global.HVIFControl.My.MySettings.Default
End Get
End Property
End Module
End Namespace
|
Namespace DataElements
Friend Class I47
Inherits StringElement
Friend Sub New()
MyBase.New(1, 8)
End Sub
End Class
End Namespace
|
Namespace Configuration
Public Class TimeSpanConvertor
#Region " Public Constants "
Public Shared TIMESPAN_SUFFIXES As Char() = _
New Char() {"s", "e", "c", "m", "i", "n", "h", "o", "u", "r", "d", "a", "y", "t"}
Public Shared TIMESPAN_DAY As String = "day"
Public Shared TIMESPAN_DAYS As String = TIMESPAN_DAY & "s"
Public Shared TIMESPAN_DAY_SHORT As String = "d"
Public Shared TIMESPAN_HOUR As String = "hour"
Public Shared TIMESPAN_HOURS As String = TIMESPAN_HOUR & "s"
Public Shared TIMESPAN_HOUR_SHORT As String = "h"
Public Shared TIMESPAN_MIN As String = "min"
Public Shared TIMESPAN_MINS As String = TIMESPAN_MIN & "s"
Public Shared TIMESPAN_MINUTE As String = "minute"
Public Shared TIMESPAN_MINUTES As String = TIMESPAN_MINUTE & "s"
Public Shared TIMESPAN_MINUTE_SHORT As String = "m"
Public Shared TIMESPAN_SEC As String = "sec"
Public Shared TIMESPAN_SECS As String = TIMESPAN_SEC & "s"
Public Shared TIMESPAN_SECOND As String = "second"
Public Shared TIMESPAN_SECONDS As String = TIMESPAN_SECOND & "s"
Public Shared TIMESPAN_SECOND_SHORT As String = "s"
Public Shared TIMESPAN_MS As String = "msec"
Public Shared TIMESPAN_MSS As String = TIMESPAN_MS & "s"
Public Shared TIMESPAN_MILLISECOND As String = "millisecond"
Public Shared TIMESPAN_MILLISECONDS As String = TIMESPAN_MILLISECOND & "s"
Public Shared TIMESPAN_MILLISECOND_SHORT As String = "ms"
Public Shared TIMESPAN_TICK As String = "tick"
Public Shared TIMESPAN_TICKS As String = TIMESPAN_TICK & "s"
Public Shared TIMESPAN_TICK_SHORT As String = "t"
#End Region
#Region " Public Parsing Methods "
''' <summary>
''' Public Parsing Method.
''' </summary>
''' <param name="value">The Value to Parse.</param>
''' <param name="successfulParse">A ByRef/Out Parameter used to indicate whether the Parse was successful or not.</param>
''' <returns>The Parsed Object or Nothing.</returns>
''' <remarks>This method can only currently parse simple timespans.</remarks>
Public Function ParseTimeSpanFromString( _
<ParsingInParameterAttribute()> ByVal value As String, _
<ParsingSuccessParameter()> ByRef successfulParse As Boolean, _
<ParsingTypeParameter()> ByVal typeToParseTo As Type _
) As Object
Dim ret_TimeSpan As TimeSpan
If value.EndsWith(TIMESPAN_SEC) OrElse _
value.EndsWith(TIMESPAN_SECS) OrElse _
value.EndsWith(TIMESPAN_SECOND) OrElse _
value.EndsWith(TIMESPAN_SECONDS) Then
ret_TimeSpan = New TimeSpan(0, 0, 0, _
Integer.Parse(value.TrimEnd(TIMESPAN_SUFFIXES), _
System.Globalization.CultureInfo.InvariantCulture))
successfulParse = True
ElseIf value.EndsWith(TIMESPAN_MIN) OrElse _
value.EndsWith(TIMESPAN_MINS) OrElse _
value.EndsWith(TIMESPAN_MINUTE) OrElse _
value.EndsWith(TIMESPAN_MINUTES) OrElse _
value.EndsWith(TIMESPAN_MINUTE_SHORT) Then
ret_TimeSpan = New TimeSpan(0, 0, _
Integer.Parse(value.TrimEnd(TIMESPAN_SUFFIXES), _
System.Globalization.CultureInfo.InvariantCulture), 0)
successfulParse = True
ElseIf value.EndsWith(TIMESPAN_HOUR) OrElse _
value.EndsWith(TIMESPAN_HOURS) OrElse _
value.EndsWith(TIMESPAN_HOUR_SHORT) Then
ret_TimeSpan = New TimeSpan(0, _
Integer.Parse(value.TrimEnd(TIMESPAN_SUFFIXES), _
System.Globalization.CultureInfo.InvariantCulture), 0, 0)
successfulParse = True
ElseIf value.EndsWith(TIMESPAN_DAY) OrElse _
value.EndsWith(TIMESPAN_DAYS) OrElse _
value.EndsWith(TIMESPAN_DAY_SHORT) Then
ret_TimeSpan = New TimeSpan( _
Integer.Parse(value.TrimEnd(TIMESPAN_SUFFIXES), _
System.Globalization.CultureInfo.InvariantCulture), 0, 0, 0)
successfulParse = True
End If
Return ret_TimeSpan
End Function
''' <summary>
''' Public Method Handling the Parsing of a Colour.
''' </summary>
''' <param name="value">The Colour Value to Parse.</param>
''' <param name="successfulParse">A ByRef/Out Parameter used to indicate whether the Parse was successful or not.</param>
''' <returns>The Parsed Object or Nothing.</returns>
''' <remarks></remarks>
Public Function ParseStringFromTimespan( _
<ParsingInParameterAttribute()> ByVal value As TimeSpan, _
<ParsingSuccessParameter()> ByRef successfulParse As Boolean, _
Optional ByVal shortFormat As Boolean = False _
) As String
If Not value = Nothing Then
Dim hasParent As Boolean = False
Dim strBuilder As New System.Text.StringBuilder
If Not value.Days = 0 Then
hasParent = True
strBuilder.Append(value.Days)
If Not shortFormat Then strBuilder.Append(SPACE)
If shortFormat Then
strBuilder.Append(TIMESPAN_DAY_SHORT)
ElseIf value.Days > 1 OrElse value.Days < -1 Then
strBuilder.Append(TIMESPAN_DAYS)
Else
strBuilder.Append(TIMESPAN_DAY)
End If
End If
If Not value.Hours = 0 Then
If hasParent Then
strBuilder.Append(COMMA)
strBuilder.Append(SPACE)
End If
hasParent = True
strBuilder.Append(value.Hours)
If Not shortFormat Then strBuilder.Append(SPACE)
If shortFormat Then
strBuilder.Append(TIMESPAN_HOUR_SHORT)
ElseIf value.Hours > 1 OrElse value.Hours < -1 Then
strBuilder.Append(TIMESPAN_HOURS)
Else
strBuilder.Append(TIMESPAN_HOUR)
End If
End If
If Not value.Minutes = 0 Then
If hasParent Then
strBuilder.Append(COMMA)
strBuilder.Append(SPACE)
End If
hasParent = True
strBuilder.Append(value.Minutes)
If Not shortFormat Then strBuilder.Append(SPACE)
If shortFormat Then
strBuilder.Append(TIMESPAN_MINUTE_SHORT)
ElseIf value.Minutes > 1 OrElse value.Minutes < -1 Then
strBuilder.Append(TIMESPAN_MINS)
Else
strBuilder.Append(TIMESPAN_MIN)
End If
End If
If Not value.Seconds = 0 Then
If hasParent Then
strBuilder.Append(COMMA)
strBuilder.Append(SPACE)
End If
hasParent = True
strBuilder.Append(value.Seconds)
If Not shortFormat Then strBuilder.Append(SPACE)
If shortFormat Then
strBuilder.Append(TIMESPAN_SECOND_SHORT)
ElseIf value.Seconds > 1 OrElse value.Seconds < -1 Then
strBuilder.Append(TIMESPAN_SECS)
Else
strBuilder.Append(TIMESPAN_SEC)
End If
End If
If value.Days = 0 _
AndAlso value.Hours = 0 _
AndAlso value.Minutes = 0 _
AndAlso value.Seconds < 60 _
AndAlso value.Milliseconds > 0 Then
If hasParent Then
strBuilder.Append(COMMA)
strBuilder.Append(SPACE)
End If
hasParent = True
strBuilder.Append(value.Milliseconds)
If Not shortFormat Then strBuilder.Append(SPACE)
If shortFormat Then
strBuilder.Append(TIMESPAN_MILLISECOND_SHORT)
ElseIf value.Milliseconds > 1 OrElse value.Milliseconds < -1 Then
strBuilder.Append(TIMESPAN_MSS)
Else
strBuilder.Append(TIMESPAN_MS)
End If
End If
If value.Days = 0 _
AndAlso value.Hours = 0 _
AndAlso value.Minutes = 0 _
AndAlso value.Seconds = 0 _
AndAlso value.Milliseconds < 10 Then
If hasParent Then
strBuilder.Append(COMMA)
strBuilder.Append(SPACE)
End If
hasParent = True
strBuilder.Append(value.Ticks)
If Not shortFormat Then strBuilder.Append(SPACE)
If shortFormat Then
strBuilder.Append(TIMESPAN_TICK_SHORT)
ElseIf value.Ticks > 1 OrElse value.Ticks < -1 Then
strBuilder.Append(TIMESPAN_TICKS)
Else
strBuilder.Append(TIMESPAN_TICK)
End If
End If
successfulParse = True
Return strBuilder.ToString
Else
successfulParse = False
Return String.Empty
End If
End Function
#End Region
End Class
End Namespace |
Imports System
Module plus_petit
Dim eof As Boolean
Dim buffer As String
Function readChar_() As Char
If buffer Is Nothing OrElse buffer.Length = 0 Then
Dim tmp As String = Console.ReadLine()
eof = (tmp Is Nothing)
buffer = tmp + Chr(10)
End If
Return buffer(0)
End Function
Sub consommeChar()
readChar_()
buffer = buffer.Substring(1)
End Sub
Sub stdin_sep()
Do
If eof Then
Return
End If
Dim c As Char = readChar_()
If c = " "C Or c = Chr(13) Or c = Chr(9) Or c = Chr(10) Then
consommeChar()
Else
Return
End If
Loop
End Sub
Function readInt() As Integer
Dim i As Integer = 0
Dim s as Char = readChar_()
Dim sign As Integer = 1
If s = "-"C Then
sign = -1
consommeChar()
End If
Do
Dim c as Char = readChar_()
If c <= "9"C And c >= "0"C Then
i = i * 10 + Asc(c) - Asc("0"C)
consommeChar()
Else
return i * sign
End If
Loop
End Function
Function go0(ByRef tab as Integer(), ByVal a as Integer, ByVal b as Integer) As Integer
Dim m As Integer = (a + b) \ 2
If a = m Then
If tab(a) = m Then
Return b
Else
Return a
End If
End If
Dim i As Integer = a
Dim j As Integer = b
Do While i < j
Dim e As Integer = tab(i)
If e < m Then
i = i + 1
Else
j = j - 1
tab(i) = tab(j)
tab(j) = e
End If
Loop
If i < m Then
Return go0(tab, a, m)
Else
Return go0(tab, m, b)
End If
End Function
Function plus_petit0(ByRef tab as Integer(), ByVal len as Integer) As Integer
Return go0(tab, 0, len)
End Function
Sub Main()
Dim len As Integer = 0
len = readInt
stdin_sep
Dim tab(len - 1) As Integer
For i As Integer = 0 To len - 1
Dim tmp As Integer = 0
tmp = readInt
stdin_sep
tab(i) = tmp
Next
Console.Write(plus_petit0(tab, len))
End Sub
End Module
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.TextTransitionZ.My.MySettings
Get
Return Global.TextTransitionZ.My.MySettings.Default
End Get
End Property
End Module
End Namespace
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Concurrent
Imports System.Collections.Generic
Imports System.Collections.Immutable
Imports System.Runtime.InteropServices
Imports System.Threading
Imports Microsoft.CodeAnalysis.RuntimeMembers
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Roslyn.Utilities
Imports TypeKind = Microsoft.CodeAnalysis.TypeKind
Namespace Microsoft.CodeAnalysis.VisualBasic
''' <summary>
''' A ExecutableCodeBinder provides context for looking up labels within a context represented by a syntax node,
''' and also implementation of GetBinder.
''' </summary>
Friend MustInherit Class ExecutableCodeBinder
Inherits Binder
Private ReadOnly _syntaxRoot As SyntaxNode
Private ReadOnly _descendantBinderFactory As DescendantBinderFactory
Private _labelsMap As MultiDictionary(Of String, SourceLabelSymbol)
Private _labels As ImmutableArray(Of SourceLabelSymbol) = Nothing
Public Sub New(root As SyntaxNode, containingBinder As Binder)
MyBase.New(containingBinder)
_syntaxRoot = root
_descendantBinderFactory = New DescendantBinderFactory(Me, root)
End Sub
Friend ReadOnly Property Labels As ImmutableArray(Of SourceLabelSymbol)
Get
If _labels.IsDefault Then
ImmutableInterlocked.InterlockedCompareExchange(_labels, BuildLabels(), Nothing)
End If
Return _labels
End Get
End Property
' Build a read only array of all the local variables declared in this statement list.
Private Function BuildLabels() As ImmutableArray(Of SourceLabelSymbol)
Dim labels = ArrayBuilder(Of SourceLabelSymbol).GetInstance()
Dim syntaxVisitor = New LabelVisitor(labels, DirectCast(ContainingMember, MethodSymbol), Me)
Select Case _syntaxRoot.Kind
Case SyntaxKind.SingleLineFunctionLambdaExpression,
SyntaxKind.SingleLineSubLambdaExpression
syntaxVisitor.Visit(DirectCast(_syntaxRoot, SingleLineLambdaExpressionSyntax).Body)
Case SyntaxKind.MultiLineFunctionLambdaExpression,
SyntaxKind.MultiLineSubLambdaExpression
syntaxVisitor.VisitList(DirectCast(_syntaxRoot, MultiLineLambdaExpressionSyntax).Statements)
Case Else
syntaxVisitor.Visit(_syntaxRoot)
End Select
If labels.Count > 0 Then
Return labels.ToImmutableAndFree()
Else
labels.Free()
Return ImmutableArray(Of SourceLabelSymbol).Empty
End If
End Function
Private ReadOnly Property LabelsMap As MultiDictionary(Of String, SourceLabelSymbol)
Get
If Me._labelsMap Is Nothing Then
Interlocked.CompareExchange(Me._labelsMap, BuildLabelsMap(Me.Labels), Nothing)
End If
Return Me._labelsMap
End Get
End Property
Private Shared ReadOnly s_emptyLabelMap As MultiDictionary(Of String, SourceLabelSymbol) = New MultiDictionary(Of String, SourceLabelSymbol)(0, IdentifierComparison.Comparer)
Private Shared Function BuildLabelsMap(labels As ImmutableArray(Of SourceLabelSymbol)) As MultiDictionary(Of String, SourceLabelSymbol)
If Not labels.IsEmpty Then
Dim map = New MultiDictionary(Of String, SourceLabelSymbol)(labels.Length, IdentifierComparison.Comparer)
For Each label In labels
map.Add(label.Name, label)
Next
Return map
Else
' Return an empty map if there aren't any labels.
' LookupLabelByNameToken and other methods assumes a non null map
' is returned from the LabelMap property.
Return s_emptyLabelMap
End If
End Function
Friend Overrides Function LookupLabelByNameToken(labelName As SyntaxToken) As LabelSymbol
Dim name As String = labelName.ValueText
For Each labelSymbol As LabelSymbol In Me.LabelsMap(name)
If labelSymbol.LabelName = labelName Then
Return labelSymbol
End If
Next
Return MyBase.LookupLabelByNameToken(labelName)
End Function
Friend Overrides Sub LookupInSingleBinder(lookupResult As LookupResult,
name As String,
arity As Integer,
options As LookupOptions,
originalBinder As Binder,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo))
Debug.Assert(lookupResult.IsClear)
If (options And LookupOptions.LabelsOnly) = LookupOptions.LabelsOnly AndAlso LabelsMap IsNot Nothing Then
Dim labels = Me.LabelsMap(name)
Select Case labels.Count
Case 0
' Not found
Case 1
lookupResult.SetFrom(SingleLookupResult.Good(labels.Single()))
Case Else
' There are several labels with the same name, so we are going through the list
' of labels and pick one with the smallest location to make the choice deterministic
Dim bestSymbol As SourceLabelSymbol = Nothing
Dim bestLocation As Location = Nothing
For Each symbol In labels
Debug.Assert(symbol.Locations.Length = 1)
Dim sourceLocation As Location = symbol.Locations(0)
If bestSymbol Is Nothing OrElse Me.Compilation.CompareSourceLocations(bestLocation, sourceLocation) > 0 Then
bestSymbol = symbol
bestLocation = sourceLocation
End If
Next
lookupResult.SetFrom(SingleLookupResult.Good(bestSymbol))
End Select
End If
End Sub
Friend Overrides Sub AddLookupSymbolsInfoInSingleBinder(nameSet As LookupSymbolsInfo,
options As LookupOptions,
originalBinder As Binder)
' UNDONE: additional filtering based on options?
If Not Labels.IsEmpty AndAlso (options And LookupOptions.LabelsOnly) = LookupOptions.LabelsOnly Then
Dim labels = Me.Labels
For Each labelSymbol In labels
nameSet.AddSymbol(labelSymbol, labelSymbol.Name, 0)
Next
End If
End Sub
Public Overrides Function GetBinder(stmtList As SyntaxList(Of StatementSyntax)) As Binder
Return _descendantBinderFactory.GetBinder(stmtList)
End Function
Public Overrides Function GetBinder(node As SyntaxNode) As Binder
Return _descendantBinderFactory.GetBinder(node)
End Function
Public ReadOnly Property Root As SyntaxNode
Get
Return _descendantBinderFactory.Root
End Get
End Property
' Get the map that maps from syntax nodes to binders.
Public ReadOnly Property NodeToBinderMap As ImmutableDictionary(Of SyntaxNode, BlockBaseBinder)
Get
Return _descendantBinderFactory.NodeToBinderMap
End Get
End Property
' Get the map that maps from statement lists to binders.
Friend ReadOnly Property StmtListToBinderMap As ImmutableDictionary(Of SyntaxList(Of StatementSyntax), BlockBaseBinder)
Get
Return _descendantBinderFactory.StmtListToBinderMap
End Get
End Property
#If DEBUG Then
' Implicit variable declaration (Option Explicit Off) relies on identifiers
' being bound in order. Also, most of our tests run with Option Explicit On. To test that
' we bind identifiers in order even with Option Explicit On, in DEBUG we check the order or
' binding of simple names when compiling a whole method body (i.e., during batch compilation,
' not SemanticModel services).
'
' We check lambda separately from method bodies (even though in theory they should be checked
' together) because there are cases where lambda are bound out of order.
'
' See SourceMethodSymbol.GetBoundMethodBody for where this is enabled.
'
' See BindSimpleName for where CheckSimpleNameBinderOrder is called.
' We just store the positions of simple names that have been checked.
Private _checkSimpleNameBindingOrder As Boolean = False
' The set of offsets of simple names that have already been bound.
Private _boundSimpleNames As HashSet(Of Integer)
' The largest position that has been bound.
Private _lastBoundSimpleName As Integer = -1
Public Overrides Sub CheckSimpleNameBindingOrder(node As SimpleNameSyntax)
If _checkSimpleNameBindingOrder Then
Dim position = node.SpanStart
' There are cases where we bind the same name multiple times -- for example, For loop
' variables, and debug checks with local type inference. Hence we only check the first time we
' see a simple name.
If Not _boundSimpleNames.Contains(position) Then
' If this assert fires, it indicates that simple names are not being bound in order.
' This indicates that binding with Option Explicit Off likely will exhibit a bug.
Debug.Assert(position >= _lastBoundSimpleName, "Did not bind simple names in order. Option Explicit Off probably will not behave correctly.")
_boundSimpleNames.Add(position)
_lastBoundSimpleName = Math.Max(_lastBoundSimpleName, position)
End If
End If
End Sub
' We require simple name binding order checks to be enabled, because the SemanticModel APIs
' will bind things not in order. We only enable them during binding of a full method body or lambda body.
Public Overrides Sub EnableSimpleNameBindingOrderChecks(enable As Boolean)
If enable Then
Debug.Assert(Not _checkSimpleNameBindingOrder)
Debug.Assert(_boundSimpleNames Is Nothing)
_boundSimpleNames = New HashSet(Of Integer)
_checkSimpleNameBindingOrder = True
Else
_boundSimpleNames = Nothing
_checkSimpleNameBindingOrder = False
End If
End Sub
#End If
Public Class LabelVisitor
Inherits StatementSyntaxWalker
Private ReadOnly _labels As ArrayBuilder(Of SourceLabelSymbol)
Private ReadOnly _containingMethod As MethodSymbol
Private ReadOnly _binder As Binder
Public Sub New(labels As ArrayBuilder(Of SourceLabelSymbol), containingMethod As MethodSymbol, binder As Binder)
Me._labels = labels
Me._containingMethod = containingMethod
Me._binder = binder
End Sub
Public Overrides Sub VisitLabelStatement(node As LabelStatementSyntax)
_labels.Add(New SourceLabelSymbol(node.LabelToken, _containingMethod, _binder))
End Sub
End Class
End Class
End Namespace
|
Imports System.Resources
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("Age of Empires III Profile Generator")>
<Assembly: AssemblyDescription("Age of Empires III Profile Generator")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("Age of Empires III Profile Generator")>
<Assembly: AssemblyCopyright("")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("bfb2116a-8118-42f2-88f5-881d634ecfd8")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
<Assembly: NeutralResourcesLanguageAttribute("en-GB")> |
Namespace Xeora.VSAddIn.Tools
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class CompilerForm
Inherits System.Windows.Forms.Form
'Form 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 Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Dim DataGridViewCellStyle4 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Dim DataGridViewCellStyle5 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Dim DataGridViewCellStyle6 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Me.cbShowPassword = New System.Windows.Forms.CheckBox()
Me.ProgressBar = New System.Windows.Forms.ProgressBar()
Me.butCompile = New System.Windows.Forms.Button()
Me.dgvDomains = New System.Windows.Forms.DataGridView()
Me.Selected = New System.Windows.Forms.DataGridViewCheckBoxColumn()
Me.Domain = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.cbSecure = New System.Windows.Forms.DataGridViewCheckBoxColumn()
Me.PasswordText = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.PasswordHidden = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.lCurrentProcess = New System.Windows.Forms.Label()
Me.cbCheckAll = New System.Windows.Forms.CheckBox()
CType(Me.dgvDomains, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'cbShowPassword
'
Me.cbShowPassword.AutoSize = True
Me.cbShowPassword.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(162, Byte))
Me.cbShowPassword.Location = New System.Drawing.Point(23, 381)
Me.cbShowPassword.Margin = New System.Windows.Forms.Padding(6)
Me.cbShowPassword.Name = "cbShowPassword"
Me.cbShowPassword.Size = New System.Drawing.Size(219, 33)
Me.cbShowPassword.TabIndex = 6
Me.cbShowPassword.Text = "Show Password"
Me.cbShowPassword.UseVisualStyleBackColor = True
Me.cbShowPassword.Visible = False
'
'ProgressBar
'
Me.ProgressBar.Location = New System.Drawing.Point(77, 380)
Me.ProgressBar.Margin = New System.Windows.Forms.Padding(6)
Me.ProgressBar.Name = "ProgressBar"
Me.ProgressBar.Size = New System.Drawing.Size(715, 35)
Me.ProgressBar.TabIndex = 7
'
'butCompile
'
Me.butCompile.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(162, Byte))
Me.butCompile.Location = New System.Drawing.Point(804, 374)
Me.butCompile.Margin = New System.Windows.Forms.Padding(6)
Me.butCompile.Name = "butCompile"
Me.butCompile.Size = New System.Drawing.Size(150, 44)
Me.butCompile.TabIndex = 3
Me.butCompile.Text = "Compile"
Me.butCompile.UseVisualStyleBackColor = True
'
'dgvDomains
'
Me.dgvDomains.AllowUserToAddRows = False
Me.dgvDomains.AllowUserToDeleteRows = False
Me.dgvDomains.AllowUserToResizeRows = False
Me.dgvDomains.ClipboardCopyMode = System.Windows.Forms.DataGridViewClipboardCopyMode.Disable
DataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft
DataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control
DataGridViewCellStyle4.Font = New System.Drawing.Font("Microsoft Sans Serif", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(162, Byte))
DataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText
DataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight
DataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText
DataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.[True]
Me.dgvDomains.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle4
Me.dgvDomains.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.dgvDomains.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.Selected, Me.Domain, Me.cbSecure, Me.PasswordText, Me.PasswordHidden})
Me.dgvDomains.Location = New System.Drawing.Point(23, 22)
Me.dgvDomains.MultiSelect = False
Me.dgvDomains.Name = "dgvDomains"
DataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft
DataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control
DataGridViewCellStyle5.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.875!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(162, Byte))
DataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText
DataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight
DataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText
DataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.[True]
Me.dgvDomains.RowHeadersDefaultCellStyle = DataGridViewCellStyle5
DataGridViewCellStyle6.BackColor = System.Drawing.Color.White
DataGridViewCellStyle6.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.875!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(162, Byte))
DataGridViewCellStyle6.ForeColor = System.Drawing.Color.Black
DataGridViewCellStyle6.SelectionBackColor = System.Drawing.Color.White
DataGridViewCellStyle6.SelectionForeColor = System.Drawing.Color.Black
Me.dgvDomains.RowsDefaultCellStyle = DataGridViewCellStyle6
Me.dgvDomains.RowTemplate.Height = 50
Me.dgvDomains.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect
Me.dgvDomains.Size = New System.Drawing.Size(931, 344)
Me.dgvDomains.TabIndex = 0
'
'Selected
'
Me.Selected.FalseValue = "0"
Me.Selected.HeaderText = ""
Me.Selected.Name = "Selected"
Me.Selected.Resizable = System.Windows.Forms.DataGridViewTriState.[False]
Me.Selected.TrueValue = "1"
Me.Selected.Width = 50
'
'Domain
'
Me.Domain.HeaderText = "Domain ID"
Me.Domain.Name = "Domain"
Me.Domain.ReadOnly = True
Me.Domain.Resizable = System.Windows.Forms.DataGridViewTriState.[False]
Me.Domain.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable
Me.Domain.Width = 250
'
'cbSecure
'
Me.cbSecure.FalseValue = "0"
Me.cbSecure.HeaderText = "Secure"
Me.cbSecure.Name = "cbSecure"
Me.cbSecure.Resizable = System.Windows.Forms.DataGridViewTriState.[False]
Me.cbSecure.TrueValue = "1"
Me.cbSecure.Width = 120
'
'PasswordText
'
Me.PasswordText.HeaderText = "Password"
Me.PasswordText.MaxInputLength = 50
Me.PasswordText.Name = "PasswordText"
Me.PasswordText.Resizable = System.Windows.Forms.DataGridViewTriState.[False]
Me.PasswordText.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable
Me.PasswordText.Width = 400
'
'PasswordHidden
'
Me.PasswordHidden.HeaderText = ""
Me.PasswordHidden.Name = "PasswordHidden"
Me.PasswordHidden.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable
Me.PasswordHidden.Visible = False
'
'lCurrentProcess
'
Me.lCurrentProcess.AutoSize = True
Me.lCurrentProcess.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(162, Byte))
Me.lCurrentProcess.Location = New System.Drawing.Point(17, 378)
Me.lCurrentProcess.Name = "lCurrentProcess"
Me.lCurrentProcess.Size = New System.Drawing.Size(33, 36)
Me.lCurrentProcess.TabIndex = 11
Me.lCurrentProcess.Text = "0"
'
'cbCheckAll
'
Me.cbCheckAll.AutoSize = True
Me.cbCheckAll.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(162, Byte))
Me.cbCheckAll.Location = New System.Drawing.Point(75, 33)
Me.cbCheckAll.Margin = New System.Windows.Forms.Padding(6)
Me.cbCheckAll.Name = "cbCheckAll"
Me.cbCheckAll.Size = New System.Drawing.Size(28, 27)
Me.cbCheckAll.TabIndex = 1
Me.cbCheckAll.UseVisualStyleBackColor = True
'
'CompilerForm
'
Me.AcceptButton = Me.butCompile
Me.AutoScaleDimensions = New System.Drawing.SizeF(12.0!, 25.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(978, 436)
Me.Controls.Add(Me.cbCheckAll)
Me.Controls.Add(Me.lCurrentProcess)
Me.Controls.Add(Me.dgvDomains)
Me.Controls.Add(Me.butCompile)
Me.Controls.Add(Me.ProgressBar)
Me.Controls.Add(Me.cbShowPassword)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.Margin = New System.Windows.Forms.Padding(6)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "CompilerForm"
Me.ShowIcon = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "XeoraCube Domain Compiler"
CType(Me.dgvDomains, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents cbShowPassword As System.Windows.Forms.CheckBox
Friend WithEvents ProgressBar As System.Windows.Forms.ProgressBar
Friend WithEvents butCompile As System.Windows.Forms.Button
Friend WithEvents dgvDomains As DataGridView
Friend WithEvents Selected As DataGridViewCheckBoxColumn
Friend WithEvents Domain As DataGridViewTextBoxColumn
Friend WithEvents cbSecure As DataGridViewCheckBoxColumn
Friend WithEvents PasswordText As DataGridViewTextBoxColumn
Friend WithEvents PasswordHidden As DataGridViewTextBoxColumn
Friend WithEvents lCurrentProcess As Label
Friend WithEvents cbCheckAll As CheckBox
End Class
End Namespace |
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Immutable
Imports System.Composition
Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.UseCollectionInitializer
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic.UseCollectionInitializer
<ExportCodeFixProvider(LanguageNames.VisualBasic, Name:=PredefinedCodeFixProviderNames.UseCollectionInitializer), [Shared]>
Friend Class VisualBasicUseCollectionInitializerCodeFixProvider
Inherits AbstractUseCollectionInitializerCodeFixProvider(Of
SyntaxKind,
ExpressionSyntax,
StatementSyntax,
ObjectCreationExpressionSyntax,
MemberAccessExpressionSyntax,
InvocationExpressionSyntax,
ExpressionStatementSyntax,
VariableDeclaratorSyntax)
Protected Overrides Function GetNewStatement(
statement As StatementSyntax, objectCreation As ObjectCreationExpressionSyntax,
matches As ImmutableArray(Of ExpressionStatementSyntax)) As StatementSyntax
Dim newStatement = statement.ReplaceNode(
objectCreation,
GetNewObjectCreation(objectCreation, matches))
Dim totalTrivia = ArrayBuilder(Of SyntaxTrivia).GetInstance()
totalTrivia.AddRange(statement.GetLeadingTrivia())
totalTrivia.Add(SyntaxFactory.ElasticMarker)
For Each match In matches
For Each trivia In match.GetLeadingTrivia()
If trivia.Kind = SyntaxKind.CommentTrivia Then
totalTrivia.Add(trivia)
totalTrivia.Add(SyntaxFactory.ElasticMarker)
End If
Next
Next
Return newStatement.WithLeadingTrivia(totalTrivia)
End Function
Private Function GetNewObjectCreation(
objectCreation As ObjectCreationExpressionSyntax,
matches As ImmutableArray(Of ExpressionStatementSyntax)) As ObjectCreationExpressionSyntax
Dim initializer = SyntaxFactory.ObjectCollectionInitializer(
CreateCollectionInitializer(matches))
If objectCreation.ArgumentList IsNot Nothing AndAlso
objectCreation.ArgumentList.Arguments.Count = 0 Then
objectCreation = objectCreation.WithType(objectCreation.Type.WithTrailingTrivia(objectCreation.ArgumentList.GetTrailingTrivia())).
WithArgumentList(Nothing)
End If
Return objectCreation.WithoutTrailingTrivia().
WithInitializer(initializer).
WithTrailingTrivia(objectCreation.GetTrailingTrivia())
End Function
Private Function CreateCollectionInitializer(
matches As ImmutableArray(Of ExpressionStatementSyntax)) As CollectionInitializerSyntax
Dim nodesAndTokens = New List(Of SyntaxNodeOrToken)
For i = 0 To matches.Length - 1
Dim expressionStatement = matches(i)
Dim newExpression As ExpressionSyntax
Dim invocationExpression = DirectCast(expressionStatement.Expression, InvocationExpressionSyntax)
Dim arguments = invocationExpression.ArgumentList.Arguments
If arguments.Count = 1 Then
newExpression = arguments(0).GetExpression()
Else
newExpression = SyntaxFactory.CollectionInitializer(
SyntaxFactory.SeparatedList(
arguments.Select(Function(a) a.GetExpression()),
arguments.GetSeparators()))
End If
newExpression = newExpression.WithLeadingTrivia(SyntaxFactory.ElasticMarker)
If i < matches.Length - 1 Then
nodesAndTokens.Add(newExpression)
Dim comma = SyntaxFactory.Token(SyntaxKind.CommaToken).
WithTrailingTrivia(expressionStatement.GetTrailingTrivia())
nodesAndTokens.Add(comma)
Else
newExpression = newExpression.WithTrailingTrivia(expressionStatement.GetTrailingTrivia())
nodesAndTokens.Add(newExpression)
End If
Next
Return SyntaxFactory.CollectionInitializer(
SyntaxFactory.Token(SyntaxKind.OpenBraceToken).WithTrailingTrivia(SyntaxFactory.ElasticCarriageReturnLineFeed),
SyntaxFactory.SeparatedList(Of ExpressionSyntax)(nodesAndTokens),
SyntaxFactory.Token(SyntaxKind.CloseBraceToken))
End Function
End Class
End Namespace |
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.Runtime.Serialization
Imports Microsoft.CodeAnalysis.CodeStyle
Imports Microsoft.CodeAnalysis.Diagnostics
Imports Microsoft.CodeAnalysis.Editing
Imports Microsoft.CodeAnalysis.Formatting
Namespace Microsoft.CodeAnalysis.VisualBasic.Formatting
<DataContract>
Friend NotInheritable Class VisualBasicSyntaxFormattingOptions
Inherits SyntaxFormattingOptions
Implements IEquatable(Of VisualBasicSyntaxFormattingOptions)
Public Shared ReadOnly [Default] As New VisualBasicSyntaxFormattingOptions()
Public Shared Shadows Function Create(options As AnalyzerConfigOptions, fallbackOptions As VisualBasicSyntaxFormattingOptions) As VisualBasicSyntaxFormattingOptions
fallbackOptions = If(fallbackOptions, [Default])
Return New VisualBasicSyntaxFormattingOptions() With
{
.Common = options.GetCommonSyntaxFormattingOptions(fallbackOptions.Common)
}
End Function
Public Overrides Function [With](lineFormatting As LineFormattingOptions) As SyntaxFormattingOptions
Return New VisualBasicSyntaxFormattingOptions() With
{
.Common = New CommonOptions() With
{
.LineFormatting = lineFormatting,
.SeparateImportDirectiveGroups = SeparateImportDirectiveGroups,
.AccessibilityModifiersRequired = AccessibilityModifiersRequired
}
}
End Function
Public Overrides Function Equals(obj As Object) As Boolean
Return Equals(TryCast(obj, VisualBasicSyntaxFormattingOptions))
End Function
Public Overloads Function Equals(other As VisualBasicSyntaxFormattingOptions) As Boolean Implements IEquatable(Of VisualBasicSyntaxFormattingOptions).Equals
Return other IsNot Nothing AndAlso
Common.Equals(other.Common)
End Function
Public Overrides Function GetHashCode() As Integer
Return Common.GetHashCode()
End Function
End Class
End Namespace
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Success
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(Success))
Me.DescriptionLabel = New System.Windows.Forms.Label()
Me.CloseBtn = New System.Windows.Forms.Button()
Me.TitleLabel = New System.Windows.Forms.Label()
Me.BottomPanel = New System.Windows.Forms.Panel()
Me.GenuineSoftwareLogo = New System.Windows.Forms.PictureBox()
Me.BenefitsLinkLabel = New System.Windows.Forms.LinkLabel()
Me.BottomPanel.SuspendLayout()
CType(Me.GenuineSoftwareLogo, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'DescriptionLabel
'
Me.DescriptionLabel.AutoSize = True
Me.DescriptionLabel.Font = New System.Drawing.Font("Segoe UI", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.DescriptionLabel.Location = New System.Drawing.Point(32, 70)
Me.DescriptionLabel.Name = "DescriptionLabel"
Me.DescriptionLabel.Size = New System.Drawing.Size(391, 51)
Me.DescriptionLabel.TabIndex = 1
Me.DescriptionLabel.Text = "Activation helps verify that your copy of Windows is genuine. With" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "a genuine cop" &
"y of Windows 7, you are eligible to receive all" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "available updates and product s" &
"upport from Microsoft."
'
'CloseBtn
'
Me.CloseBtn.BackColor = System.Drawing.SystemColors.Control
Me.CloseBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.CloseBtn.FlatStyle = System.Windows.Forms.FlatStyle.System
Me.CloseBtn.Location = New System.Drawing.Point(530, 8)
Me.CloseBtn.Name = "CloseBtn"
Me.CloseBtn.Size = New System.Drawing.Size(75, 23)
Me.CloseBtn.TabIndex = 0
Me.CloseBtn.Text = "Close"
Me.CloseBtn.UseVisualStyleBackColor = True
'
'TitleLabel
'
Me.TitleLabel.AutoSize = True
Me.TitleLabel.Font = New System.Drawing.Font("Segoe UI", 12.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TitleLabel.ForeColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(108, Byte), Integer), CType(CType(189, Byte), Integer))
Me.TitleLabel.Location = New System.Drawing.Point(32, 32)
Me.TitleLabel.Name = "TitleLabel"
Me.TitleLabel.Size = New System.Drawing.Size(199, 23)
Me.TitleLabel.TabIndex = 0
Me.TitleLabel.Text = "Activation was successful"
'
'BottomPanel
'
Me.BottomPanel.BackColor = System.Drawing.SystemColors.Control
Me.BottomPanel.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.BottomPanel.Controls.Add(Me.CloseBtn)
Me.BottomPanel.Location = New System.Drawing.Point(-1, 472)
Me.BottomPanel.Name = "BottomPanel"
Me.BottomPanel.Size = New System.Drawing.Size(619, 42)
Me.BottomPanel.TabIndex = 3
'
'GenuineSoftwareLogo
'
Me.GenuineSoftwareLogo.Image = CType(resources.GetObject("GenuineSoftwareLogo.Image"), System.Drawing.Image)
Me.GenuineSoftwareLogo.Location = New System.Drawing.Point(465, 80)
Me.GenuineSoftwareLogo.Name = "GenuineSoftwareLogo"
Me.GenuineSoftwareLogo.Size = New System.Drawing.Size(112, 61)
Me.GenuineSoftwareLogo.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize
Me.GenuineSoftwareLogo.TabIndex = 8
Me.GenuineSoftwareLogo.TabStop = False
'
'BenefitsLinkLabel
'
Me.BenefitsLinkLabel.AutoSize = True
Me.BenefitsLinkLabel.Font = New System.Drawing.Font("Segoe UI", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.BenefitsLinkLabel.LinkColor = System.Drawing.Color.FromArgb(CType(CType(0, Byte), Integer), CType(CType(126, Byte), Integer), CType(CType(220, Byte), Integer))
Me.BenefitsLinkLabel.Location = New System.Drawing.Point(32, 135)
Me.BenefitsLinkLabel.Name = "BenefitsLinkLabel"
Me.BenefitsLinkLabel.Size = New System.Drawing.Size(347, 17)
Me.BenefitsLinkLabel.TabIndex = 2
Me.BenefitsLinkLabel.TabStop = True
Me.BenefitsLinkLabel.Text = "Learn more online about the benefits of genuine Windows"
'
'Success
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.SystemColors.ButtonHighlight
Me.CancelButton = Me.CloseBtn
Me.ClientSize = New System.Drawing.Size(617, 512)
Me.Controls.Add(Me.BenefitsLinkLabel)
Me.Controls.Add(Me.GenuineSoftwareLogo)
Me.Controls.Add(Me.DescriptionLabel)
Me.Controls.Add(Me.TitleLabel)
Me.Controls.Add(Me.BottomPanel)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.MinimumSize = New System.Drawing.Size(633, 551)
Me.Name = "Success"
Me.ShowInTaskbar = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Windows Activation"
Me.TopMost = True
Me.BottomPanel.ResumeLayout(False)
CType(Me.GenuineSoftwareLogo, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents DescriptionLabel As Label
Friend WithEvents CloseBtn As Button
Friend WithEvents TitleLabel As Label
Friend WithEvents BottomPanel As Panel
Friend WithEvents GenuineSoftwareLogo As PictureBox
Friend WithEvents BenefitsLinkLabel As LinkLabel
End Class
|
'''<summary>The RTCDTMFToneChangeEvent interface represents events sent to indicate that DTMF tones have started or finished playing. This interface is used by the tonechange event.</summary>
<DynamicInterface(GetType(EcmaScriptObject))>
Public Interface [RTCDTMFToneChangeEvent]
'''<summary>A DOMString specifying the tone which has begun playing, or an empty string ("") if the previous tone has finished playing.</summary>
ReadOnly Property [tone] As String
'''<summary>Returns a new RTCDTMFToneChangeEvent. It takes two parameters, the first being a DOMString representing the type of the event (always "tonechange"); the second a dictionary containing the initial state of the properties of the event.</summary>
Property [RTCDTMFToneChangeEvent] As RTCDTMFToneChangeEvent
End Interface |
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports System.ComponentModel.Composition
Imports System.Threading
Imports Microsoft.CodeAnalysis.Editor.Host
Imports Microsoft.CodeAnalysis.Editor.Implementation.DocumentationComments
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.VisualStudio.Commanding
Imports Microsoft.VisualStudio.Language.Intellisense.AsyncCompletion
Imports Microsoft.VisualStudio.Text.Operations
Imports Microsoft.VisualStudio.Utilities
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.DocumentationComments
<Export(GetType(ICommandHandler))>
<ContentType(ContentTypeNames.VisualBasicContentType)>
<Name(PredefinedCommandHandlerNames.DocumentationComments)>
<Order(After:=PredefinedCommandHandlerNames.Rename)>
<Order(After:=PredefinedCompletionNames.CompletionCommandHandler)>
Friend Class DocumentationCommentCommandHandler
Inherits AbstractDocumentationCommentCommandHandler(Of DocumentationCommentTriviaSyntax, DeclarationStatementSyntax)
<ImportingConstructor()>
Public Sub New(
waitIndicator As IWaitIndicator,
undoHistoryRegistry As ITextUndoHistoryRegistry,
editorOperationsFactoryService As IEditorOperationsFactoryService)
MyBase.New(waitIndicator, undoHistoryRegistry, editorOperationsFactoryService)
End Sub
Protected Overrides ReadOnly Property ExteriorTriviaText As String
Get
Return "'''"
End Get
End Property
Protected Overrides Function GetContainingMember(syntaxTree As SyntaxTree, position As Integer, cancellationToken As CancellationToken) As DeclarationStatementSyntax
Return syntaxTree.GetRoot(cancellationToken).FindToken(position).GetContainingMember()
End Function
Protected Overrides Function SupportsDocumentationComments(member As DeclarationStatementSyntax) As Boolean
If member Is Nothing Then
Return False
End If
Select Case member.Kind
Case SyntaxKind.ClassBlock,
SyntaxKind.InterfaceBlock,
SyntaxKind.ModuleBlock,
SyntaxKind.StructureBlock,
SyntaxKind.EnumBlock,
SyntaxKind.SubBlock,
SyntaxKind.FunctionBlock,
SyntaxKind.ConstructorBlock,
SyntaxKind.OperatorBlock,
SyntaxKind.PropertyBlock,
SyntaxKind.EventBlock,
SyntaxKind.ClassStatement,
SyntaxKind.InterfaceStatement,
SyntaxKind.ModuleStatement,
SyntaxKind.StructureStatement,
SyntaxKind.EnumStatement,
SyntaxKind.EnumMemberDeclaration,
SyntaxKind.DelegateSubStatement,
SyntaxKind.DelegateFunctionStatement,
SyntaxKind.FieldDeclaration,
SyntaxKind.EventStatement,
SyntaxKind.PropertyStatement,
SyntaxKind.OperatorStatement,
SyntaxKind.FunctionStatement,
SyntaxKind.SubStatement,
SyntaxKind.SubNewStatement,
SyntaxKind.DeclareFunctionStatement,
SyntaxKind.DeclareSubStatement
Return True
Case Else
Return False
End Select
End Function
Protected Overrides Function HasDocumentationComment(member As DeclarationStatementSyntax) As Boolean
If member Is Nothing Then
Return False
End If
Return member.GetFirstToken().LeadingTrivia.Any(SyntaxKind.DocumentationCommentTrivia)
End Function
Private Function SupportsDocumentationCommentReturnsClause(member As DeclarationStatementSyntax) As Boolean
If member Is Nothing Then
Return False
End If
Select Case member.Kind
Case SyntaxKind.FunctionBlock,
SyntaxKind.OperatorBlock,
SyntaxKind.PropertyBlock,
SyntaxKind.DelegateFunctionStatement,
SyntaxKind.OperatorStatement,
SyntaxKind.FunctionStatement,
SyntaxKind.DeclareFunctionStatement
Return True
Case SyntaxKind.PropertyStatement
Return Not DirectCast(member, PropertyStatementSyntax).Modifiers.Any(SyntaxKind.WriteOnlyKeyword)
Case Else
Return False
End Select
End Function
Protected Overrides Function GetPrecedingDocumentationCommentCount(member As DeclarationStatementSyntax) As Integer
Dim firstToken = member.GetFirstToken()
Dim count = firstToken.LeadingTrivia.Sum(Function(t) If(t.Kind = SyntaxKind.DocumentationCommentTrivia, 1, 0))
Dim previousToken = firstToken.GetPreviousToken()
If previousToken.Kind <> SyntaxKind.None Then
count += previousToken.TrailingTrivia.Sum(Function(t) If(t.Kind = SyntaxKind.DocumentationCommentTrivia, 1, 0))
End If
Return count
End Function
Protected Overrides Function IsMemberDeclaration(member As DeclarationStatementSyntax) As Boolean
Return member.IsMemberDeclaration()
End Function
Protected Overrides Function GetDocumentationCommentStubLines(member As DeclarationStatementSyntax) As List(Of String)
Dim list = New List(Of String)
list.Add("''' <summary>")
list.Add("''' ")
list.Add("''' </summary>")
Dim typeParameterList = member.GetTypeParameterList()
If typeParameterList IsNot Nothing Then
For Each typeParam In typeParameterList.Parameters
list.Add("''' <typeparam name=""" & typeParam.Identifier.ToString() & """></typeparam>")
Next
End If
Dim parameterList = member.GetParameterList()
If parameterList IsNot Nothing Then
For Each param In parameterList.Parameters
list.Add("''' <param name=""" & param.Identifier.Identifier.ToString() & """></param>")
Next
End If
If SupportsDocumentationCommentReturnsClause(member) Then
list.Add("''' <returns></returns>")
End If
Return list
End Function
Protected Overrides Function IsSingleExteriorTrivia(documentationComment As DocumentationCommentTriviaSyntax, Optional allowWhitespace As Boolean = False) As Boolean
If documentationComment Is Nothing Then
Return False
End If
If documentationComment.Content.Count <> 1 Then
Return False
End If
Dim xmlText = TryCast(documentationComment.Content(0), XmlTextSyntax)
If xmlText Is Nothing Then
Return False
End If
Dim textTokens = xmlText.TextTokens
If Not textTokens.Any Then
Return False
End If
If Not allowWhitespace AndAlso textTokens.Count <> 1 Then
Return False
End If
If textTokens.Any(Function(t) Not String.IsNullOrWhiteSpace(t.ToString())) Then
Return False
End If
Dim lastTextToken = textTokens.Last()
Dim firstTextToken = textTokens.First()
Return lastTextToken.Kind = SyntaxKind.DocumentationCommentLineBreakToken AndAlso
firstTextToken.LeadingTrivia.Count = 1 AndAlso
firstTextToken.LeadingTrivia.ElementAt(0).Kind = SyntaxKind.DocumentationCommentExteriorTrivia AndAlso
firstTextToken.LeadingTrivia.ElementAt(0).ToString() = "'''" AndAlso
lastTextToken.TrailingTrivia.Count = 0
End Function
Private Function GetTextTokensFollowingExteriorTrivia(xmlText As XmlTextSyntax) As IList(Of SyntaxToken)
Dim result = New List(Of SyntaxToken)
Dim tokenList = xmlText.TextTokens
For Each token In tokenList.Reverse()
result.Add(token)
If token.LeadingTrivia.Any(SyntaxKind.DocumentationCommentExteriorTrivia) Then
Exit For
End If
Next
result.Reverse()
Return result
End Function
Protected Overrides Function EndsWithSingleExteriorTrivia(documentationComment As DocumentationCommentTriviaSyntax) As Boolean
If documentationComment Is Nothing Then
Return False
End If
Dim xmlText = TryCast(documentationComment.Content.LastOrDefault(), XmlTextSyntax)
If xmlText Is Nothing Then
Return False
End If
Dim textTokens = GetTextTokensFollowingExteriorTrivia(xmlText)
If textTokens.Any(Function(t) Not String.IsNullOrWhiteSpace(t.ToString())) Then
Return False
End If
Dim lastTextToken = textTokens.LastOrDefault()
Dim firstTextToken = textTokens.FirstOrDefault()
Return lastTextToken.Kind = SyntaxKind.DocumentationCommentLineBreakToken AndAlso
firstTextToken.LeadingTrivia.Count = 1 AndAlso
firstTextToken.LeadingTrivia.ElementAt(0).Kind = SyntaxKind.DocumentationCommentExteriorTrivia AndAlso
firstTextToken.LeadingTrivia.ElementAt(0).ToString() = "'''" AndAlso
lastTextToken.TrailingTrivia.Count = 0
End Function
Protected Overrides Function IsMultilineDocComment(documentationComment As DocumentationCommentTriviaSyntax) As Boolean
Return False
End Function
Protected Overrides Function GetTokenToRight(syntaxTree As SyntaxTree, position As Integer, cancellationToken As CancellationToken) As SyntaxToken
If position >= syntaxTree.GetText(cancellationToken).Length Then
Return Nothing
End If
Return syntaxTree.GetRoot(cancellationToken).FindTokenOnRightOfPosition(
position, includeDirectives:=True, includeDocumentationComments:=True)
End Function
Protected Overrides Function GetTokenToLeft(syntaxTree As SyntaxTree, position As Integer, cancellationToken As CancellationToken) As SyntaxToken
If position < 1 Then
Return Nothing
End If
Return syntaxTree.GetRoot(cancellationToken).FindTokenOnLeftOfPosition(
position - 1, includeDirectives:=True, includeDocumentationComments:=True)
End Function
Protected Overrides Function IsDocCommentNewLine(token As SyntaxToken) As Boolean
Return token.Kind = SyntaxKind.DocumentationCommentLineBreakToken
End Function
Protected Overrides Function IsEndOfLineTrivia(trivia As SyntaxTrivia) As Boolean
Return trivia.RawKind = SyntaxKind.EndOfLineTrivia
End Function
Protected Overrides ReadOnly Property AddIndent As Boolean
Get
Return False
End Get
End Property
Friend Overrides Function HasSkippedTrailingTrivia(token As SyntaxToken) As Boolean
Return token.TrailingTrivia.Any(Function(t) t.Kind() = SyntaxKind.SkippedTokensTrivia)
End Function
End Class
End Namespace
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form2
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.Panelx = New System.Windows.Forms.Panel
Me.Label2 = New System.Windows.Forms.Label
Me.Button1 = New System.Windows.Forms.Button
Me.ListBox2 = New System.Windows.Forms.ListBox
Me.Label1 = New System.Windows.Forms.Label
Me.ListBox1 = New System.Windows.Forms.ListBox
Me.Button2 = New System.Windows.Forms.Button
Me.Panelx.SuspendLayout()
Me.SuspendLayout()
'
'Panelx
'
Me.Panelx.Controls.Add(Me.Button2)
Me.Panelx.Controls.Add(Me.Label2)
Me.Panelx.Controls.Add(Me.Button1)
Me.Panelx.Controls.Add(Me.ListBox2)
Me.Panelx.Controls.Add(Me.Label1)
Me.Panelx.Controls.Add(Me.ListBox1)
Me.Panelx.Location = New System.Drawing.Point(2, 12)
Me.Panelx.Name = "Panelx"
Me.Panelx.Size = New System.Drawing.Size(383, 336)
Me.Panelx.TabIndex = 26
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(27, 245)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(114, 13)
Me.Label2.TabIndex = 4
Me.Label2.Text = "Advanced, don't touch:"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(264, 4)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(102, 19)
Me.Button1.TabIndex = 3
Me.Button1.Text = "Hide"
Me.Button1.UseVisualStyleBackColor = True
'
'ListBox2
'
Me.ListBox2.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.ListBox2.Font = New System.Drawing.Font("Calibri", 12.0!)
Me.ListBox2.HorizontalExtent = 20
Me.ListBox2.ItemHeight = 19
Me.ListBox2.Items.AddRange(New Object() {"0,1,2,3", "0,1,3,2", "0,2,1,3", "0,2,3,1", "0,3,1,2", "0,3,2,1", "1,0,2,3", "1,0,3,2", "1,2,0,3", "1,2,3,0", "1,3,2,0", "1,3,0,2", "2,0,1,3", "2,0,3,1", "2,1,0,3", "2,1,3,0", "2,3,1,0", "2,3,0,1", "3,0,1,2", "3,0,2,1", "3,1,0,2", "3,1,2,0", "3,2,0,1", "3,2,1,0"})
Me.ListBox2.Location = New System.Drawing.Point(30, 261)
Me.ListBox2.MinimumSize = New System.Drawing.Size(25, 10)
Me.ListBox2.Name = "ListBox2"
Me.ListBox2.Size = New System.Drawing.Size(336, 59)
Me.ListBox2.TabIndex = 2
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(19, 10)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(89, 13)
Me.Label1.TabIndex = 1
Me.Label1.Text = "Select Animation:"
'
'ListBox1
'
Me.ListBox1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.ListBox1.Font = New System.Drawing.Font("Calibri", 12.0!)
Me.ListBox1.HorizontalExtent = 20
Me.ListBox1.ItemHeight = 19
Me.ListBox1.Location = New System.Drawing.Point(30, 63)
Me.ListBox1.MinimumSize = New System.Drawing.Size(25, 10)
Me.ListBox1.Name = "ListBox1"
Me.ListBox1.Size = New System.Drawing.Size(336, 154)
Me.ListBox1.TabIndex = 0
'
'Button2
'
Me.Button2.Location = New System.Drawing.Point(264, 223)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(96, 18)
Me.Button2.TabIndex = 5
Me.Button2.Text = "OK"
Me.Button2.UseVisualStyleBackColor = True
'
'Form2
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(388, 351)
Me.ControlBox = False
Me.Controls.Add(Me.Panelx)
Me.Font = New System.Drawing.Font("Calibri", 8.25!)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow
Me.Name = "Form2"
Me.ShowInTaskbar = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.Manual
Me.Panelx.ResumeLayout(False)
Me.Panelx.PerformLayout()
Me.ResumeLayout(False)
End Sub
Friend WithEvents Panelx As System.Windows.Forms.Panel
Friend WithEvents Label1 As System.Windows.Forms.Label
Public WithEvents ListBox1 As System.Windows.Forms.ListBox
Public WithEvents ListBox2 As System.Windows.Forms.ListBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents Button2 As System.Windows.Forms.Button
End Class
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "14.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.ADS.My.MySettings
Get
Return Global.ADS.My.MySettings.Default
End Get
End Property
End Module
End Namespace
|
'-------------------------------------------------------------------------------------------'
' Inicio del codigo
'-------------------------------------------------------------------------------------------'
' Importando librerias
'-------------------------------------------------------------------------------------------'
Imports System.Data
'-------------------------------------------------------------------------------------------'
' Inicio de clase "fPropiedades_Clientes"
'-------------------------------------------------------------------------------------------'
Partial Class fPropiedades_Clientes
Inherits vis2Formularios.frmReporte
Dim loObjetoReporte As CrystalDecisions.CrystalReports.Engine.ReportDocument
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
Dim loComandoSeleccionar As New StringBuilder()
Dim lcTipo As String = goServicios.mObtenerCampoFormatoSQL(goEmpresa.pcCodigo & "Clientes")
loComandoSeleccionar.AppendLine(" SELECT")
loComandoSeleccionar.AppendLine(" Clientes.Cod_Cli,")
loComandoSeleccionar.AppendLine(" Clientes.Nom_Cli,")
loComandoSeleccionar.AppendLine(" Propiedades.Nom_Pro,")
loComandoSeleccionar.AppendLine(" Campos_Propiedades.Cod_Pro,")
loComandoSeleccionar.AppendLine(" Campos_Propiedades.Tip_Pro,")
loComandoSeleccionar.AppendLine(" Campos_Propiedades.Val_Log,")
loComandoSeleccionar.AppendLine(" Campos_Propiedades.Val_Num,")
loComandoSeleccionar.AppendLine(" Campos_Propiedades.Val_Car,")
loComandoSeleccionar.AppendLine(" Campos_Propiedades.Val_Fec,")
loComandoSeleccionar.AppendLine(" Campos_Propiedades.Val_Mem")
loComandoSeleccionar.AppendLine(" FROM Clientes")
loComandoSeleccionar.AppendLine(" JOIN Campos_Propiedades ON (Campos_Propiedades.Cod_Reg = Clientes.Cod_Cli)")
loComandoSeleccionar.AppendLine(" JOIN Propiedades ON (Propiedades.Cod_Pro = Campos_Propiedades.Cod_Pro)")
loComandoSeleccionar.AppendLine(" WHERE")
loComandoSeleccionar.AppendLine(" Campos_Propiedades.Origen = 'Clientes'")
loComandoSeleccionar.AppendLine(" AND" & cusAplicacion.goFormatos.pcCondicionPrincipal)
loComandoSeleccionar.AppendLine("ORDER BY Campos_Propiedades.Tip_Pro ASC")
Dim loServicios As New cusDatos.goDatos
Dim laDatosReporte As DataSet = loServicios.mObtenerTodosSinEsquema(loComandoSeleccionar.ToString, "curReportes")
'--------------------------------------------------'
' Carga la imagen del logo en cusReportes '
'--------------------------------------------------'
Me.mCargarLogoEmpresa(laDatosReporte.Tables(0), "LogoEmpresa")
'-------------------------------------------------------------------------------------------------------
' Verificando si el select (tabla nº0) trae registros
'-------------------------------------------------------------------------------------------------------
If (laDatosReporte.Tables(0).Rows.Count <= 0) Then
Me.WbcAdministradorMensajeModal.mMostrarMensajeModal("Información", _
"No se Encontraron Registros para los Parámetros Especificados. ", _
vis3Controles.wbcAdministradorMensajeModal.enumTipoMensaje.KN_Informacion, _
"350px", _
"200px")
End If
loObjetoReporte = cusAplicacion.goFormatos.mCargarInforme("fPropiedades_Clientes", laDatosReporte)
Me.mTraducirReporte(loObjetoReporte)
Me.mFormatearCamposReporte(loObjetoReporte)
Me.crvfPropiedades_Clientes.ReportSource = loObjetoReporte
Catch loExcepcion As Exception
Me.WbcAdministradorMensajeModal.mMostrarMensajeModal("Error", _
"No se pudo Completar el Proceso: " & loExcepcion.Message, _
vis3Controles.wbcAdministradorMensajeModal.enumTipoMensaje.KN_Error, _
"auto", _
"auto")
End Try
End Sub
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
Try
loObjetoReporte.Close()
Catch loExcepcion As Exception
Me.WbcAdministradorMensajeModal.mMostrarMensajeModal("Error", _
"No se pudo Completar el Proceso: " & loExcepcion.Message, _
vis3Controles.wbcAdministradorMensajeModal.enumTipoMensaje.KN_Error, _
"auto", _
"auto")
End Try
End Sub
End Class
'-------------------------------------------------------------------------------------------'
' Fin del codigo
'-------------------------------------------------------------------------------------------'
' RAC: 11/03/11: Código Inicial
'-------------------------------------------------------------------------------------------'
' RAC: 29/03/11: Mejora en la configuracion del archivo rpt y la consulta para que se
' pudiera ver el logo de la empresa
'-------------------------------------------------------------------------------------------' |
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Concurrent
Imports System.Collections.Generic
Imports System.Collections.Immutable
Imports System.Runtime.InteropServices
Imports System.Threading
Imports Microsoft.CodeAnalysis
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports TypeKind = Microsoft.CodeAnalysis.TypeKind
Namespace Microsoft.CodeAnalysis.VisualBasic
' Handler the parts of binding for member lookup.
Partial Friend Class Binder
Friend Sub LookupMember(lookupResult As LookupResult,
container As NamespaceOrTypeSymbol,
name As String,
arity As Integer,
options As LookupOptions,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo))
Debug.Assert(options.IsValid())
options = BinderSpecificLookupOptions(options)
MemberLookup.Lookup(lookupResult, container, name, arity, options, Me, useSiteDiagnostics)
End Sub
Friend Sub LookupMember(lookupResult As LookupResult,
container As TypeSymbol,
name As String,
arity As Integer,
options As LookupOptions,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo))
Debug.Assert(options.IsValid())
options = BinderSpecificLookupOptions(options)
MemberLookup.Lookup(lookupResult, container, name, arity, options, Me, useSiteDiagnostics)
End Sub
Friend Sub LookupMember(lookupResult As LookupResult,
container As NamespaceSymbol,
name As String,
arity As Integer,
options As LookupOptions,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo))
Debug.Assert(options.IsValid())
options = BinderSpecificLookupOptions(options)
MemberLookup.Lookup(lookupResult, container, name, arity, options, Me, useSiteDiagnostics)
End Sub
Friend Sub LookupMemberImmediate(lookupResult As LookupResult,
container As NamespaceSymbol,
name As String,
arity As Integer,
options As LookupOptions,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo))
Debug.Assert(options.IsValid())
options = BinderSpecificLookupOptions(options)
MemberLookup.LookupImmediate(lookupResult, container, name, arity, options, Me, useSiteDiagnostics)
End Sub
Friend Sub LookupExtensionMethods(
lookupResult As LookupResult,
container As TypeSymbol,
name As String,
arity As Integer,
options As LookupOptions,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo)
)
Debug.Assert(options.IsValid())
Debug.Assert(lookupResult.IsClear)
options = BinderSpecificLookupOptions(options)
MemberLookup.LookupForExtensionMethods(lookupResult, container, name, arity, options, Me, useSiteDiagnostics)
End Sub
Friend Sub LookupMemberInModules(lookupResult As LookupResult,
container As NamespaceSymbol,
name As String,
arity As Integer,
options As LookupOptions,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo))
Debug.Assert(options.IsValid())
options = BinderSpecificLookupOptions(options)
MemberLookup.LookupInModules(lookupResult, container, name, arity, options, Me, useSiteDiagnostics)
End Sub
Friend Sub AddMemberLookupSymbolsInfo(nameSet As LookupSymbolsInfo,
container As NamespaceOrTypeSymbol,
options As LookupOptions)
Debug.Assert(options.IsValid())
options = BinderSpecificLookupOptions(options)
MemberLookup.AddLookupSymbolsInfo(nameSet, container, options, Me)
End Sub
' Validates a symbol to check if it
' a) has the right arity
' b) is accessible. (accessThroughType is passed in for protected access checks)
' c) matches the lookup options.
' A non-empty SingleLookupResult with the result is returned.
'
' For symbols from outside of this compilation the method also checks
' if the symbol is marked with 'Microsoft.VisualBasic.Embedded' attribute.
'
' If arity passed in is -1, no arity checks are done.
Friend Function CheckViability(sym As Symbol,
arity As Integer,
options As LookupOptions,
accessThroughType As TypeSymbol,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo)) As SingleLookupResult
Debug.Assert(sym IsNot Nothing)
If Not sym.CanBeReferencedByNameIgnoringIllegalCharacters Then
Return SingleLookupResult.Empty
End If
If (options And LookupOptions.LabelsOnly) <> 0 Then
' If LabelsOnly is set then the symbol must be a label otherwise return empty
If options = LookupOptions.LabelsOnly AndAlso sym.Kind = SymbolKind.Label Then
Return SingleLookupResult.Good(sym)
End If
' Mixing LabelsOnly with any other flag returns an empty result
Return SingleLookupResult.Empty
End If
If (options And LookupOptions.MustNotBeReturnValueVariable) <> 0 Then
'§11.4.4 Simple Name Expressions
' If the identifier matches a local variable, the local variable matched is
' the implicit function or Get accessor return local variable, and the expression
' is part of an invocation expression, invocation statement, or an AddressOf
' expression, then no match occurs and resolution continues.
'
' LookupOptions.MustNotBeReturnValueVariable is set if "the expression
' is part of an invocation expression, invocation statement, or an AddressOf
' expression", and we then skip return value variables.
' We'll always bind to the containing method or property instead further on in the lookup process.
If sym.Kind = SymbolKind.Local AndAlso DirectCast(sym, LocalSymbol).IsFunctionValue Then
Return SingleLookupResult.Empty
End If
End If
Dim unwrappedSym = sym
Dim asAlias = TryCast(sym, AliasSymbol)
If asAlias IsNot Nothing Then
unwrappedSym = asAlias.Target
End If
' Check for external symbols marked with 'Microsoft.VisualBasic.Embedded' attribute
If Me.Compilation.SourceModule IsNot unwrappedSym.ContainingModule AndAlso unwrappedSym.IsHiddenByEmbeddedAttribute() Then
Return SingleLookupResult.Empty
End If
If unwrappedSym.Kind = SymbolKind.NamedType AndAlso unwrappedSym.EmbeddedSymbolKind = EmbeddedSymbolKind.EmbeddedAttribute AndAlso
Me.SyntaxTree IsNot Nothing AndAlso Me.SyntaxTree.GetEmbeddedKind = EmbeddedSymbolKind.None Then
' Only allow direct access to Microsoft.VisualBasic.Embedded attribute
' from user code if current compilation embeds Vb Core
If Not Me.Compilation.Options.EmbedVbCoreRuntime Then
Return SingleLookupResult.Empty
End If
End If
' Do arity checking, unless specifically asked not to.
' Only types and namespaces in VB shadow by arity. All other members shadow
' regardless of arity. So, we only check arity on types.
If arity <> -1 Then
Select Case sym.Kind
Case SymbolKind.NamedType, SymbolKind.ErrorType
Dim actualArity As Integer = DirectCast(sym, NamedTypeSymbol).Arity
If actualArity <> arity Then
Return SingleLookupResult.WrongArity(sym, WrongArityErrid(actualArity, arity))
End If
Case SymbolKind.TypeParameter, SymbolKind.Namespace
If arity <> 0 Then ' type parameters and namespaces are always arity 0
Return SingleLookupResult.WrongArity(unwrappedSym, WrongArityErrid(0, arity))
End If
Case SymbolKind.Alias
' Since raw generics cannot be imported, the import aliases would always refer to
' constructed types when referring to generics. So any other generic arity besides
' -1 or 0 are invalid.
If arity <> 0 Then ' aliases are always arity 0, but error refers to the taget
' Note, Dev11 doesn't stop lookup in case of arity mismatch for an alias.
Return SingleLookupResult.WrongArity(unwrappedSym, WrongArityErrid(0, arity))
End If
Case SymbolKind.Method
' Unlike types and namespaces, we always stop looking if we find a method with the right name but wrong arity.
' The arity matching rules for methods are customizable for the LookupOptions; when binding expressions
' we always pass AllMethodsOfAnyArity and allow overload resolution to filter methods. The other flags
' are for binding API scenarios.
Dim actualArity As Integer = DirectCast(sym, MethodSymbol).Arity
If actualArity <> arity AndAlso
Not ((options And LookupOptions.AllMethodsOfAnyArity) <> 0) Then
Return SingleLookupResult.WrongArityAndStopLookup(sym, WrongArityErrid(actualArity, arity))
End If
Case Else
' Unlike types and namespace, we stop looking if we find other symbols with wrong arity.
' All these symbols have arity 0.
If arity <> 0 Then
Return SingleLookupResult.WrongArityAndStopLookup(sym, WrongArityErrid(0, arity))
End If
End Select
End If
If (options And LookupOptions.IgnoreAccessibility) = 0 Then
Dim accessCheckResult = CheckAccessibility(unwrappedSym, useSiteDiagnostics, If((options And LookupOptions.UseBaseReferenceAccessibility) <> 0, Nothing, accessThroughType))
' Check if we are in 'MyBase' resolving mode and we need to ignore 'accessThroughType' to make protected members accessed
If accessCheckResult <> VisualBasic.AccessCheckResult.Accessible Then
Return SingleLookupResult.Inaccessible(sym, GetInaccessibleErrorInfo(sym))
End If
End If
If (options And Global.Microsoft.CodeAnalysis.VisualBasic.LookupOptions.MustNotBeInstance) <> 0 AndAlso sym.IsInstanceMember Then
Return Global.Microsoft.CodeAnalysis.VisualBasic.SingleLookupResult.MustNotBeInstance(sym, Global.Microsoft.CodeAnalysis.VisualBasic.ERRID.ERR_ObjectReferenceNotSupplied)
ElseIf (options And Global.Microsoft.CodeAnalysis.VisualBasic.LookupOptions.MustBeInstance) <> 0 AndAlso Not sym.IsInstanceMember Then
Return Global.Microsoft.CodeAnalysis.VisualBasic.SingleLookupResult.MustBeInstance(sym) ' there is no error message for this
End If
Return SingleLookupResult.Good(sym)
End Function
Friend Function GetInaccessibleErrorInfo(sym As Symbol, <[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo)) As DiagnosticInfo
CheckAccessibility(sym, useSiteDiagnostics) ' For diagnostics.
Return GetInaccessibleErrorInfo(sym)
End Function
Friend Function GetInaccessibleErrorInfo(sym As Symbol) As DiagnosticInfo
Dim unwrappedSym = sym
Dim asAlias = TryCast(sym, AliasSymbol)
If asAlias IsNot Nothing Then
unwrappedSym = asAlias.Target
ElseIf sym.Kind = SymbolKind.Method Then
sym = DirectCast(sym, MethodSymbol).ConstructedFrom
End If
Dim diagInfo As DiagnosticInfo
' for inaccessible members (in e.g. AddressOf expressions, DEV10 shows a ERR_InaccessibleMember3 diagnostic)
' TODO maybe this condition needs to be adjusted to be shown in cases of e.g. inaccessible properties
If unwrappedSym.Kind = SymbolKind.Method AndAlso unwrappedSym.ContainingSymbol IsNot Nothing Then
diagInfo = New BadSymbolDiagnostic(sym,
ERRID.ERR_InaccessibleMember3,
sym.ContainingSymbol.Name,
sym,
AccessCheck.GetAccessibilityForErrorMessage(sym, Me.Compilation.Assembly))
Else
diagInfo = New BadSymbolDiagnostic(sym,
ERRID.ERR_InaccessibleSymbol2,
CustomSymbolDisplayFormatter.QualifiedName(sym),
AccessCheck.GetAccessibilityForErrorMessage(sym, sym.ContainingAssembly))
End If
Debug.Assert(diagInfo.Severity = DiagnosticSeverity.Error)
Return diagInfo
End Function
''' <summary>
''' Used by Add*LookupSymbolsInfo* to determine whether the symbol is of interest.
''' Distinguish from <see cref="CheckViability"/>, which performs an analogous task for LookupSymbols*.
''' </summary>
''' <remarks>
''' Does not consider <see cref="Symbol.CanBeReferencedByName"/> - that is left to the caller.
''' </remarks>
Friend Function CanAddLookupSymbolInfo(sym As Symbol,
options As LookupOptions,
accessThroughType As TypeSymbol) As Boolean
Dim singleResult = CheckViability(sym, -1, options, accessThroughType, useSiteDiagnostics:=Nothing)
If sym IsNot Nothing AndAlso
(options And LookupOptions.MethodsOnly) <> 0 AndAlso
sym.Kind <> SymbolKind.Method Then
Return False
End If
If singleResult.IsGoodOrAmbiguous Then
' Its possible there is an error (ambiguity, wrong arity) associated with result.
' We still return true here, because binding finds that symbol and doesn't continue.
' NOTE: We're going to let the SemanticModel check for symbols that can't be
' referenced by name. That way, it can either filter them or not, depending
' on whether a name was passed to LookupSymbols.
Return True
End If
Return False
End Function
' return the error id for mismatched arity.
Private Shared Function WrongArityErrid(actualArity As Integer, arity As Integer) As ERRID
If actualArity < arity Then
If actualArity = 0 Then
Return ERRID.ERR_TypeOrMemberNotGeneric1
Else
Return ERRID.ERR_TooManyGenericArguments1
End If
Else
Debug.Assert(actualArity > arity, "arities shouldn't match")
Return ERRID.ERR_TooFewGenericArguments1
End If
End Function
' Check is a symbol has a speakable name.
Private Shared Function HasSpeakableName(sym As Symbol) As Boolean
' TODO: this probably should move to Symbol -- e.g., Symbol.CanBeBoundByName
If sym.Kind = SymbolKind.Method Then
Select Case DirectCast(sym, MethodSymbol).MethodKind
Case MethodKind.Ordinary, MethodKind.ReducedExtension, MethodKind.DelegateInvoke, MethodKind.UserDefinedOperator, MethodKind.Conversion, MethodKind.DeclareMethod
Return True
Case Else
Return False
End Select
End If
Return True
End Function
''' <summary>
''' This class handles binding of members of namespaces and types.
''' The key member is Lookup, which handles looking up a name
''' in a namespace or type, by name and arity, and produces a
''' lookup result.
''' </summary>
Private Class MemberLookup
''' <summary>
''' Lookup a member name in a namespace or type, returning a LookupResult that
''' summarizes the results of the lookup. See LookupResult structure for a detailed
''' discussing of the meaning of the results. The supplied binder is used for accessibility
''' checked and base class suppression.
''' </summary>
Public Shared Sub Lookup(lookupResult As LookupResult,
container As NamespaceOrTypeSymbol,
name As String,
arity As Integer,
options As LookupOptions,
binder As Binder,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo))
If container.IsNamespace Then
Lookup(lookupResult, DirectCast(container, NamespaceSymbol), name, arity, options, binder, useSiteDiagnostics)
Else
Lookup(lookupResult, DirectCast(container, TypeSymbol), name, arity, options, binder, useSiteDiagnostics)
End If
End Sub
' Lookup all the names available on the given container, that match the given lookup options.
' The supplied binder is used for accessibility checking.
Public Shared Sub AddLookupSymbolsInfo(nameSet As LookupSymbolsInfo,
container As NamespaceOrTypeSymbol,
options As LookupOptions,
binder As Binder)
If container.IsNamespace Then
AddLookupSymbolsInfo(nameSet, DirectCast(container, NamespaceSymbol), options, binder)
Else
AddLookupSymbolsInfo(nameSet, DirectCast(container, TypeSymbol), options, binder)
End If
End Sub
''' <summary>
''' Lookup a member name in a namespace, returning a LookupResult that
''' summarizes the results of the lookup. See LookupResult structure for a detailed
''' discussing of the meaning of the results. The supplied binder is used for accessibility
''' checked and base class suppression.
''' </summary>
Public Shared Sub Lookup(lookupResult As LookupResult,
container As NamespaceSymbol,
name As String,
arity As Integer,
options As LookupOptions,
binder As Binder,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo))
Debug.Assert(lookupResult.IsClear)
LookupImmediate(lookupResult, container, name, arity, options, binder, useSiteDiagnostics)
' Result in the namespace takes precedence over results in containing modules.
If lookupResult.StopFurtherLookup Then
Return
End If
Dim currentResult = LookupResult.GetInstance()
LookupInModules(currentResult, container, name, arity, options, binder, useSiteDiagnostics)
lookupResult.MergeAmbiguous(currentResult, AmbiguousInModuleError)
currentResult.Free()
End Sub
''' <summary>
''' Lookup an immediate (without decending into modules) member name in a namespace,
''' returning a LookupResult that summarizes the results of the lookup.
''' See LookupResult structure for a detailed discussion of the meaning of the results.
''' The supplied binder is used for accessibility checks and base class suppression.
''' </summary>
Public Shared Sub LookupImmediate(lookupResult As LookupResult,
container As NamespaceSymbol,
name As String,
arity As Integer,
options As LookupOptions,
binder As Binder,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo))
Debug.Assert(lookupResult.IsClear)
Dim sourceModule = binder.Compilation.SourceModule
#If DEBUG Then
Dim haveSeenNamespace As Boolean = False
#End If
For Each sym In container.GetMembers(name)
#If DEBUG Then
If sym.Kind = SymbolKind.Namespace Then
Debug.Assert(Not haveSeenNamespace, "Expected namespaces to be merged into a single symbol.")
haveSeenNamespace = True
End If
#End If
Dim currentResult As SingleLookupResult = binder.CheckViability(sym, arity, options, Nothing, useSiteDiagnostics)
lookupResult.MergeMembersOfTheSameNamespace(currentResult, sourceModule)
Next
End Sub
''' <summary>
''' Lookup a member name in modules of a namespace,
''' returning a LookupResult that summarizes the results of the lookup.
''' See LookupResult structure for a detailed discussion of the meaning of the results.
''' The supplied binder is used for accessibility checks and base class suppression.
''' </summary>
Public Shared Sub LookupInModules(lookupResult As LookupResult,
container As NamespaceSymbol,
name As String,
arity As Integer,
options As LookupOptions,
binder As Binder,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo))
Debug.Assert(lookupResult.IsClear)
Dim firstModule As Boolean = True
Dim sourceModule = binder.Compilation.SourceModule
' NOTE: while looking up the symbol in modules we should ignore base class
options = options Or LookupOptions.IgnoreExtensionMethods Or LookupOptions.NoBaseClassLookup
' Next, do a lookup in each contained module and merge the results.
For Each containedModule As NamedTypeSymbol In container.GetModuleMembers()
If firstModule Then
Lookup(lookupResult, containedModule, name, arity, options, binder, useSiteDiagnostics)
firstModule = False
Else
Dim currentResult = LookupResult.GetInstance()
Lookup(currentResult, containedModule, name, arity, options, binder, useSiteDiagnostics)
' Symbols in source take priority over symbols in a referenced assembly.
If currentResult.StopFurtherLookup AndAlso currentResult.Symbols.Count > 0 AndAlso
lookupResult.StopFurtherLookup AndAlso lookupResult.Symbols.Count > 0 Then
Dim currentFromSource = currentResult.Symbols(0).ContainingModule Is sourceModule
Dim contenderFromSource = lookupResult.Symbols(0).ContainingModule Is sourceModule
If currentFromSource Then
If Not contenderFromSource Then
' current is better
lookupResult.SetFrom(currentResult)
currentResult.Free()
Continue For
End If
ElseIf contenderFromSource Then
' contender is better
currentResult.Free()
Continue For
End If
End If
lookupResult.MergeAmbiguous(currentResult, AmbiguousInModuleError)
currentResult.Free()
End If
Next
End Sub
Private Shared Sub AddLookupSymbolsInfo(nameSet As LookupSymbolsInfo,
container As NamespaceSymbol,
options As LookupOptions,
binder As Binder)
' Add names from the namespace
For Each sym In container.GetMembersUnordered()
' UNDONE: filter by options
If binder.CanAddLookupSymbolInfo(sym, options, Nothing) Then
nameSet.AddSymbol(sym, sym.Name, sym.GetArity())
End If
Next
' Next, add names from each contained module.
For Each containedModule As NamedTypeSymbol In container.GetModuleMembers()
AddLookupSymbolsInfo(nameSet, containedModule, options, binder)
Next
End Sub
' Create a diagnostic for ambiguous names in multiple modules.
Private Shared ReadOnly AmbiguousInModuleError As Func(Of ImmutableArray(Of Symbol), AmbiguousSymbolDiagnostic) =
Function(syms As ImmutableArray(Of Symbol)) As AmbiguousSymbolDiagnostic
Dim name As String = syms(0).Name
Dim deferredFormattedList As New FormattedSymbolList(syms.Select(Function(sym) sym.ContainingType))
Return New AmbiguousSymbolDiagnostic(ERRID.ERR_AmbiguousInModules2, syms, name, deferredFormattedList)
End Function
''' <summary>
''' Lookup a member name in a type, returning a LookupResult that
''' summarizes the results of the lookup. See LookupResult structure for a detailed
''' discussing of the meaning of the results. The supplied binder is used for accessibility
''' checked and base class suppression.
''' </summary>
Friend Shared Sub Lookup(lookupResult As LookupResult,
type As TypeSymbol,
name As String,
arity As Integer,
options As LookupOptions,
binder As Binder,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo))
Debug.Assert(lookupResult.IsClear)
Select Case type.TypeKind
Case TypeKind.Class, TypeKind.Module, TypeKind.Structure, TypeKind.Delegate, TypeKind.Array, TypeKind.Enum
LookupInClass(lookupResult, type, name, arity, options, type, binder, useSiteDiagnostics)
Case TypeKind.Submission
LookupInSubmissions(lookupResult, type, name, arity, options, binder, useSiteDiagnostics)
Case TypeKind.Interface
LookupInInterface(lookupResult, DirectCast(type, NamedTypeSymbol), name, arity, options, binder, useSiteDiagnostics)
Case TypeKind.TypeParameter
LookupInTypeParameter(lookupResult, DirectCast(type, TypeParameterSymbol), name, arity, options, binder, useSiteDiagnostics)
Case TypeKind.Error
' Error types have no members.
Return
Case Else
Throw ExceptionUtilities.UnexpectedValue(type.TypeKind)
End Select
End Sub
Private Shared Sub AddLookupSymbolsInfo(nameSet As LookupSymbolsInfo,
container As TypeSymbol,
options As LookupOptions,
binder As Binder)
Select Case container.TypeKind
Case TypeKind.Class, TypeKind.Structure, TypeKind.Delegate, TypeKind.Array, TypeKind.Enum
AddLookupSymbolsInfoInClass(nameSet, container, options, binder)
Case TypeKind.Module
AddLookupSymbolsInfoInClass(nameSet, container, options Or LookupOptions.NoBaseClassLookup, binder)
Case TypeKind.Submission
AddLookupSymbolsInfoInSubmissions(nameSet, container, options, binder)
Case TypeKind.Interface
AddLookupSymbolsInfoInInterface(nameSet, DirectCast(container, NamedTypeSymbol), options, binder)
Case TypeKind.TypeParameter
AddLookupSymbolsInfoInTypeParameter(nameSet, DirectCast(container, TypeParameterSymbol), options, binder)
Case TypeKind.Error
' Error types have no members.
Return
Case Else
Throw ExceptionUtilities.UnexpectedValue(container.TypeKind)
End Select
End Sub
''' <summary>
''' Lookup a member name in a module, class, struct, enum, or delegate, returning a LookupResult that
''' summarizes the results of the lookup. See LookupResult structure for a detailed
''' discussing of the meaning of the results. The supplied binder is used for accessibility
''' checks and base class suppression.
''' </summary>
Private Shared Sub LookupInClass(result As LookupResult,
container As TypeSymbol,
name As String,
arity As Integer,
options As LookupOptions,
accessThroughType As TypeSymbol,
binder As Binder,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo))
Debug.Assert(result.IsClear)
Dim methodsOnly As Boolean = CheckAndClearMethodsOnlyOption(options)
' Lookup proceeds up the base class chain.
Dim currentType = container
Do
Dim hitNonoverloadingSymbol As Boolean = False
Dim currentResult = LookupResult.GetInstance()
LookupWithoutInheritance(currentResult, currentType, name, arity, options, accessThroughType, binder, useSiteDiagnostics)
If result.IsGoodOrAmbiguous AndAlso currentResult.IsGoodOrAmbiguous AndAlso Not LookupResult.CanOverload(result.Symbols(0), currentResult.Symbols(0)) Then
' We hit another good symbol that can't overload this one. That doesn't affect the lookup result, but means we have to stop
' looking for more members. See bug #14078 for example.
hitNonoverloadingSymbol = True
End If
result.MergeOverloadedOrPrioritized(currentResult, True)
currentResult.Free()
' If the type is from a winmd file and implements any of the special WinRT collection
' projections, then we may need to add projected interface members
Dim namedType = TryCast(currentType, NamedTypeSymbol)
If namedType IsNot Nothing AndAlso namedType.ShouldAddWinRTMembers Then
FindWinRTMembers(result,
namedType,
binder,
useSiteDiagnostics,
lookupMembersNotDefaultProperties:=True,
name:=name,
arity:=arity,
options:=options)
End If
If hitNonoverloadingSymbol Then
Exit Do ' still do extension methods.
End If
If result.StopFurtherLookup Then
' If we found a non-overloadable symbol, we can stop now. Note that even if we find a method without the Overloads
' modifier, we cannot stop because we need to check for extension methods.
If result.HasSymbol Then
If Not result.Symbols.First.IsOverloadable Then
If methodsOnly Then
Exit Do ' Need to look for extension methods.
End If
Return
End If
End If
End If
' Go to base type, unless that would case infinite recursion or the options or the binder
' disallows it.
If (options And LookupOptions.NoBaseClassLookup) <> 0 OrElse binder.IgnoreBaseClassesInLookup Then
currentType = Nothing
Else
currentType = currentType.GetDirectBaseTypeWithDefinitionUseSiteDiagnostics(binder.BasesBeingResolved, useSiteDiagnostics)
End If
Loop While currentType IsNot Nothing
ClearLookupResultIfNotMethods(methodsOnly, result)
LookupForExtensionMethodsIfNeedTo(result, container, name, arity, options, binder, useSiteDiagnostics)
End Sub
Delegate Sub WinRTLookupDelegate(iface As NamedTypeSymbol,
binder As Binder,
result As LookupResult,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo))
''' <summary>
''' This function generalizes the idea of producing a set of non-conflicting
''' WinRT members of a given type based on the results of some arbitrary lookup
''' closure (which produces a LookupResult signifying success as IsGood).
'''
''' A non-conflicting WinRT member lookup looks for all members of projected
''' WinRT interfaces which are implemented by a given type, discarding any
''' which have equal signatures.
'''
''' If <paramref name="lookupMembersNotDefaultProperties" /> is true then
''' this function lookups up members with the given <paramref name="name" />,
''' <paramref name="arity" />, and <paramref name="options" />. Otherwise, it looks for default properties.
''' </summary>
Private Shared Sub FindWinRTMembers(result As LookupResult,
type As NamedTypeSymbol,
binder As Binder,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo),
lookupMembersNotDefaultProperties As Boolean,
Optional name As String = Nothing,
Optional arity As Integer = -1,
Optional options As LookupOptions = Nothing)
' If we have no conflict with existing members, we also have to check
' if we have a conflict with other interface members. An example would be
' a type which implements both IIterable (IEnumerable) and IMap
' (IDictionary).There are two different GetEnumerator methods from each
' interface. Thus, we don't know which method to choose. The solution?
' Don't add any GetEnumerator method.
Dim comparer = MemberSignatureComparer.WinRTComparer
Dim allMembers = New HashSet(Of Symbol)(comparer)
Dim conflictingMembers = New HashSet(Of Symbol)(comparer)
' Add all viable members from type lookup
If result.IsGood Then
For Each sym In result.Symbols
' Fields can't be present in the HashSet because they can't be compared
' with a MemberSignatureComparer
' TODO: Add field support in the C# and VB member comparers and then
' delete this check
If sym.Kind <> SymbolKind.Field Then
allMembers.Add(sym)
End If
Next
End If
Dim tmp = LookupResult.GetInstance()
' Dev11 searches all declared and undeclared base interfaces
For Each iface In type.AllInterfacesWithDefinitionUseSiteDiagnostics(useSiteDiagnostics)
If IsWinRTProjectedInterface(iface, binder.Compilation) Then
If lookupMembersNotDefaultProperties Then
Debug.Assert(name IsNot Nothing)
LookupWithoutInheritance(tmp,
iface,
name,
arity,
options,
iface,
binder,
useSiteDiagnostics)
Else
LookupDefaultPropertyInSingleType(tmp,
iface,
iface,
binder,
useSiteDiagnostics)
End If
' only add viable members
If tmp.IsGood Then
For Each sym In tmp.Symbols
If Not allMembers.Add(sym) Then
conflictingMembers.Add(sym)
End If
Next
End If
tmp.Clear()
End If
Next
tmp.Free()
If result.IsGood Then
For Each sym In result.Symbols
If sym.Kind <> SymbolKind.Field Then
allMembers.Remove(sym)
conflictingMembers.Remove(sym)
End If
Next
End If
For Each sym In allMembers
If Not conflictingMembers.Contains(sym) Then
' since we only added viable members, every lookupresult should be viable
result.MergeOverloadedOrPrioritized(
New SingleLookupResult(LookupResultKind.Good, sym, Nothing),
checkIfCurrentHasOverloads:=False)
End If
Next
End Sub
Private Shared Function IsWinRTProjectedInterface(iFace As NamedTypeSymbol, compilation As VisualBasicCompilation) As Boolean
Dim idictSymbol = compilation.GetWellKnownType(WellKnownType.System_Collections_Generic_IDictionary_KV)
Dim iroDictSymbol = compilation.GetWellKnownType(WellKnownType.System_Collections_Generic_IReadOnlyDictionary_KV)
Dim iListSymbol = compilation.GetWellKnownType(WellKnownType.System_Collections_IList)
Dim iCollectionSymbol = compilation.GetWellKnownType(WellKnownType.System_Collections_ICollection)
Dim inccSymbol = compilation.GetWellKnownType(WellKnownType.System_Collections_Specialized_INotifyCollectionChanged)
Dim inpcSymbol = compilation.GetWellKnownType(WellKnownType.System_ComponentModel_INotifyPropertyChanged)
Dim iFaceOriginal = iFace.OriginalDefinition
Dim iFaceSpecial = iFaceOriginal.SpecialType
' Types match the list given in dev11 IMPORTER::GetWindowsRuntimeInterfacesToFake
Return iFaceSpecial = SpecialType.System_Collections_Generic_IEnumerable_T OrElse
iFaceSpecial = SpecialType.System_Collections_Generic_IList_T OrElse
iFaceSpecial = SpecialType.System_Collections_Generic_ICollection_T OrElse
iFaceOriginal = idictSymbol OrElse
iFaceSpecial = SpecialType.System_Collections_Generic_IReadOnlyList_T OrElse
iFaceSpecial = SpecialType.System_Collections_Generic_IReadOnlyCollection_T OrElse
iFaceOriginal = iroDictSymbol OrElse
iFaceSpecial = SpecialType.System_Collections_IEnumerable OrElse
iFaceOriginal = iListSymbol OrElse
iFaceOriginal = iCollectionSymbol OrElse
iFaceOriginal = inccSymbol OrElse
iFaceOriginal = inpcSymbol
End Function
''' <summary>
''' Lookup a member name in a submission chain.
''' </summary>
''' <remarks>
''' We start with the current submission class and walk the submission chain back to the first submission.
''' The search has two phases
''' 1) We are looking for any symbol matching the given name, arity, and options. If we don't find any the search is over.
''' If we find an overloadable symbol(s) (a method or a property) we start looking for overloads of this kind
''' (lookingForOverloadsOfKind) of symbol in phase 2.
''' 2) If a visited submission contains a matching member of a kind different from lookingForOverloadsOfKind we stop
''' looking further. Otherwise, if we find viable overload(s) we add them into the result. Overloads modifier is ignored.
''' </remarks>
Private Shared Sub LookupInSubmissions(result As LookupResult,
submissionClass As TypeSymbol,
name As String,
arity As Integer,
options As LookupOptions,
binder As Binder,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo))
Debug.Assert(result.IsClear)
Dim submissionSymbols = LookupResult.GetInstance()
Dim nonViable = LookupResult.GetInstance()
Dim lookingForOverloadsOfKind As SymbolKind? = Nothing
Dim submission = binder.Compilation
Do
submissionSymbols.Clear()
If submission.ScriptClass IsNot Nothing Then
LookupWithoutInheritance(submissionSymbols, submission.ScriptClass, name, arity, options, submissionClass, binder, useSiteDiagnostics)
End If
' TOOD (tomat): import aliases
If lookingForOverloadsOfKind Is Nothing Then
If Not submissionSymbols.IsGoodOrAmbiguous Then
' skip non-viable members, but remember them in case no viable members are found in previous submissions:
nonViable.MergePrioritized(submissionSymbols)
submission = submission.PreviousSubmission
Continue Do
End If
' always overload (ignore Overloads modifier):
result.MergeOverloadedOrPrioritized(submissionSymbols, checkIfCurrentHasOverloads:=False)
Dim first = submissionSymbols.Symbols.First
If Not first.IsOverloadable Then
Exit Do
End If
' we are now looking for any kind of member regardless of the original binding restrictions:
options = options And Not LookupOptions.NamespacesOrTypesOnly
lookingForOverloadsOfKind = first.Kind
Else
' found a member we are not looking for - the overload set is final now
If submissionSymbols.HasSymbol AndAlso submissionSymbols.Symbols.First.Kind <> lookingForOverloadsOfKind.Value Then
Exit Do
End If
' found a viable overload
If submissionSymbols.IsGoodOrAmbiguous Then
' merge overloads
Debug.Assert(result.Symbols.All(Function(s) s.IsOverloadable))
' always overload (ignore Overloads modifier):
result.MergeOverloadedOrPrioritized(submissionSymbols, checkIfCurrentHasOverloads:=False)
End If
End If
submission = submission.PreviousSubmission
Loop Until submission Is Nothing
If Not result.HasSymbol Then
result.SetFrom(nonViable)
End If
' TODO (tomat): extension methods
submissionSymbols.Free()
nonViable.Free()
End Sub
Public Shared Sub LookupDefaultProperty(result As LookupResult, container As TypeSymbol, binder As Binder, <[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo))
Select Case container.TypeKind
Case TypeKind.Class, TypeKind.Module, TypeKind.Structure
LookupDefaultPropertyInClass(result, DirectCast(container, NamedTypeSymbol), binder, useSiteDiagnostics)
Case TypeKind.Interface
LookupDefaultPropertyInInterface(result, DirectCast(container, NamedTypeSymbol), binder, useSiteDiagnostics)
Case TypeKind.TypeParameter
LookupDefaultPropertyInTypeParameter(result, DirectCast(container, TypeParameterSymbol), binder, useSiteDiagnostics)
End Select
End Sub
Private Shared Sub LookupDefaultPropertyInClass(
result As LookupResult,
type As NamedTypeSymbol,
binder As Binder,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo)
)
Debug.Assert(type.IsClassType OrElse type.IsModuleType OrElse type.IsStructureType OrElse type.IsDelegateType)
Dim accessThroughType As NamedTypeSymbol = type
While type IsNot Nothing
If LookupDefaultPropertyInSingleType(result, type, accessThroughType, binder, useSiteDiagnostics) Then
Return
End If
' If this is a WinRT type, we should also look for default properties in the
' implemented projected interfaces
If type.ShouldAddWinRTMembers Then
FindWinRTMembers(result,
type,
binder,
useSiteDiagnostics,
lookupMembersNotDefaultProperties:=False)
If result.IsGood Then
Return
End If
End If
type = type.BaseTypeWithDefinitionUseSiteDiagnostics(useSiteDiagnostics)
End While
End Sub
' See Semantics::LookupDefaultPropertyInInterface.
Private Shared Sub LookupDefaultPropertyInInterface(
result As LookupResult,
[interface] As NamedTypeSymbol,
binder As Binder,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo)
)
Debug.Assert([interface].IsInterfaceType)
If LookupDefaultPropertyInSingleType(result, [interface], [interface], binder, useSiteDiagnostics) Then
Return
End If
For Each baseInterface In [interface].InterfacesNoUseSiteDiagnostics
baseInterface.OriginalDefinition.AddUseSiteDiagnostics(useSiteDiagnostics)
LookupDefaultPropertyInBaseInterface(result, baseInterface, binder, useSiteDiagnostics)
If result.HasDiagnostic Then
Return
End If
Next
End Sub
Private Shared Sub LookupDefaultPropertyInTypeParameter(result As LookupResult, typeParameter As TypeParameterSymbol, binder As Binder, <[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo))
' Look up in class constraint.
Dim constraintClass = typeParameter.GetClassConstraint(useSiteDiagnostics)
If constraintClass IsNot Nothing Then
LookupDefaultPropertyInClass(result, constraintClass, binder, useSiteDiagnostics)
If Not result.IsClear Then
Return
End If
End If
' Look up in interface constraints.
Dim lookIn As Queue(Of InterfaceInfo) = Nothing
Dim processed As HashSet(Of InterfaceInfo) = Nothing
AddInterfaceConstraints(typeParameter, lookIn, processed, useSiteDiagnostics)
If lookIn IsNot Nothing Then
For Each baseInterface In lookIn
LookupDefaultPropertyInBaseInterface(result, baseInterface.InterfaceType, binder, useSiteDiagnostics)
If result.HasDiagnostic Then
Return
End If
Next
End If
End Sub
' See Semantics::LookupDefaultPropertyInBaseInterface.
Private Shared Sub LookupDefaultPropertyInBaseInterface(
result As LookupResult,
type As NamedTypeSymbol,
binder As Binder,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo)
)
If type.IsErrorType() Then
Return
End If
Debug.Assert(type.IsInterfaceType)
Debug.Assert(Not result.HasDiagnostic)
Dim tmpResult = LookupResult.GetInstance()
Try
LookupDefaultPropertyInInterface(tmpResult, type, binder, useSiteDiagnostics)
If Not tmpResult.HasSymbol Then
Return
End If
If tmpResult.HasDiagnostic OrElse Not result.HasSymbol Then
result.SetFrom(tmpResult)
Return
End If
' At least one member was found on another interface.
' Report an ambiguity error if the two interfaces are distinct.
Dim symbolA = result.Symbols(0)
Dim symbolB = tmpResult.Symbols(0)
If symbolA.ContainingSymbol <> symbolB.ContainingSymbol Then
result.MergeAmbiguous(tmpResult, AddressOf GenerateAmbiguousDefaultPropertyDiagnostic)
End If
Finally
tmpResult.Free()
End Try
End Sub
' Return True if a default property is defined on the type.
Private Shared Function LookupDefaultPropertyInSingleType(
result As LookupResult,
type As NamedTypeSymbol,
accessThroughType As TypeSymbol,
binder As Binder,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo)
) As Boolean
Dim defaultPropertyName = type.DefaultPropertyName
If String.IsNullOrEmpty(defaultPropertyName) Then
Return False
End If
Select Case type.TypeKind
Case TypeKind.Class, TypeKind.Module, TypeKind.Structure
LookupInClass(
result,
type,
defaultPropertyName,
arity:=0,
options:=LookupOptions.Default,
accessThroughType:=accessThroughType,
binder:=binder,
useSiteDiagnostics:=useSiteDiagnostics)
Case TypeKind.Interface
Debug.Assert(accessThroughType Is type)
LookupInInterface(
result,
type,
defaultPropertyName,
arity:=0,
options:=LookupOptions.Default,
binder:=binder,
useSiteDiagnostics:=useSiteDiagnostics)
Case TypeKind.TypeParameter
Throw ExceptionUtilities.UnexpectedValue(type.TypeKind)
End Select
Return result.HasSymbol
End Function
Private Shared Function GenerateAmbiguousDefaultPropertyDiagnostic(symbols As ImmutableArray(Of Symbol)) As AmbiguousSymbolDiagnostic
Debug.Assert(symbols.Length > 1)
Dim symbolA = symbols(0)
Dim containingSymbolA = symbolA.ContainingSymbol
For i = 1 To symbols.Length - 1
Dim symbolB = symbols(i)
Dim containingSymbolB = symbolB.ContainingSymbol
If containingSymbolA <> containingSymbolB Then
' "Default property access is ambiguous between the inherited interface members '{0}' of interface '{1}' and '{2}' of interface '{3}'."
Return New AmbiguousSymbolDiagnostic(ERRID.ERR_DefaultPropertyAmbiguousAcrossInterfaces4, symbols, symbolA, containingSymbolA, symbolB, containingSymbolB)
End If
Next
' Expected ambiguous symbols
Throw ExceptionUtilities.Unreachable
End Function
Private Shared Sub LookupForExtensionMethodsIfNeedTo(
result As LookupResult,
container As TypeSymbol,
name As String,
arity As Integer,
options As LookupOptions,
binder As Binder,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo)
)
If result.IsGood AndAlso
((options And LookupOptions.EagerlyLookupExtensionMethods) = 0 OrElse
result.Symbols(0).Kind <> SymbolKind.Method) Then
Return
End If
Dim currentResult = LookupResult.GetInstance()
LookupForExtensionMethods(currentResult, container, name, arity, options, binder, useSiteDiagnostics)
MergeInternalXmlHelperValueIfNecessary(currentResult, container, name, arity, options, binder, useSiteDiagnostics)
result.MergeOverloadedOrPrioritized(currentResult, checkIfCurrentHasOverloads:=False)
currentResult.Free()
End Sub
Private Shared Function ShouldLookupExtensionMethods(options As LookupOptions, container As TypeSymbol) As Boolean
Return options.ShouldLookupExtensionMethods AndAlso
Not container.IsObjectType() AndAlso
Not container.IsShared AndAlso
Not container.IsModuleType()
End Function
Public Shared Sub LookupForExtensionMethods(
lookupResult As LookupResult,
container As TypeSymbol,
name As String,
arity As Integer,
options As LookupOptions,
binder As Binder,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo)
)
Debug.Assert(lookupResult.IsClear)
If Not ShouldLookupExtensionMethods(options, container) Then
lookupResult.SetFrom(SingleLookupResult.Empty)
Return
End If
' Proceed up the chain of binders, collecting extension methods
Dim originalBinder = binder
Dim currentBinder = binder
Dim methods = ArrayBuilder(Of MethodSymbol).GetInstance()
Dim proximity As Integer = 0
' We don't want to process the same methods more than once, but the same extension method
' might be in scope in several different binders. For example, within a type, within
' imported the same type, within imported namespace containing the type.
' So, taking into consideration the fact that CollectProbableExtensionMethodsInSingleBinder
' groups methods from the same containing type together, we will keep track of the types and
' will process all the methods from the same containing type at once.
Dim seenContainingTypes As New HashSet(Of NamedTypeSymbol)()
Do
methods.Clear()
currentBinder.CollectProbableExtensionMethodsInSingleBinder(name, methods, originalBinder)
Dim i As Integer = 0
Dim count As Integer = methods.Count
While i < count
Dim containingType As NamedTypeSymbol = methods(i).ContainingType
If seenContainingTypes.Add(containingType) AndAlso
((options And LookupOptions.IgnoreAccessibility) <> 0 OrElse
AccessCheck.IsSymbolAccessible(containingType, binder.Compilation.Assembly, useSiteDiagnostics)) Then
' Process all methods from the same type together.
Do
' Try to reduce this method and merge with the current result
Dim reduced As MethodSymbol = methods(i).ReduceExtensionMethod(container, proximity)
If reduced IsNot Nothing Then
lookupResult.MergeOverloadedOrPrioritizedExtensionMethods(binder.CheckViability(reduced, arity, options, reduced.ContainingType, useSiteDiagnostics))
End If
i += 1
Loop While i < count AndAlso containingType Is methods(i).ContainingSymbol
Else
' We already processed extension methods from this container before or the whole container is not accessible,
' skip the whole group of methods from this containing type.
Do
i += 1
Loop While i < count AndAlso containingType Is methods(i).ContainingSymbol
End If
End While
' Continue to containing binders.
proximity += 1
currentBinder = currentBinder.m_containingBinder
Loop While currentBinder IsNot Nothing
methods.Free()
End Sub
''' <summary>
''' Include the InternalXmlHelper.Value extension property in the LookupResult
''' if the container implements IEnumerable(Of XElement), the name is "Value",
''' and the arity is 0.
''' </summary>
Private Shared Sub MergeInternalXmlHelperValueIfNecessary(
lookupResult As LookupResult,
container As TypeSymbol,
name As String,
arity As Integer,
options As LookupOptions,
binder As Binder,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo)
)
If (arity <> 0) OrElse Not IdentifierComparison.Equals(name, StringConstants.ValueProperty) Then
Return
End If
Dim compilation = binder.Compilation
If (options And LookupOptions.NamespacesOrTypesOnly) <> 0 OrElse
Not container.IsOrImplementsIEnumerableOfXElement(compilation, useSiteDiagnostics) Then
Return
End If
Dim symbol = compilation.GetWellKnownTypeMember(WellKnownMember.My_InternalXmlHelper__Value)
Dim singleResult As SingleLookupResult
If symbol Is Nothing Then
' Match the native compiler which reports ERR_XmlFeaturesNotAvailable in this case.
Dim useSiteError = ErrorFactory.ErrorInfo(ERRID.ERR_XmlFeaturesNotAvailable)
singleResult = New SingleLookupResult(LookupResultKind.NotReferencable, binder.GetErrorSymbol(name, useSiteError), useSiteError)
Else
Dim reduced = New ReducedExtensionPropertySymbol(DirectCast(symbol, PropertySymbol))
singleResult = binder.CheckViability(reduced, arity, options, reduced.ContainingType, useSiteDiagnostics)
End If
lookupResult.MergePrioritized(singleResult)
End Sub
Private Shared Sub AddLookupSymbolsInfoOfExtensionMethods(nameSet As LookupSymbolsInfo,
container As TypeSymbol,
newInfo As LookupSymbolsInfo,
binder As Binder)
Dim lookup = LookupResult.GetInstance()
For Each name In newInfo.Names
lookup.Clear()
LookupForExtensionMethods(lookup, container, name, 0,
LookupOptions.AllMethodsOfAnyArity Or LookupOptions.IgnoreAccessibility,
binder, useSiteDiagnostics:=Nothing)
If lookup.IsGood Then
For Each method As MethodSymbol In lookup.Symbols
nameSet.AddSymbol(method, method.Name, method.Arity)
Next
End If
Next
lookup.Free()
End Sub
Public Shared Sub AddExtensionMethodLookupSymbolsInfo(nameSet As LookupSymbolsInfo,
container As TypeSymbol,
options As LookupOptions,
binder As Binder)
If Not ShouldLookupExtensionMethods(options, container) Then
Return
End If
' We will not reduce extension methods for the purpose of this operation,
' they will still be shared methods.
options = options And (Not Global.Microsoft.CodeAnalysis.VisualBasic.LookupOptions.MustBeInstance)
' Proceed up the chain of binders, collecting names of extension methods
Dim currentBinder As Binder = binder
Dim newInfo = LookupSymbolsInfo.GetInstance()
Do
currentBinder.AddExtensionMethodLookupSymbolsInfoInSingleBinder(newInfo, options, binder)
' Continue to containing binders.
currentBinder = currentBinder.m_containingBinder
Loop While currentBinder IsNot Nothing
AddLookupSymbolsInfoOfExtensionMethods(nameSet, container, newInfo, binder)
newInfo.Free()
' Include "Value" for InternalXmlHelper.Value if necessary.
Dim compilation = binder.Compilation
Dim useSiteDiagnostics As HashSet(Of DiagnosticInfo) = Nothing
If container.IsOrImplementsIEnumerableOfXElement(compilation, useSiteDiagnostics) AndAlso useSiteDiagnostics.IsNullOrEmpty Then
nameSet.AddSymbol(Nothing, StringConstants.ValueProperty, 0)
End If
End Sub
''' <summary>
''' Checks if two interfaces have a base-derived relationship
''' </summary>
Private Shared Function IsDerivedInterface(
base As NamedTypeSymbol,
derived As NamedTypeSymbol,
basesBeingResolved As ConsList(Of Symbol),
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo)
) As Boolean
Debug.Assert(base.IsInterface)
Debug.Assert(derived.IsInterface)
If derived.OriginalDefinition = base.OriginalDefinition Then
Return False
End If
' if we are not resolving bases we can just go through AllInterfaces list
If basesBeingResolved Is Nothing Then
For Each i In derived.AllInterfacesWithDefinitionUseSiteDiagnostics(useSiteDiagnostics)
If i = base Then
Return True
End If
Next
Return False
End If
' we are resolving bases so should use a private helper that relies only on Declared interfaces
Return IsDerivedInterface(base, derived, basesBeingResolved, New HashSet(Of Symbol), useSiteDiagnostics)
End Function
Private Shared Function IsDerivedInterface(
base As NamedTypeSymbol,
derived As NamedTypeSymbol,
basesBeingResolved As ConsList(Of Symbol),
verified As HashSet(Of Symbol),
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo)
) As Boolean
Debug.Assert(base <> derived, "should already be verified for equality")
Debug.Assert(base.IsInterface)
Debug.Assert(derived.IsInterface)
verified.Add(derived)
' not afraid of cycles here as we will not verify same symbol twice
Dim interfaces = derived.GetDeclaredInterfacesWithDefinitionUseSiteDiagnostics(basesBeingResolved, useSiteDiagnostics)
If Not interfaces.IsDefaultOrEmpty Then
For Each i In interfaces
If i = base Then
Return True
End If
If verified.Contains(i) Then
' seen this already
Continue For
End If
If IsDerivedInterface(
base,
i,
basesBeingResolved,
verified,
useSiteDiagnostics) Then
Return True
End If
Next
End If
Return False
End Function
Private Structure InterfaceInfo
Implements IEquatable(Of InterfaceInfo)
Public ReadOnly InterfaceType As NamedTypeSymbol
Public ReadOnly InComInterfaceContext As Boolean
Public ReadOnly DescendantDefinitions As ImmutableHashSet(Of NamedTypeSymbol)
Public Sub New(interfaceType As NamedTypeSymbol, inComInterfaceContext As Boolean, Optional descendantDefinitions As ImmutableHashSet(Of NamedTypeSymbol) = Nothing)
Me.InterfaceType = interfaceType
Me.InComInterfaceContext = inComInterfaceContext
Me.DescendantDefinitions = descendantDefinitions
End Sub
Public Overrides Function GetHashCode() As Integer
Return Hash.Combine(Me.InterfaceType.GetHashCode(), Me.InComInterfaceContext.GetHashCode())
End Function
Public Overloads Overrides Function Equals(obj As Object) As Boolean
Return TypeOf obj Is InterfaceInfo AndAlso Equals(DirectCast(obj, InterfaceInfo))
End Function
Public Overloads Function Equals(other As InterfaceInfo) As Boolean Implements IEquatable(Of InterfaceInfo).Equals
Return Me.InterfaceType.Equals(other.InterfaceType) AndAlso Me.InComInterfaceContext = other.InComInterfaceContext
End Function
End Structure
Private Shared Sub LookupInInterface(lookupResult As LookupResult,
container As NamedTypeSymbol,
name As String,
arity As Integer,
options As LookupOptions,
binder As Binder,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo)
)
Debug.Assert(lookupResult.IsClear)
Dim methodsOnly As Boolean = CheckAndClearMethodsOnlyOption(options)
' look in these types. Start with container, add more accordingly.
Dim info As New InterfaceInfo(container, False)
Dim lookIn As New Queue(Of InterfaceInfo)
lookIn.Enqueue(info)
Dim processed As New HashSet(Of InterfaceInfo)
processed.Add(info)
LookupInInterfaces(lookupResult, container, lookIn, processed, name, arity, options, binder, methodsOnly, useSiteDiagnostics)
' If no viable or ambiguous results, look in Object.
If Not lookupResult.IsGoodOrAmbiguous AndAlso (options And LookupOptions.NoSystemObjectLookupForInterfaces) = 0 Then
Dim currentResult = LookupResult.GetInstance()
Dim obj As NamedTypeSymbol = binder.SourceModule.ContainingAssembly.GetSpecialType(SpecialType.System_Object)
LookupInClass(currentResult,
obj,
name, arity, options Or LookupOptions.IgnoreExtensionMethods, obj, binder,
useSiteDiagnostics)
If currentResult.IsGood Then
lookupResult.SetFrom(currentResult)
End If
currentResult.Free()
End If
ClearLookupResultIfNotMethods(methodsOnly, lookupResult)
LookupForExtensionMethodsIfNeedTo(lookupResult, container, name, arity, options, binder, useSiteDiagnostics)
Return
End Sub
Private Shared Sub LookupInInterfaces(lookupResult As LookupResult,
container As TypeSymbol,
lookIn As Queue(Of InterfaceInfo),
processed As HashSet(Of InterfaceInfo),
name As String,
arity As Integer,
options As LookupOptions,
binder As Binder,
methodsOnly As Boolean,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo)
)
Debug.Assert(lookupResult.IsClear)
Dim basesBeingResolved As ConsList(Of Symbol) = binder.BasesBeingResolved()
Dim isEventsOnlySpecified As Boolean = (options And LookupOptions.EventsOnly) <> 0
Dim currentResult = LookupResult.GetInstance()
Do
Dim info As InterfaceInfo = lookIn.Dequeue()
Debug.Assert(processed.Contains(info))
Debug.Assert(currentResult.IsClear)
LookupWithoutInheritance(currentResult, info.InterfaceType, name, arity, options, container, binder, useSiteDiagnostics)
' if result does not shadow we will have bases to visit
If Not (currentResult.StopFurtherLookup AndAlso AnyShadows(currentResult)) Then
If (options And LookupOptions.NoBaseClassLookup) = 0 AndAlso Not binder.IgnoreBaseClassesInLookup Then
AddBaseInterfacesToTheSearch(binder, info, lookIn, processed, useSiteDiagnostics)
End If
End If
Dim leaveEventsOnly As Boolean? = Nothing
If info.InComInterfaceContext Then
leaveEventsOnly = isEventsOnlySpecified
End If
If lookupResult.IsGood AndAlso currentResult.IsGood Then
' We have _another_ viable result while lookupResult is already viable. Use special interface merging rules.
MergeInterfaceLookupResults(lookupResult, currentResult, basesBeingResolved, leaveEventsOnly, useSiteDiagnostics)
Else
If currentResult.IsGood AndAlso leaveEventsOnly.HasValue Then
FilterSymbolsInLookupResult(currentResult, SymbolKind.Event, leaveInsteadOfRemoving:=leaveEventsOnly.Value)
End If
lookupResult.MergePrioritized(currentResult)
End If
currentResult.Clear()
Loop While lookIn.Count <> 0
currentResult.Free()
If methodsOnly AndAlso lookupResult.IsGood Then
' We need to filter out non-method symbols from 'currentResult'
' before merging with 'lookupResult'
FilterSymbolsInLookupResult(lookupResult, SymbolKind.Method, leaveInsteadOfRemoving:=True)
End If
' it may look like a Good result, but it may have ambiguities inside
' so we need to check that to be sure.
If lookupResult.IsGood Then
Dim ambiguityDiagnostics As AmbiguousSymbolDiagnostic = Nothing
Dim symbols As ArrayBuilder(Of Symbol) = lookupResult.Symbols
For i As Integer = 0 To symbols.Count - 2
Dim interface1 = DirectCast(symbols(i).ContainingType, NamedTypeSymbol)
For j As Integer = i + 1 To symbols.Count - 1
If Not LookupResult.CanOverload(symbols(i), symbols(j)) Then
' Symbols cannot overload each other.
' If they were from the same interface, LookupWithoutInheritance would make the result ambiguous.
' If they were from interfaces related through inheritance, one of them would shadow another,
' MergeInterfaceLookupResults handles that.
' Therefore, this symbols are from unrelated interfaces.
ambiguityDiagnostics = New AmbiguousSymbolDiagnostic(
ERRID.ERR_AmbiguousAcrossInterfaces3,
symbols.ToImmutable,
name,
symbols(i).ContainingType,
symbols(j).ContainingType)
GoTo ExitForFor
End If
Next
Next
ExitForFor:
If ambiguityDiagnostics IsNot Nothing Then
lookupResult.SetFrom(New SingleLookupResult(LookupResultKind.Ambiguous, symbols.First, ambiguityDiagnostics))
End If
End If
End Sub
Private Shared Sub FilterSymbolsInLookupResult(result As LookupResult, kind As SymbolKind, leaveInsteadOfRemoving As Boolean)
Debug.Assert(result.IsGood)
Dim resultSymbols As ArrayBuilder(Of Symbol) = result.Symbols
Debug.Assert(resultSymbols.Count > 0)
Dim i As Integer = 0
Dim j As Integer = 0
While j < resultSymbols.Count
Dim symbol As Symbol = resultSymbols(j)
If (symbol.Kind = kind) = leaveInsteadOfRemoving Then
resultSymbols(i) = resultSymbols(j)
i += 1
End If
j += 1
End While
resultSymbols.Clip(i)
If i = 0 Then
result.Clear()
End If
End Sub
Private Shared Sub LookupInTypeParameter(lookupResult As LookupResult,
typeParameter As TypeParameterSymbol,
name As String,
arity As Integer,
options As LookupOptions,
binder As Binder,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo))
Dim methodsOnly = CheckAndClearMethodsOnlyOption(options)
LookupInTypeParameterNoExtensionMethods(lookupResult, typeParameter, name, arity, options, binder, useSiteDiagnostics)
ClearLookupResultIfNotMethods(methodsOnly, lookupResult)
LookupForExtensionMethodsIfNeedTo(lookupResult, typeParameter, name, arity, options, binder, useSiteDiagnostics)
End Sub
Private Shared Sub LookupInTypeParameterNoExtensionMethods(result As LookupResult,
typeParameter As TypeParameterSymbol,
name As String,
arity As Integer,
options As LookupOptions,
binder As Binder,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo))
Debug.Assert((options And LookupOptions.MethodsOnly) = 0)
options = options Or LookupOptions.IgnoreExtensionMethods
' §4.9.2: "the class constraint hides members in interface constraints, which
' hide members in System.ValueType (if Structure constraint is specified),
' which hides members in Object."
' Look up in class constraint.
Dim constraintClass = typeParameter.GetClassConstraint(useSiteDiagnostics)
If constraintClass IsNot Nothing Then
LookupInClass(result, constraintClass, name, arity, options, constraintClass, binder, useSiteDiagnostics)
If result.StopFurtherLookup Then
Return
End If
End If
' Look up in interface constraints.
Dim lookIn As Queue(Of InterfaceInfo) = Nothing
Dim processed As HashSet(Of InterfaceInfo) = Nothing
AddInterfaceConstraints(typeParameter, lookIn, processed, useSiteDiagnostics)
If lookIn IsNot Nothing Then
' §4.9.2: "If a member with the same name appears in more than one interface
' constraint the member is unavailable (as in multiple interface inheritance)"
Dim interfaceResult = LookupResult.GetInstance()
Debug.Assert((options And LookupOptions.MethodsOnly) = 0)
LookupInInterfaces(interfaceResult, typeParameter, lookIn, processed, name, arity, options, binder, False, useSiteDiagnostics)
result.MergePrioritized(interfaceResult)
interfaceResult.Free()
If Not result.IsClear Then
Return
End If
End If
' Look up in System.ValueType or System.Object.
If constraintClass Is Nothing Then
Debug.Assert(result.IsClear)
Dim baseType = GetTypeParameterBaseType(typeParameter)
LookupInClass(result, baseType, name, arity, options, baseType, binder, useSiteDiagnostics)
End If
End Sub
Private Shared Function CheckAndClearMethodsOnlyOption(ByRef options As LookupOptions) As Boolean
If (options And LookupOptions.MethodsOnly) <> 0 Then
options = CType(options And (Not LookupOptions.MethodsOnly), LookupOptions)
Return True
End If
Return False
End Function
Private Shared Sub ClearLookupResultIfNotMethods(methodsOnly As Boolean, lookupResult As LookupResult)
If methodsOnly AndAlso
lookupResult.HasSymbol AndAlso
lookupResult.Symbols(0).Kind <> SymbolKind.Method Then
lookupResult.Clear()
End If
End Sub
Private Shared Sub AddInterfaceConstraints(typeParameter As TypeParameterSymbol,
ByRef allInterfaces As Queue(Of InterfaceInfo),
ByRef processedInterfaces As HashSet(Of InterfaceInfo),
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo)
)
For Each constraintType In typeParameter.ConstraintTypesWithDefinitionUseSiteDiagnostics(useSiteDiagnostics)
Select Case constraintType.TypeKind
Case TypeKind.Interface
Dim newInfo As New InterfaceInfo(DirectCast(constraintType, NamedTypeSymbol), False)
If processedInterfaces Is Nothing OrElse Not processedInterfaces.Contains(newInfo) Then
If processedInterfaces Is Nothing Then
allInterfaces = New Queue(Of InterfaceInfo)
processedInterfaces = New HashSet(Of InterfaceInfo)
End If
allInterfaces.Enqueue(newInfo)
processedInterfaces.Add(newInfo)
End If
Case TypeKind.TypeParameter
AddInterfaceConstraints(DirectCast(constraintType, TypeParameterSymbol), allInterfaces, processedInterfaces, useSiteDiagnostics)
End Select
Next
End Sub
''' <summary>
''' Merges two lookup results while eliminating symbols that are shadowed.
''' Note that the final result may contain unrelated and possibly conflicting symbols as
''' this helper is not intended to catch ambiguities.
''' </summary>
''' <param name="leaveEventsOnly">
''' If is not Nothing and False filters out all Event symbols, and if is not Nothing
''' and True filters out all non-Event symbols, nos not have any effect otherwise.
''' Is used for special handling of Events inside COM interfaces.
''' </param>
Private Shared Sub MergeInterfaceLookupResults(
knownResult As LookupResult,
newResult As LookupResult,
BasesBeingResolved As ConsList(Of Symbol),
leaveEventsOnly As Boolean?,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo)
)
Debug.Assert(knownResult.Kind = newResult.Kind)
Dim knownSymbols As ArrayBuilder(Of Symbol) = knownResult.Symbols
Dim newSymbols As ArrayBuilder(Of Symbol) = newResult.Symbols
Dim newSymbolContainer = newSymbols.First().ContainingType
For i As Integer = 0 To knownSymbols.Count - 1
Dim knownSymbol = knownSymbols(i)
' Nothing means that the symbol has been eliminated via shadowing
If knownSymbol Is Nothing Then
Continue For
End If
Dim knownSymbolContainer = knownSymbol.ContainingType
For j As Integer = 0 To newSymbols.Count - 1
Dim newSymbol As Symbol = newSymbols(j)
' Nothing means that the symbol has been eliminated via shadowing
If newSymbol Is Nothing Then
Continue For
End If
' Special-case events in case we are inside COM interface
If leaveEventsOnly.HasValue AndAlso (newSymbol.Kind = SymbolKind.Event) <> leaveEventsOnly.Value Then
newSymbols(j) = Nothing
Continue For
End If
If knownSymbol = newSymbol Then
' this is the same result as we already have, remove from the new set
newSymbols(j) = Nothing
Continue For
End If
' container of the first new symbol should be container of all others
Debug.Assert(newSymbolContainer = newSymbol.ContainingType)
' Are the known and new symbols of the right kinds to overload?
Dim cantOverloadEachOther = Not LookupResult.CanOverload(knownSymbol, newSymbol)
If IsDerivedInterface(base:=newSymbolContainer,
derived:=knownSymbolContainer,
basesBeingResolved:=BasesBeingResolved,
useSiteDiagnostics:=useSiteDiagnostics) Then
' if currently known is more derived and shadows the new one
' it shadows all the new ones and we are done
If IsShadows(knownSymbol) OrElse cantOverloadEachOther Then
' no need to continue with merge. new symbols are all shadowed
' and they cannot shadow anything in the old set
Debug.Assert(Not knownSymbols.Any(Function(s) s Is Nothing))
newResult.Clear()
Return
End If
ElseIf IsDerivedInterface(base:=knownSymbolContainer,
derived:=newSymbolContainer,
basesBeingResolved:=BasesBeingResolved,
useSiteDiagnostics:=useSiteDiagnostics) Then
' if new is more derived and shadows
' the current one should be dropped
' NOTE that we continue iterating as more known symbols may be "shadowed out" by the current.
If IsShadows(newSymbol) OrElse cantOverloadEachOther Then
knownSymbols(i) = Nothing
' all following known symbols in the same container are shadowed by the new one
' we can do a quick check and remove them here
For k = i + 1 To knownSymbols.Count - 1
Dim otherKnown As Symbol = knownSymbols(k)
If otherKnown IsNot Nothing AndAlso otherKnown.ContainingType = knownSymbolContainer Then
knownSymbols(k) = Nothing
End If
Next
End If
End If
' we can get here if results are completely unrelated.
' However we do not know if they are conflicting as either one could be "shadowed out" in later iterations.
' for now we let both known and new stay
Next
Next
CompactAndAppend(knownSymbols, newSymbols)
newResult.Clear()
End Sub
''' <summary>
''' first.Where(t IsNot Nothing).Concat(second.Where(t IsNot Nothing))
''' </summary>
Private Shared Sub CompactAndAppend(first As ArrayBuilder(Of Symbol), second As ArrayBuilder(Of Symbol))
Dim i As Integer = 0
' skip non nulls
While i < first.Count
If first(i) Is Nothing Then
Exit While
End If
i += 1
End While
' compact the rest
Dim j As Integer = i + 1
While j < first.Count
Dim item As Symbol = first(j)
If item IsNot Nothing Then
first(i) = item
i += 1
End If
j += 1
End While
' clip to compacted size
first.Clip(i)
' append non nulls from second
i = 0
While i < second.Count
Dim items As Symbol = second(i)
If items IsNot Nothing Then
first.Add(items)
End If
i += 1
End While
End Sub
''' <summary>
'''
''' </summary>
Private Shared Sub AddBaseInterfacesToTheSearch(binder As Binder,
currentInfo As InterfaceInfo,
lookIn As Queue(Of InterfaceInfo),
processed As HashSet(Of InterfaceInfo),
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo))
Dim interfaces As ImmutableArray(Of NamedTypeSymbol) = currentInfo.InterfaceType.GetDirectBaseInterfacesNoUseSiteDiagnostics(binder.BasesBeingResolved)
If Not interfaces.IsDefaultOrEmpty Then
Dim inComInterfaceContext As Boolean = currentInfo.InComInterfaceContext OrElse
currentInfo.InterfaceType.CoClassType IsNot Nothing
Dim descendants As ImmutableHashSet(Of NamedTypeSymbol)
If binder.BasesBeingResolved Is Nothing Then
descendants = Nothing
Else
' We need to watch out for cycles in inheritance chain since they are not broken while bases are being resolved.
If currentInfo.DescendantDefinitions Is Nothing Then
descendants = ImmutableHashSet.Create(currentInfo.InterfaceType.OriginalDefinition)
Else
descendants = currentInfo.DescendantDefinitions.Add(currentInfo.InterfaceType.OriginalDefinition)
End If
End If
For Each i In interfaces
If descendants IsNot Nothing AndAlso descendants.Contains(i.OriginalDefinition) Then
' About to get in an inheritance cycle
Continue For
End If
i.OriginalDefinition.AddUseSiteDiagnostics(useSiteDiagnostics)
Dim newInfo As New InterfaceInfo(i, inComInterfaceContext, descendants)
If processed.Add(newInfo) Then
lookIn.Enqueue(newInfo)
End If
Next
End If
End Sub
''' <summary>
''' if any symbol in the list Shadows. This implies that name is not visible through the base.
''' </summary>
Private Shared Function AnyShadows(result As LookupResult) As Boolean
For Each sym As Symbol In result.Symbols
If sym.IsShadows Then
Return True
End If
Next
Return False
End Function
' Find all names in a non-interface type, consider inheritance.
Private Shared Sub AddLookupSymbolsInfoInClass(nameSet As LookupSymbolsInfo,
container As TypeSymbol,
options As LookupOptions,
binder As Binder)
' We need a check for SpecialType.System_Void as its base type is
' ValueType but we don't wish to return any members for void type
If container IsNot Nothing And container.SpecialType = SpecialType.System_Void Then
Return
End If
' Lookup proceeds up the base class chain.
Dim currentType = container
Do
AddLookupSymbolsInfoWithoutInheritance(nameSet, currentType, options, container, binder)
' If the type is from a winmd file and implements any of the special WinRT collection
' projections, then we may need to add projected interface members
Dim namedType = TryCast(currentType, NamedTypeSymbol)
If namedType IsNot Nothing AndAlso namedType.ShouldAddWinRTMembers Then
AddWinRTMembersLookupSymbolsInfo(nameSet, namedType, options, container, binder)
End If
' Go to base type, unless that would case infinite recursion or the options or the binder
' disallows it.
If (options And LookupOptions.NoBaseClassLookup) <> 0 OrElse binder.IgnoreBaseClassesInLookup Then
currentType = Nothing
Else
currentType = currentType.GetDirectBaseTypeNoUseSiteDiagnostics(binder.BasesBeingResolved)
End If
Loop While currentType IsNot Nothing
' Search for extension methods.
AddExtensionMethodLookupSymbolsInfo(nameSet, container, options, binder)
' Special case: if we're in a constructor of a class or structure, then we can call constructors on ourself or our immediate base
' (via Me.New or MyClass.New or MyBase.New). We don't have enough info to check the constraints that the constructor must be
' the specific tokens Me, MyClass, or MyBase, or that its the first statement in the constructor, so services must do
' that check if it wants to show that.
' Roslyn Bug 9701.
Dim containingMethod = TryCast(binder.ContainingMember, MethodSymbol)
If containingMethod IsNot Nothing AndAlso
containingMethod.MethodKind = MethodKind.Constructor AndAlso
(container.TypeKind = TypeKind.Class OrElse container.TypeKind = TypeKind.Structure) AndAlso
(containingMethod.ContainingType = container OrElse containingMethod.ContainingType.BaseTypeNoUseSiteDiagnostics = container) Then
nameSet.AddSymbol(Nothing, WellKnownMemberNames.InstanceConstructorName, 0)
End If
End Sub
Private Shared Sub AddLookupSymbolsInfoInSubmissions(nameSet As LookupSymbolsInfo,
submissionClass As TypeSymbol,
options As LookupOptions,
binder As Binder)
Dim submission = binder.Compilation
Do
' TODO (tomat): import aliases
If submission.ScriptClass IsNot Nothing Then
AddLookupSymbolsInfoWithoutInheritance(nameSet, submission.ScriptClass, options, submissionClass, binder)
End If
submission = submission.PreviousSubmission
Loop Until submission Is Nothing
' TODO (tomat): extension methods
End Sub
' Find all names in an interface type, consider inheritance.
Private Shared Sub AddLookupSymbolsInfoInInterface(nameSet As LookupSymbolsInfo,
container As NamedTypeSymbol,
options As LookupOptions,
binder As Binder)
Dim info As New InterfaceInfo(container, False)
Dim lookIn As New Queue(Of InterfaceInfo)
lookIn.Enqueue(info)
Dim processed As New HashSet(Of InterfaceInfo)
processed.Add(info)
AddLookupSymbolsInfoInInterfaces(nameSet, container, lookIn, processed, options, binder)
' Look in Object.
AddLookupSymbolsInfoInClass(nameSet,
binder.SourceModule.ContainingAssembly.GetSpecialType(SpecialType.System_Object),
options Or LookupOptions.IgnoreExtensionMethods, binder)
' Search for extension methods.
AddExtensionMethodLookupSymbolsInfo(nameSet, container, options, binder)
End Sub
Private Shared Sub AddLookupSymbolsInfoInInterfaces(nameSet As LookupSymbolsInfo,
container As TypeSymbol,
lookIn As Queue(Of InterfaceInfo),
processed As HashSet(Of InterfaceInfo),
options As LookupOptions,
binder As Binder)
Dim useSiteDiagnostics As HashSet(Of DiagnosticInfo) = Nothing
Do
Dim currentType As InterfaceInfo = lookIn.Dequeue
AddLookupSymbolsInfoWithoutInheritance(nameSet, currentType.InterfaceType, options, container, binder)
' Go to base type, unless that would case infinite recursion or the options or the binder
' disallows it.
If (options And LookupOptions.NoBaseClassLookup) = 0 AndAlso Not binder.IgnoreBaseClassesInLookup Then
AddBaseInterfacesToTheSearch(binder, currentType, lookIn, processed, useSiteDiagnostics)
End If
Loop While lookIn.Count <> 0
End Sub
Private Shared Sub AddLookupSymbolsInfoInTypeParameter(nameSet As LookupSymbolsInfo,
typeParameter As TypeParameterSymbol,
options As LookupOptions,
binder As Binder)
AddLookupSymbolsInfoInTypeParameterNoExtensionMethods(nameSet, typeParameter, options, binder)
' Search for extension methods.
AddExtensionMethodLookupSymbolsInfo(nameSet, typeParameter, options, binder)
End Sub
Private Shared Sub AddLookupSymbolsInfoInTypeParameterNoExtensionMethods(nameSet As LookupSymbolsInfo,
typeParameter As TypeParameterSymbol,
options As LookupOptions,
binder As Binder)
options = options Or LookupOptions.IgnoreExtensionMethods
' Look up in class constraint.
Dim constraintClass = typeParameter.GetClassConstraint(Nothing)
If constraintClass IsNot Nothing Then
AddLookupSymbolsInfoInClass(nameSet, constraintClass, options, binder)
End If
' Look up in interface constraints.
Dim lookIn As Queue(Of InterfaceInfo) = Nothing
Dim processed As HashSet(Of InterfaceInfo) = Nothing
AddInterfaceConstraints(typeParameter, lookIn, processed, useSiteDiagnostics:=Nothing)
If lookIn IsNot Nothing Then
AddLookupSymbolsInfoInInterfaces(nameSet, typeParameter, lookIn, processed, options, binder)
End If
' Look up in System.ValueType or System.Object.
If constraintClass Is Nothing Then
Dim baseType = GetTypeParameterBaseType(typeParameter)
AddLookupSymbolsInfoInClass(nameSet, baseType, options, binder)
End If
End Sub
''' <summary>
''' Lookup a member name in a type without considering inheritance, returning a LookupResult that
''' summarizes the results of the lookup. See LookupResult structure for a detailed
''' discussing of the meaning of the results.
''' </summary>
Private Shared Sub LookupWithoutInheritance(lookupResult As LookupResult,
container As TypeSymbol,
name As String,
arity As Integer,
options As LookupOptions,
accessThroughType As TypeSymbol,
binder As Binder,
<[In], Out> ByRef useSiteDiagnostics As HashSet(Of DiagnosticInfo)
)
Dim members As ImmutableArray(Of Symbol) = ImmutableArray(Of Symbol).Empty
If (options And (LookupOptions.NamespacesOrTypesOnly Or LookupOptions.LabelsOnly)) = LookupOptions.NamespacesOrTypesOnly Then
' Only named types have members that are types. Go through all the types in this type and
' validate them. If there's multiple, give an error.
If TypeOf container Is NamedTypeSymbol Then
members = ImmutableArray.Create(Of Symbol, NamedTypeSymbol)(container.GetTypeMembers(name))
End If
ElseIf (options And LookupOptions.LabelsOnly) = 0 Then
members = container.GetMembers(name)
End If
Debug.Assert(lookupResult.IsClear)
' Go through each member of the type, and combine them into a single result. Overloadable members
' are combined together, while other duplicates cause an ambiguity error.
If Not members.IsDefaultOrEmpty Then
Dim imported As Boolean = container.ContainingModule IsNot binder.SourceModule
For Each sym In members
lookupResult.MergeMembersOfTheSameType(binder.CheckViability(sym, arity, options, accessThroughType, useSiteDiagnostics), imported)
Next
End If
End Sub
' Find all names in a type, without considering inheritance.
Private Shared Sub AddLookupSymbolsInfoWithoutInheritance(nameSet As LookupSymbolsInfo,
container As TypeSymbol,
options As LookupOptions,
accessThroughType As TypeSymbol,
binder As Binder)
' UNDONE: validate symbols with something that looks like ValidateSymbol.
If (options And (LookupOptions.NamespacesOrTypesOnly Or LookupOptions.LabelsOnly)) = LookupOptions.NamespacesOrTypesOnly Then
' Only named types have members that are types. Go through all the types in this type and
' validate them.
If TypeOf container Is NamedTypeSymbol Then
For Each sym In container.GetTypeMembersUnordered()
If binder.CanAddLookupSymbolInfo(sym, options, accessThroughType) Then
nameSet.AddSymbol(sym, sym.Name, sym.Arity)
End If
Next
End If
ElseIf (options And LookupOptions.LabelsOnly) = 0 Then
' Go through each member of the type.
For Each sym In container.GetMembersUnordered()
If binder.CanAddLookupSymbolInfo(sym, options, accessThroughType) Then
nameSet.AddSymbol(sym, sym.Name, sym.GetArity())
End If
Next
End If
End Sub
Private Shared Sub AddWinRTMembersLookupSymbolsInfo(
nameSet As LookupSymbolsInfo,
type As NamedTypeSymbol,
options As LookupOptions,
accessThroughType As TypeSymbol,
binder As Binder
)
' Dev11 searches all declared and undeclared base interfaces
For Each iface In type.AllInterfacesNoUseSiteDiagnostics
If IsWinRTProjectedInterface(iface, binder.Compilation) Then
AddLookupSymbolsInfoWithoutInheritance(nameSet, iface, options, accessThroughType, binder)
End If
Next
End Sub
Private Shared Function GetTypeParameterBaseType(typeParameter As TypeParameterSymbol) As NamedTypeSymbol
' The default base type should only be used if there is no explicit class constraint.
Debug.Assert(typeParameter.GetClassConstraint(Nothing) Is Nothing)
Return typeParameter.ContainingAssembly.GetSpecialType(If(typeParameter.HasValueTypeConstraint, SpecialType.System_ValueType, SpecialType.System_Object))
End Function
End Class
End Class
End Namespace
|
'*********************************************************
'
' Copyright (c) Microsoft. All rights reserved.
' THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OF
' ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY
' IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR
' PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
'
'*********************************************************
Imports Windows.UI.Xaml
Imports Windows.UI.Xaml.Controls
Imports Windows.UI.Xaml.Navigation
Imports SDKTemplate
Imports System
Imports System.Threading.Tasks
Imports System.Net
Imports System.IO
Imports System.Xml
Imports Windows.Storage
''' <summary>
''' An empty page that can be used on its own or navigated to within a Frame.
''' </summary>
Partial Public NotInheritable Class XmlReaderWriterScenario
Inherits SDKTemplate.Common.LayoutAwarePage
' A pointer back to the main page. This is needed if you want to call methods in MainPage such
' as NotifyUser()
Private rootPage As MainPage = MainPage.Current
Public Sub New()
Me.InitializeComponent()
End Sub
''' <summary>
''' Invoked when this page is about to be displayed in a Frame.
''' </summary>
''' <param name="e">Event data that describes how this page was reached. The Parameter
''' property is typically used to configure the page.</param>
Protected Overrides Sub OnNavigatedTo(e As NavigationEventArgs)
End Sub
''' <summary>
''' This is the click handler for the 'DoSomething' button. You would replace this with your own handler
''' if you have a button or buttons on this page.
''' </summary>
''' <param name="sender"></param>
''' <param name="e"></param>
Private Async Sub DoSomething_Click(sender As Object, e As RoutedEventArgs)
Dim b As Button = TryCast(sender, Button)
If b IsNot Nothing Then
rootPage.NotifyUser("You clicked the " & b.Content.ToString & " button", NotifyType.StatusMessage)
End If
Dim filename As String = "manchester_us.xml"
Try
Await ProcessWithReaderWriter(filename)
' show the content of the file just created
Using s As Stream = Await KnownFolders.PicturesLibrary.OpenStreamForReadAsync(filename)
Using sr As New StreamReader(s)
OutputTextBlock1.Text = sr.ReadToEnd()
End Using
End Using
Catch ex As UnauthorizedAccessException
OutputTextBlock1.Text = "Exception happend, Message:" & ex.Message
Catch webEx As System.Net.WebException
OutputTextBlock1.Text = "Exception happend, Message:" & webEx.Message & " Have you updated the bing map key in function ProcessWithReaderWriter()?"
End Try
End Sub
Private Async Function ProcessWithReaderWriter(filename As String) As Task
' you need to acquire a Bing Maps key. See http://www.bingmapsportal.com/
Dim bingMapKey As String = "INSERT_YOUR_BING_MAPS_KEY"
' the following uri will returns a response with xml content
Dim uri As New Uri(String.Format("http://dev.virtualearth.net/REST/v1/Locations?q=manchester&o=xml&key={0}", bingMapKey))
Dim request As WebRequest = WebRequest.Create(uri)
' if needed, specify credential here
' request.Credentials = new NetworkCredential();
' GetResponseAsync() returns immediately after the header is ready
Dim response As WebResponse = Await request.GetResponseAsync()
Dim inputStream As Stream = response.GetResponseStream()
Dim xrs As New XmlReaderSettings() With {.Async = True, .CloseInput = True}
Using reader As XmlReader = XmlReader.Create(inputStream, xrs)
Dim xws As New XmlWriterSettings() With {.Async = True, .Indent = True, .CloseOutput = True}
Dim outputStream As Stream = Await KnownFolders.PicturesLibrary.OpenStreamForWriteAsync(filename, CreationCollisionOption.OpenIfExists)
Using writer As XmlWriter = XmlWriter.Create(outputStream, xws)
Dim prefix As String = ""
Dim ns As String = ""
Await writer.WriteStartDocumentAsync()
Await writer.WriteStartElementAsync(prefix, "Locations", ns)
' iterate through the REST message, and find the Mancesters in US then write to file
While Await reader.ReadAsync()
' take element nodes with name "Address"
If reader.NodeType = XmlNodeType.Element AndAlso reader.Name = "Address" Then
' create a XmlReader from the Address element
Using subReader As XmlReader = reader.ReadSubtree()
Dim isInUS As Boolean = False
While Await subReader.ReadAsync()
' check if the CountryRegion element contains "United States"
If subReader.Name = "CountryRegion" Then
Dim value As String = Await subReader.ReadInnerXmlAsync()
If value.Contains("United States") Then
isInUS = True
End If
End If
' write the FormattedAddress node of the reader, if the address is within US
If isInUS AndAlso subReader.NodeType = XmlNodeType.Element AndAlso subReader.Name = "FormattedAddress" Then
Await writer.WriteNodeAsync(subReader, False)
End If
End While
End Using
End If
End While
Await writer.WriteEndElementAsync()
Await writer.WriteEndDocumentAsync()
End Using
End Using
End Function
End Class
|
Imports System.Security.Cryptography
Namespace HTTPSocket
Public Module Encryption
Public Function RSA_Encrypt(ByVal Input As String, ByVal Key As String) As String
Dim output As String
Using RSA As New RSACryptoServiceProvider(2048)
RSA.PersistKeyInCsp = False
RSA.FromXmlString(Key)
Dim buffer As Byte() = System.Text.Encoding.UTF8.GetBytes(Input)
Dim encrypted As Byte() = RSA.Encrypt(buffer, True)
output = Convert.ToBase64String(encrypted)
End Using
Return output
End Function
Public Function RSA_Decrypt(ByVal Input As String, ByVal Key As String) As String
Dim plain As Byte()
Using rsa As New RSACryptoServiceProvider(2048)
rsa.PersistKeyInCsp = False
rsa.FromXmlString(Key)
Dim buffer As Byte() = Convert.FromBase64String(Input)
plain = rsa.Decrypt(buffer, True)
End Using
Return System.Text.Encoding.UTF8.GetString(plain)
End Function
End Module
End Namespace |
Imports System.Data
Imports System.Data.SqlClient
Public Class patient_allocation
Private connectionString As String = "Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\kitti\source\repos\final-wellmeadown\final-wellmeadown\wellmeadown-final.mdf;Integrated Security=True;Connect Timeout=30"
Dim sqlSelectQuery As String = "select pa.* , w.ward_name , w.location , w.[tel extn] , s.first_name
from m_patient_allocation as pa, ward as w , staff as s
where pa.staff_number = s.staff_number and pa.ward_number = w.ward_name"
Dim sqlConnection As New SqlConnection(connectionString)
Dim sqlCommand As New SqlCommand(sqlSelectQuery, sqlConnection)
Dim sqlReader As SqlDataReader
Private Sub patient_allocation_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the '_wellmeadown_finalDataSet1.patient' table. You can move, or remove it, as needed.
Me.PatientTableAdapter.Fill(Me._wellmeadown_finalDataSet1.patient)
'TODO: This line of code loads data into the '_wellmeadown_finalDataSet1.d_patient_allocation' table. You can move, or remove it, as needed.
Me.D_patient_allocationTableAdapter.Fill(Me._wellmeadown_finalDataSet1.d_patient_allocation)
'TODO: This line of code loads data into the '_wellmeadown_finalDataSet.ward' table. You can move, or remove it, as needed.
Me.WardTableAdapter.Fill(Me._wellmeadown_finalDataSet.ward)
'TODO: This line of code loads data into the '_wellmeadown_finalDataSet.m_patient_allocation' table. You can move, or remove it, as needed.
Me.M_patient_allocationTableAdapter.Fill(Me._wellmeadown_finalDataSet.m_patient_allocation)
btn_add.Text = "add"
btn_edit.Text = "edit"
End Sub
Private Sub ReadMydata(connection As String)
Dim sqlSelectQuery As String = "select * from m_patient_allocation "
Dim sqlConnection As New SqlConnection(connectionString)
Dim sqlCommand As New SqlCommand(sqlSelectQuery, sqlConnection)
Dim sqlReader As SqlDataReader
sqlConnection.Open()
sqlReader = sqlCommand.ExecuteReader()
sqlReader.Read()
Patient_allocation_numberTextBox.Text = sqlReader.Item("Patient_allocation_number")
Ward_numberTextBox.Text = sqlReader.Item("Ward_number")
Staff_numberTextBox.Text = sqlReader.Item("Staff_number")
sqlReader.Close()
sqlConnection.Close()
End Sub
Private Sub ReadMydata2(connection As String)
Dim sqlSelectQuery As String = "select * from d_patient_allocation "
Dim sqlConnection As New SqlConnection(connectionString)
Dim sqlCommand As New SqlCommand(sqlSelectQuery, sqlConnection)
Dim sqlReader As SqlDataReader
sqlConnection.Open()
sqlReader = sqlCommand.ExecuteReader()
sqlReader.Read()
Patient_allocation_numberTextBox.Text = sqlReader.Item("patient_allocation_number")
TextBox1.Text = sqlReader.Item("patient_number")
DateTimePicker1.Value = sqlReader.Item("on_waiting_list")
TextBox5.Text = sqlReader.Item("expected_stay_(days)")
DateTimePicker2.Value = sqlReader.Item("date_placed")
DateTimePicker3.Value = sqlReader.Item("date_lave")
DateTimePicker4.Value = sqlReader.Item("actual_leave")
TextBox9.Text = sqlReader.Item("bed_number")
sqlReader.Close()
sqlConnection.Close()
End Sub
Private Sub btn_add_Click(dender As Object, e As EventArgs) Handles btn_add.Click
If btn_add.Text = "add" Then
btn_edit.Text = "cancle"
Else
MessageBox.Show("บันทึกข้อมูล " & First_nameTextBox.Text & " สำเร็จ", "ข้อความจากระบบ", MessageBoxButtons.OK, MessageBoxIcon.Information)
InsertMyData(connectionString)
ReadMydata(connectionString)
End If
End Sub
Private Sub btn_delete_Click(sender As Object, e As EventArgs) Handles btn_delete.Click
MessageBox.Show("ลบข้อมูลวอร์ด " & Ward_numberTextBox.Text & Ward_nameTextBox.Text & " สำเร็จ", "ข้อความจากระบบ", MessageBoxButtons.OK, MessageBoxIcon.Information)
Dim sqlDelete2 As String = ("DELETE FROM d_patient_allocation where patient_allocation_number = " & Patient_allocation_numberTextBox.Text)
Dim sqlCommand2 As New SqlCommand(sqlDelete2, sqlConnection)
sqlConnection.Close()
sqlConnection.Open()
sqlCommand2.ExecuteNonQuery()
Dim sqlDelete As String = ("DELETE FROM m_patient_allocation where patient_allocation_number = " & Patient_allocation_numberTextBox.Text)
Dim sqlCommand As New SqlCommand(sqlDelete, sqlConnection)
sqlConnection.Close()
sqlConnection.Open()
sqlCommand.ExecuteNonQuery()
ListView1.Items.Clear()
End Sub
Private Sub InsertMyData(connectionString As String)
Dim sqlInsert As String = ("insert into m_patient_allocation (patient_allocation_number,Ward_number,Staff_number)
values (" & Patient_allocation_numberTextBox.Text & ",'" & Ward_numberTextBox.Text & "','" & Staff_numberTextBox.Text & "')")
Debug.WriteLine(sqlInsert)
Dim sqlCommand As New SqlCommand(sqlInsert, sqlConnection)
sqlConnection.Close()
sqlConnection.Open()
sqlCommand.ExecuteNonQuery()
End Sub
Private Sub InsertMyData2(connectionString As String)
Dim sqlInsert As String = ("insert into d_patient_allocation (patient_allocation_number ,patient_number ,on_waiting_list ,[expected_stay_(days)] , date_placed , date_lave , actual_leave , bed_number)
values(" & Patient_allocation_numberTextBox.Text & ",'" & TextBox1.Text & "' ,'" & DateTimePicker1.Value.ToString("MM/dd/yyyy") & "' ," & TextBox5.Text & " ,'" & DateTimePicker2.Value.ToString("MM/dd/yyyy") & "' ,'" & DateTimePicker3.Value.ToString("MM/dd/yyyy") & "' ,'" & DateTimePicker4.Value.ToString("MM/dd/yyyy") & "','" & TextBox9.Text & "')")
Debug.WriteLine(sqlInsert)
Dim sqlCommand As New SqlCommand(sqlInsert, sqlConnection)
sqlConnection.Close()
sqlConnection.Open()
sqlCommand.ExecuteNonQuery()
End Sub
Sub deleteData(connectionString As String)
MessageBox.Show(" ลบข้อมูล " & First_nameTextBox.Text & " สำเร็จ", "ข้อความจากระบบ", MessageBoxButtons.OK, MessageBoxIcon.Information)
Dim sqlDelete As String = ("DELETE FROM m_patient_allocation where patient_allocation_number = " & Patient_allocation_numberTextBox.Text)
Debug.WriteLine(sqlDelete)
Dim sqlCommand As New SqlCommand(sqlDelete, sqlConnection)
sqlConnection.Close()
sqlConnection.Open()
sqlCommand.ExecuteNonQuery()
End Sub
Private Sub btn_edit_Click(dender As Object, e As EventArgs) Handles btn_edit.Click
If btn_edit.Text = "edit" Then
MessageBox.Show("ลบข้อมูลวอร์ด " & Ward_numberTextBox.Text & Ward_nameTextBox.Text & " สำเร็จ", "ข้อความจากระบบ", MessageBoxButtons.OK, MessageBoxIcon.Information)
UpdateMyData(connectionString)
ReadMydata(connectionString)
Else
btn_edit.Text = "edit"
End If
End Sub
Private Sub UpdateMyData(connectionString As String)
Dim sqlUpdate As String = "Update m_patient_allocation set Ward_number = '" & Ward_numberTextBox.Text &
"' ,Staff_number = '" & Staff_numberTextBox.Text & "'
where patient_allocation_number = " & Patient_allocation_numberTextBox.Text
Debug.WriteLine(sqlUpdate)
Dim sqlCommand As New SqlCommand(sqlUpdate, sqlConnection)
sqlConnection.Close()
sqlConnection.Open()
sqlCommand.ExecuteNonQuery()
End Sub
Private Sub btn_save_Click(sender As Object, e As EventArgs) Handles btn_save.Click
MessageBox.Show("บันทึกข้อมูลวอร์ด " & Ward_numberTextBox.Text & Ward_nameTextBox.Text & " สำเร็จ", "ข้อความจากระบบ", MessageBoxButtons.OK, MessageBoxIcon.Information)
InsertMyData(connectionString)
ReadMydata(connectionString)
btn_edit.Text = "edit"
End Sub
Sub add()
Dim item As New ListViewItem
If TextBox9.Text = "" Then
MessageBox.Show("กรุณากรอกข้อมูลให้ครบถถ้วน ", "ข้อความจากระบบ", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
If ListView1.Items.Count = 0 Then
item = ListView1.Items.Add(TextBox1.Text)
item.SubItems.Add(TextBox2.Text)
item.SubItems.Add(TextBox3.Text)
item.SubItems.Add(DateTimePicker1.Value.ToString("MM/dd/yyyy"))
item.SubItems.Add(TextBox5.Text)
item.SubItems.Add(DateTimePicker2.Value.ToString("MM/dd/yyyy"))
item.SubItems.Add(DateTimePicker3.Value.ToString("MM/dd/yyyy"))
item.SubItems.Add(DateTimePicker4.Value.ToString("MM/dd/yyyy"))
item.SubItems.Add(TextBox9.Text)
InsertMyData2(connectionString)
ReadMydata2(connectionString)
Else
With ListView1
Dim itm As ListViewItem
itm = .FindItemWithText(TextBox9.Text, True, 0, True)
If Not itm Is Nothing Then
MessageBox.Show("ข้อมูลของเตียง " & TextBox9.Text & " มีอยู่ในตารางอยู่แล้ว", "ข้อความจากระบบ", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
item = ListView1.Items.Add(TextBox1.Text)
item.SubItems.Add(TextBox2.Text)
item.SubItems.Add(TextBox3.Text)
item.SubItems.Add(DateTimePicker1.Value.ToString("MM/dd/yyyy"))
item.SubItems.Add(TextBox5.Text)
item.SubItems.Add(DateTimePicker2.Value.ToString("MM/dd/yyyy"))
item.SubItems.Add(DateTimePicker3.Value.ToString("MM/dd/yyyy"))
item.SubItems.Add(DateTimePicker4.Value.ToString("MM/dd/yyyy"))
item.SubItems.Add(TextBox9.Text)
InsertMyData2(connectionString)
ReadMydata2(connectionString)
End If
End With
End If
End If
End Sub
Private Sub btn_addview_Click(sender As Object, e As EventArgs) Handles btn_addview.Click
Call add()
End Sub
Private Sub DeleteToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ClearToolStripMenuItem.Click
ListView1.Items.Clear()
End Sub
Private Sub RemoveToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles RemoveToolStripMenuItem.Click
For i As Integer = ListView1.Items.Count - 1 To 0 Step -1
If ListView1.Items(i).Selected Then ListView1.Items.RemoveAt(i)
Next
deleteData(connectionString)
End Sub
Private Sub ListView1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListView1.SelectedIndexChanged
If ListView1.SelectedItems.Count > 0 Then
TextBox1.Text = ListView1.SelectedItems(0).SubItems(0).Text
TextBox2.Text = ListView1.SelectedItems(0).SubItems(1).Text
TextBox3.Text = ListView1.SelectedItems(0).SubItems(2).Text
DateTimePicker1.Value = ListView1.SelectedItems(0).SubItems(3).Text
TextBox5.Text = ListView1.SelectedItems(0).SubItems(4).Text
DateTimePicker2.Value = ListView1.SelectedItems(0).SubItems(5).Text
DateTimePicker3.Value = ListView1.SelectedItems(0).SubItems(6).Text
DateTimePicker4.Value = ListView1.SelectedItems(0).SubItems(7).Text
TextBox9.Text = ListView1.SelectedItems(0).SubItems(8).Text
End If
End Sub
Private Sub searchw_Click(sender As Object, e As EventArgs) Handles searchw.Click
patient_allo_ward_search.Show()
End Sub
Private Sub btn_patient_Click(sender As Object, e As EventArgs) Handles btn_patient.Click
patient.Show()
Me.Close()
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles btnd_staff_allocation.Click
staff_allocation.Show()
Me.Close()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles btn_patient_appointment.Click
Patient_appointment.Show()
Me.Close()
End Sub
Private Sub Button3_Click_1(sender As Object, e As EventArgs) Handles btn_patient_medication.Click
patient_medication.Show()
Me.Close()
End Sub
Private Sub btn_suppiler_Click(sender As Object, e As EventArgs) Handles btn_suppiler.Click
Suppiler.Show()
Me.Close()
End Sub
Private Sub btn_vaccine_oder_Click(sender As Object, e As EventArgs) Handles btn_vaccine_oder.Click
vaccine_order.Show()
Me.Close()
End Sub
Private Sub btn_logout_Click(sender As Object, e As EventArgs) Handles btn_logout.Click
LOGIN.Show()
Me.Close()
End Sub
Private Sub btn_staff_Click(sender As Object, e As EventArgs) Handles btn_staff.Click
staff.Show()
Me.Close()
End Sub
Private Sub btn_patient_allocation_Click(sender As Object, e As EventArgs) Handles btn_patient_allocation.Click
End Sub
Private Sub btn_search_Click(sender As Object, e As EventArgs) Handles btn_search.Click
patient_allo_search.Show()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
patient_patient_search.Show()
End Sub
End Class |
Imports System.Data.SqlClient
Imports sys_ui
Imports System.Drawing
Public Class SingleSell
Inherits System.Web.UI.Page
Private cnSQL As SqlConnection
Private strSQL As String
Private cmSQL As SqlCommand
Private drSQL As SqlDataReader
Private object_userlog As New usrlog.usrlog
Private currency As String
Private Days As String
Private MatAmount As String
Private selloption As String
Private maturity As String
Private selectedItem As Integer
Private cost As Decimal = 0
'Private SellPV As Decimal = 0
Private TotalProfit As Decimal = 0
Private maturityAmt As Decimal = 0
Private PortID As Integer
Dim Buyback As String = ""
Private SellingOption As String
Private securityRef As String
Private dealRef As String
Private backvalue As Integer
Dim comm As Decimal
Dim interest As Decimal
'Private lblFV As Decimal
'Private PV As Decimal
Private commrate As Decimal
Private PresentV, MaturityV, intToDate ', cost As Decimal
Private DealPortfolio As String
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
If Not Request.ServerVariables("QUERY_STRING") Is Nothing Then
currency = Request.QueryString("currency")
Days = Request.QueryString("Days")
MatAmount = Request.QueryString("MatAmount")
selloptionValue.Text = Request.QueryString("selloption")
Else
lblError.Text = alert("Please make sure all fields are selected On the newDeal Page", "Incomplete informaton")
End If
Call load_TBs(currency, MatAmount, Days, selloptionValue.Text)
End If
End Sub
Public Sub load_TBs(ByVal ccy As String, ByVal amt As Double, ByVal daysR As Integer, ByVal sellOpt As String)
Try
If sellOpt = "Discount" Then
strSQL = "select securitypurchase.tb_id,securitypurchase.dealreference from securitypurchase join" & _
" deals_live on securitypurchase.tb_id=deals_live.TB_ID and deals_live.dealreference=" & _
" securitypurchase.dealreference join dealtypes on dealtypes.deal_code=deals_live.dealtype " & _
" where dealtypes.othercharacteristics='Trading' and matured = 'N' and daystomaturity >2 and" & _
" authorisationstatus='A' and dealtypes.currency='" & Trim(ccy) & "' and daystomaturity >= " & daysR & "" & _
" and deals_live.maturityamount>=" & amt & " and entrytype='D'"
ElseIf sellOpt = "Yield" Then
strSQL = "select securitypurchase.tb_id,securitypurchase.dealreference from securitypurchase join" & _
" deals_live on securitypurchase.tb_id=deals_live.TB_ID and deals_live.dealreference=" & _
" securitypurchase.dealreference join dealtypes on dealtypes.deal_code=deals_live.dealtype " & _
" where dealtypes.othercharacteristics='Trading' and matured = 'N' and daystomaturity >2 and" & _
" authorisationstatus='A' and dealtypes.currency='" & Trim(ccy) & "' and daystomaturity >= " & daysR & "" & _
" and deals_live.dealamount>=" & amt & " and entrytype='Y'"
Else
strSQL = "select securitypurchase.tb_id,securitypurchase.dealreference from securitypurchase join" & _
" deals_live on securitypurchase.tb_id=deals_live.TB_ID and deals_live.dealreference=" & _
" securitypurchase.dealreference join dealtypes on dealtypes.deal_code=deals_live.dealtype " & _
" where dealtypes.othercharacteristics='Trading' and matured = 'N' and daystomaturity >2 and" & _
" authorisationstatus='A' and dealtypes.currency='" & Trim(ccy) & "' and daystomaturity >= " & daysR & ""
End If
cnSQL = New SqlConnection(Session("ConnectionString"))
cnSQL.Open()
cmSQL = New SqlCommand(strSQL, cnSQL)
drSQL = cmSQL.ExecuteReader()
'ListTbs.Items.Clear()
Do While drSQL.Read
If Checkamount(Trim(drSQL.Item(0).ToString), Trim(drSQL.Item(1).ToString)) = True Then
'Dim itms As New ListViewItem(Trim(drSQL.Item(0).ToString))
'itms.SubItems.Add(Trim(drSQL.Item(1).ToString))
'ListTbs.Items.Add(itms)
cmbTB.Items.Add(New ListItem(Trim(drSQL.Item(0).ToString) + " " + Trim(drSQL.Item(1).ToString), Trim(drSQL.Item(0).ToString)))
End If
Loop
' Close and Clean up objects
drSQL.Close()
cnSQL.Close()
cmSQL.Dispose()
cnSQL.Dispose()
Catch ex As SqlException
MsgBox(ex.Message, MsgBoxStyle.Critical)
'Log the event *****************************************************
object_userlog.SendDataToLog(Session("username") & "ERR001" & Format(Now, "dd/MM/yyyy hh:mm:ss") & ex.Message, Session("serverName"), Session("client"))
'************************END****************************************
End Try
End Sub
Private Function Checkamount(ByVal TBid As String, ByVal DealRef As String) As Boolean
Dim cnSQL1 As SqlConnection
Dim cmSQL1 As SqlCommand
Dim drSQL1 As SqlDataReader
Dim strSQL1 As String
Try
'validate username first
strSQL1 = "select Dealamount,maturityamount,entrytype from deals_live where tb_id='" & TBid & "' and dealreference='" & DealRef & "'"
cnSQL1 = New SqlConnection(Session("ConnectionString"))
cnSQL1.Open()
cmSQL1 = New SqlCommand(strSQL1, cnSQL1)
drSQL1 = cmSQL1.ExecuteReader()
Do While drSQL1.Read
If Trim(drSQL1.Item(2)).ToString = "D" Then
If CDec(drSQL1.Item(1)) <= 0 Then
Return False
End If
Else
If CDec(drSQL1.Item(0)) <= 0 Then
Return False
End If
End If
Loop
' Close and Clean up objects
drSQL1.Close()
cnSQL1.Close()
cmSQL1.Dispose()
cnSQL1.Dispose()
Return True
Catch ex As SqlException
MsgBox(ex.Message, MsgBoxStyle.Critical)
'Log the event *****************************************************
object_userlog.SendDataToLog(Session("username") & "ERR001" & Format(Now, "dd/MM/yyyy hh:mm:ss") & ex.Message, Session("serverName"), Session("client"))
'************************END****************************************
End Try
End Function
Protected Sub cmbTB_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cmbTB.SelectedIndexChanged
'Get details about the security
Dim cnSQL1 As SqlConnection
Dim strSQL1 As String
Dim cmSQL1 As SqlCommand
Dim drSQL1 As SqlDataReader
Dim accruedInt As Decimal
'Get details about the security
If cmbTB.SelectedValue.ToString <> "" Then
Try
strSQL1 = "select deals_live.dealamount as amt,securitypurchase.amtavailable,securitypurchase.dealamount as secamt,securitypurchase.interestRate as Rate,deals_live.entrytype,deals_live.Currency as curr,securitypurchase.maturitydate as matdate,deals_live.MaturityAmount as matAmt,deals_live.tenor,deals_live.daystomaturity,deals_live.Discountrate as disc,deals_live.intdaysbasis,deals_live.StartDate as start ,deals_live.intaccruedtodate,deals_live.Acceptancerate from securitypurchase join deals_live on securitypurchase.tb_id=deals_live.TB_ID " & _
" where securitypurchase.tb_id ='" & cmbTB.SelectedValue.ToString & "' and deals_live.TB_ID ='" & cmbTB.SelectedValue.ToString & "'" & _
" and securitypurchase.dealreference='" & getRef(Trim(cmbTB.SelectedValue.ToString)) & "' and" & _
" deals_live.dealreference='" & getRef(Trim(cmbTB.SelectedValue.ToString)) & "' and deals_live.othercharacteristics='Discount Purchase' "
cnSQL1 = New SqlConnection(Session("ConnectionString"))
cnSQL1.Open()
cmSQL1 = New SqlCommand(strSQL1, cnSQL1)
drSQL1 = cmSQL1.ExecuteReader()
Do While drSQL1.Read
If drSQL1.Item("entrytype").ToString = "D" Then
avalAtPV.Text = "Amount Available"
lblCostDesc2.Visible = False
txtAvalableForSale.Visible = False
accruedInt = CDec(drSQL1.Item("matAmt").ToString) * (CInt(drSQL1.Item("tenor")) - CInt(drSQL1.Item("daystomaturity"))) * CDec(drSQL1.Item("disc")) / (CDec(drSQL1.Item("intdaysbasis")) * 100)
txtAvalableForSale.Text = CDec(drSQL1.Item("matAmt").ToString) - SecurityAttached()
lblAvalableForSalePV.Text = CDec(drSQL1.Item("matAmt").ToString) - SecurityAttached()
txtPurValue.Text = drSQL1.Item("secamt").ToString
txtIntRate.Text = drSQL1.Item("Rate").ToString
lblDesc.Text = "Maturity Value"
rate.Text = "Discount Rate"
DealPortfolio = "D"
Else
txtAvalableForSale.Text = CDec(drSQL1.Item("amt").ToString) - SecurityAttached()
accruedInt = CDec(drSQL1.Item("amt").ToString) * (CInt(drSQL1.Item("tenor")) - CInt(drSQL1.Item("daystomaturity"))) * CDec(drSQL1.Item("interestrate")) / (CDec(drSQL1.Item("intdaysbasis")) * 100)
lblAvalableForSalePV.Text = CDec(drSQL1.Item("amt").ToString) + accruedInt - SecurityAttached()
txtPurValue.Text = drSQL1.Item("secamt").ToString
txtIntRate.Text = drSQL1.Item("Rate").ToString
lblDesc.Text = "Purchase Value"
rate.Text = "Yield Rate"
DealPortfolio = "Y"
End If
'MsgBox(CDec(drSQL1.Item("matAmt").ToString))
lbltb.Text = Trim(cmbTB.SelectedValue.ToString)
lblAvalableForSalePV.Text = Format(CDec(lblAvalableForSalePV.Text), "###,###,###.00")
txtAvalableForSale.Text = Format(CDec(txtAvalableForSale.Text), "###,###,###.00")
lblBasis.Text = drSQL1.Item("intdaysbasis").ToString
lblPurchaseStart.Text = drSQL1.Item("start").ToString
lblCurrency.Text = drSQL1.Item("curr").ToString
txtDaysMaturity.Text = DateDiff(DateInterval.Day, CDate(Session("SysDate")), CDate(drSQL1.Item("matdate")))
txtmaturity.Text = drSQL1.Item("matdate").ToString
lblTenor.Text = drSQL1.Item("tenor").ToString
txtSellTenor.Text = txtDaysMaturity.Text
commrate = CDec(drSQL1.Item("Acceptancerate"))
comm = CDec(drSQL1.Item("amt")) * CDec(drSQL1.Item("Acceptancerate")) * Int(drSQL1.Item("tenor")) / (Int(lblBasis.Text) * 100)
PresentV = CDec(drSQL1.Item("amt").ToString)
interest = PresentV * CDec(lblTenor.Text) * CDec(txtIntRate.Text) / (Int(lblBasis.Text) * 100)
MaturityV = PresentV + interest
'lblSellingOPT.Text = selloption
'MaturityV = CDec(drSQL.Item(12).ToString)
intToDate = CDec(drSQL1.Item("intaccruedtodate").ToString)
lblDealAmount.Text = CDec(drSQL1.Item("amt").ToString)
lblfv.Text = CDec(drSQL1.Item("matAmt").ToString)
lblpv.Text = CDec(drSQL1.Item("amt").ToString) + comm + accruedInt
If Trim(rate.Text) = "Discount Rate" Then
lblbreakeven.Text = BreakEvenRate(CDec(drSQL1.Item("matAmt").ToString), CDec(drSQL1.Item("amt").ToString) + comm + accruedInt, Int(drSQL1.Item("intdaysbasis").ToString), Int(drSQL1.Item("daystomaturity").ToString), DealPortfolio)
'MaturityV = CDec(drSQL.Item(12).ToString)
Else
lblbreakeven.Text = BreakEvenRate(MaturityV, CDec(drSQL1.Item("amt").ToString) + comm + accruedInt, Int(drSQL1.Item("intdaysbasis").ToString), Int(drSQL1.Item("daystomaturity").ToString), DealPortfolio)
End If
Loop
' Close and Clean up objects
drSQL1.Close()
cnSQL1.Close()
cmSQL1.Dispose()
cnSQL1.Dispose()
Catch xx As NullReferenceException
Catch ex As SqlException
MsgBox(ex.Message, MsgBoxStyle.Critical)
'Log the event *****************************************************
object_userlog.SendDataToLog(Session("username") & "ERR001" & Format(Now, "dd/MM/yyyy hh:mm:ss") & ex.Message, Session("serverName"), Session("client"))
'************************END****************************************
End Try
End If
End Sub
Private Sub checkAmtAvailable()
Dim accruedInt As Decimal
'Get details about the security
If Trim(cmbTB.SelectedValue.ToString) <> "" Then
Try
strSQL = "select * from securitypurchase join deals_live on securitypurchase.tb_id=deals_live.TB_ID " & _
" where securitypurchase.tb_id ='" & Trim(cmbTB.SelectedValue.ToString) & "' and deals_live.TB_ID ='" & Trim(cmbTB.SelectedValue.ToString) & "'" & _
" and securitypurchase.dealreference='" & getRef(Trim(cmbTB.SelectedValue.ToString)) & "' and" & _
" deals_live.dealreference='" & getRef(Trim(cmbTB.SelectedValue.ToString)) & "' and deals_live.othercharacteristics='Discount Purchase' "
cnSQL = New SqlConnection(Session("ConnectionString"))
cnSQL.Open()
cmSQL = New SqlCommand(strSQL, cnSQL)
drSQL = cmSQL.ExecuteReader()
Do While drSQL.Read
If drSQL.Item("entrytype").ToString = "D" Then
avalAtPV.Text = "Amount Available"
lblCostDesc2.Visible = False
txtAvalableForSale.Visible = False
accruedInt = CDec(drSQL.Item(13).ToString) * (CInt(drSQL.Item("tenor")) - CInt(drSQL.Item("daystomaturity"))) * CDec(drSQL.Item("Discountrate")) / (CDec(drSQL.Item("intdaysbasis")) * 100)
txtAvalableForSale.Text = CDec(drSQL.Item(13).ToString) - SecurityAttached()
lblAvalableForSalePV.Text = CDec(drSQL.Item(13).ToString) - SecurityAttached()
txtPurValue.Text = drSQL.Item(2).ToString
txtIntRate.Text = drSQL.Item(3).ToString
lblDesc.Text = "Maturity Value"
rate.Text = "Discount Rate"
DealPortfolio = "D"
Else
txtAvalableForSale.Text = CDec(drSQL.Item(12).ToString) - SecurityAttached()
accruedInt = CDec(drSQL.Item(12).ToString) * (CInt(drSQL.Item("tenor")) - CInt(drSQL.Item("daystomaturity"))) * CDec(drSQL.Item("interestrate")) / (CDec(drSQL.Item("intdaysbasis")) * 100)
lblAvalableForSalePV.Text = CDec(drSQL.Item(12).ToString) + accruedInt - SecurityAttached()
txtPurValue.Text = drSQL.Item(2).ToString
txtIntRate.Text = drSQL.Item(3).ToString
lblDesc.Text = "Purchase Value"
rate.Text = "Yield Rate"
DealPortfolio = "Y"
End If
lbltb.Text = Trim(cmbTB.SelectedValue.ToString)
lblAvalableForSalePV.Text = Format(CDec(lblAvalableForSalePV.Text), "###,###,###.00")
txtAvalableForSale.Text = Format(CDec(txtAvalableForSale.Text), "###,###,###.00")
txtAvalableForSale.ForeColor = Color.Blue
lblBasis.Text = drSQL.Item("intdaysbasis").ToString
lblPurchaseStart.Text = drSQL.Item("startdate").ToString
lblCurrency.Text = drSQL.Item("currency").ToString
txtDaysMaturity.Text = DateDiff(DateInterval.Day, CDate(Session("SysDate")), CDate(drSQL.Item(4)))
maturity = drSQL.Item(4).ToString
lblTenor.Text = drSQL.Item("tenor").ToString
txtSellTenor.Text = txtDaysMaturity.Text
commrate = CDec(drSQL.Item("Acceptancerate"))
comm = CDec(drSQL.Item(12)) * CDec(drSQL.Item("Acceptancerate")) * Int(drSQL.Item("tenor")) / (Int(lblBasis.Text) * 100)
PresentV = CDec(drSQL.Item(12).ToString)
interest = PresentV * CDec(lblTenor.Text) * CDec(txtIntRate.Text) / (Int(lblBasis.Text) * 100)
MaturityV = PresentV + interest
'MaturityV = CDec(drSQL.Item(12).ToString)
intToDate = CDec(drSQL.Item("intaccruedtodate").ToString)
lblDealAmount.Text = CDec(drSQL.Item(12).ToString)
lblfv.Text = CDec(drSQL.Item(13).ToString)
lblpv.Text = CDec(drSQL.Item(12).ToString) + comm + accruedInt
If Trim(rate.Text) = "Discount Rate" Then
lblbreakeven.Text = BreakEvenRate(CDec(drSQL.Item(13).ToString), CDec(drSQL.Item(12).ToString) + comm + accruedInt, Int(drSQL.Item("intdaysbasis").ToString), Int(drSQL.Item("daystomaturity").ToString), DealPortfolio)
lblbreakeven.ForeColor = Color.Green
'MaturityV = CDec(drSQL.Item(12).ToString)
Else
lblbreakeven.Text = BreakEvenRate(MaturityV, CDec(drSQL.Item(12).ToString) + comm + accruedInt, Int(drSQL.Item("intdaysbasis").ToString), Int(drSQL.Item("daystomaturity").ToString), DealPortfolio)
lblbreakeven.ForeColor = Color.Green
End If
Loop
' Close and Clean up objects
drSQL.Close()
cnSQL.Close()
cmSQL.Dispose()
cnSQL.Dispose()
Catch xx As NullReferenceException
Catch ex As SqlException
MsgBox(ex.Message, MsgBoxStyle.Critical)
'Log the event *****************************************************
object_userlog.SendDataToLog(Session("username") & "ERR001" & Format(Now, "dd/MM/yyyy hh:mm:ss") & ex.Message, Session("serverName"), Session("client"))
'************************END****************************************
End Try
End If
End Sub
Private Function getRef(ByVal tb As String)
Try
strSQL = " select securitypurchase.dealreference, matured from securitypurchase join deals_live on securitypurchase.dealreference=deals_live.dealreference" & _
" where matured = 'N' and authorisationstatus='A' and deals_live.tb_id='" & tb & "' "
cnSQL = New SqlConnection(Session("ConnectionString"))
cnSQL.Open()
cmSQL = New SqlCommand(strSQL, cnSQL)
drSQL = cmSQL.ExecuteReader()
Do While drSQL.Read
Return Trim(drSQL.Item(0).ToString)
Loop
' Close and Clean up objects
drSQL.Close()
cnSQL.Close()
cmSQL.Dispose()
cnSQL.Dispose()
Catch ex As SqlException
MsgBox(ex.Message, MsgBoxStyle.Critical)
'Log the event *****************************************************
object_userlog.SendDataToLog(Session("username") & "ERR001" & Format(Now, "dd/MM/yyyy hh:mm:ss") & ex.Message, Session("serverName"), Session("client"))
'************************END****************************************
End Try
End Function
Private Function SecurityAttached() As Decimal
Dim x As String
Dim cnSQL1 As SqlConnection
Dim cmSQL1 As SqlCommand
Dim drSQL1 As SqlDataReader
Dim strSQL1 As String
Try
'validate username first
strSQL1 = "select sum(securityamount)[hhh] from attachedsecurities where tb_id = '" & Trim(cmbTB.SelectedValue.ToString) & "' and dealreferencesecurity='" & getRef(Trim(cmbTB.SelectedValue.ToString)) & "' "
cnSQL1 = New SqlConnection(Session("ConnectionString"))
cnSQL1.Open()
cmSQL1 = New SqlCommand(strSQL1, cnSQL1)
drSQL1 = cmSQL1.ExecuteReader()
If drSQL.HasRows = True Then
Do While drSQL1.Read
x = drSQL1.Item(0).ToString
Loop
End If
' Close and Clean up objects
drSQL1.Close()
cnSQL1.Close()
cmSQL1.Dispose()
cnSQL1.Dispose()
If x = "" Then x = "0"
Return CDec(x)
Catch ex As SqlException
MsgBox(ex.Message, MsgBoxStyle.Critical)
'Log the event *****************************************************
object_userlog.SendDataToLog(Session("username") & "ERR001" & Format(Now, "dd/MM/yyyy hh:mm:ss") & ex.Message, Session("serverName"), Session("client"))
'************************END****************************************
End Try
End Function
Protected Sub btnReset_Click(sender As Object, e As EventArgs) Handles btnReset.Click
txtSellTenor.Enabled = True
txtSaleRate.Enabled = True
txtSale.Enabled = True
btnSale.Enabled = False
cmbTB.Enabled = True
End Sub
Protected Sub cmdExit_Click(sender As Object, e As EventArgs) Handles cmdExit.Click
Response.Redirect("newsell.aspx")
End Sub
Protected Sub btnValidate_Click(sender As Object, e As EventArgs) Handles btnValidate.Click
Dim SellingAmt As Decimal
Dim amount As Decimal
If Trim(lblSellingOPT.Text) = "" Then
MsgBox("Select Selling option.", MsgBoxStyle.Information, "Sell Option")
lblSellingOPT.Focus()
Exit Sub
End If
If Trim(lblAvalableForSalePV.Text) = "" Then
Exit Sub
End If
If Trim(lblSellingOPT.Text).Equals("Cost") Then
SellingAmt = CDec(txtAvalableForSale.Text)
Else
SellingAmt = CDec(lblAvalableForSalePV.Text)
End If
lblSellingOPT.ForeColor = Color.Green
'If Trim(Label4.Text) = "Interest Rate" Then
'amount = CDec(Label11.Text)
'Else
If txtSale.Text = "" Then
MsgBox("Enter Sale amount.", MsgBoxStyle.Critical, "Sale")
Exit Sub
End If
amount = CDec(txtSale.Text)
'End If
If CDec(txtSale.Text) = 0 Then
MsgBox("Sale amount cannot be zero.", MsgBoxStyle.Critical, "Inconsistent operation")
Exit Sub
End If
Try
If Int(txtSellTenor.Text) > Int(lblTenor.Text) Then
MsgBox("Tenor for sale cannot be greater than tenor purchase", MsgBoxStyle.Critical, "Tenor")
Exit Sub
End If
'check if amount is not greater than what is available to sale
If SellingAmt - amount < 0 Then
MsgBox("Sale amount is greater than what is available.", MsgBoxStyle.Critical, "Sale")
Exit Sub
End If
If rate.Text = "Discount Rate" Then
DiscountMethod()
Else
YieldMethod()
End If
cmbTB.Enabled = False
btnSale.Enabled = True
Catch xs As Exception
MsgBox(xs.Message, MsgBoxStyle.Critical)
End Try
End Sub
Private Sub DiscountMethod()
Dim TotalProfit As Decimal
Dim IntClient As Decimal
Dim TotalInterest As Decimal
Dim days As Integer
Dim AccruedOnSaleAmt As Decimal
Dim EffectiveRate As Decimal
Dim intToDate1 As Decimal
Dim comm As Decimal
btnSale.Enabled = False
'Holding period Yield Variables
Dim HoldingReturn As Decimal ' Holding return - Accrued interest Plus the Profit/Loss on the sale
Dim AHPY As Decimal ' Annual Holding Preiod Yield
If txtSellTenor.Text = "" Then
Exit Sub
End If
If txtSaleRate.Text = "" Then
MsgBox("Enter the interest rate", MsgBoxStyle.Critical)
Exit Sub
End If
If txtSale.Text = "" Then
Exit Sub
End If
comm = CDec(lblfv.Text) * commrate * Int(lblTenor.Text) / (Int(lblBasis.Text) * 100)
If Int(txtSellTenor.Text) > Int(txtDaysMaturity.Text) Then
MsgBox("Transaction will be backvalued and Breakeven rate will change.", MsgBoxStyle.Information, "Sell")
intToDate1 = (CDec(lblfv.Text) * (CDec(txtIntRate.Text)) * (CDec(lblTenor.Text) - Int(txtSellTenor.Text))) / (Int(lblBasis.Text) * 100)
lblbreakeven.Text = BreakEvenRate(CDec(lblfv.Text), CDec(lblpv.Text) + comm + intToDate1, Int(lblBasis.Text), Int(txtSellTenor.Text), "D")
ElseIf Int(txtSellTenor.Text) < Int(txtDaysMaturity.Text) Then
intToDate1 = (CDec(lblfv.Text) * (CDec(txtIntRate.Text)) * (CDec(lblTenor.Text) - Int(txtDaysMaturity.Text))) / (Int(lblBasis.Text) * 100)
lblbreakeven.Text = BreakEvenRate(CDec(lblfv.Text), CDec(lblpv.Text), Int(lblBasis.Text), Int(txtSellTenor.Text), "D")
Else
lblbreakeven.Text = BreakEvenRate(CDec(lblfv.Text), CDec(lblpv.Text), Int(lblBasis.Text), Int(txtDaysMaturity.Text), "D")
End If
'Get accrual on sell amount
If Int(txtDaysMaturity.Text) < Int(txtSellTenor.Text) Then
backvalue = Int(txtSellTenor.Text) - Int(txtDaysMaturity.Text)
days = (Int(lblTenor.Text) - Int(txtSellTenor.Text))
'AccruedOnSaleAmt = (CDec(txtSale.Text) * (CDec(txtIntRate.Text)) * (Int(lblTenor.Text) - Int(txtSellTenor.Text))) / (Int(lblBasis.Text) * 100)
Else
'AccruedOnSaleAmt = (CDec(txtSale.Text) * (CDec(txtIntRate.Text)) * (CDec(lblTenor.Text) - Int(DaysMaturity.Text))) / (Int(lblBasis.Text) * 100)
days = (CDec(lblTenor.Text) - Int(txtDaysMaturity.Text))
backvalue = 0
End If
'get present value of sell amount
txtSellPV.text = CDec(txtSale.Text) * (1 - (CDec(txtSaleRate.Text) * days / (Int(lblBasis.Text) * 100)))
'SellPV = CDec(txtSale.Text) - AccruedOnSaleAmt
'Calculate total interest to be accrued on sell amount for days to maturity
'TotalInterest = CDec(txtSale.Text) * CDec(mmt.Text) * Int(txtSellTenor.Text) / (Int(lblBasis.Text) * 100)
TotalInterest = (CDec(txtSale.Text) * (CDec(txtIntRate.Text)) * Int(txtSellTenor.Text)) / (Int(lblBasis.Text) * 100)
'Calculate interest due to client
IntClient = CDec(txtSale.Text) * CDec(txtSaleRate.Text * Int(txtSellTenor.Text)) / (Int(lblBasis.Text) * 100)
'Calculate own profit
TotalProfit = TotalInterest - IntClient
If TotalProfit < 0 Then
lblprofit.Text = "Capital Loss"
Else
lblprofit.Text = "Capital gain"
End If
'Calculate the effective rate for the client
'lblEffectiveRate.Text = Math.Round((IntClient * Int(lblBasis.Text) * 100) / (CDec(txtSale.Text) * Int(txtSellTenor.Text)), 9)
txtProfit.Text = Format(TotalProfit, "###,###,###.00")
'Label11.Text = Format(SellPV, "###,###,###.00")
TotalInterest = (CDec(txtSale.Text) * (CDec(txtIntRate.Text)) * Int(lblTenor.Text)) / (Int(lblBasis.Text) * 100)
cost = CDec(txtSale.Text) - TotalInterest
lblCost.Text = Format(cost, "###,###,###.00")
lblCost.ForeColor = Color.Red
'Compute the holding period Yieldtxt
HoldingReturn = ((Int(lblTenor.Text) - Int(txtDaysMaturity.Text)) * (CDec(txtIntRate.Text) * CDec(txtSale.Text) / 100) / CDec(lblBasis.Text)) + TotalProfit
If (Int(lblTenor.Text) - Int(txtDaysMaturity.Text)) = 0 Then
AHPY = 0
Else
AHPY = (HoldingReturn / cost) * (CDec(lblBasis.Text) * 100 / (Int(lblTenor.Text) - Int(txtDaysMaturity.Text))) ' (return/Amount Invested)* (DaysBasis/Number of days invested)
End If
AnnualisedHPY.Text = Format(AHPY, "###,###.00")
'End of AHPY Calculations
txtSellTenor.Enabled = False
txtSaleRate.Enabled = False
txtSale.Enabled = False
btnSale.Enabled = True
End Sub
'calculate break even rate for purchase on sell
Private Function BreakEvenRate(ByVal maturityvalue As Decimal, ByVal presentvalue As Decimal, ByVal intdaysB As Integer, ByVal daysTomaturity As Integer, ByVal RateType As String) As Decimal
Dim remainAccrual As Decimal = 0
Dim brkRate As Decimal
Dim x As Decimal
If RateType = "Y" Then
'Formula: FV=PV(1+(Rate*Ttime/DaysBasis*100))
brkRate = ((maturityvalue / presentvalue) - 1) * (intdaysB * 100 / daysTomaturity)
Else
'Formula: PV = FV(1-(Rate*Ttime/DaysBasis*100))
brkRate = (1 - (presentvalue / maturityvalue)) * (intdaysB * 100 / daysTomaturity)
End If
Return Math.Round(brkRate, 9)
End Function
Private Sub YieldMethod()
Dim TotalProfit As Decimal
Dim IntClient As Decimal
Dim TotalInterest As Decimal
Dim AccruedOnSaleAmt As Decimal
'Dim SellPV As Decimal
Dim EffectiveRate As Decimal
Dim intToDate1 As Decimal
Dim interest As Decimal
Dim DaysRun As Integer
Dim MaturityAmnt As Decimal
btnSale.Enabled = False
'Holding period Yield Variables
Dim HoldingReturn As Decimal ' Holding return - Accrued interest Plus the Profit/Loss on the sale
Dim AHPY As Decimal ' Annual Holding Preiod Yield
If txtSellTenor.Text = "" Then
Exit Sub
End If
If txtSaleRate.Text = "" Then
MsgBox("Enter the interest rate", MsgBoxStyle.Critical)
Exit Sub
End If
If txtSale.Text = "" Then
Exit Sub
End If
interest = PresentV * CDec(lblTenor.Text) * CDec(txtIntRate.Text) / (Int(lblBasis.Text) * 100)
lblfv = PresentV + interest
If Int(txtSellTenor.Text) > Int(txtDaysMaturity.Text) Then 'tenor of sale is greater than days to maturity of purchase
MsgBox("Transaction will be backvalued and breakeven rate will change.", MsgBoxStyle.Information, "Sell")
intToDate1 = (PresentV * (CDec(txtIntRate.Text)) * (CDec(lblTenor.Text) - Int(txtSellTenor.Text))) / (Int(lblBasis.Text) * 100)
lblbreakeven.Text = BreakEvenRate(CDec(lblfv.Text), PresentV + intToDate1, Int(lblBasis.Text), Int(txtSellTenor.Text), "Y")
ElseIf Int(txtSellTenor.Text) < Int(txtDaysMaturity.Text) Then 'tenor of sale is less than days to maturity of purchase
intToDate1 = (PresentV * (CDec(txtIntRate.Text)) * (CDec(lblTenor.Text) - Int(txtDaysMaturity.Text))) / (Int(lblBasis.Text) * 100)
lblbreakeven.Text = BreakEvenRate(CDec(lblfv.Text), PresentV + intToDate1, Int(lblBasis.Text), Int(txtSellTenor.Text), "Y")
Else 'tenor of sale is equal to days to maturity of purchase
lblbreakeven.Text = BreakEvenRate(CDec(lblfv.Text), PresentV + intToDate, Int(lblBasis.Text), Int(txtDaysMaturity.Text), "Y")
End If
'Get accrual on sell amount
If Int(txtDaysMaturity.Text) < Int(txtSellTenor.Text) Then
backvalue = Int(txtSellTenor.Text) - Int(txtDaysMaturity.Text)
DaysRun = (CDec(lblTenor.Text) - Int(txtSellTenor.Text))
'AccruedOnSaleAmt = (CDec(txtSale.Text) * (CDec(txtIntRate.Text)) * (CDec(lblTenor.Text) - Int(txtSellTenor.Text))) / (Int(lblBasis.Text) * 100)
DaysRun = (CDec(lblTenor.Text) - Int(txtSellTenor.Text))
Else
'AccruedOnSaleAmt = (CDec(txtSale.Text) * (CDec(txtIntRate.Text)) * (CDec(lblTenor.Text) - Int(txtDaysMaturity.Text))) / (Int(lblBasis.Text) * 100)
DaysRun = (CDec(lblTenor.Text) - Int(txtDaysMaturity.Text))
backvalue = 0
End If
txtSellPV.Text = CDec(txtSale.Text)
cost = CDec(txtSellPV.Text) / (1 + ((DaysRun * CDec(txtIntRate.Text)) / (Int(lblBasis.Text) * 100)))
AccruedOnSaleAmt = CDec(txtSellPV.Text) - cost
'Calculate total interest to be accrued from inception to maturity
TotalInterest = cost * Int(lblTenor.Text) * CDec(txtIntRate.Text) / (Int(lblBasis.Text) * 100)
'Client interest
IntClient = CDec(txtSellPV.Text) * CDec(txtSaleRate.Text * Int(txtSellTenor.Text)) / (Int(lblBasis.Text) * 100)
'Capital gain
TotalProfit = TotalInterest - IntClient - AccruedOnSaleAmt
'Calculate the effective rate for the client
'lblEffectiveRate.Text = Math.Round((IntClient * Int(lblBasis.Text) * 100) / (CDec(txtSellPV.Text) * Int(txtSellTenor.Text)), 9)
'Calculate client maturity amount
MaturityAmnt = CDec(txtSale.Text) + IntClient
'**************************************************************************************
''Calculate own profit
'TotalProfit = TotalInterest - IntClient
If TotalProfit < 0 Then
lblprofit.Text = "Capital Loss"
Else
lblprofit.Text = "Capital gain"
End If
txtProfit.Text = Format(TotalProfit, "###,###,###.00")
txtProfit.ForeColor = Color.BlueViolet
'Label11.Text = Format(CDec(txtSellPV.Text), "###,###,###.00")
lblCost.Text = Format(cost, "###,###,###.00")
lblCost.ForeColor = Color.Red
'Compute the holding period Yield
HoldingReturn = ((Int(lblTenor.Text) - Int(txtDaysMaturity.Text)) * (CDec(txtIntRate.Text) * CDec(txtSale.Text) / 100) / CDec(lblBasis.Text)) + TotalProfit
If (Int(lblTenor.Text) - Int(txtDaysMaturity.Text)) = 0 Then
AHPY = 0
Else
AHPY = (HoldingReturn / cost) * (CDec(lblBasis.Text) * 100 / (Int(lblTenor.Text) - Int(txtDaysMaturity.Text))) ' (return/Amount Invested)* (DaysBasis/Number of days invested)
End If
AnnualisedHPY.Text = Format(AHPY, "###,###.00")
'End of AHPY Calculations
txtSellTenor.Enabled = False
txtSaleRate.Enabled = False
txtSale.Enabled = False
btnSale.Enabled = True
End Sub
Protected Sub btnSale_Click(sender As Object, e As EventArgs) Handles btnSale.Click
On Error Resume Next
'Call this routing to re-validate amount available for sell
checkAmtAvailable()
Dim SellingAmt As Decimal
Dim amount As Decimal
If Trim(lblSellingOPT.Text) = "" Then
MsgBox("Select Selling option.", MsgBoxStyle.Information, "Sell Option")
lblSellingOPT.Focus()
Exit Sub
End If
If Trim(lblSellingOPT.Text).Equals("Cost") Then
SellingAmt = CDec(txtAvalableForSale.Text)
Else
SellingAmt = CDec(lblAvalableForSalePV.Text)
End If
If Trim(rate.Text) = "Interest Rate" Then
amount = CDec(lblCost.Text)
Else
amount = CDec(txtSale.Text)
End If
If Trim(txtSaleRate.Text) = "" Then
MsgBox("Enter the interest rate.", MsgBoxStyle.Critical, "Sale")
Exit Sub
End If
If txtSale.Text = "" Then
MsgBox("Enter Sale amount.", MsgBoxStyle.Critical, "Sale")
Exit Sub
End If
'check if amount is not greater than what is available to sale
If SellingAmt - amount < 0 Then
MsgBox("Sale amount is greater than what is available.", MsgBoxStyle.Critical, "Sale")
Exit Sub
End If
If CDec(txtSale.Text) = 0 Then
MsgBox("Sale amount cannot be zero.", MsgBoxStyle.Critical, "Inconsistent operation")
Exit Sub
End If
'If DealPortfolio = "D" Then
' DiscSale.Checked = True
'Else
' YieldSale.Checked = True
'End If
''Get the TB ID
securityRef = Trim(cmbTB.SelectedValue.ToString)
dealRef = getRef(Trim(cmbTB.SelectedValue.ToString))
SellingOption = "Security Sale - Single"
Call saleDetails()
Response.Redirect("SecuritySell.aspx")
End Sub
Private Sub saleDetails()
Session("salestartD") = lblPurchaseStart.Text
Session("saleMaturityD") = txtmaturity.Text
Session("saleFutureValue") = txtSale.Text
Session("saleTenor") = txtSellTenor.Text
Session("saleDiscount") = txtSaleRate.Text
Session("saleTB") = lbltb.Text
Session("saleDealRef") = Trim(getRef(cmbTB.SelectedValue.ToString))
Session("saleOPT") = selloptionValue.Text
Session("DaysBasis") = lblBasis.Text
Session("currencySAle") = lblCurrency.Text
Session("commrate") = commrate
Session(" lblbreakeven") = lblbreakeven.Text
Session("Gain") = txtProfit.Text
Session("Cost") = lblCost.Text
Session("PV") = CDec(txtSellPV.Text)
Session("Single") = "Single"
End Sub
End Class |
'-------------------------------------------------------------------------------------------'
' Inicio del codigo
'-------------------------------------------------------------------------------------------'
' Importando librerias
'-------------------------------------------------------------------------------------------'
Imports System.Data
'-------------------------------------------------------------------------------------------'
' Inicio de clase "rCRetencion_ISLRProveedores_TUR"
'-------------------------------------------------------------------------------------------'
Partial Class rCRetencion_ISLRProveedores_TUR
Inherits vis2formularios.frmReporte
Dim loObjetoReporte As CrystalDecisions.CrystalReports.Engine.ReportDocument
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
Dim lcParametro0Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(0), goServicios.enuOpcionesRedondeo.KN_FechaInicioDelDia)
Dim lcParametro0Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(0), goServicios.enuOpcionesRedondeo.KN_FechaFinDelDia)
Dim lcParametro1Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(1), goServicios.enuOpcionesRedondeo.KN_FechaInicioDelDia)
Dim lcParametro1Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(1), goServicios.enuOpcionesRedondeo.KN_FechaFinDelDia)
Dim lcParametro2Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(2), goServicios.enuOpcionesRedondeo.KN_FechaInicioDelDia)
Dim lcParametro2Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(2), goServicios.enuOpcionesRedondeo.KN_FechaFinDelDia)
Dim lcParametro3Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(3), goServicios.enuOpcionesRedondeo.KN_FechaInicioDelDia)
Dim lcParametro3Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(3), goServicios.enuOpcionesRedondeo.KN_FechaFinDelDia)
Dim lcOrdenamiento As String = cusAplicacion.goReportes.pcOrden
Dim loConsulta As New StringBuilder()
loConsulta.AppendLine("SELECT Cuentas_Pagar.Tip_Ori AS Tipo_Origen,")
loConsulta.AppendLine(" Cuentas_Pagar.Fec_Ini AS Fecha_Retencion,")
loConsulta.AppendLine(" Cuentas_Pagar.Doc_Ori AS Numero_Pago,")
loConsulta.AppendLine(" Facturas_Retenidas.Factura AS Numero_Factura,")
loConsulta.AppendLine(" Facturas_Retenidas.Control AS Control_Factura,")
loConsulta.AppendLine(" Retenciones_Documentos.Cod_Tip AS Tipo_Documento,")
loConsulta.AppendLine(" Retenciones_Documentos.Doc_Ori AS Numero_Documento,")
loConsulta.AppendLine(" Renglones_Pagos.Mon_Net AS Monto_Documento,")
loConsulta.AppendLine(" Renglones_Pagos.Mon_Abo AS Monto_Abonado,")
loConsulta.AppendLine(" Retenciones_Documentos.Mon_Bas AS Base_Retencion,")
loConsulta.AppendLine(" Retenciones_Documentos.Por_Ret AS Porcentaje_Retenido,")
loConsulta.AppendLine(" Retenciones_Documentos.Mon_Sus AS Sustraendo_Retenido,")
loConsulta.AppendLine(" RTRIM(Retenciones.Cod_Ret) + ': ' + Retenciones.Nom_Ret AS Concepto,")
loConsulta.AppendLine(" Retenciones_Documentos.Mon_Ret AS Monto_Retenido,")
loConsulta.AppendLine(" Cuentas_Pagar.Cod_Pro AS Cod_Pro,")
loConsulta.AppendLine(" Proveedores.Nom_Pro AS Nom_Pro,")
loConsulta.AppendLine(" Proveedores.Rif AS Rif,")
loConsulta.AppendLine(" Proveedores.Nit AS Nit,")
loConsulta.AppendLine(" Proveedores.Dir_Fis AS Direccion")
loConsulta.AppendLine("FROM Cuentas_Pagar")
loConsulta.AppendLine(" JOIN Pagos ON Pagos.documento = Cuentas_Pagar.Doc_Ori")
loConsulta.AppendLine(" JOIN Retenciones_Documentos ON Retenciones_Documentos.Documento = Pagos.documento")
loConsulta.AppendLine(" AND Retenciones_Documentos.doc_des = Cuentas_Pagar.documento")
loConsulta.AppendLine(" AND Retenciones_Documentos.clase = 'ISLR'")
loConsulta.AppendLine(" JOIN Renglones_Pagos ON Renglones_Pagos.Documento = Pagos.documento")
loConsulta.AppendLine(" AND Renglones_Pagos.Doc_Ori = Retenciones_Documentos.Doc_Ori")
loConsulta.AppendLine(" JOIN Cuentas_Pagar Facturas_Retenidas")
loConsulta.AppendLine(" ON Facturas_Retenidas.Documento = Retenciones_Documentos.Doc_Ori")
loConsulta.AppendLine(" AND Facturas_Retenidas.Cod_Tip = Retenciones_Documentos.Cod_Tip")
loConsulta.AppendLine(" JOIN Proveedores ON Proveedores.Cod_Pro = Cuentas_Pagar.Cod_Pro")
loConsulta.AppendLine(" LEFT JOIN Retenciones ON Retenciones.Cod_Ret = Retenciones_Documentos.Cod_Ret")
loConsulta.AppendLine("WHERE Cuentas_Pagar.Cod_Tip = 'ISLR'")
loConsulta.AppendLine(" AND Cuentas_Pagar.Status <> 'Anulado'")
loConsulta.AppendLine(" AND Cuentas_Pagar.Tip_Ori = 'Pagos'")
loConsulta.AppendLine(" AND Cuentas_Pagar.Fec_Ini BETWEEN " & lcParametro0Desde)
loConsulta.AppendLine(" AND " & lcParametro0Hasta)
loConsulta.AppendLine(" AND Cuentas_Pagar.Cod_Pro BETWEEN " & lcParametro1Desde)
loConsulta.AppendLine(" AND " & lcParametro1Hasta)
loConsulta.AppendLine(" AND Pagos.Cod_Mon BETWEEN " & lcParametro2Desde)
loConsulta.AppendLine(" AND " & lcParametro2Hasta)
loConsulta.AppendLine(" AND Pagos.Cod_Suc BETWEEN " & lcParametro3Desde)
loConsulta.AppendLine(" AND " & lcParametro3Hasta)
loConsulta.AppendLine("UNION ALL ")
loConsulta.AppendLine("SELECT Retenciones_Documentos.Tip_Ori AS Tipo_Origen,")
loConsulta.AppendLine(" Ordenes_Pagos.Fec_Ini AS Fecha_Retencion,")
loConsulta.AppendLine(" '' AS Numero_Pago,")
loConsulta.AppendLine(" Ordenes_Pagos.Factura AS Numero_Factura,")
loConsulta.AppendLine(" Ordenes_Pagos.Control AS Control_Factura,")
loConsulta.AppendLine(" 'ORD/PAG' AS Tipo_Documento,")
loConsulta.AppendLine(" Ordenes_Pagos.Documento AS Numero_Documento,")
loConsulta.AppendLine(" Ordenes_Pagos.Mon_Net AS Monto_Documento,")
loConsulta.AppendLine(" Ordenes_Pagos.Mon_Net AS Monto_Abonado,")
loConsulta.AppendLine(" Retenciones_Documentos.Mon_Bas AS Base_Retencion,")
loConsulta.AppendLine(" Retenciones_Documentos.Por_Ret AS Porcentaje_Retenido,")
loConsulta.AppendLine(" Retenciones_Documentos.Mon_Sus AS Sustraendo_Retenido,")
loConsulta.AppendLine(" RTRIM(Retenciones.Cod_Ret) + ': ' + Retenciones.Nom_Ret AS Concepto,")
loConsulta.AppendLine(" Retenciones_Documentos.Mon_Ret AS Monto_Retenido,")
loConsulta.AppendLine(" Ordenes_Pagos.Cod_Pro AS Cod_Pro,")
loConsulta.AppendLine(" Proveedores.Nom_Pro AS Nom_Pro,")
loConsulta.AppendLine(" Proveedores.Rif AS Rif,")
loConsulta.AppendLine(" Proveedores.Nit AS Nit,")
loConsulta.AppendLine(" Proveedores.Dir_Fis AS Direccion")
loConsulta.AppendLine("FROM Retenciones_Documentos")
loConsulta.AppendLine(" JOIN Ordenes_Pagos ON Ordenes_Pagos.Documento = Retenciones_Documentos.documento")
loConsulta.AppendLine(" JOIN Proveedores ON Proveedores.Cod_Pro = Ordenes_Pagos.Cod_Pro")
loConsulta.AppendLine(" LEFT JOIN Retenciones ON Retenciones.Cod_Ret = Retenciones_Documentos.Cod_Ret")
loConsulta.AppendLine("WHERE Ordenes_Pagos.Status = 'Confirmado'")
loConsulta.AppendLine(" AND Retenciones_Documentos.Tip_Ori = 'Ordenes_Pagos'")
loConsulta.AppendLine(" AND Retenciones_Documentos.clase = 'ISLR'")
loConsulta.AppendLine(" AND Ordenes_Pagos.Fec_Ini BETWEEN " & lcParametro0Desde)
loConsulta.AppendLine(" AND " & lcParametro0Hasta)
loConsulta.AppendLine(" AND Ordenes_Pagos.Cod_Pro BETWEEN " & lcParametro1Desde)
loConsulta.AppendLine(" AND " & lcParametro1Hasta)
loConsulta.AppendLine(" AND Ordenes_Pagos.Cod_Mon BETWEEN " & lcParametro2Desde)
loConsulta.AppendLine(" AND " & lcParametro2Hasta)
loConsulta.AppendLine(" AND Ordenes_Pagos.Cod_Suc BETWEEN " & lcParametro3Desde)
loConsulta.AppendLine(" AND " & lcParametro3Hasta)
loConsulta.AppendLine("UNION ALL ")
loConsulta.AppendLine("SELECT Cuentas_Pagar.Tip_Ori AS Tipo_Origen,")
loConsulta.AppendLine(" Cuentas_Pagar.Fec_Ini AS Fecha_Retencion,")
loConsulta.AppendLine(" '' AS Numero_Pago,")
loConsulta.AppendLine(" Documentos.Factura AS Numero_Factura,")
loConsulta.AppendLine(" Documentos.Control AS Control_Factura,")
loConsulta.AppendLine(" Retenciones_Documentos.Cod_Tip AS Tipo_Documento,")
loConsulta.AppendLine(" Retenciones_Documentos.Doc_Ori AS Numero_Documento,")
loConsulta.AppendLine(" Documentos.Mon_Net AS Monto_Documento,")
loConsulta.AppendLine(" Documentos.Mon_Net AS Monto_Abonado,")
loConsulta.AppendLine(" Retenciones_Documentos.Mon_Bas AS Base_Retencion,")
loConsulta.AppendLine(" Retenciones_Documentos.Por_Ret AS Porcentaje_Retenido,")
loConsulta.AppendLine(" Retenciones_Documentos.Mon_Sus AS Sustraendo_Retenido,")
loConsulta.AppendLine(" RTRIM(Retenciones.Cod_Ret) + ': ' + Retenciones.Nom_Ret AS Concepto,")
loConsulta.AppendLine(" Retenciones_Documentos.Mon_Ret AS Monto_Retenido,")
loConsulta.AppendLine(" Cuentas_Pagar.Cod_Pro AS Cod_Pro,")
loConsulta.AppendLine(" Proveedores.Nom_Pro AS Nom_Pro,")
loConsulta.AppendLine(" Proveedores.Rif AS Rif,")
loConsulta.AppendLine(" Proveedores.Nit AS Nit,")
loConsulta.AppendLine(" Proveedores.Dir_Fis AS Direccion")
loConsulta.AppendLine("FROM Cuentas_Pagar")
loConsulta.AppendLine(" JOIN Cuentas_Pagar AS Documentos ON Documentos.documento = Cuentas_Pagar.Doc_Ori")
loConsulta.AppendLine(" AND Documentos.Cod_Tip = Cuentas_Pagar.Cla_Ori")
loConsulta.AppendLine(" JOIN Retenciones_Documentos ON Retenciones_Documentos.Doc_Des = Cuentas_Pagar.Documento")
loConsulta.AppendLine(" AND Retenciones_Documentos.Doc_Ori = Cuentas_Pagar.Doc_Ori")
loConsulta.AppendLine(" JOIN Proveedores ON Proveedores.Cod_Pro = Cuentas_Pagar.Cod_Pro")
loConsulta.AppendLine(" LEFT JOIN Retenciones ON Retenciones.Cod_Ret = Retenciones_Documentos.Cod_Ret")
loConsulta.AppendLine("WHERE Cuentas_Pagar.Cod_Tip = 'ISLR'")
loConsulta.AppendLine(" AND Cuentas_Pagar.Status <> 'Anulado'")
loConsulta.AppendLine(" AND Cuentas_Pagar.Tip_Ori = 'cuentas_pagar'")
loConsulta.AppendLine(" AND Cuentas_Pagar.Fec_Ini BETWEEN " & lcParametro0Desde)
loConsulta.AppendLine(" AND " & lcParametro0Hasta)
loConsulta.AppendLine(" AND Cuentas_Pagar.Cod_Pro BETWEEN " & lcParametro1Desde)
loConsulta.AppendLine(" AND " & lcParametro1Hasta)
loConsulta.AppendLine(" AND Cuentas_Pagar.Cod_Mon BETWEEN " & lcParametro2Desde)
loConsulta.AppendLine(" AND " & lcParametro2Hasta)
loConsulta.AppendLine(" AND Cuentas_Pagar.Cod_Suc BETWEEN " & lcParametro3Desde)
loConsulta.AppendLine(" AND " & lcParametro3Hasta)
loConsulta.AppendLine("ORDER BY " & lcOrdenamiento)
'Me.mEscribirConsulta(loComandoSeleccionar.ToString())
Dim loServicios As New cusDatos.goDatos
Dim laDatosReporte As DataSet = loServicios.mObtenerTodosSinEsquema(loConsulta.ToString(), "curReportes")
'-------------------------------------------------------------------------------------------------------
' Verificando si el select (tabla nº 0) trae registros
'-------------------------------------------------------------------------------------------------------
If (laDatosReporte.Tables(0).Rows.Count <= 0) Then
Me.WbcAdministradorMensajeModal.mMostrarMensajeModal("Información", _
"No se Encontraron Registros para los Parámetros Especificados. ", _
vis3Controles.wbcAdministradorMensajeModal.enumTipoMensaje.KN_Informacion, _
"350px", _
"200px")
End If
'--------------------------------------------------'
' Carga la imagen del logo en curReportes '
'--------------------------------------------------'
Me.mCargarLogoEmpresa(laDatosReporte.Tables(0), "LogoEmpresa")
loObjetoReporte = cusAplicacion.goReportes.mCargarReporte("rCRetencion_ISLRProveedores_TUR", laDatosReporte)
Me.mTraducirReporte(loObjetoReporte)
Me.mFormatearCamposReporte(loObjetoReporte)
Me.crvrCRetencion_ISLRProveedores_TUR.ReportSource = loObjetoReporte
Catch loExcepcion As Exception
Me.WbcAdministradorMensajeModal.mMostrarMensajeModal("Error", _
"No se pudo Completar el Proceso: " & loExcepcion.Message, _
vis3Controles.wbcAdministradorMensajeModal.enumTipoMensaje.KN_Error, _
"auto", _
"auto")
End Try
End Sub
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
Try
loObjetoReporte.Close()
Catch loExcepcion As Exception
End Try
End Sub
End Class
'-------------------------------------------------------------------------------------------'
' Fin del codigo '
'-------------------------------------------------------------------------------------------'
' CMS: 21/05/09: Codigo inicial '
'-------------------------------------------------------------------------------------------'
' CMS: 28/07/09: Se modificó la consulta de modo que se obtuvieron por separado los '
' proveedores y los beneficiarios y luego se unieron los resultados. '
' Verificacion de registros. '
' Metodo de Ordenamiento '
'-------------------------------------------------------------------------------------------'
' CMS: 29/07/09: Se Renonbre de Relación Global de ISLR Relativo a Relación Global de ISLR '
' Retenido '
'-------------------------------------------------------------------------------------------'
' RJG: 20/03/10: Agregado el filtro para que distinga retenciones de IVA de las de ISLR. '
'-------------------------------------------------------------------------------------------'
' JJD: 27/11/13: Se le agrego el Logo de la empresa '
'-------------------------------------------------------------------------------------------'
' RJG: 27/02/15: Se le agrego El número de Factura (o documento) y controldel doc retenido. '
'-------------------------------------------------------------------------------------------'
|
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("Hilbert Curve")>
<Assembly: AssemblyDescription("Hilbert Curve")>
<Assembly: AssemblyCompany("xFX JumpStart")>
<Assembly: AssemblyProduct("Hilbert Curve")>
<Assembly: AssemblyCopyright("Copyright © 2016")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("4fea2be5-776b-497e-9975-8e1084bea531")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("2017.10.9.17")>
<Assembly: AssemblyFileVersion("2017.10.9.17")>
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.CodeRefactorings.MoveType
Partial Public Class MoveTypeTests
Inherits BasicMoveTypeTestsBase
<WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsMoveType)>
Public Async Function TestMissing_OnMatchingFileName() As Task
Dim code =
"
[||]Class test1
End Class
"
Await TestMissingInRegularAndScriptAsync(code)
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsMoveType)>
Public Async Function TestMissing_Nested_OnMatchingFileName_Simple() As Task
Dim code =
"
Class Outer
[||]Class test1
End Class
End Class
"
Await TestMissingInRegularAndScriptAsync(code)
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsMoveType)>
Public Async Function MultipleTypesInFileWithNoContainerNamespace() As Task
Dim code =
"
[||]Class Class1
End Class
Class Class2
End Class
"
Dim codeAfterMove =
"
Class Class2
End Class
"
Dim expectedDocumentName = "Class1.vb"
Dim destinationDocumentText =
"Class Class1
End Class
"
Await TestMoveTypeToNewFileAsync(code, codeAfterMove, expectedDocumentName, destinationDocumentText)
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsMoveType)>
Public Async Function MoveNestedTypeToNewFile_Simple() As Task
Dim code =
"
Public Class Class1
Class Class2[||]
End Class
End Class
"
Dim codeAfterMove =
"
Public Partial Class Class1
End Class
"
Dim expectedDocumentName = "Class2.vb"
Dim destinationDocumentText =
"
Public Partial Class Class1
Class Class2
End Class
End Class
"
Await TestMoveTypeToNewFileAsync(code, codeAfterMove, expectedDocumentName, destinationDocumentText)
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsMoveType)>
Public Async Function MoveNestedTypeToNewFile_Simple_DottedName() As Task
Dim code =
"
Public Class Class1
Class Class2[||]
End Class
End Class
"
Dim codeAfterMove =
"
Public Partial Class Class1
End Class
"
Dim expectedDocumentName = "Class1.Class2.vb"
Dim destinationDocumentText =
"
Public Partial Class Class1
Class Class2
End Class
End Class
"
Await TestMoveTypeToNewFileAsync(code, codeAfterMove, expectedDocumentName, destinationDocumentText, index:=1)
End Function
<WorkItem(14484, "https://github.com/dotnet/roslyn/issues/14484")>
<WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsMoveType)>
Public Async Function MoveNestedTypeToNewFile_RemoveComments() As Task
Dim code =
"
''' Outer comment
Public Class Class1
''' Inner comment
Class Class2[||]
End Class
End Class
"
Dim codeAfterMove =
"
''' Outer comment
Public Partial Class Class1
End Class
"
Dim expectedDocumentName = "Class1.Class2.vb"
Dim destinationDocumentText =
"
Public Partial Class Class1
''' Inner comment
Class Class2
End Class
End Class
"
Await TestMoveTypeToNewFileAsync(
code, codeAfterMove, expectedDocumentName, destinationDocumentText,
index:=1)
End Function
<WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsMoveType)>
Public Async Function TestImports() As Task
Dim code =
"
' Used only by inner
Imports System
' Not used
Imports System.Collections
Class Outer
[||]Class Inner
Sub M(d as DateTime)
End Sub
End Class
End Class
"
Dim codeAfterMove =
"
' Used only by inner
' Not used
Imports System.Collections
Partial Class Outer
End Class
"
Dim expectedDocumentName = "Inner.vb"
Dim destinationDocumentText =
"
' Used only by inner
Imports System
' Not used
Partial Class Outer
Class Inner
Sub M(d as DateTime)
End Sub
End Class
End Class
"
Await TestMoveTypeToNewFileAsync(code, codeAfterMove, expectedDocumentName, destinationDocumentText)
End Function
<WorkItem(16282, "https://github.com/dotnet/roslyn/issues/16282")>
<WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsMoveType)>
Public Async Function TestTypeInheritance() As Task
Dim code =
"
Class Outer
Inherits Something
Implements ISomething
[||]Class Inner
Inherits Other
Implements IOther
Sub M(d as DateTime)
End Sub
End Class
End Class
"
Dim codeAfterMove =
"
Partial Class Outer
Inherits Something
Implements ISomething
End Class
"
Dim expectedDocumentName = "Inner.vb"
Dim destinationDocumentText =
"
Partial Class Outer
Class Inner
Inherits Other
Implements IOther
Sub M(d as DateTime)
End Sub
End Class
End Class
"
Await TestMoveTypeToNewFileAsync(code, codeAfterMove, expectedDocumentName, destinationDocumentText)
End Function
<WorkItem(21456, "https://github.com/dotnet/roslyn/issues/21456")>
<WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsMoveType)>
Public Async Function TestLeadingBlankLines1() As Task
Dim code =
"' Banner Text
imports System
[||]class Class1
sub Foo()
Console.WriteLine()
end sub
end class
class Class2
sub Foo()
Console.WriteLine()
end sub
end class
"
Dim codeAfterMove = "' Banner Text
imports System
class Class2
sub Foo()
Console.WriteLine()
end sub
end class
"
Dim expectedDocumentName = "Class1.vb"
Dim destinationDocumentText = "' Banner Text
imports System
class Class1
sub Foo()
Console.WriteLine()
end sub
end class
"
Await TestMoveTypeToNewFileAsync(
code, codeAfterMove, expectedDocumentName, destinationDocumentText)
End Function
<WorkItem(21456, "https://github.com/dotnet/roslyn/issues/21456")>
<WpfFact, Trait(Traits.Feature, Traits.Features.CodeActionsMoveType)>
Public Async Function TestLeadingBlankLines2() As Task
Dim code =
"' Banner Text
imports System
class Class1
sub Foo()
Console.WriteLine()
end sub
end class
[||]class Class2
sub Foo()
Console.WriteLine()
end sub
end class
"
Dim codeAfterMove = "' Banner Text
imports System
class Class1
sub Foo()
Console.WriteLine()
end sub
end class
"
Dim expectedDocumentName = "Class2.vb"
Dim destinationDocumentText = "' Banner Text
imports System
class Class2
sub Foo()
Console.WriteLine()
end sub
end class
"
Await TestMoveTypeToNewFileAsync(
code, codeAfterMove, expectedDocumentName, destinationDocumentText)
End Function
End Class
End Namespace
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Othello.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set(ByVal value As Global.System.Globalization.CultureInfo)
resourceCulture = value
End Set
End Property
End Module
End Namespace
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings), MySettings)
#Region "My.Settings Auto-Save Functionality"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.Rectangles_6._2Part2_.My.MySettings
Get
Return Global.Rectangles_6._2Part2_.My.MySettings.Default
End Get
End Property
End Module
End Namespace
|
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Imports Microsoft.CodeAnalysis.Classification
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Workspaces
Imports Microsoft.CodeAnalysis.Text
Namespace Microsoft.CodeAnalysis.Editor.UnitTests.Classification
<UseExportProvider>
Public Class SyntacticChangeRangeComputerTests
Private Shared Function TestCSharp(markup As String, newText As String) As Task
Return Test(markup, newText, LanguageNames.CSharp)
End Function
Private Shared Async Function Test(markup As String, newText As String, language As String) As Task
Using workspace = TestWorkspace.Create(language, compilationOptions:=Nothing, parseOptions:=Nothing, markup)
Dim testDocument = workspace.Documents(0)
Dim startingDocument = workspace.CurrentSolution.GetDocument(testDocument.Id)
Dim spans = testDocument.SelectedSpans
Assert.True(1 = spans.Count, "Test should have one spans in it representing the span to replace")
Dim annotatedSpans = testDocument.AnnotatedSpans
Assert.True(1 = annotatedSpans.Count, "Test should have a single {||} span representing the change span in the final document")
Dim annotatedSpan = annotatedSpans.Single().Value.Single()
Dim startingText = Await startingDocument.GetTextAsync()
Dim startingTree = Await startingDocument.GetSyntaxTreeAsync()
Dim startingRoot = Await startingTree.GetRootAsync()
Dim endingText = startingText.Replace(spans(0), newText)
Dim endingTree = startingTree.WithChangedText(endingText)
Dim endingRoot = Await endingTree.GetRootAsync()
Dim actualChange = SyntacticChangeRangeComputer.ComputeSyntacticChangeRange(startingRoot, endingRoot, TimeSpan.MaxValue, Nothing)
Dim expectedChange = New TextChangeRange(
annotatedSpan,
annotatedSpan.Length + newText.Length - spans(0).Length)
Assert.True(expectedChange = actualChange, expectedChange.ToString() & " != " & actualChange.ToString() & vbCrLf & "Changed span was" & vbCrLf & startingText.ToString(actualChange.Span))
End Using
End Function
<Fact>
Public Async Function TestIdentifierChangeInMethod1() As Task
Await TestCSharp(
"
using X;
public class C
{
void M1()
{
}
void M2()
{
{|changed: Con[||]|}.WriteLine(0);
}
void M3()
{
}
}
", "sole")
End Function
<Fact>
Public Async Function TestIdentifierChangeInMethod2() As Task
Await TestCSharp(
"
using X;
public class C
{
void M1()
{
}
void M2()
{
{|changed: Con[|sole|]|}.WriteLine(0);
}
void M3()
{
}
}
", "")
End Function
<Fact>
Public Async Function TestSplitClass1() As Task
Await TestCSharp(
"
using X;
public class C
{
void M1()
{
}
{|changed:
[||]
void |}M2()
{
Console.WriteLine(0);
}
void M3()
{
}
}
", "} class C2 {")
End Function
<Fact>
Public Async Function TestMergeClass() As Task
Await TestCSharp(
"
using X;
public class C
{
void M1()
{
}
{|changed:
[|} class C2 {|]
void |}M2()
{
Console.WriteLine(0);
}
void M3()
{
}
}
", "")
End Function
<Fact>
Public Async Function TestExtendComment() As Task
Await TestCSharp(
"
using X;
public class C
{
void M1()
{
}
void M2()
{
{|changed: [||]
}
void M3()
{
Console.WriteLine(""*/ Console.WriteLine("")
|} }
void M4()
{
}
}
", "/*")
End Function
<Fact>
Public Async Function TestRemoveComment() As Task
Await TestCSharp(
"
using X;
public class C
{
void M1()
{
}
void M2()
{
{|changed: [|/*|]
}
void M3()
{
Console.WriteLine(""*/ Console.WriteLine("")
|} }
void M4()
{
}
}
", "")
End Function
<Fact>
Public Async Function TestExtendCommentToEndOfFile() As Task
Await TestCSharp(
"
using X;
public class C
{
void M1()
{
}
void M2()
{
{|changed: [||]
}
void M3()
{
}
void M4()
{
}
}
|}", "/*")
End Function
<Fact>
Public Async Function TestDeleteFullFile() As Task
Await TestCSharp(
"{|changed:[|
using X;
public class C
{
void M1()
{
}
void M2()
{
}
void M3()
{
}
void M4()
{
}
}
|]|}", "")
End Function
<Fact>
Public Async Function InsertFullFile() As Task
Await TestCSharp(
"{|changed:[||]|}", "
using X;
public class C
{
void M1()
{
}
void M2()
{
}
void M3()
{
}
void M4()
{
}
}
")
End Function
<Fact>
Public Async Function TestInsertDuplicateLineBelow() As Task
Await TestCSharp(
"
using X;
public class C
{
void M1()
{
}
void M2()
{
throw new NotImplementedException();[||]
{|changed:|} }
void M3()
{
}
}
", "
throw new NotImplementedException();")
End Function
<Fact>
Public Async Function TestInsertDuplicateLineAbove() As Task
Await TestCSharp(
"
using X;
public class C
{
void M1()
{
}
void M2()
{[||]
throw new NotImplementedException();
{|changed:|} }
void M3()
{
}
}
", "
throw new NotImplementedException();")
End Function
<Fact>
Public Async Function TestDeleteDuplicateLineBelow() As Task
Await TestCSharp(
"
using X;
public class C
{
void M1()
{
}
void M2()
{
throw new NotImplementedException();
{|changed: [|throw new NotImplementedException();|]
}
|}
void M3()
{
}
}
", "")
End Function
<Fact>
Public Async Function TestDeleteDuplicateLineAbove() As Task
Await TestCSharp(
"
using X;
public class C
{
void M1()
{
}
void M2()
{
{|changed: [|throw new NotImplementedException();|]
throw |}new NotImplementedException();
}
void M3()
{
}
}
", "")
End Function
End Class
End Namespace
|
Public Class update_buyer
Dim con As New ADODB.Connection
Dim cmd As New ADODB.Recordset
Private Sub update_buyer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
con.Open("dsn=bkl")
cmd.Open("select * from buyerinfo ", con, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic)
While Not cmd.EOF
ComboBox3.Items.Add(cmd.Fields("buyer_name").Value)
cmd.MoveNext()
End While
cmd.Close()
End Sub
Private Sub ComboBox3_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ComboBox3.SelectedIndexChanged
cmd.Open("select * from buyerinfo where buyer_name = '" & ComboBox3.Text & "' ", con, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic)
While Not cmd.EOF
TextBox3.Text = cmd.Fields("address").Value
ComboBox2.Text = cmd.Fields("state").Value
ComboBox1.Text = cmd.Fields("city").Value
TextBox5.Text = cmd.Fields("gst_number").Value
'TextBox2.Text = cmd.Fields("tin_number").Value
TextBox6.Text = cmd.Fields("pan").Value
TextBox4.Text = cmd.Fields("dis").Value
TextBox2.Text = cmd.Fields("contact_number").Value
cmd.MoveNext()
End While
cmd.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
cmd.Open("select * from buyerinfo where buyer_name = '" & ComboBox3.Text & "' ", con, ADODB.CursorTypeEnum.adOpenDynamic, ADODB.LockTypeEnum.adLockOptimistic)
While Not cmd.EOF
cmd.Fields("buyer_name").Value = ComboBox3.Text
cmd.Fields("address").Value = TextBox3.Text
cmd.Fields("state").Value = ComboBox2.Text
cmd.Fields("city").Value = ComboBox1.Text
cmd.Fields("gst_number").Value = TextBox5.Text
'TextBox2.Text = cmd.Fields("tin_number").Value
cmd.Fields("pan").Value = TextBox6.Text
cmd.Fields("dis").Value = TextBox4.Text
cmd.Fields("contact_number").Value = TextBox2.Text
cmd.MoveNext()
End While
cmd.Close()
MsgBox("Updated Succesfully")
TextBox3.Text = ""
ComboBox2.Text = ""
ComboBox1.Text = ""
ComboBox3.Text = ""
TextBox5.Text = ""
TextBox6.Text = ""
TextBox4.Text = ""
TextBox2.Text = ""
End Sub
End Class |
Imports System.Data.OleDb
Imports System.Text.RegularExpressions
Public Class RenewForm
Public AuthorList(0) As String
Public PublisherList(0) As String
Public Shared SelectedItem As ListViewItem
Public conn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=lms.mdb; Persist Security Info=False;")
Public Sub New()
InitializeComponent()
'Filling all the data, imcluding combobox list items
lbID2.Text = Form1.memberID
Dim cmd As New OleDbCommand("SELECT * FROM [Loan] INNER JOIN [Book] ON Loan.ISBN = Book.ISBN WHERE Loan.memberID = @id ORDER BY [Loan].[ISBN]", conn)
cmd.Parameters.AddWithValue("@id", Form1.memberID)
Try
conn.Open()
Dim dr As OleDbDataReader = cmd.ExecuteReader
Do While dr.Read()
If dr.Item("returnDate").ToString = String.Empty Then
cbAuthor.Items.Add(dr.Item("authors"))
cbPublisher.Items.Add(dr.Item("publisher"))
cbISBN.Items.Add(dr.Item(5))
cbEdition.Items.Add(dr.Item("edition"))
cbYear.Items.Add(dr.Item("publishYear"))
End If
Loop
conn.Close()
Catch ex As Exception
MsgBox(ex.ToString)
conn.Close()
End Try
End Sub
Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click
If cbISBN.Text.ToString <> "" Then
Dim response = MessageBox.Show("Are you sure you want to exit without return or renew books?", "Confirm exit", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)
If response = DialogResult.Yes Then
Me.Dispose()
End If
Else
Me.Dispose()
End If
End Sub
Private Sub cbISBN_TextChanged(sender As Object, e As EventArgs) Handles cbISBN.TextChanged
ClearItems()
SelectLatestTransaction(cbISBN.Text.ToString)
End Sub
Private Sub btnRenew_Click(sender As Object, e As EventArgs) Handles btnRenew.Click
'Double validates
If cbISBN.Text.ToString <> "" And lbLoanID2.Text.ToString <> "" Then
Dim loanDuration As Double = Regex.Replace(cbDuration.Text, "days|day", "")
Dim newExpiryDate As Date = Now.AddDays(loanDuration)
'Use old expirydate to calculate IsLate or not
Dim cmd As New OleDbCommand("UPDATE Loan SET returnDate=@returnDate WHERE loanID=@loanID", conn)
Dim cmd2 As New OleDbCommand("INSERT INTO [Loan] ([borrowDate],[expiryDate],[memberID],[ISBN]) VALUES (@borrowDate,@newExpiryDate,@memberID,@ISBN);", conn)
cmd.Parameters.AddWithValue("@returnDate", Now.ToShortDateString)
cmd.Parameters.AddWithValue("@loanID", lbLoanID2.Text.ToString)
With cmd2.Parameters
.AddWithValue("@borrowDate", Date.Now().ToShortDateString)
.AddWithValue("@newExpiryDate", newExpiryDate.ToShortDateString)
.AddWithValue("@memberID", lbID2.Text.ToString)
.AddWithValue("@ISBN", cbISBN.Text.ToString)
End With
Try
conn.Open()
cmd.ExecuteNonQuery()
cmd2.ExecuteNonQuery()
conn.Close()
If LateDate() > 0 Then
'Late renew
MessageBox.Show("Book renew successful! Please pay your fine : RM" & LateDate(), "Renew with fine !", MessageBoxButtons.OK, MessageBoxIcon.Stop)
Else
MessageBox.Show("Book renew successfully! Thank you!", "Renew Successful!", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
Me.Dispose()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
ElseIf cbISBN.Text.ToString <> "" And lbLoanID2.Text.ToString = "" Then
MessageBox.Show("Please enter a correct ISBN!", "Invalid ISBN!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Else
'Handle empty tb entered
MessageBox.Show("Please enter the ISBN to proceed!", "Please enter ISBN!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
End Sub
Private Sub btnReturn_Click(sender As Object, e As EventArgs) Handles btnReturn.Click
'Double validates is always better ;)
If cbISBN.Text.ToString <> "" And lbLoanID2.Text.ToString <> "" Then
Dim cmd As New OleDbCommand("UPDATE Loan SET returnDate=@returnDate WHERE loanID = @loanID", conn)
cmd.Parameters.AddWithValue("@returnDate", Date.Now.ToShortDateString)
cmd.Parameters.AddWithValue("@loanID", lbLoanID2.Text.ToString)
conn.Open()
Dim success As Integer = cmd.ExecuteNonQuery()
conn.Close()
If success > 0 And LateDate() > 0 Then
MessageBox.Show("Late return of book! Please pay your fine : RM" & LateDate(), "Return with fine !", MessageBoxButtons.OK, MessageBoxIcon.Stop)
ElseIf success > 0 And LateDate() <= 0 Then
MessageBox.Show("Book return successfully! Thank you!", "Return Successful !", MessageBoxButtons.OK, MessageBoxIcon.Information)
Else
MessageBox.Show("Error Updating Database!", "Update error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End If
Me.Dispose()
ElseIf cbISBN.Text.ToString <> "" And lbLoanID2.Text.ToString = "" Then
MessageBox.Show("Please enter a correct ISBN!", "Invalid ISBN!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Else
MessageBox.Show("Please enter the ISBN to proceed!", "Please enter ISBN!", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
End If
End Sub
Public Function LateDate() As Double
Return DateDiff(DateInterval.Day, Date.Parse(lbExpiryDate2.Text), Date.Now)
End Function
Private Sub cbISBN_KeyPress(sender As Object, e As KeyPressEventArgs) Handles cbISBN.KeyPress
If Char.IsControl(e.KeyChar) Or Char.IsNumber(e.KeyChar) Then
Else
e.Handled = True
End If
End Sub
Public Sub SelectLatestTransaction(ISBN As String)
If ISBN <> "" Then
Dim cmd As New OleDbCommand("SELECT TOP 1 * FROM [Loan] INNER JOIN [Book] ON Loan.ISBN = Book.ISBN WHERE Loan.ISBN = @ISBN AND Loan.memberID = @id ORDER BY [Loan].[loanID] desc", conn)
cmd.Parameters.AddWithValue("@ISBN", ISBN)
cmd.Parameters.AddWithValue("@id", Form1.memberID)
'Select the latest transaction of the book
Try
conn.Close()
conn.Open()
Dim dr As OleDbDataReader = cmd.ExecuteReader
If dr.HasRows = False Then
MessageBox.Show("The book had never been borrowed before! Please refer to a librarian.", "Book never been borrowed!", MessageBoxButtons.OK, MessageBoxIcon.Stop)
ClearItems()
End If
While dr.Read()
'Check if has row and if the book is already return or not
If dr.HasRows And dr.Item("returnDate").ToString = String.Empty Then
lbLoanID2.Text = dr.Item("loanID")
lbBorrowDate2.Text = dr.Item("borrowDate")
lbExpiryDate2.Text = dr.Item("expiryDate")
cbISBN.Text = dr.Item("Loan.ISBN")
cbAuthor.Text = dr.Item("authors")
cbEdition.Text = dr.Item("edition")
cbPublisher.Text = dr.Item("publisher")
cbYear.Text = dr.Item("publishYear")
cbType.Text = dr.Item("type")
cbDuration.Text = dr.Item("loanDuration")
ElseIf dr.Item("returnDate").ToString <> "" Then
MessageBox.Show("The book had never been borrowed before! Please refer to a librarian.", "Book never been borrowed!", MessageBoxButtons.OK, MessageBoxIcon.Stop)
ClearItems()
End If
End While
conn.Close()
Catch ex As Exception
conn.Close()
End Try
End If
End Sub
Sub ClearItems()
lbLoanID2.ResetText()
lbExpiryDate2.ResetText()
lbBorrowDate2.ResetText()
cbAuthor.ResetText()
cbDuration.SelectedIndex = -1
cbEdition.SelectedIndex = -1
cbPublisher.ResetText()
cbType.SelectedIndex = -1
cbYear.SelectedIndex = -1
End Sub
Private Sub cbAuthor_SelectedIndexChanged(sender As Object, e As EventArgs) Handles cbAuthor.SelectedIndexChanged
cbISBN.SelectedIndex = cbAuthor.SelectedIndex
'Once cbISBN is changed , the data will be automatically refreshed
End Sub
Private Sub cbPublisher_SelectionChangeCommitted(sender As Object, e As EventArgs) Handles cbPublisher.SelectedIndexChanged
cbISBN.SelectedIndex = cbPublisher.SelectedIndex
'Once cbISBN is changed , the data will be automatically refreshed
End Sub
End Class |
Imports Entities
Imports Domain
Public Class frmAddHerramienta
Public Sub New(p As EPerson)
' Esta llamada es exigida por el diseñador.
InitializeComponent()
' Agregue cualquier inicialización después de la llamada a InitializeComponent().
Person = p
End Sub
Private mPerson As EPerson
Public Property Person() As EPerson
Get
Return mPerson
End Get
Private Set(ByVal value As EPerson)
mPerson = value
End Set
End Property
Dim com As DTool
Dim unDZ As New DZone
Dim com1 As DPlant
Dim unHE As ETool
Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
unHE.Use = txtUso.Text
unHE.Type = cbxTipo.Text
unHE.ZoneName.ZoneName = cbxZona.Text
unHE.ProductName = txtNombre.Text
com.altaHerramienta(unHE)
End Sub
Private Sub frmAddHerramienta_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim colZonas = unDZ.List
cbxZona.ValueMember = "Zona_nombre"
cbxZona.DisplayMember = "Zona_nombre"
cbxZona.DataSource = colZonas
End Sub
End Class |
Imports Newtonsoft.Json.Linq
Imports pxBook
Imports SMC.Lib
Imports System.Text.RegularExpressions
Imports System.Net.Http
Imports System.Threading
Imports System.Reflection
Imports System.ServiceModel
Public Class Exporter
Public Enum ExporterCommitCommand
Update
Create
End Enum
' Klassenvariablen
Private flsConn As FlsConnection
Private MyConn As ProffixConnection
Private pxHelper As ProffixHelper
Private articleMapper As ArticleMapper
' Actions
Public DoProgress As Action
Public Log As Action(Of String)
' Regex-Pattern für GUID
Private pattern_GUID As Regex = New Regex("^(\{){0,1}[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}(\}){0,1}$", RegexOptions.Compiled)
Private _lastExport As DateTime = Nothing
Public Property LastExport As DateTime
Get
Return _lastExport
End Get
Set(ByVal value As DateTime)
_lastExport = value
End Set
End Property
Private _progress As Integer
Public Property Progress As Integer
Get
Return _progress
End Get
Private Set(ByVal value As Integer)
_progress = value
End Set
End Property
Private _count As Integer
Public Property Count As Integer
Get
Return _count
End Get
Private Set(ByVal value As Integer)
_count = value
End Set
End Property
Public Sub New(ByVal lastExport As DateTime, ByRef serviceClient As FlsConnection, ByRef pxHelper As ProffixHelper, ByRef Myconn As ProffixConnection)
Me.LastExport = lastExport
Me.flsConn = serviceClient
Me.pxHelper = pxHelper
Me.MyConn = Myconn
articleMapper = New ArticleMapper
End Sub
Public Function Export() As Boolean
Dim articleResult As Threading.Tasks.Task(Of JArray)
Dim fehler As String = ""
Dim response_FLS As String = ""
Dim successful As Boolean = True
Dim articleList = New List(Of pxBook.pxKommunikation.pxArtikel)
Dim existsInFLS As Boolean = False
Dim response As String = String.Empty
Dim update_successful As Boolean = True
Dim create_successful As Boolean = True
Try
logComplete("Artikelexport gestartet", LogLevel.Info)
Progress = 0
' **************************************************************alle FLS-Artikel: Negativbestand = 1 setzen***********************************************************
pxHelper.SetNegativBestand(response)
If Not String.IsNullOrEmpty(response) Then
logComplete(response, LogLevel.Exception)
End If
'******************************************************************************Artikel holen*********************************************************************************
' alle Artikel aus FLS holen
articleResult = flsConn.CallAsyncAsJArray(My.Settings.ServiceAPIArticlesMethod)
articleResult.Wait()
' alle Artikel aus Proffix holen, die erstellt/geaendert am > lastExport haben und in Gruppe FLS sind
articleList = pxArtikelLaden()
Count = articleList.Count
'**********************************************************************Artikel vergleichen*********************************************************
' Artikel in Proffix + FLS vergleichen (ArticleNumber)
For Each proffixArticle In articleList
' Defaultwert = false
existsInFLS = False
' Alle Artikel aus FLS durchgehen
For Each existingFLSarticle As JObject In articleResult.Result.Children
'************************************************************UPDATE IN FLS*******************************************************************
' --> wenn in FLS vorhanden --> update PUT
If proffixArticle.ArtikelNr = existingFLSarticle("ArticleNumber").ToString Then
existsInFLS = True
' updated den Artikel in FLS (Flag existsInFLS
If Not updateInFLS(proffixArticle, existingFLSarticle) Then
' geklappt soll falsch sein (und bleiben), sobald 1 update/create nicht geklappt hat --> wenn updateInFLS true zurückgibt --> geklappt nicht verändern, da sonst vorheriger Fehler ignoriert wird
successful = False
End If
End If
Next
'*******************************************************************CREATE IN FLS******************************************************************
' wenn in FLS nicht vorhanden
If Not existsInFLS Then
' ... und in Proffix nicht bereits schon wieder gelöscht wurde
If proffixArticle.Geloescht = 0 Then
'... dann: create Article in FLS + neue Id in Proffix schreiben
If Not createInFLS(proffixArticle) Then
' geklappt soll falsch sein, sobald 1 update/create nicht geklappt hat --> wenn updateInFLS true zurückgibt --> geklappt nicht verändern, da sonst vorheriger Fehler ignoriert wird
successful = False
End If
End If
End If
Progress += 1
InvokeDoProgress()
Next
'**************************************************************LastSync updaten*****************************************************************************
' wenn bis herhin alles geklappt --> geklappt immer noch true
If successful Then
logComplete("Artikelexport erfolgreich beendet", LogLevel.Info)
LastExport = DateTime.Now
Else
logComplete("Beim Artikelexport ist mindestens 1 Fehler aufgetreten. Deshalb wird das Datum des letzten Exports nicht angepasst.", LogLevel.Exception)
Logger.GetInstance.Log(LogLevel.Exception, "Artikelexport beendet. Mindestens 1 Fehler bei Artikelexport")
End If
logComplete("", LogLevel.Info)
Progress = Count
InvokeDoProgress()
Return successful
Catch faultExce As FaultException
Logger.GetInstance().Log(LogLevel.Exception, faultExce.Message)
Throw faultExce
'End If
Catch exce As Exception
Logger.GetInstance().Log(LogLevel.Exception, exce)
Throw
End Try
End Function
Private Function pxArtikelLaden() As List(Of pxKommunikation.pxArtikel)
Dim sql As String = String.Empty
Dim rs As New ADODB.Recordset
Dim articleList As New List(Of pxKommunikation.pxArtikel)
Dim fehler As String = String.Empty
sql = "Select artikelNrLAG, bezeichnung1, bezeichnung2, bezeichnung3, geloescht from lag_artikel " + _
"where Z_FLS = 1 and (erstelltam > '" + LastExport.ToString(pxHelper.dateformat + " HH:mm:ss") + "' or geaendertam > '" + LastExport.ToString(pxHelper.dateformat + " HH:mm:ss") + "')"
If Not MyConn.getRecord(rs, sql, fehler) Then
logComplete("Fehler beim Laden der geänderten Artikel" + fehler, LogLevel.Exception)
Return Nothing
Else
' geholte Artikel in einer Liste speichern
Dim article As New pxKommunikation.pxArtikel
While Not rs.EOF
article.ArtikelNr = rs.Fields("artikelNrLAG").Value.ToString()
article.Bezeichnung1 = rs.Fields("bezeichnung1").Value.ToString()
article.Bezeichnung2 = rs.Fields("bezeichnung2").Value.ToString()
article.Bezeichnung3 = rs.Fields("bezeichnung3").Value.ToString()
article.Geloescht = CInt(rs.Fields("geloescht").Value)
articleList.Add(article)
rs.MoveNext()
End While
End If
Return articleList
End Function
Private Function updateInFLS(ByVal proffixArticle As pxKommunikation.pxArtikel, ByVal existingFLSarticle As JObject) As Boolean
Dim response_FLS As String = String.Empty
Dim sql As String = String.Empty
Dim rs As New ADODB.Recordset
Dim fehler As String = String.Empty
Try
' JSON verändern
existingFLSarticle = articleMapper.Mapp(proffixArticle, existingFLSarticle)
' Artikel in FLS updaten
response_FLS = flsConn.ExportChanges(existingFLSarticle("ArticleId").ToString, existingFLSarticle, ExporterCommitCommand.Update)
' Ist response_FLS keine GUID? --> update in FLS hat nicht geklappt, response_FLS enthält Fehlermeldung
If Not pattern_GUID.IsMatch(response_FLS) Then
logComplete("Fehler beim Updaten in FLS ArtikelNr: " + proffixArticle.ArtikelNr.ToString + " " + proffixArticle.Bezeichnung1, LogLevel.Exception, response_FLS)
Throw New Exception("Fehler beim Updaten des Artikels in FLS")
End If
' response_FLS ist GUID = update in FLS hat geklappt --> ArticleId in Proffix updaten
If Not updateArticleIdInProffix(response_FLS, proffixArticle.ArtikelNr, fehler) Then
' Update ArticleId in Proffix hat nicht geklappt
Logger.GetInstance().Log(LogLevel.Exception, "... des bereits in FLS vorhandenen Artikels. " + " ArtikelNr:" + proffixArticle.ArtikelNr + " " + proffixArticle.Bezeichnung1)
Throw New Exception("Fehler beim Updaten der ArticleId in Proffix ArtikelNr ")
End If
' wenn bis hierher --> update (in Artikel in FLS und ArticleId in Proffix) hat geklappt
logComplete("Aktualisiert in FLS: ArticleNr " + proffixArticle.ArtikelNr + " Bezeichnung " + proffixArticle.Bezeichnung1, LogLevel.Info)
Return True
Catch ex As Exception
logComplete("Fehler beim Updaten des Artikels in FLS ArtikelNr: " + proffixArticle.ArtikelNr, LogLevel.Exception, "Fehler in " + MethodBase.GetCurrentMethod().Name + " " + ex.Message)
Return False
End Try
End Function
Private Function createInFLS(ByVal proffixArticle As pxKommunikation.pxArtikel) As Boolean
Dim newFLSarticle = New JObject
Dim response_FLS As String = String.Empty
Dim fehler As String = String.Empty
Try
' JSON für neuen Artikel erstellen
newFLSarticle = articleMapper.Mapp(proffixArticle, newFLSarticle)
If LogAusfuehrlich Then
Logger.GetInstance.Log(LogLevel.Info, My.Settings.ServiceAPIArticlesMethod)
Logger.GetInstance.Log(LogLevel.Info, newFLSarticle.ToString)
End If
' Artikel in FLS erstellen
response_FLS = flsConn.ExportChanges("", newFLSarticle, ExporterCommitCommand.Create)
' Wenn InternalServerError und ArtikelName in FLS bereits vorhanden (unique) --> Fehlermeldung
If response_FLS.Contains("InternalServerError") And articleNameExistsAlreadyInFLS(newFLSarticle("ArticleName").ToString) Then
' Anweisungen an User
logComplete("Fehler: In FLS besteht bereits ein Artikel mit dem Artikelnamen/Bezeichnung1 """ + proffixArticle.Bezeichnung1 + """ ArtikelNr: " + newFLSarticle("ArticleNumber").ToString +
"Deshalb konnte der Artikel in FLS nicht neu erstellt werden." + vbCrLf +
"Sie haben folgende Möglichkeiten:" + vbCrLf +
"- Ändern Sie den Artikelnamen/Bezeichnung1 """ + proffixArticle.Bezeichnung1 + """des Artikels" + vbCrLf +
"- Falls der Artikel mit Artikel-Nr. " + newFLSarticle("ArticleNumber").ToString + " Artikelname/Bezeichnung1 " + proffixArticle.Bezeichnung1 + " gelöscht noch vorhanden ist, entfernen Sie das Häckchen bei ""gelöscht""",
LogLevel.Exception)
' logcomplete( "- Erstellen Sie einen neuen Artikel mit der Artikel-Nr: " + newFLSarticle("ArticleNumber").ToString + "Artikelname/Bezeichnung1: " + proffixArticle.Bezeichnung1 + " und löschen Sie den Artikel mit der Artikel-Nr: " + proffixArticle.ArtikelNr)
Logger.GetInstance.Log(LogLevel.Exception, "In FLS besteht bereits ein Artikel mit dem Artikelnamen/Bezeichnung """ + proffixArticle.Bezeichnung1 + """ ArtikelNr: " + newFLSarticle("ArticleNumber").ToString + " Anweisungen an Kunde im Log")
Return False
End If
' Ist response_FLS GUID? --> create hat geklappt, ansonsten enthält response_FLS die Fehlermeldung
If Not pattern_GUID.IsMatch(response_FLS) Then
logComplete("Fehler beim Erstellen in FLS: " + proffixArticle.ArtikelNr + " " + proffixArticle.Bezeichnung1, LogLevel.Exception, response_FLS)
Return False
End If
' response_FLS ist GUID --> in Proffix updaten
If Not updateArticleIdInProffix(response_FLS, proffixArticle.ArtikelNr, fehler) Then
Logger.GetInstance().Log(LogLevel.Exception, "... des soeben in FLS neu erstellten Artikels. " + " ArtikelNr:" + proffixArticle.ArtikelNr + " " + proffixArticle.Bezeichnung1)
Return False
End If
' wenn bis hierher --> create Artikel in FLS und update ArticleId in Proffix hat geklappt
logComplete("Erstellt in FLS: " + proffixArticle.ArtikelNr + " " + proffixArticle.Bezeichnung1, LogLevel.Info)
Return True
Catch ex As Exception
logComplete("Fehler beim Erstellen des Artikels in FLS ArtikelNr: " + proffixArticle.ArtikelNr, LogLevel.Exception, response_FLS + " " + ex.Message)
Return Nothing
End Try
End Function
' prüft, ob Artikelname/Bezeichnung1 bereits in FLS in Artikeltabelle vorhanden ist (Feld ist unique)
Private Function articleNameExistsAlreadyInFLS(ByVal articlename As String) As Boolean
Dim articleResult As Threading.Tasks.Task(Of JArray)
' alle Artikel aus Artikeltabelle in FLS holen
articleResult = flsConn.CallAsyncAsJArray(My.Settings.ServiceAPIArticlesMethod)
articleResult.Wait()
' ist der Artikelname bereits in FLS vorhanden?
For Each article In articleResult.Result.Children
' Artikelname/Bezeichnung in FLS bereits vorhanden
If articlename = article("ArticleName").ToString Then
Return True
End If
Next
' wenn bis hierher --> Artikelname in FLS in Artikeltabelle noch nicht vorhanden
Return False
End Function
Private Function updateArticleIdInProffix(ByVal FLSarticleId As String, ByVal pxArtikelNr As String, ByRef fehler As String) As Boolean
Dim sql As String = String.Empty
Dim rs As New ADODB.Recordset
' Artikel mit neuer ArtikelId in Proffix schreiben
sql = "Update lag_artikel set Z_ArticleId = '" + FLSarticleId + "', " + _
"geaendertVon = '" + Assembly.GetExecutingAssembly().GetName.Name + "', geaendertAm = '" + Now.ToString(pxHelper.dateformat + " HH:mm:ss") + "' " + _
"where ArtikelNrLAG = '" + pxArtikelNr + "'"
If Not MyConn.getRecord(rs, sql, fehler) Then
Logger.GetInstance.Log(LogLevel.Exception, "Fehler beim Updaten der ArticleId " + FLSarticleId + " in Proffix")
Return False
Else
Return True
End If
End Function
Private Sub InvokeDoProgress()
If DoProgress IsNot Nothing Then DoProgress.Invoke()
End Sub
' schreibt in Log und in Logger (File)
Private Sub logComplete(ByVal logString As String, ByVal loglevel As LogLevel, Optional ByVal zusatzloggerString As String = "")
If Log IsNot Nothing Then Log.Invoke(If(loglevel <> loglevel.Info, vbTab, "") + logString)
Logger.GetInstance.Log(loglevel, logString + " " + zusatzloggerString)
End Sub
''' <summary>
''' Anzeigen des Synchronisationsfortschritt
''' </summary>
Private Sub DoExporterProgress()
'ProgressBar aktualisieren
FrmMain.pbMain.Maximum = Count
FrmMain.pbMain.Value = Progress
End Sub
End Class
|
' Note: For instructions on enabling IIS6 or IIS7 classic mode,
' visit http://go.microsoft.com/?LinkId=9394802
Public Class MvcApplication
Inherits System.Web.HttpApplication
Shared Sub RegisterRoutes(ByVal routes As RouteCollection)
routes.IgnoreRoute("{resource}.axd/{*pathInfo}")
' MapRoute takes the following parameters, in order:
' (1) Route name
' (2) URL with parameters
' (3) Parameter defaults
routes.MapRoute( _
"News", _
"{controller}/{action}/{id}", _
New With {.controller = "Game", .action = "Welcome", .id = UrlParameter.Optional} _
)
End Sub
Sub Application_Start()
AreaRegistration.RegisterAllAreas()
RegisterRoutes(RouteTable.Routes)
End Sub
End Class
|
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.
Option Strict On
Option Explicit On
Imports System
Namespace Microsoft.VisualBasic.Devices
'''**************************************************************************
''' ;Clock
''' <summary>
''' A wrapper object that acts as a discovery mechanism to quickly find out
''' the current local time of the machine and the GMT time.
''' </summary>
Public Class Clock
'* PUBLIC *************************************************************
'''**************************************************************************
''' ;LocalTime
''' <summary>
''' Gets a DateTime that is the current local date and time on this computer.
''' </summary>
''' <value>A DateTime whose value is the current date and time.</value>
Public ReadOnly Property LocalTime() As DateTime
Get
Return DateTime.Now
End Get
End Property
'''**************************************************************************
''' ;GmtTime
''' <summary>
''' Gets a DateTime that is the current local date and time on this
''' computer expressed as GMT time.
''' </summary>
''' <value>A DateTime whose value is the current date and time expressed as GMT time.</value>
Public ReadOnly Property GmtTime() As DateTime
Get
Return DateTime.UtcNow
End Get
End Property
'''**************************************************************************
''' ;TickCount
''' <summary>
''' This property wraps the Environment.TickCount property to get the
''' number of milliseconds elapsed since the system started.
''' </summary>
''' <value>An Integer containing the amount of time in milliseconds.</value>
Public ReadOnly Property TickCount() As Integer
Get
Return System.Environment.TickCount
End Get
End Property
'* FRIEND *************************************************************
'* PRIVATE ************************************************************
End Class 'Clock
End Namespace
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class DBModifCreate
Inherits System.Windows.Forms.Form
'Das Formular überschreibt den Löschvorgang, um die Komponentenliste zu bereinigen.
<System.Diagnostics.DebuggerNonUserCode()>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Wird vom Windows Form-Designer benötigt.
Private components As System.ComponentModel.IContainer
'Hinweis: Die folgende Prozedur ist für den Windows Form-Designer erforderlich.
'Das Bearbeiten ist mit dem Windows Form-Designer möglich.
'Das Bearbeiten mit dem Code-Editor ist nicht möglich.
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(DBModifCreate))
Me.Cancel_Button = New System.Windows.Forms.Button()
Me.OK_Button = New System.Windows.Forms.Button()
Me.CreateCB = New System.Windows.Forms.Button()
Me.DBModifName = New System.Windows.Forms.TextBox()
Me.NameLabel = New System.Windows.Forms.Label()
Me.Tablename = New System.Windows.Forms.TextBox()
Me.PrimaryKeys = New System.Windows.Forms.TextBox()
Me.Database = New System.Windows.Forms.TextBox()
Me.IgnoreColumns = New System.Windows.Forms.TextBox()
Me.addStoredProc = New System.Windows.Forms.TextBox()
Me.TablenameLabel = New System.Windows.Forms.Label()
Me.PrimaryKeysLabel = New System.Windows.Forms.Label()
Me.DatabaseLabel = New System.Windows.Forms.Label()
Me.IgnoreColumnsLabel = New System.Windows.Forms.Label()
Me.AdditionalStoredProcLabel = New System.Windows.Forms.Label()
Me.insertIfMissing = New System.Windows.Forms.CheckBox()
Me.execOnSave = New System.Windows.Forms.CheckBox()
Me.ToolTip1 = New System.Windows.Forms.ToolTip(Me.components)
Me.envSel = New System.Windows.Forms.ComboBox()
Me.DBSeqenceDataGrid = New System.Windows.Forms.DataGridView()
Me.TargetRangeAddress = New System.Windows.Forms.Label()
Me.CUDflags = New System.Windows.Forms.CheckBox()
Me.RepairDBSeqnce = New System.Windows.Forms.TextBox()
Me.AskForExecute = New System.Windows.Forms.CheckBox()
Me.IgnoreDataErrors = New System.Windows.Forms.CheckBox()
Me.AutoIncFlag = New System.Windows.Forms.CheckBox()
Me.EnvironmentLabel = New System.Windows.Forms.Label()
Me.MoveMenu = New System.Windows.Forms.ContextMenuStrip(Me.components)
Me.MoveRowUp = New System.Windows.Forms.ToolStripMenuItem()
Me.MoveRowDown = New System.Windows.Forms.ToolStripMenuItem()
CType(Me.DBSeqenceDataGrid, System.ComponentModel.ISupportInitialize).BeginInit()
Me.MoveMenu.SuspendLayout()
Me.SuspendLayout()
'
'Cancel_Button
'
Me.Cancel_Button.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.Cancel_Button.DialogResult = System.Windows.Forms.DialogResult.Cancel
Me.Cancel_Button.Location = New System.Drawing.Point(401, 434)
Me.Cancel_Button.Name = "Cancel_Button"
Me.Cancel_Button.Size = New System.Drawing.Size(67, 23)
Me.Cancel_Button.TabIndex = 3
Me.Cancel_Button.TabStop = False
Me.Cancel_Button.Text = "Cancel"
Me.ToolTip1.SetToolTip(Me.Cancel_Button, "discard changes in DB Modifier Creation")
'
'OK_Button
'
Me.OK_Button.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.OK_Button.Location = New System.Drawing.Point(361, 434)
Me.OK_Button.Name = "OK_Button"
Me.OK_Button.Size = New System.Drawing.Size(34, 23)
Me.OK_Button.TabIndex = 2
Me.OK_Button.TabStop = False
Me.OK_Button.Text = "OK"
Me.ToolTip1.SetToolTip(Me.OK_Button, "use changes done in DB Modifier Creation")
Me.OK_Button.UseVisualStyleBackColor = True
'
'CreateCB
'
Me.CreateCB.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.CreateCB.Location = New System.Drawing.Point(287, 434)
Me.CreateCB.Name = "CreateCB"
Me.CreateCB.Size = New System.Drawing.Size(68, 23)
Me.CreateCB.TabIndex = 1
Me.CreateCB.TabStop = False
Me.CreateCB.Text = "Create CB"
Me.ToolTip1.SetToolTip(Me.CreateCB, "Create a Commandbutton for the DB Modifier Definition (max. 5 Buttons possible pe" &
"r Workbook)")
'
'DBModifName
'
Me.DBModifName.Location = New System.Drawing.Point(167, 3)
Me.DBModifName.Name = "DBModifName"
Me.DBModifName.Size = New System.Drawing.Size(297, 20)
Me.DBModifName.TabIndex = 1
Me.ToolTip1.SetToolTip(Me.DBModifName, resources.GetString("DBModifName.ToolTip"))
'
'NameLabel
'
Me.NameLabel.AutoSize = True
Me.NameLabel.Location = New System.Drawing.Point(9, 6)
Me.NameLabel.Name = "NameLabel"
Me.NameLabel.Size = New System.Drawing.Size(91, 13)
Me.NameLabel.TabIndex = 2
Me.NameLabel.Text = "DBModifier name:"
'
'Tablename
'
Me.Tablename.Location = New System.Drawing.Point(167, 55)
Me.Tablename.Name = "Tablename"
Me.Tablename.Size = New System.Drawing.Size(297, 20)
Me.Tablename.TabIndex = 3
Me.ToolTip1.SetToolTip(Me.Tablename, "Database Table, where Data is to be stored")
'
'PrimaryKeys
'
Me.PrimaryKeys.Location = New System.Drawing.Point(167, 81)
Me.PrimaryKeys.Name = "PrimaryKeys"
Me.PrimaryKeys.Size = New System.Drawing.Size(297, 20)
Me.PrimaryKeys.TabIndex = 4
Me.ToolTip1.SetToolTip(Me.PrimaryKeys, "Number of primary keys in DBMapper datatable (starting from the left)")
'
'Database
'
Me.Database.Location = New System.Drawing.Point(167, 29)
Me.Database.Name = "Database"
Me.Database.Size = New System.Drawing.Size(297, 20)
Me.Database.TabIndex = 2
Me.ToolTip1.SetToolTip(Me.Database, "Database to store DBMaps Data into/ do DBActions")
'
'IgnoreColumns
'
Me.IgnoreColumns.Location = New System.Drawing.Point(167, 107)
Me.IgnoreColumns.Name = "IgnoreColumns"
Me.IgnoreColumns.Size = New System.Drawing.Size(297, 20)
Me.IgnoreColumns.TabIndex = 5
Me.ToolTip1.SetToolTip(Me.IgnoreColumns, "columns to be ignored (e.g. helper columns), comma separated")
'
'addStoredProc
'
Me.addStoredProc.Location = New System.Drawing.Point(167, 133)
Me.addStoredProc.Name = "addStoredProc"
Me.addStoredProc.Size = New System.Drawing.Size(297, 20)
Me.addStoredProc.TabIndex = 6
Me.ToolTip1.SetToolTip(Me.addStoredProc, "additional stored procedure to be executed after saving")
'
'TablenameLabel
'
Me.TablenameLabel.AutoSize = True
Me.TablenameLabel.Location = New System.Drawing.Point(9, 58)
Me.TablenameLabel.Name = "TablenameLabel"
Me.TablenameLabel.Size = New System.Drawing.Size(63, 13)
Me.TablenameLabel.TabIndex = 2
Me.TablenameLabel.Text = "Tablename:"
'
'PrimaryKeysLabel
'
Me.PrimaryKeysLabel.AutoSize = True
Me.PrimaryKeysLabel.Location = New System.Drawing.Point(9, 84)
Me.PrimaryKeysLabel.Name = "PrimaryKeysLabel"
Me.PrimaryKeysLabel.Size = New System.Drawing.Size(99, 13)
Me.PrimaryKeysLabel.TabIndex = 2
Me.PrimaryKeysLabel.Text = "Primary keys count:"
'
'DatabaseLabel
'
Me.DatabaseLabel.AutoSize = True
Me.DatabaseLabel.Location = New System.Drawing.Point(9, 32)
Me.DatabaseLabel.Name = "DatabaseLabel"
Me.DatabaseLabel.Size = New System.Drawing.Size(56, 13)
Me.DatabaseLabel.TabIndex = 2
Me.DatabaseLabel.Text = "Database:"
'
'IgnoreColumnsLabel
'
Me.IgnoreColumnsLabel.AutoSize = True
Me.IgnoreColumnsLabel.Location = New System.Drawing.Point(9, 110)
Me.IgnoreColumnsLabel.Name = "IgnoreColumnsLabel"
Me.IgnoreColumnsLabel.Size = New System.Drawing.Size(82, 13)
Me.IgnoreColumnsLabel.TabIndex = 2
Me.IgnoreColumnsLabel.Text = "Ignore columns:"
'
'AdditionalStoredProcLabel
'
Me.AdditionalStoredProcLabel.AutoSize = True
Me.AdditionalStoredProcLabel.Location = New System.Drawing.Point(9, 136)
Me.AdditionalStoredProcLabel.Name = "AdditionalStoredProcLabel"
Me.AdditionalStoredProcLabel.Size = New System.Drawing.Size(139, 13)
Me.AdditionalStoredProcLabel.TabIndex = 2
Me.AdditionalStoredProcLabel.Text = "Additional stored procedure:"
'
'insertIfMissing
'
Me.insertIfMissing.AutoSize = True
Me.insertIfMissing.Location = New System.Drawing.Point(216, 163)
Me.insertIfMissing.Name = "insertIfMissing"
Me.insertIfMissing.Size = New System.Drawing.Size(97, 17)
Me.insertIfMissing.TabIndex = 9
Me.insertIfMissing.Text = "Insert if missing"
Me.ToolTip1.SetToolTip(Me.insertIfMissing, "if set, then insert row into table if primary key is missing there. Default = Fal" &
"se (only update)")
Me.insertIfMissing.UseVisualStyleBackColor = True
'
'execOnSave
'
Me.execOnSave.AutoSize = True
Me.execOnSave.Location = New System.Drawing.Point(12, 163)
Me.execOnSave.Name = "execOnSave"
Me.execOnSave.Size = New System.Drawing.Size(91, 17)
Me.execOnSave.TabIndex = 7
Me.execOnSave.Text = "Exec on save"
Me.ToolTip1.SetToolTip(Me.execOnSave, "should DB Modifier automatically be done on Excel Workbook Saving? (default no)")
Me.execOnSave.UseVisualStyleBackColor = True
'
'envSel
'
Me.envSel.FormattingEnabled = True
Me.envSel.Location = New System.Drawing.Point(351, 159)
Me.envSel.Name = "envSel"
Me.envSel.Size = New System.Drawing.Size(113, 21)
Me.envSel.TabIndex = 10
Me.ToolTip1.SetToolTip(Me.envSel, "The Environment, where connection id should be taken from (if not existing, take " &
"from selected Environment in DB Addin General Settings Group)")
'
'DBSeqenceDataGrid
'
Me.DBSeqenceDataGrid.AllowDrop = True
Me.DBSeqenceDataGrid.AllowUserToResizeRows = False
Me.DBSeqenceDataGrid.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.DBSeqenceDataGrid.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.AllCells
Me.DBSeqenceDataGrid.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.DBSeqenceDataGrid.Location = New System.Drawing.Point(12, 209)
Me.DBSeqenceDataGrid.MultiSelect = False
Me.DBSeqenceDataGrid.Name = "DBSeqenceDataGrid"
Me.DBSeqenceDataGrid.Size = New System.Drawing.Size(452, 219)
Me.DBSeqenceDataGrid.TabIndex = 13
Me.ToolTip1.SetToolTip(Me.DBSeqenceDataGrid, "Define the steps for the DB Sequence in the order of their desired execution here" &
". Any DBMapper and/or DBAction can be selected.")
'
'TargetRangeAddress
'
Me.TargetRangeAddress.Anchor = CType((System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.TargetRangeAddress.AutoEllipsis = True
Me.TargetRangeAddress.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Underline, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.TargetRangeAddress.ForeColor = System.Drawing.Color.DodgerBlue
Me.TargetRangeAddress.Location = New System.Drawing.Point(12, 434)
Me.TargetRangeAddress.Name = "TargetRangeAddress"
Me.TargetRangeAddress.Size = New System.Drawing.Size(269, 23)
Me.TargetRangeAddress.TabIndex = 11
Me.ToolTip1.SetToolTip(Me.TargetRangeAddress, "click to select Target Range with Data for DBMapper or SQL DML for DBAction")
'
'CUDflags
'
Me.CUDflags.AutoSize = True
Me.CUDflags.Location = New System.Drawing.Point(12, 186)
Me.CUDflags.Name = "CUDflags"
Me.CUDflags.Size = New System.Drawing.Size(84, 17)
Me.CUDflags.TabIndex = 11
Me.CUDflags.Text = "C/U/D flags"
Me.ToolTip1.SetToolTip(Me.CUDflags, "if set, then only insert/update/delete row if special CUDFlags column contains i," &
" u or d. Default = False (only update)")
Me.CUDflags.UseVisualStyleBackColor = True
'
'RepairDBSeqnce
'
Me.RepairDBSeqnce.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
Or System.Windows.Forms.AnchorStyles.Left) _
Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
Me.RepairDBSeqnce.Location = New System.Drawing.Point(12, 209)
Me.RepairDBSeqnce.Multiline = True
Me.RepairDBSeqnce.Name = "RepairDBSeqnce"
Me.RepairDBSeqnce.ScrollBars = System.Windows.Forms.ScrollBars.Vertical
Me.RepairDBSeqnce.Size = New System.Drawing.Size(456, 219)
Me.RepairDBSeqnce.TabIndex = 14
Me.ToolTip1.SetToolTip(Me.RepairDBSeqnce, "use this textbox to repair DB Sequence entries...")
'
'AskForExecute
'
Me.AskForExecute.AutoSize = True
Me.AskForExecute.Location = New System.Drawing.Point(102, 163)
Me.AskForExecute.Name = "AskForExecute"
Me.AskForExecute.Size = New System.Drawing.Size(108, 17)
Me.AskForExecute.TabIndex = 8
Me.AskForExecute.Text = "Ask for execution"
Me.ToolTip1.SetToolTip(Me.AskForExecute, "ask for confirmation before execution?")
Me.AskForExecute.UseVisualStyleBackColor = True
'
'IgnoreDataErrors
'
Me.IgnoreDataErrors.AutoSize = True
Me.IgnoreDataErrors.Location = New System.Drawing.Point(101, 186)
Me.IgnoreDataErrors.Name = "IgnoreDataErrors"
Me.IgnoreDataErrors.Size = New System.Drawing.Size(109, 17)
Me.IgnoreDataErrors.TabIndex = 12
Me.IgnoreDataErrors.Text = "Ignore data errors"
Me.ToolTip1.SetToolTip(Me.IgnoreDataErrors, "if set, don't notify user of error values in cells during update/insert, null val" &
"ues are used instead")
Me.IgnoreDataErrors.UseVisualStyleBackColor = True
'
'AutoIncFlag
'
Me.AutoIncFlag.AutoSize = True
Me.AutoIncFlag.Location = New System.Drawing.Point(216, 186)
Me.AutoIncFlag.Name = "AutoIncFlag"
Me.AutoIncFlag.Size = New System.Drawing.Size(98, 17)
Me.AutoIncFlag.TabIndex = 13
Me.AutoIncFlag.Text = "Auto Increment"
Me.ToolTip1.SetToolTip(Me.AutoIncFlag, resources.GetString("AutoIncFlag.ToolTip"))
Me.AutoIncFlag.UseVisualStyleBackColor = True
'
'EnvironmentLabel
'
Me.EnvironmentLabel.AutoSize = True
Me.EnvironmentLabel.Location = New System.Drawing.Point(316, 164)
Me.EnvironmentLabel.Name = "EnvironmentLabel"
Me.EnvironmentLabel.Size = New System.Drawing.Size(29, 13)
Me.EnvironmentLabel.TabIndex = 6
Me.EnvironmentLabel.Text = "Env:"
'
'MoveMenu
'
Me.MoveMenu.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.MoveRowUp, Me.MoveRowDown})
Me.MoveMenu.Name = "ContextMenuStrip1"
Me.MoveMenu.Size = New System.Drawing.Size(165, 48)
'
'MoveRowUp
'
Me.MoveRowUp.Name = "MoveRowUp"
Me.MoveRowUp.Size = New System.Drawing.Size(164, 22)
Me.MoveRowUp.Text = "Move Row Up"
'
'MoveRowDown
'
Me.MoveRowDown.Name = "MoveRowDown"
Me.MoveRowDown.Size = New System.Drawing.Size(164, 22)
Me.MoveRowDown.Text = "Move Row Down"
'
'DBModifCreate
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.CancelButton = Me.Cancel_Button
Me.ClientSize = New System.Drawing.Size(479, 469)
Me.ControlBox = False
Me.Controls.Add(Me.AutoIncFlag)
Me.Controls.Add(Me.CreateCB)
Me.Controls.Add(Me.OK_Button)
Me.Controls.Add(Me.Cancel_Button)
Me.Controls.Add(Me.IgnoreDataErrors)
Me.Controls.Add(Me.EnvironmentLabel)
Me.Controls.Add(Me.AskForExecute)
Me.Controls.Add(Me.CUDflags)
Me.Controls.Add(Me.insertIfMissing)
Me.Controls.Add(Me.DBSeqenceDataGrid)
Me.Controls.Add(Me.envSel)
Me.Controls.Add(Me.execOnSave)
Me.Controls.Add(Me.AdditionalStoredProcLabel)
Me.Controls.Add(Me.IgnoreColumnsLabel)
Me.Controls.Add(Me.DatabaseLabel)
Me.Controls.Add(Me.PrimaryKeysLabel)
Me.Controls.Add(Me.TablenameLabel)
Me.Controls.Add(Me.NameLabel)
Me.Controls.Add(Me.addStoredProc)
Me.Controls.Add(Me.IgnoreColumns)
Me.Controls.Add(Me.Database)
Me.Controls.Add(Me.PrimaryKeys)
Me.Controls.Add(Me.Tablename)
Me.Controls.Add(Me.DBModifName)
Me.Controls.Add(Me.RepairDBSeqnce)
Me.Controls.Add(Me.TargetRangeAddress)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.MinimumSize = New System.Drawing.Size(490, 485)
Me.Name = "DBModifCreate"
Me.ShowInTaskbar = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent
CType(Me.DBSeqenceDataGrid, System.ComponentModel.ISupportInitialize).EndInit()
Me.MoveMenu.ResumeLayout(False)
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents OK_Button As System.Windows.Forms.Button
Friend WithEvents Cancel_Button As System.Windows.Forms.Button
Friend WithEvents DBModifName As Windows.Forms.TextBox
Friend WithEvents NameLabel As Windows.Forms.Label
Friend WithEvents Tablename As Windows.Forms.TextBox
Friend WithEvents PrimaryKeys As Windows.Forms.TextBox
Friend WithEvents Database As Windows.Forms.TextBox
Friend WithEvents IgnoreColumns As Windows.Forms.TextBox
Friend WithEvents addStoredProc As Windows.Forms.TextBox
Friend WithEvents TablenameLabel As Windows.Forms.Label
Friend WithEvents PrimaryKeysLabel As Windows.Forms.Label
Friend WithEvents DatabaseLabel As Windows.Forms.Label
Friend WithEvents IgnoreColumnsLabel As Windows.Forms.Label
Friend WithEvents AdditionalStoredProcLabel As Windows.Forms.Label
Friend WithEvents insertIfMissing As Windows.Forms.CheckBox
Friend WithEvents execOnSave As Windows.Forms.CheckBox
Friend WithEvents ToolTip1 As Windows.Forms.ToolTip
Friend WithEvents envSel As Windows.Forms.ComboBox
Friend WithEvents EnvironmentLabel As Windows.Forms.Label
Friend WithEvents DBSeqenceDataGrid As Windows.Forms.DataGridView
Friend WithEvents TargetRangeAddress As Windows.Forms.Label
Friend WithEvents CUDflags As Windows.Forms.CheckBox
Friend WithEvents RepairDBSeqnce As Windows.Forms.TextBox
Friend WithEvents AskForExecute As Windows.Forms.CheckBox
Friend WithEvents CreateCB As Windows.Forms.Button
Friend WithEvents IgnoreDataErrors As Windows.Forms.CheckBox
Friend WithEvents MoveMenu As Windows.Forms.ContextMenuStrip
Friend WithEvents MoveRowUp As Windows.Forms.ToolStripMenuItem
Friend WithEvents MoveRowDown As Windows.Forms.ToolStripMenuItem
Friend WithEvents AutoIncFlag As Windows.Forms.CheckBox
End Class
|
Imports System.Collections.Generic
Imports BaseDL4JTest = org.deeplearning4j.BaseDL4JTest
Imports ParagraphVectorsTest = org.deeplearning4j.models.paragraphvectors.ParagraphVectorsTest
Imports org.deeplearning4j.models.embeddings.learning.impl.elements
Imports org.deeplearning4j.models.embeddings.reader.impl
Imports VocabWord = org.deeplearning4j.models.word2vec.VocabWord
Imports Word2Vec = org.deeplearning4j.models.word2vec.Word2Vec
Imports SentenceIterator = org.deeplearning4j.text.sentenceiterator.SentenceIterator
Imports SentencePreProcessor = org.deeplearning4j.text.sentenceiterator.SentencePreProcessor
Imports LabelAwareSentenceIterator = org.deeplearning4j.text.sentenceiterator.labelaware.LabelAwareSentenceIterator
Imports CommonPreprocessor = org.deeplearning4j.text.tokenization.tokenizer.preprocessor.CommonPreprocessor
Imports DefaultTokenizerFactory = org.deeplearning4j.text.tokenization.tokenizerfactory.DefaultTokenizerFactory
Imports TokenizerFactory = org.deeplearning4j.text.tokenization.tokenizerfactory.TokenizerFactory
Imports Disabled = org.junit.jupiter.api.Disabled
Imports Tag = org.junit.jupiter.api.Tag
Imports Test = org.junit.jupiter.api.Test
Imports NativeTag = org.nd4j.common.tests.tags.NativeTag
Imports TagNames = org.nd4j.common.tests.tags.TagNames
Imports INDArray = org.nd4j.linalg.api.ndarray.INDArray
Imports DataSet = org.nd4j.linalg.dataset.DataSet
Imports Resources = org.nd4j.common.resources.Resources
import static org.junit.jupiter.api.Assertions.assertArrayEquals
'
' * ******************************************************************************
' * *
' * *
' * * This program and the accompanying materials are made available under the
' * * terms of the Apache License, Version 2.0 which is available at
' * * https://www.apache.org/licenses/LICENSE-2.0.
' * *
' * * See the NOTICE file distributed with this work for additional
' * * information regarding copyright ownership.
' * * Unless required by applicable law or agreed to in writing, software
' * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
' * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
' * * License for the specific language governing permissions and limitations
' * * under the License.
' * *
' * * SPDX-License-Identifier: Apache-2.0
' * *****************************************************************************
'
Namespace org.deeplearning4j.models.word2vec.iterator
'JAVA TO VB CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
'ORIGINAL LINE: @Tag(TagNames.FILE_IO) @NativeTag public class Word2VecDataSetIteratorTest extends org.deeplearning4j.BaseDL4JTest
Public Class Word2VecDataSetIteratorTest
Inherits BaseDL4JTest
Public Overrides ReadOnly Property TimeoutMilliseconds As Long
Get
Return 60000L
End Get
End Property
''' <summary>
''' Basically all we want from this test - being able to finish without exceptions.
''' </summary>
'JAVA TO VB CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
'ORIGINAL LINE: @Test public void testIterator1() throws Exception
'JAVA TO VB CONVERTER WARNING: Method 'throws' clauses are not available in VB:
Public Overridable Sub testIterator1()
Dim inputFile As File = Resources.asFile("big/raw_sentences.txt")
Dim iter As SentenceIterator = ParagraphVectorsTest.getIterator(IntegrationTests, inputFile)
' SentenceIterator iter = new BasicLineIterator(inputFile.getAbsolutePath());
Dim t As TokenizerFactory = New DefaultTokenizerFactory()
t.TokenPreProcessor = New CommonPreprocessor()
Dim vec As Word2Vec = (New Word2Vec.Builder()).minWordFrequency(10).iterations(1).learningRate(0.025).layerSize(150).seed(42).sampling(0).negativeSample(0).useHierarchicSoftmax(True).windowSize(5).modelUtils(New BasicModelUtils(Of VocabWord)()).useAdaGrad(False).iterate(iter).workers(8).tokenizerFactory(t).elementsLearningAlgorithm(New CBOW(Of VocabWord)()).build()
vec.fit()
Dim labels As IList(Of String) = New List(Of String)()
labels.Add("positive")
labels.Add("negative")
Dim iterator As New Word2VecDataSetIterator(vec, getLASI(iter, labels), labels, 1)
'JAVA TO VB CONVERTER TODO TASK: Java iterators are only converted within the context of 'while' and 'for' loops:
Dim array As INDArray = iterator.next().getFeatures()
Dim count As Integer = 0
Do While iterator.MoveNext()
Dim ds As DataSet = iterator.Current
assertArrayEquals(array.shape(), ds.Features.shape())
'JAVA TO VB CONVERTER TODO TASK: The following line contains an assignment within expression that was not extracted by Java to VB Converter:
'ORIGINAL LINE: if(!isIntegrationTests() && count++ > 20)
If Not IntegrationTests AndAlso count++ > 20 Then
Exit Do 'raw_sentences.txt is 2.81 MB, takes quite some time to process. We'll only first 20 minibatches when doing unit tests
End If
Loop
End Sub
'JAVA TO VB CONVERTER WARNING: 'final' parameters are not available in VB:
'ORIGINAL LINE: protected org.deeplearning4j.text.sentenceiterator.labelaware.LabelAwareSentenceIterator getLASI(final org.deeplearning4j.text.sentenceiterator.SentenceIterator iterator, final java.util.List<String> labels)
Protected Friend Overridable Function getLASI(ByVal iterator As SentenceIterator, ByVal labels As IList(Of String)) As LabelAwareSentenceIterator
iterator.reset()
Return New LabelAwareSentenceIteratorAnonymousInnerClass(Me)
End Function
Private Class LabelAwareSentenceIteratorAnonymousInnerClass
Implements LabelAwareSentenceIterator
Private ReadOnly outerInstance As Word2VecDataSetIteratorTest
Public Sub New(ByVal outerInstance As Word2VecDataSetIteratorTest)
Me.outerInstance = outerInstance
cnt = New AtomicInteger(0)
End Sub
Private cnt As AtomicInteger
Public Function currentLabel() As String Implements LabelAwareSentenceIterator.currentLabel
Return labels.get(cnt.incrementAndGet() Mod labels.size())
End Function
Public Function currentLabels() As IList(Of String) Implements LabelAwareSentenceIterator.currentLabels
Return Collections.singletonList(currentLabel())
End Function
Public Function nextSentence() As String
Return iterator.nextSentence()
End Function
Public Function hasNext() As Boolean
Return iterator.hasNext()
End Function
Public Sub reset()
iterator.reset()
End Sub
Public Sub finish()
iterator.finish()
End Sub
Public Property PreProcessor As SentencePreProcessor
Get
Return iterator.getPreProcessor()
End Get
Set(ByVal preProcessor As SentencePreProcessor)
iterator.setPreProcessor(preProcessor)
End Set
End Property
End Class
End Class
End Namespace |
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis.Editor.UnitTests.Extensions
Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.ChangeSignature
Partial Public Class ChangeSignatureTests
<WpfFact, Trait(Traits.Feature, Traits.Features.ChangeSignature)>
Public Sub ReorderMethodParameters_InvokeOnClassName_ShouldFail()
Dim markup = <Text><![CDATA[
Class C$$
Sub M()
End Sub
End Class]]></Text>.NormalizedValue()
TestChangeSignatureViaCommand(LanguageNames.VisualBasic, markup, expectedSuccess:=False, expectedErrorText:=FeaturesResources.YouCanOnlyChangeTheSignatureOfAConstructorIndexerMethodOrDelegate)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.ChangeSignature)>
Public Sub ReorderMethodParameters_InvokeOnField_ShouldFail()
Dim markup = <Text><![CDATA[
Class C
Dim t$$ = 7
Sub M()
End Sub
End Class]]></Text>.NormalizedValue()
TestChangeSignatureViaCommand(LanguageNames.VisualBasic, markup, expectedSuccess:=False, expectedErrorText:=FeaturesResources.YouCanOnlyChangeTheSignatureOfAConstructorIndexerMethodOrDelegate)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.ChangeSignature)>
Public Sub ReorderMethodParameters_InsufficientParameters_None()
Dim markup = <Text><![CDATA[
Class C
Sub $$M()
End Sub
End Class]]></Text>.NormalizedValue()
TestChangeSignatureViaCommand(LanguageNames.VisualBasic, markup, expectedSuccess:=False, expectedErrorText:=FeaturesResources.ThisSignatureDoesNotContainParametersThatCanBeChanged)
End Sub
<WpfFact, Trait(Traits.Feature, Traits.Features.ChangeSignature)>
Public Sub ReorderMethodParameters_InvokeOnOperator_ShouldFail()
Dim markup = <Text><![CDATA[
Class C
Public Shared $$Operator +(c1 As C, c2 As C)
Return Nothing
End Operator
End Class]]></Text>.NormalizedValue()
TestChangeSignatureViaCommand(LanguageNames.VisualBasic, markup, expectedSuccess:=False, expectedErrorText:=FeaturesResources.YouCanOnlyChangeTheSignatureOfAConstructorIndexerMethodOrDelegate)
End Sub
End Class
End Namespace
|
Public Class frmAnalytics
Dim ticketClass(886) As Integer, gender(886) As String, fullName(886) As String, age(886) As Integer, farePaid(886) As String, survivalStatus(886) As Boolean
Dim numberOfPassengers As Integer
Private Sub btnLoadData_Click(sender As Object, e As EventArgs) Handles btnLoadData.Click
FileOpen(1, "Titanic.csv", OpenMode.Input)
numberOfPassengers = 0
Do While Not EOF(1)
Input(1, ticketClass(numberOfPassengers))
Input(1, gender(numberOfPassengers))
Input(1, fullName(numberOfPassengers))
Input(1, age(numberOfPassengers))
Input(1, farePaid(numberOfPassengers))
Input(1, survivalStatus(numberOfPassengers))
outResults.AppendText(ticketClass(numberOfPassengers) & " " & gender(numberOfPassengers) & " " & fullName(numberOfPassengers) & " " & _
age(numberOfPassengers) & " " & farePaid(numberOfPassengers) & " " & survivalStatus(numberOfPassengers) & vbNewLine)
numberOfPassengers = numberOfPassengers + 1
Loop
FileClose(1)
outResults.AppendText("-----" & vbNewLine)
outResults.AppendText("Total passengers in file: " & numberOfPassengers)
End Sub
Private Sub btnSearchByName_Click(sender As Object, e As EventArgs) Handles btnSearchByName.Click
Dim i As Integer, searchName As String, survivedString As String, found As Boolean, foundIndex As Integer
searchName = InputBox("Enter the name of a passenger to search for:")
searchName = searchName.ToLower().Trim()
i = 0
found = False
Do While i < numberOfPassengers And Not found
If fullName(i).ToLower().Contains(searchName) Then
found = True
foundIndex = i
End If
i = i + 1
Loop
If found Then
If survivalStatus(foundIndex) Then
survivedString = "SURVIVED"
Else
survivedString = "DIED"
End If
outResults.Text = fullName(foundIndex) & " " & ticketClass(foundIndex) & " " & age(foundIndex) & " " & farePaid(foundIndex) & " " & survivedString
Else
outResults.Text = searchName & " PRODUCED NO MATCHES"
End If
End Sub
Private Sub btnPlotByGender_Click(sender As Object, e As EventArgs) Handles btnPlotByGender.Click
Dim i As Integer, femaleSurvivedTotal As Integer, femaleTotal As Integer, maleSurvivedTotal As Integer, maleTotal As Integer
femaleSurvivedTotal = 0
femaleTotal = 0
maleSurvivedTotal = 0
maleTotal = 0
For i = 0 To numberOfPassengers - 1
If gender(i) = "female" Then
If survivalStatus(i) Then
femaleSurvivedTotal = femaleSurvivedTotal + 1
End If
femaleTotal = femaleTotal + 1
Else
If survivalStatus(i) Then
maleSurvivedTotal = maleSurvivedTotal + 1
End If
maleTotal = maleTotal + 1
End If
Next
' add data
Dim xAxis(1) As String
Dim yAxis(1) As Single
xAxis(0) = "female"
xAxis(1) = "male"
yAxis(0) = femaleSurvivedTotal / femaleTotal * 100
yAxis(1) = maleSurvivedTotal / maleTotal * 100
plot(xAxis, yAxis, picBoxChart)
outResults.Text = "Percentage of female survivors was " & FormatPercent(femaleSurvivedTotal / femaleTotal) & vbNewLine & _
"Percentage of male survivors was " & FormatPercent(maleSurvivedTotal / maleTotal)
End Sub
Private Sub btnPlotByClass_Click(sender As Object, e As EventArgs) Handles btnPlotByClass.Click
Dim i As Integer, searchClass As Integer, survivedTotal As Integer, total As Integer
searchClass = InputBox("Enter the class of a passengers plot:")
survivedTotal = 0
total = 0
For i = 0 To numberOfPassengers - 1
If ticketClass(i) = searchClass Then
If survivalStatus(i) Then
survivedTotal = survivedTotal + 1
End If
total = total + 1
End If
Next
If total > 0 Then
outResults.Text = FormatPercent(survivedTotal / total, 2) & " of passengers from class " & searchClass & " survived."
Else
outResults.Text = searchClass & " class is not a valid class."
End If
End Sub
Private Sub btnPlotByBoth_Click(sender As Object, e As EventArgs) Handles btnPlotByBoth.Click
End Sub
Private Sub btnQuit_Click(sender As Object, e As EventArgs) Handles btnQuit.Click
End
End Sub
End Class
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Roslyn.Test.Utilities
Namespace Microsoft.VisualStudio.LanguageServices.UnitTests.CodeModel.MethodXML
Partial Public Class MethodXMLTests
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModelMethodXml)>
Public Sub TestVBLocalDeclarations_NoInitializer()
Dim definition =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<CompilationOptions RootNamespace="ClassLibrary1"/>
<Document>
Public Class Class1
$$Sub M()
Dim s As String
End Sub
End Class
</Document>
</Project>
</Workspace>
Dim expected =
<Block>
<Local line="3">
<Type>System.String</Type>
<Name>s</Name>
</Local>
</Block>
Test(definition, expected)
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModelMethodXml)>
Public Sub TestVBLocalDeclarations_WithLiteralInitializer()
Dim definition =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<CompilationOptions RootNamespace="ClassLibrary1"/>
<Document>
Public Class Class1
$$Sub M()
Dim s As String = "Hello"
End Sub
End Class
</Document>
</Project>
</Workspace>
Dim expected =
<Block>
<Local line="3">
<Type>System.String</Type>
<Name>s</Name>
<Expression>
<Literal>
<String>Hello</String>
</Literal>
</Expression>
</Local>
</Block>
Test(definition, expected)
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModelMethodXml)>
Public Sub TestVBLocalDeclarations_WithInvocationInitializer1()
Dim definition =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<CompilationOptions RootNamespace="ClassLibrary1"/>
<Document>
Public Class Class1
$$Sub M()
Dim s As String = Goo()
End Sub
Function Goo() As String
Return "Hello"
End Function
End Class
</Document>
</Project>
</Workspace>
Dim expected =
<Block>
<Local line="3">
<Type>System.String</Type>
<Name>s</Name>
<Expression>
<MethodCall>
<Expression>
<NameRef variablekind="method">
<Expression>
<ThisReference/>
</Expression>
<Name>Goo</Name>
</NameRef>
</Expression>
</MethodCall>
</Expression>
</Local>
</Block>
Test(definition, expected)
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModelMethodXml)>
Public Sub TestVBLocalDeclarations_WithInvocationInitializer2()
Dim definition =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<CompilationOptions RootNamespace="ClassLibrary1"/>
<Document>
Public Class Class1
$$Sub M()
Dim s As String = Goo(1)
End Sub
Function Goo(i As Integer) As String
Return "Hello"
End Function
End Class
</Document>
</Project>
</Workspace>
Dim expected =
<Block>
<Local line="3">
<Type>System.String</Type>
<Name>s</Name>
<Expression>
<MethodCall>
<Expression>
<NameRef variablekind="method">
<Expression>
<ThisReference/>
</Expression>
<Name>Goo</Name>
</NameRef>
</Expression>
<Argument>
<Expression>
<Literal>
<Number type="System.Int32">1</Number>
</Literal>
</Expression>
</Argument>
</MethodCall>
</Expression>
</Local>
</Block>
Test(definition, expected)
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModelMethodXml)>
Public Sub TestVBLocalDeclarations_WithEscapedNameAndAsNewClause()
' Note: The behavior here is different than Dev10 where escaped keywords
' would not be escaped in the generated XML.
Dim definition =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<CompilationOptions RootNamespace="ClassLibrary1"/>
<Document>
Public Class Class1
$$Sub M()
Dim [class] as New Class1
End Sub
End Class
</Document>
</Project>
</Workspace>
Dim expected =
<Block>
<Local line="3">
<Type>ClassLibrary1.Class1</Type>
<Name>[class]</Name>
<Expression>
<NewClass>
<Type>ClassLibrary1.Class1</Type>
</NewClass>
</Expression>
</Local>
</Block>
Test(definition, expected)
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModelMethodXml)>
Public Sub TestVBLocalDeclarations_TwoInferredDeclarators()
Dim definition =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<CompilationOptions RootNamespace="ClassLibrary1"/>
<Document>
Public Class Class1
$$Sub M()
Dim i = 0, j = 1
End Sub
End Class
</Document>
</Project>
</Workspace>
Dim expected =
<Block>
<Local line="3">
<Type>System.Int32</Type>
<Name>i</Name>
<Expression>
<Literal>
<Number type="System.Int32">0</Number>
</Literal>
</Expression>
</Local>
<Local line="3">
<Type>System.Int32</Type>
<Name>j</Name>
<Expression>
<Literal>
<Number type="System.Int32">1</Number>
</Literal>
</Expression>
</Local>
</Block>
Test(definition, expected)
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModelMethodXml)>
Public Sub TestVBLocalDeclarations_StaticLocal()
Dim definition =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<CompilationOptions RootNamespace="ClassLibrary1"/>
<Document>
Public Class Class1
$$Sub M()
Static i As Integer = 1
End Sub
End Class
</Document>
</Project>
</Workspace>
Dim expected =
<Block>
<Local line="3">
<Type>System.Int32</Type>
<Name>i</Name>
<Expression>
<Literal>
<Number type="System.Int32">1</Number>
</Literal>
</Expression>
</Local>
</Block>
Test(definition, expected)
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModelMethodXml)>
Public Sub TestVBLocalDeclarations_ConstLocal()
' NOTE: Dev10 didn't generate *any* XML for Const locals because it walked the
' lowered IL tree. We're now generating the same thing that C# does (which has
' generates a local without the "Const" modifier -- i.e. a bug).
Dim definition =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<CompilationOptions RootNamespace="ClassLibrary1"/>
<Document>
Public Class Class1
$$Sub M()
Const i As Integer = 1
End Sub
End Class
</Document>
</Project>
</Workspace>
Dim expected =
<Block>
<Local line="3">
<Type>System.Int32</Type>
<Name>i</Name>
<Expression>
<Literal>
<Number type="System.Int32">1</Number>
</Literal>
</Expression>
</Local>
</Block>
Test(definition, expected)
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModelMethodXml)>
Public Sub TestVBLocalDeclarations_TwoNamesWithAsNewClause()
Dim definition =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<CompilationOptions RootNamespace="ClassLibrary1"/>
<Document>
Public Class Class1
$$Sub M()
Dim o, n As New Object()
End Sub
End Class
</Document>
</Project>
</Workspace>
Dim expected =
<Block>
<Local line="3">
<Type>System.Object</Type>
<Name>o</Name>
<Expression>
<NewClass>
<Type>System.Object</Type>
</NewClass>
</Expression>
<Name>n</Name>
<Expression>
<NewClass>
<Type>System.Object</Type>
</NewClass>
</Expression>
</Local>
</Block>
Test(definition, expected)
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModelMethodXml)>
Public Sub TestVBLocalDeclarations_ArrayWithNoBoundOrInitializer1()
Dim definition =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<CompilationOptions RootNamespace="ClassLibrary1"/>
<Document>
Public Class Class1
$$Sub M()
Dim i() As Integer
End Sub
End Class
</Document>
</Project>
</Workspace>
Dim expected =
<Block>
<Local line="3">
<ArrayType rank="1">
<Type>System.Int32</Type>
</ArrayType>
<Name>i</Name>
</Local>
</Block>
Test(definition, expected)
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModelMethodXml)>
Public Sub TestVBLocalDeclarations_ArrayWithNoBoundOrInitializer2()
Dim definition =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<CompilationOptions RootNamespace="ClassLibrary1"/>
<Document>
Public Class Class1
$$Sub M()
Dim i As Integer()
End Sub
End Class
</Document>
</Project>
</Workspace>
Dim expected =
<Block>
<Local line="3">
<ArrayType rank="1">
<Type>System.Int32</Type>
</ArrayType>
<Name>i</Name>
</Local>
</Block>
Test(definition, expected)
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModelMethodXml)>
Public Sub TestVBLocalDeclarations_ArrayWithSimpleBound()
Dim definition =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<CompilationOptions RootNamespace="ClassLibrary1"/>
<Document>
Public Class Class1
$$Sub M()
Dim i(4) As Integer
End Sub
End Class
</Document>
</Project>
</Workspace>
Dim expected =
<Block>
<Local line="3">
<ArrayType rank="1">
<Type>System.Int32</Type>
</ArrayType>
<Name>i</Name>
<Expression>
<NewArray>
<ArrayType rank="1">
<Type>System.Int32</Type>
</ArrayType>
<Bound>
<Expression>
<Literal>
<Number type="System.Int32">5</Number>
</Literal>
</Expression>
</Bound>
</NewArray>
</Expression>
</Local>
</Block>
Test(definition, expected)
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModelMethodXml)>
Public Sub TestVBLocalDeclarations_ArrayWithRangeBound()
Dim definition =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<CompilationOptions RootNamespace="ClassLibrary1"/>
<Document>
Public Class Class1
$$Sub M()
Dim i(0 To 4) As Integer
End Sub
End Class
</Document>
</Project>
</Workspace>
Dim expected =
<Block>
<Local line="3">
<ArrayType rank="1">
<Type>System.Int32</Type>
</ArrayType>
<Name>i</Name>
<Expression>
<NewArray>
<ArrayType rank="1">
<Type>System.Int32</Type>
</ArrayType>
<Bound>
<Expression>
<Literal>
<Number type="System.Int32">5</Number>
</Literal>
</Expression>
</Bound>
</NewArray>
</Expression>
</Local>
</Block>
Test(definition, expected)
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModelMethodXml)>
Public Sub TestVBLocalDeclarations_ArrayWithSimpleAndRangeBounds()
Dim definition =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<CompilationOptions RootNamespace="ClassLibrary1"/>
<Document>
Public Class Class1
$$Sub M()
Dim i(3, 0 To 6) As Integer
End Sub
End Class
</Document>
</Project>
</Workspace>
Dim expected =
<Block>
<Local line="3">
<ArrayType rank="2">
<Type>System.Int32</Type>
</ArrayType>
<Name>i</Name>
<Expression>
<NewArray>
<ArrayType rank="2">
<Type>System.Int32</Type>
</ArrayType>
<Bound>
<Expression>
<Literal>
<Number type="System.Int32">4</Number>
</Literal>
</Expression>
</Bound>
<Bound>
<Expression>
<Literal>
<Number type="System.Int32">7</Number>
</Literal>
</Expression>
</Bound>
</NewArray>
</Expression>
</Local>
</Block>
Test(definition, expected)
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModelMethodXml)>
Public Sub TestVBLocalDeclarations_ArrayWithStringBound()
Dim definition =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<CompilationOptions RootNamespace="ClassLibrary1"/>
<Document>
Public Class Class1
$$Sub M()
Dim i("Goo") As Integer
End Sub
End Class
</Document>
</Project>
</Workspace>
Dim expected =
<Block>
<Quote line="3">Dim i("Goo") As Integer</Quote>
</Block>
Test(definition, expected)
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModelMethodXml)>
Public Sub TestVBLocalDeclarations_ArrayWithStringAndCastBound()
Dim definition =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<CompilationOptions RootNamespace="ClassLibrary1"/>
<Document>
Public Class Class1
$$Sub M()
Dim i(CInt("Goo")) As Integer
End Sub
End Class
</Document>
</Project>
</Workspace>
Dim expected =
<Block>
<Quote line="3">Dim i(CInt("Goo")) As Integer</Quote>
</Block>
Test(definition, expected)
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModelMethodXml)>
Public Sub TestVBLocalDeclarations_ArrayWithPropertyAccessBound()
Dim definition =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<CompilationOptions RootNamespace="ClassLibrary1"/>
<Document>
Public Class Class1
$$Sub M()
Dim i("Goo".Length) As Integer
End Sub
End Class
</Document>
</Project>
</Workspace>
Dim expected =
<Block>
<Quote line="3">Dim i("Goo".Length) As Integer</Quote>
</Block>
Test(definition, expected)
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModelMethodXml)>
Public Sub TestVBLocalDeclarations_ArrayWithNoBoundAndCollectionInitializer1()
Dim definition =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<CompilationOptions RootNamespace="ClassLibrary1"/>
<Document>
Public Class Class1
$$Sub M()
Dim i() As Integer = {1, 2, 3}
End Sub
End Class
</Document>
</Project>
</Workspace>
Dim expected =
<Block>
<Local line="3">
<ArrayType rank="1">
<Type>System.Int32</Type>
</ArrayType>
<Name>i</Name>
<Expression>
<NewArray>
<ArrayType rank="1">
<Type>System.Int32</Type>
</ArrayType>
<Bound>
<Expression>
<Literal>
<Number>3</Number>
</Literal>
</Expression>
</Bound>
<Expression>
<Literal>
<Number type="System.Int32">1</Number>
</Literal>
</Expression>
<Expression>
<Literal>
<Number type="System.Int32">2</Number>
</Literal>
</Expression>
<Expression>
<Literal>
<Number type="System.Int32">3</Number>
</Literal>
</Expression>
</NewArray>
</Expression>
</Local>
</Block>
Test(definition, expected)
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModelMethodXml)>
Public Sub TestVBLocalDeclarations_ArrayWithNoBoundAndCollectionInitializer2()
Dim definition =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<CompilationOptions RootNamespace="ClassLibrary1"/>
<Document>
Public Class Class1
$$Sub M()
Dim i As Integer() = {1, 2, 3}
End Sub
End Class
</Document>
</Project>
</Workspace>
Dim expected =
<Block>
<Local line="3">
<ArrayType rank="1">
<Type>System.Int32</Type>
</ArrayType>
<Name>i</Name>
<Expression>
<NewArray>
<ArrayType rank="1">
<Type>System.Int32</Type>
</ArrayType>
<Bound>
<Expression>
<Literal>
<Number>3</Number>
</Literal>
</Expression>
</Bound>
<Expression>
<Literal>
<Number type="System.Int32">1</Number>
</Literal>
</Expression>
<Expression>
<Literal>
<Number type="System.Int32">2</Number>
</Literal>
</Expression>
<Expression>
<Literal>
<Number type="System.Int32">3</Number>
</Literal>
</Expression>
</NewArray>
</Expression>
</Local>
</Block>
Test(definition, expected)
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModelMethodXml)>
Public Sub TestVBLocalDeclarations_InitializeWithStringConcatenation()
Dim definition =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<CompilationOptions RootNamespace="ClassLibrary1"/>
<Document>
Public Class C
$$Sub M()
Dim s = "Text" & "Text"
End Sub
End Class
</Document>
</Project>
</Workspace>
Dim expected =
<Block><Local line="3">
<Type>System.String</Type>
<Name>s</Name>
<Expression>
<BinaryOperation binaryoperator="concatenate">
<Expression>
<Literal>
<String>Text</String>
</Literal>
</Expression>
<Expression>
<Literal>
<String>Text</String>
</Literal>
</Expression>
</BinaryOperation>
</Expression>
</Local>
</Block>
Test(definition, expected)
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModelMethodXml)>
Public Sub TestVBLocalDeclarations_DirectCast()
Dim definition =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<CompilationOptions RootNamespace="ClassLibrary1"/>
<Document>
Public Class C
$$Sub M()
Dim s = DirectCast("Text", String)
End Sub
End Class
</Document>
</Project>
</Workspace>
Dim expected =
<Block><Local line="3">
<Type>System.String</Type>
<Name>s</Name>
<Expression>
<Cast directcast="yes">
<Type>System.String</Type>
<Expression>
<Literal>
<String>Text</String>
</Literal>
</Expression>
</Cast>
</Expression>
</Local>
</Block>
Test(definition, expected)
End Sub
<ConditionalWpfFact(GetType(x86)), Trait(Traits.Feature, Traits.Features.CodeModelMethodXml)>
Public Sub TestVBLocalDeclarations_TryCast()
Dim definition =
<Workspace>
<Project Language="Visual Basic" CommonReferences="true">
<CompilationOptions RootNamespace="ClassLibrary1"/>
<Document>
Public Class C
$$Sub M()
Dim s = TryCast("Text", String)
End Sub
End Class
</Document>
</Project>
</Workspace>
Dim expected =
<Block><Local line="3">
<Type>System.String</Type>
<Name>s</Name>
<Expression>
<Cast trycast="yes">
<Type>System.String</Type>
<Expression>
<Literal>
<String>Text</String>
</Literal>
</Expression>
</Cast>
</Expression>
</Local>
</Block>
Test(definition, expected)
End Sub
End Class
End Namespace
|
Imports System.Collections.Generic
Imports System.IO
Imports Buffer = io.vertx.core.buffer.Buffer
Imports RoutingContext = io.vertx.ext.web.RoutingContext
Imports Slf4j = lombok.extern.slf4j.Slf4j
Imports Persistable = org.deeplearning4j.core.storage.Persistable
Imports StatsStorage = org.deeplearning4j.core.storage.StatsStorage
Imports StatsStorageEvent = org.deeplearning4j.core.storage.StatsStorageEvent
Imports StatsStorageListener = org.deeplearning4j.core.storage.StatsStorageListener
Imports HttpMethod = org.deeplearning4j.ui.api.HttpMethod
Imports Route = org.deeplearning4j.ui.api.Route
Imports UIModule = org.deeplearning4j.ui.api.UIModule
Imports I18NResource = org.deeplearning4j.ui.i18n.I18NResource
Imports ConvolutionListenerPersistable = org.deeplearning4j.ui.model.weights.ConvolutionListenerPersistable
'
' * ******************************************************************************
' * *
' * *
' * * This program and the accompanying materials are made available under the
' * * terms of the Apache License, Version 2.0 which is available at
' * * https://www.apache.org/licenses/LICENSE-2.0.
' * *
' * * See the NOTICE file distributed with this work for additional
' * * information regarding copyright ownership.
' * * Unless required by applicable law or agreed to in writing, software
' * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
' * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
' * * License for the specific language governing permissions and limitations
' * * under the License.
' * *
' * * SPDX-License-Identifier: Apache-2.0
' * *****************************************************************************
'
Namespace org.deeplearning4j.ui.module.convolutional
'JAVA TO VB CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
'ORIGINAL LINE: @Slf4j public class ConvolutionalListenerModule implements org.deeplearning4j.ui.api.UIModule
Public Class ConvolutionalListenerModule
Implements UIModule
Private Const TYPE_ID As String = "ConvolutionalListener"
Private lastStorage As StatsStorage
Private lastSessionID As String
Private lastWorkerID As String
Private lastTimeStamp As Long
Public Overridable ReadOnly Property CallbackTypeIDs As IList(Of String) Implements UIModule.getCallbackTypeIDs
Get
Return Collections.singletonList(TYPE_ID)
End Get
End Property
Public Overridable ReadOnly Property Routes As IList(Of Route) Implements UIModule.getRoutes
Get
Dim r As New Route("/activations", HttpMethod.GET, Function(path, rc) rc.response().sendFile("templates/Activations.html"))
Dim r2 As New Route("/activations/data", HttpMethod.GET, Sub(path, rc) Me.getImage(rc))
Return New List(Of Route) From {r, r2}
End Get
End Property
Public Overridable Sub reportStorageEvents(ByVal events As ICollection(Of StatsStorageEvent)) Implements UIModule.reportStorageEvents
SyncLock Me
For Each sse As StatsStorageEvent In events
If TYPE_ID.Equals(sse.getTypeID()) AndAlso sse.getEventType() = StatsStorageListener.EventType.PostStaticInfo Then
If sse.getTimestamp() > lastTimeStamp Then
lastStorage = sse.getStatsStorage()
lastSessionID = sse.getSessionID()
lastWorkerID = sse.getWorkerID()
lastTimeStamp = sse.getTimestamp()
End If
End If
Next sse
End SyncLock
End Sub
Public Overridable Sub onAttach(ByVal statsStorage As StatsStorage) Implements UIModule.onAttach
'No-op
End Sub
Public Overridable Sub onDetach(ByVal statsStorage As StatsStorage) Implements UIModule.onDetach
'No-op
End Sub
Public Overridable ReadOnly Property InternationalizationResources As IList(Of I18NResource) Implements UIModule.getInternationalizationResources
Get
Return Collections.emptyList()
End Get
End Property
Private Sub getImage(ByVal rc As RoutingContext)
If lastTimeStamp > 0 AndAlso lastStorage IsNot Nothing Then
Dim p As Persistable = lastStorage.getStaticInfo(lastSessionID, TYPE_ID, lastWorkerID)
If TypeOf p Is ConvolutionListenerPersistable Then
Dim clp As ConvolutionListenerPersistable = DirectCast(p, ConvolutionListenerPersistable)
Dim bi As BufferedImage = clp.getImg()
Dim baos As New MemoryStream()
Try
ImageIO.write(bi, "png", baos)
Catch e As IOException
log.warn("Error displaying image", e)
End Try
rc.response().putHeader("content-type", "image/png").end(Buffer.buffer(baos.toByteArray()))
Else
rc.response().putHeader("content-type", "image/png").end(Buffer.buffer(New SByte(){}))
End If
Else
rc.response().putHeader("content-type", "image/png").end(Buffer.buffer(New SByte(){}))
End If
End Sub
End Class
End Namespace |
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Partial Public Class Login
'''<summary>
'''main_loginl1 control.
'''</summary>
'''<remarks>
'''Auto-generated field.
'''To modify move field declaration from designer file to code-behind file.
'''</remarks>
Protected WithEvents main_loginl1 As Global.BSAP_UI_WebForms.main_loginl
End Class
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class Form1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.Button1 = New System.Windows.Forms.Button()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.SuspendLayout()
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(86, 105)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(124, 23)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Redefinição do título"
Me.Button1.UseVisualStyleBackColor = True
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(97, 50)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(100, 20)
Me.TextBox1.TabIndex = 1
'
'Form1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(284, 261)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Button1)
Me.Name = "Form1"
Me.Text = "Form1"
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents Button1 As Button
Friend WithEvents TextBox1 As TextBox
End Class
|
Imports System
Imports System.Threading.Tasks
Imports System.Collections.Generic
Imports System.Numerics
Imports Nethereum.Hex.HexTypes
Imports Nethereum.ABI.FunctionEncoding.Attributes
Namespace StandardToken.MyContractName.DTOs
<[Event]("Approval")>
Public Class ApprovalEventDTO
<[Parameter]("address", "_owner", 1, true)>
Public Property Owner As String
<[Parameter]("address", "_spender", 2, true)>
Public Property Spender As String
<[Parameter]("uint256", "_value", 3, false)>
Public Property Value As BigInteger
End Class
End Namespace
|
Public Class FeatureSchema
Public Property Name As String = ""
Public Property Type As String = ""
Public Property abstract As Boolean = False
Public Property substitutionGroup As String = ""
End Class |
Imports System.Data
Imports cusAplicacion
Partial Class rCotizaciones_dMes
Inherits vis2Formularios.frmReporte
Dim loObjetoReporte As CrystalDecisions.CrystalReports.Engine.ReportDocument
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
Dim lcParametro0Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(0), goServicios.enuOpcionesRedondeo.KN_FechaInicioDelDia)
Dim lcParametro0Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(0), goServicios.enuOpcionesRedondeo.KN_FechaFinDelDia)
Dim lcParametro1Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(1))
Dim lcParametro1Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(1))
Dim lcParametro2Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(2))
Dim lcParametro2Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(2))
Dim lcParametro3Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(3))
Dim lcParametro3Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(3))
Dim lcParametro4Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(4))
Dim lcParametro4Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(4))
Dim lcParametro5Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(5))
Dim lcParametro5Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(5))
Dim lcParametro6Desde As String = goServicios.mObtenerListaFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(6))
Dim lcOrdenamiento As String = cusAplicacion.goReportes.pcOrden
Dim lcComandoSeleccionar As New StringBuilder()
lcComandoSeleccionar.AppendLine(" SELECT SUBSTRING(departamentos.nom_dep,0,30) as nom_dep, ")
lcComandoSeleccionar.AppendLine(" sum(case when DatePart(MONTH,cotizaciones.Fec_Ini) = 1 then renglones_cotizaciones.can_art1 else 0 end ) as ped_ene, ")
lcComandoSeleccionar.AppendLine(" Sum(Case when DatePart(MONTH,cotizaciones.Fec_Ini) = 2 Then renglones_cotizaciones.can_art1 Else 0 End) As ped_feb, ")
lcComandoSeleccionar.AppendLine(" Sum(Case when DatePart(MONTH,cotizaciones.Fec_Ini) = 3 Then renglones_cotizaciones.can_art1 Else 0 End) As ped_mar, ")
lcComandoSeleccionar.AppendLine(" Sum(Case when DatePart(MONTH,cotizaciones.Fec_Ini) = 4 Then renglones_cotizaciones.can_art1 Else 0 End) As ped_abr, ")
lcComandoSeleccionar.AppendLine(" Sum(Case when DatePart(MONTH,cotizaciones.Fec_Ini) = 5 Then renglones_cotizaciones.can_art1 Else 0 End) As ped_may, ")
lcComandoSeleccionar.AppendLine(" Sum(Case when DatePart(MONTH,cotizaciones.Fec_Ini) = 6 Then renglones_cotizaciones.can_art1 Else 0 End) As ped_jun, ")
lcComandoSeleccionar.AppendLine(" Sum(Case when DatePart(MONTH,cotizaciones.Fec_Ini) = 7 Then renglones_cotizaciones.can_art1 Else 0 End) As ped_jul, ")
lcComandoSeleccionar.AppendLine(" Sum(Case when DatePart(MONTH,cotizaciones.Fec_Ini) = 8 Then renglones_cotizaciones.can_art1 Else 0 End) As ped_ago, ")
lcComandoSeleccionar.AppendLine(" Sum(Case when DatePart(MONTH,cotizaciones.Fec_Ini) = 9 Then renglones_cotizaciones.can_art1 Else 0 End) As ped_sep, ")
lcComandoSeleccionar.AppendLine(" Sum(Case when DatePart(MONTH,cotizaciones.Fec_Ini) = 10 Then renglones_cotizaciones.can_art1 Else 0 End) As ped_oct, ")
lcComandoSeleccionar.AppendLine(" Sum(Case when DatePart(MONTH,cotizaciones.Fec_Ini) = 11 Then renglones_cotizaciones.can_art1 Else 0 End) As ped_nov, ")
lcComandoSeleccionar.AppendLine(" Sum(Case when DatePart(MONTH,cotizaciones.Fec_Ini) = 12 Then renglones_cotizaciones.can_art1 Else 0 End) As ped_dic ")
lcComandoSeleccionar.AppendLine("into #temporal ")
lcComandoSeleccionar.AppendLine("from renglones_cotizaciones, cotizaciones, articulos, departamentos ")
lcComandoSeleccionar.AppendLine(" WHERE ")
lcComandoSeleccionar.AppendLine(" cotizaciones.documento=renglones_cotizaciones.documento ")
lcComandoSeleccionar.AppendLine(" AND departamentos.cod_dep=articulos.cod_dep ")
lcComandoSeleccionar.AppendLine(" AND renglones_cotizaciones.cod_art = articulos.cod_art ")
lcComandoSeleccionar.AppendLine(" AND articulos.cod_dep = departamentos.cod_dep ")
lcComandoSeleccionar.AppendLine(" AND cotizaciones.fec_ini Between " & lcParametro0Desde)
lcComandoSeleccionar.AppendLine(" AND " & lcParametro0Hasta)
lcComandoSeleccionar.AppendLine(" AND articulos.cod_art Between " & lcParametro1Desde)
lcComandoSeleccionar.AppendLine(" AND " & lcParametro1Hasta)
lcComandoSeleccionar.AppendLine(" AND cotizaciones.cod_cli Between " & lcParametro2Desde)
lcComandoSeleccionar.AppendLine(" AND " & lcParametro2Hasta)
lcComandoSeleccionar.AppendLine(" AND cotizaciones.cod_ven Between " & lcParametro3Desde)
lcComandoSeleccionar.AppendLine(" AND " & lcParametro3Hasta)
lcComandoSeleccionar.AppendLine(" AND articulos.cod_dep Between " & lcParametro4Desde)
lcComandoSeleccionar.AppendLine(" AND " & lcParametro4Hasta)
lcComandoSeleccionar.AppendLine(" AND articulos.cod_art Between " & lcParametro5Desde)
lcComandoSeleccionar.AppendLine(" AND " & lcParametro5Hasta)
lcComandoSeleccionar.AppendLine(" AND cotizaciones.status IN (" & lcParametro6Desde & ")")
lcComandoSeleccionar.AppendLine("GROUP BY departamentos.nom_dep ")
lcComandoSeleccionar.AppendLine("select nom_dep, ")
lcComandoSeleccionar.AppendLine(" ped_ene, ")
lcComandoSeleccionar.AppendLine(" ped_feb, ")
lcComandoSeleccionar.AppendLine(" ped_mar, ")
lcComandoSeleccionar.AppendLine(" ped_abr, ")
lcComandoSeleccionar.AppendLine(" ped_may, ")
lcComandoSeleccionar.AppendLine(" ped_jun, ")
lcComandoSeleccionar.AppendLine(" ped_jul, ")
lcComandoSeleccionar.AppendLine(" ped_ago, ")
lcComandoSeleccionar.AppendLine(" ped_sep, ")
lcComandoSeleccionar.AppendLine(" ped_oct, ")
lcComandoSeleccionar.AppendLine(" ped_nov, ")
lcComandoSeleccionar.AppendLine(" ped_dic, ")
lcComandoSeleccionar.AppendLine(" (ped_ene+ped_feb+ped_mar+ped_abr+ped_may+ped_jun+ped_jul+ped_ago+ped_sep+ped_oct+ped_nov+ped_dic)as total ")
lcComandoSeleccionar.AppendLine(" from #temporal ")
lcComandoSeleccionar.AppendLine("ORDER BY " & lcOrdenamiento)
'lcComandoSeleccionar.AppendLine("ORDER BY nom_dep ")
Dim loServicios As New cusDatos.goDatos
Dim laDatosReporte As DataSet = loServicios.mObtenerTodosSinEsquema(lcComandoSeleccionar.ToString, "curReportes")
loObjetoReporte = cusAplicacion.goReportes.mCargarReporte("rCotizaciones_dMes", laDatosReporte)
Me.mTraducirReporte(loObjetoReporte)
Me.mFormatearCamposReporte(loObjetoReporte)
Me.crvrCotizaciones_dMes.ReportSource = loObjetoReporte
Catch loExcepcion As Exception
Me.WbcAdministradorMensajeModal.mMostrarMensajeModal("Error", _
"No se pudo Completar el Proceso: " & loExcepcion.Message, _
vis3Controles.wbcAdministradorMensajeModal.enumTipoMensaje.KN_Error, _
"auto", _
"auto")
End Try
End Sub
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
Try
loObjetoReporte.Close()
Catch loExcepcion As Exception
End Try
End Sub
End Class
'-------------------------------------------------------------------------------------------'
' Fin del codigo
'-------------------------------------------------------------------------------------------'
' YJP: 11/05/09: Codigo inicial
'-------------------------------------------------------------------------------------------'
' MAT: 16/02/11: Rediseño de la vista del reporte.
'-------------------------------------------------------------------------------------------'
|
Partial Class TabelDokter
Inherits System.Web.UI.Page
Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim dokteradapter As New DataSetDokterTableAdapters.dokterTableAdapter
dokteradapter.Insert(nama_dokter.Text, jenis_kelamin.Text, spesialis.Text, kontak.Text, status.Text)
dokter.Visible = True
dokter.DataSource = dokteradapter.GetDataDokter()
Response.Redirect("TabelRegis.aspx")
End Sub
End Class
|
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("FichaVBNET_ex4")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("FichaVBNET_ex4")>
<Assembly: AssemblyCopyright("Copyright © 2016")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("bde413dc-2c9d-474f-835a-817f40829dea")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
Public Class UC_LiteEditor
Inherits System.Web.UI.UserControl
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
End Sub
End Class |
'------------------------------------------------------------------------------
' <auto-generated>
' Este código se generó a partir de una plantilla.
'
' Los cambios manuales en este archivo pueden causar un comportamiento inesperado de la aplicación.
' Los cambios manuales en este archivo se sobrescribirán si se regenera el código.
' </auto-generated>
'------------------------------------------------------------------------------
Imports System
Imports System.Data.Entity
Imports System.Data.Entity.Infrastructure
Namespace TomaFisica.Entities
Partial Public Class ITSEntities
Inherits DbContext
Public Sub New()
MyBase.New("name=ITSEntities")
End Sub
Protected Overrides Sub OnModelCreating(modelBuilder As DbModelBuilder)
Throw New UnintentionalCodeFirstException()
End Sub
Public Overridable Property FISICO_DETALLE() As DbSet(Of FISICO_DETALLE)
Public Overridable Property FISICO_MAESTRO() As DbSet(Of FISICO_MAESTRO)
End Class
End Namespace
|
Option Explicit On
Option Strict On
Option Infer On
#Region " --------------->> Imports/ usings "
Imports System.Text
#End Region
Namespace Cryptography.Hashes
''' <summary>
''' Copyright (c) 2000 Oren Novotny ([email protected])
''' Permission is granted to use this code for anything.
''' Derived from the RSA Data Security, Inc. MD4 Message-Digest Algorithm.
''' http://www.rsasecurity.com">RSA Data Security, Inc. requires
''' attribution for any work that is derived from the MD4 Message-Digest
''' Algorithm; for details see http://www.roxen.com/rfc/rfc1320.html.
''' This code is ported from Norbert Hranitzky'''s
''' ([email protected])
''' Java version.
''' Copyright (c) 2008 Luca Mauri (http://www.lucamauri.com)
''' The orginal version found at http://www.derkeiler.com/Newsgroups/microsoft.public.dotnet.security/2004-08/0004.html
''' was not working. I corrected and modified it so the current version is
''' now calculating proper MD4 checksum.
''' Implements the MD4 message digest algorithm in VB.Net
''' Ronald L. Rivest,
''' http://www.roxen.com/rfc/rfc1320.html
''' The MD4 Message-Digest Algorithm
''' IETF RFC-1320 (informational).
''' </summary>
''' <remarks></remarks>
Public Class MD4Hash
#Region " --------------->> Enumerationen der Klasse "
#End Region
#Region " --------------->> Eigenschaften der Klasse "
Private Const _blockLength As Int32 = 64 ' = 512 / 8
Private _context(4 - 1) As UInt32
Private _count As Int64
Private _buffer(_blockLength - 1) As Byte
Private _x(16 - 1) As UInt32
#End Region
#Region " --------------->> Konstruktor und Destruktor der Klasse "
Public Sub New()
EngineReset()
End Sub
' This constructor is here to implement the clonability of this class
Private Sub New(ByVal md As MD4Hash)
Initialize(md)
End Sub
Private Sub Initialize(ByVal md As MD4Hash)
_context = CType(md._context.Clone(), UInt32())
_buffer = CType(md._buffer.Clone(), Byte())
_count = md._count
End Sub
#End Region
#Region " --------------->> Zugriffsmethoden der Klasse "
#End Region
#Region " --------------->> Ereignismethoden Methoden der Klasse "
#End Region
#Region " --------------->> Private Methoden der Klasse "
''' <summary>
''' Resets this object disregarding any temporary data present at the
''' time of the invocation of this call.
''' </summary>
Private Sub EngineReset()
_context = New UInt32() {1732584193, 4023233417, 2562383102, 271733878}
_count = 0
For i = 0 To _blockLength - 1
_buffer(i) = 0
Next i
End Sub
''' <summary>
''' Continues an MD4 message digest using the input byte
''' </summary>
''' <param name="b">byte to input</param>
Private Sub EngineUpdate(ByVal b As Byte)
' compute number of bytes still unhashed; ie. present in buffer
Dim i = Convert.ToInt32(_count Mod _blockLength)
_count += 1 ' update number of bytes
_buffer(i) = b
If i = (_blockLength - 1) Then Transform(_buffer, 0)
End Sub
''' <summary>
''' MD4 block update operation
''' Continues an MD4 message digest operation by filling the buffer,
''' transform(ing) data in 512-bit message block(s), updating the variables
''' context and count, and leaving (buffering) the remaining bytes in buffer
''' for the next update or finish.
''' </summary>
''' <param name="input">input block</param>
''' <param name="offset">start of meaningful bytes in input</param>
''' <param name="len">count of bytes in input blcok to consider</param>
Private Sub EngineUpdate(ByVal input() As Byte, ByVal offset As Int32, ByVal len As Int32)
' make sure we don't exceed input's allocated size/length
If ((offset < 0) OrElse (len < 0) OrElse (offset + len > input.Length)) Then
Throw New ArgumentOutOfRangeException()
End If
' compute number of bytes still unhashed; ie. present in buffer
Dim bufferNdx = Convert.ToInt32(_count Mod _blockLength)
_count += len ' update number of bytes
Dim partLen = (_blockLength - bufferNdx)
Dim i = 0
If len >= partLen Then
Array.Copy(input, offset + i, _buffer, bufferNdx, partLen)
Transform(_buffer, 0)
i = partLen
While (i + _blockLength - 1) < len
Transform(input, offset + i)
i += _blockLength
End While
bufferNdx = 0
End If
' buffer remaining input
If i < len Then Array.Copy(input, offset + i, _buffer, bufferNdx, len - i)
End Sub
''' <summary>
''' Completes the hash computation by performing final operations
''' such as padding. At the return of this engineDigest, the MD
''' engine is reset.
''' </summary>
''' <returns>returns the array of bytes for the resulting hash value.</returns>
Private Function EngineDigest() As Byte()
' pad output to 56 mod 64; as RFC1320 puts it: congruent to 448 mod 512
Dim bufferNdx = Convert.ToInt32(_count Mod _blockLength)
Dim padLen As Int32
padLen = If(bufferNdx < 56, 56, 120) - bufferNdx
' padding is always binary 1 followed by binary 0's
Dim tail(padLen + 8 - 1) As Byte
tail(0) = Convert.ToByte(128)
' append length before final transform
' save number of bits, casting the long to an array of 8 bytes
' save low-order byte first.
Dim tempArray As Byte()
tempArray = BitConverter.GetBytes(_count * 8)
tempArray.CopyTo(tail, padLen)
EngineUpdate(tail, 0, tail.Length)
Dim result(16 - 1) As Byte
For i = 0 To 3
Dim tempStore(4 - 1) As Byte
tempStore = BitConverter.GetBytes(_context(i))
tempStore.CopyTo(result, i * 4)
Next i
' reset the engine
EngineReset()
Return result
End Function
Private Shared Function BytesToHex(ByVal a() As Byte, ByVal len As Int32) As String
Dim temp = BitConverter.ToString(a)
' We need to remove the dashes that come from the BitConverter
' This should be the final size
Dim sb = New StringBuilder(Convert.ToInt32((len - 2) / 2))
For i = 0 To temp.Length - 1 Step 1
If temp(i) <> "-" Then sb.Append(temp(i))
Next i
Return sb.ToString()
End Function
''' <summary>
''' MD4 basic transformation
''' Transforms context based on 512 bits from input block starting
''' from the offset'th byte.
''' </summary>
''' <param name="block">input sub-array</param>
''' <param name="offset">starting position of sub-array</param>
Private Sub Transform(ByRef block() As Byte, ByVal offset As Int32)
' decodes 64 bytes from input block into an array of 16 32-bit
' entities. Use A as a temp var.
For i = 0 To 15 Step 1
If offset >= block.Length Then Exit For
_x(i) = Convert.ToUInt32((Convert.ToUInt32(block(offset + 0)) And 255) _
Or (Convert.ToUInt32(block(offset + 1)) And 255) << 8 _
Or (Convert.ToUInt32(block(offset + 2)) And 255) << 16 _
Or (Convert.ToUInt32(block(offset + 3)) And 255) << 24)
offset += 4
Next i
Dim a = _context(0)
Dim b = _context(1)
Dim c = _context(2)
Dim d = _context(3)
a = FF(a, b, c, d, _x(0), 3)
d = FF(d, a, b, c, _x(1), 7)
c = FF(c, d, a, b, _x(2), 11)
b = FF(b, c, d, a, _x(3), 19)
a = FF(a, b, c, d, _x(4), 3)
d = FF(d, a, b, c, _x(5), 7)
c = FF(c, d, a, b, _x(6), 11)
b = FF(b, c, d, a, _x(7), 19)
a = FF(a, b, c, d, _x(8), 3)
d = FF(d, a, b, c, _x(9), 7)
c = FF(c, d, a, b, _x(10), 11)
b = FF(b, c, d, a, _x(11), 19)
a = FF(a, b, c, d, _x(12), 3)
d = FF(d, a, b, c, _x(13), 7)
c = FF(c, d, a, b, _x(14), 11)
b = FF(b, c, d, a, _x(15), 19)
a = GG(a, b, c, d, _x(0), 3)
d = GG(d, a, b, c, _x(4), 5)
c = GG(c, d, a, b, _x(8), 9)
b = GG(b, c, d, a, _x(12), 13)
a = GG(a, b, c, d, _x(1), 3)
d = GG(d, a, b, c, _x(5), 5)
c = GG(c, d, a, b, _x(9), 9)
b = GG(b, c, d, a, _x(13), 13)
a = GG(a, b, c, d, _x(2), 3)
d = GG(d, a, b, c, _x(6), 5)
c = GG(c, d, a, b, _x(10), 9)
b = GG(b, c, d, a, _x(14), 13)
a = GG(a, b, c, d, _x(3), 3)
d = GG(d, a, b, c, _x(7), 5)
c = GG(c, d, a, b, _x(11), 9)
b = GG(b, c, d, a, _x(15), 13)
a = HH(a, b, c, d, _x(0), 3)
d = HH(d, a, b, c, _x(8), 9)
c = HH(c, d, a, b, _x(4), 11)
b = HH(b, c, d, a, _x(12), 15)
a = HH(a, b, c, d, _x(2), 3)
d = HH(d, a, b, c, _x(10), 9)
c = HH(c, d, a, b, _x(6), 11)
b = HH(b, c, d, a, _x(14), 15)
a = HH(a, b, c, d, _x(1), 3)
d = HH(d, a, b, c, _x(9), 9)
c = HH(c, d, a, b, _x(5), 11)
b = HH(b, c, d, a, _x(13), 15)
a = HH(a, b, c, d, _x(3), 3)
d = HH(d, a, b, c, _x(11), 9)
c = HH(c, d, a, b, _x(7), 11)
b = HH(b, c, d, a, _x(15), 15)
_context(0) = TruncateHex(Convert.ToUInt64(_context(0) + Convert.ToInt64(a)))
_context(1) = TruncateHex(Convert.ToUInt64(_context(1) + Convert.ToInt64(b)))
_context(2) = TruncateHex(Convert.ToUInt64(_context(2) + Convert.ToInt64(c)))
_context(3) = TruncateHex(Convert.ToUInt64(_context(3) + Convert.ToInt64(d)))
End Sub
Private Function FF _
(ByVal a As UInt32 _
, ByVal b As UInt32 _
, ByVal c As UInt32 _
, ByVal d As UInt32 _
, ByVal x As UInt32 _
, ByVal s As Int32) As UInt32
Dim t As UInt32
Try
t = TruncateHex(Convert.ToUInt64(TruncateHex(Convert.ToUInt64(Convert.ToInt64(a) _
+ ((b And c) Or ((Not b) And d)))) + Convert.ToInt64(x)))
Return (t << s) Or (t >> (32 - s))
Catch ex As Exception
Return (t << s) Or (t >> (32 - s))
End Try
End Function
Private Function GG _
(ByVal a As UInt32 _
, ByVal b As UInt32 _
, ByVal c As UInt32 _
, ByVal d As UInt32 _
, ByVal x As UInt32 _
, ByVal s As Int32) As UInt32
Dim t As UInt32
Try
t = TruncateHex(CULng(TruncateHex(Convert.ToUInt64(Convert.ToInt64(a) _
+ ((b And (c Or d)) Or (c And d)))) + Convert.ToInt64(x) + 1518500249)) '&H5A827999
Return t << s Or t >> (32 - s)
Catch
Return t << s Or t >> (32 - s)
End Try
End Function
Private Function HH _
(ByVal a As UInt32 _
, ByVal b As UInt32 _
, ByVal c As UInt32 _
, ByVal d As UInt32 _
, ByVal x As UInt32 _
, ByVal s As Int32) As UInt32
Dim t As UInt32
Try
t = TruncateHex(Convert.ToUInt64(TruncateHex _
(Convert.ToUInt64(Convert.ToInt64(a) + (b Xor c Xor d))) _
+ Convert.ToInt64(x) + 1859775393)) '&H6ED9EBA1
Return t << s Or t >> (32 - s)
Catch
Return t << s Or t >> (32 - s)
End Try
End Function
Private Function TruncateHex(ByVal number64 As UInt64) As UInt32
Dim hexString = number64.ToString("x")
Dim hexStringLimited = If(hexString.Length < 8 _
, hexString.PadLeft(8, Convert.ToChar("0")), hexString.Substring(hexString.Length - 8))
Return UInt32.Parse(hexStringLimited, Globalization.NumberStyles.HexNumber)
End Function
#End Region
#Region " --------------->> Öffentliche Methoden der Klasse "
Public Function Clone() As Object
Return New MD4Hash(Me)
End Function
''' <summary>Returns a byte hash from a string</summary>
''' <param name="s">string to hash</param>
''' <returns>returns byte-array that contains the hash</returns>
Public Function GetByteHashFromString(ByVal s As String) As Byte()
Dim b = Encoding.UTF8.GetBytes(s)
Dim md4 = New MD4Hash()
md4.EngineUpdate(b, 0, b.Length)
Return md4.EngineDigest()
End Function
''' <summary>Returns a binary hash from an input byte array</summary>
''' <param name="b">byte-array to hash</param>
''' <returns>returns binary hash of input</returns>
Public Function GetByteHashFromBytes(ByVal b() As Byte) As Byte()
Dim md4 = New MD4Hash()
md4.EngineUpdate(b, 0, b.Length)
Return md4.EngineDigest()
End Function
''' <summary>Returns a string that contains the hexadecimal hash</summary>
''' <param name="b">byte-array to input</param>
''' <returns>returns String that contains the hex of the hash</returns>
Public Function GetHexHashFromBytes(ByVal b() As Byte) As String
Dim e = GetByteHashFromBytes(b)
Return BytesToHex(e, e.Length)
End Function
''' <summary>Returns a byte hash from the input byte</summary>
''' <param name="b">byte to hash</param>
''' <returns>returns binary hash of the input byte</returns>
Public Function GetByteHashFromByte(ByVal b As Byte) As Byte()
Dim md4 = New MD4Hash()
md4.EngineUpdate(b)
Return md4.EngineDigest()
End Function
''' <summary>Returns a string that contains the hexadecimal hash</summary>
''' <param name="b">byte to hash</param>
''' <returns>returns String that contains the hex of the hash</returns>
Public Function GetHexHashFromByte(ByVal b As Byte) As String
Dim e = GetByteHashFromByte(b)
Return BytesToHex(e, e.Length)
End Function
''' <summary>Returns a string that contains the hexadecimal hash</summary>
''' <param name="s">string to hash</param>
''' <returns>returns String that contains the hex of the hash</returns>
Public Function GetHexHashFromString(ByVal s As String) As String
Dim b = GetByteHashFromString(s)
Return BytesToHex(b, b.Length)
End Function
#End Region
End Class
End Namespace
|
Public Partial Class AccordionTest
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Accordion1.ActivePaneIndex = 1
End Sub
Protected Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim i = 0
End Sub
End Class |
Imports System.Data
Partial Class PAS_rTrabajadores
Inherits vis2formularios.frmReporte
Dim loObjetoReporte As CrystalDecisions.CrystalReports.Engine.ReportDocument
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim lcParametro0Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(0))
Dim lcParametro0Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(0))
Dim lcParametro1Desde As String = goServicios.mObtenerListaFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(1))
Dim lcParametro2Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(2))
Dim lcParametro2Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(2))
Dim lcParametro3Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(3))
Dim lcParametro3Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(3))
Dim lcParametro4Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(4))
Dim lcParametro4Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(4))
Dim lcParametro5Desde As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosIniciales(5), goServicios.enuOpcionesRedondeo.KN_FechaInicioDelDia)
Dim lcParametro5Hasta As String = goServicios.mObtenerCampoFormatoSQL(cusAplicacion.goReportes.paParametrosFinales(5), goServicios.enuOpcionesRedondeo.KN_FechaFinDelDia)
Dim lcOrdenamiento As String = cusAplicacion.goReportes.pcOrden
Dim lcComandoSeleccionar As New StringBuilder()
Try
lcComandoSeleccionar.AppendLine("DECLARE @CodTra_Fin AS VARCHAR(15);")
lcComandoSeleccionar.AppendLine("DECLARE @CodTra_Ini AS VARCHAR(15);")
lcComandoSeleccionar.AppendLine("DECLARE @Contrato_Ini AS VARCHAR(2);")
lcComandoSeleccionar.AppendLine("DECLARE @Contrato_Fin AS VARCHAR(2);")
lcComandoSeleccionar.AppendLine("DECLARE @Dep_Ini AS VARCHAR(3);")
lcComandoSeleccionar.AppendLine("DECLARE @Dep_Fin AS VARCHAR(3);")
lcComandoSeleccionar.AppendLine("DECLARE @Cargo_Ini AS VARCHAR(10);")
lcComandoSeleccionar.AppendLine("DECLARE @Cargo_Fin AS VARCHAR(10);")
lcComandoSeleccionar.AppendLine("DECLARE @Fecha_Ini AS DATETIME;")
lcComandoSeleccionar.AppendLine("DECLARE @Fecha_Fin AS DATETIME;")
lcComandoSeleccionar.AppendLine("")
lcComandoSeleccionar.AppendLine("SET @CodTra_Ini = " & lcParametro0Desde)
lcComandoSeleccionar.AppendLine("SET @CodTra_Fin = " & lcParametro0Hasta)
lcComandoSeleccionar.AppendLine("SET @Contrato_Ini = " & lcParametro2Desde)
lcComandoSeleccionar.AppendLine("SET @Contrato_Fin = " & lcParametro2Hasta)
lcComandoSeleccionar.AppendLine("SET @Dep_Ini = " & lcParametro3Desde)
lcComandoSeleccionar.AppendLine("SET @Dep_Fin = " & lcParametro3Hasta)
lcComandoSeleccionar.AppendLine("SET @Cargo_Ini = " & lcParametro4Desde)
lcComandoSeleccionar.AppendLine("SET @Cargo_Fin = " & lcParametro4Hasta)
lcComandoSeleccionar.AppendLine("SET @Fecha_Ini = " & lcParametro5Desde)
lcComandoSeleccionar.AppendLine("SET @Fecha_Fin = " & lcParametro5Hasta)
lcComandoSeleccionar.AppendLine("")
lcComandoSeleccionar.AppendLine("SELECT DISTINCT ")
lcComandoSeleccionar.AppendLine(" Trabajadores.Rif AS Cod_Tra,")
lcComandoSeleccionar.AppendLine(" Trabajadores.Nom_Tra AS Nom_Tra,")
lcComandoSeleccionar.AppendLine(" Cargos.Nom_Car AS Cargo,")
lcComandoSeleccionar.AppendLine(" Trabajadores.Fec_Ini AS Ingreso,")
lcComandoSeleccionar.AppendLine(" Renglones_Recibos.Mon_Net AS Sueldo,")
lcComandoSeleccionar.AppendLine(" Trabajadores.Status AS Status,")
lcComandoSeleccionar.AppendLine(" @Fecha_Ini AS Desde,")
lcComandoSeleccionar.AppendLine(" @Fecha_Fin AS Hasta")
lcComandoSeleccionar.AppendLine("FROM Recibos")
lcComandoSeleccionar.AppendLine(" JOIN Renglones_Recibos ON Recibos.Documento = Renglones_Recibos.Documento")
lcComandoSeleccionar.AppendLine(" JOIN Trabajadores ON Trabajadores.Cod_Tra = Recibos.Cod_Tra")
lcComandoSeleccionar.AppendLine(" JOIN Contratos ON Trabajadores.Cod_Con = Contratos.Cod_Con")
lcComandoSeleccionar.AppendLine(" JOIN Departamentos_Nomina ON Departamentos_Nomina.Cod_Dep = Trabajadores.Cod_Dep")
lcComandoSeleccionar.AppendLine(" JOIN Cargos ON Cargos.Cod_Car = Trabajadores.Cod_Car")
lcComandoSeleccionar.AppendLine("WHERE Recibos.Fecha >= @Fecha_Ini AND Recibos.Fecha < DATEADD(dd, DATEDIFF(dd, 0, @Fecha_Fin) + 1, 0)")
lcComandoSeleccionar.AppendLine(" AND Renglones_Recibos.Cod_Con = 'Q024'")
lcComandoSeleccionar.AppendLine(" AND Trabajadores.Cod_Tra BETWEEN @CodTra_Ini AND @CodTra_Fin")
lcComandoSeleccionar.AppendLine(" AND Contratos.Cod_Con BETWEEN @Contrato_Ini AND @Contrato_Fin")
lcComandoSeleccionar.AppendLine(" AND Departamentos_Nomina.Cod_Dep BETWEEN @Dep_Ini AND @Dep_Fin")
lcComandoSeleccionar.AppendLine(" AND Cargos.Cod_Car BETWEEN @Cargo_Ini AND @Cargo_Fin")
lcComandoSeleccionar.AppendLine(" AND Trabajadores.Status IN (" & lcParametro1Desde & " )")
lcComandoSeleccionar.AppendLine("ORDER BY Trabajadores.Rif, Trabajadores.Nom_Tra")
'Me.mEscribirConsulta(lcComandoSeleccionar.ToString())
Dim loServicios As New cusDatos.goDatos
Dim laDatosReporte As DataSet = loServicios.mObtenerTodosSinEsquema(lcComandoSeleccionar.ToString, "curReportes")
Me.mCargarLogoEmpresa(laDatosReporte.Tables(0), "LogoEmpresa")
loObjetoReporte = cusAplicacion.goReportes.mCargarReporte("PAS_rTrabajadores", laDatosReporte)
Me.mTraducirReporte(loObjetoReporte)
Me.mFormatearCamposReporte(loObjetoReporte)
Me.crvPAS_rTrabajadores.ReportSource = loObjetoReporte
Catch loExcepcion As Exception
Me.WbcAdministradorMensajeModal.mMostrarMensajeModal("Error", _
"No se pudo Completar el Proceso: " & loExcepcion.Message, _
vis3Controles.wbcAdministradorMensajeModal.enumTipoMensaje.KN_Error, _
"auto", _
"auto")
End Try
End Sub
Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload
Try
loObjetoReporte.Close()
Catch loExcepcion As Exception
End Try
End Sub
End Class
'-------------------------------------------------------------------------------------------'
' JJD: 06/12/08: Programacion inicial
'-------------------------------------------------------------------------------------------'
' YJP: 14/05/09: Agregar filtro revisión
'-------------------------------------------------------------------------------------------'
' CMS: 22/06/09: Metodo de ordenamiento
'-------------------------------------------------------------------------------------------'
' AAP: 01/07/09: Filtro "Sucursal:"
'-------------------------------------------------------------------------------------------'
|
Imports INDArray = org.nd4j.linalg.api.ndarray.INDArray
Imports ArrayUtil = org.nd4j.common.util.ArrayUtil
'
' * ******************************************************************************
' * *
' * *
' * * This program and the accompanying materials are made available under the
' * * terms of the Apache License, Version 2.0 which is available at
' * * https://www.apache.org/licenses/LICENSE-2.0.
' * *
' * * See the NOTICE file distributed with this work for additional
' * * information regarding copyright ownership.
' * * Unless required by applicable law or agreed to in writing, software
' * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
' * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
' * * License for the specific language governing permissions and limitations
' * * under the License.
' * *
' * * SPDX-License-Identifier: Apache-2.0
' * *****************************************************************************
'
Namespace org.nd4j.linalg.convolution
Public MustInherit Class BaseConvolution
Implements ConvolutionInstance
Public MustOverride Function convn(ByVal input As INDArray, ByVal kernel As INDArray, ByVal type As Convolution.Type, ByVal axes() As Integer) As INDArray
''' <summary>
''' 2d convolution (aka the last 2 dimensions
''' </summary>
''' <param name="input"> the input to op </param>
''' <param name="kernel"> the kernel to convolve with </param>
''' <param name="type">
''' @return </param>
Public Overridable Function conv2d(ByVal input As INDArray, ByVal kernel As INDArray, ByVal type As Convolution.Type) As INDArray Implements ConvolutionInstance.conv2d
Dim axes() As Integer = If(input.shape().Length < 2, ArrayUtil.range(0, 1), ArrayUtil.range(input.shape().Length - 2, input.shape().Length))
Return convn(input, kernel, type, axes)
End Function
''' <summary>
''' ND Convolution
''' </summary>
''' <param name="input"> the input to transform </param>
''' <param name="kernel"> the kernel to transform with </param>
''' <param name="type"> the opType of convolution </param>
''' <returns> the convolution of the given input and kernel </returns>
Public Overridable Function convn(ByVal input As INDArray, ByVal kernel As INDArray, ByVal type As Convolution.Type) As INDArray Implements ConvolutionInstance.convn
Return convn(input, kernel, type, ArrayUtil.range(0, input.shape().Length))
End Function
End Class
End Namespace |
Namespace ByteBank
Public Class Cliente
#Region "PROPRIEDADES"
Private m_Nome As String
Public Property Nome As String
Get
Return m_Nome
End Get
Set(value As String)
m_Nome = value
End Set
End Property
Private m_CPF As String
Public Property CPF As String
Get
Return m_CPF
End Get
Set(value As String)
m_CPF = TestaCPF(value)
End Set
End Property
Public Property Profissao As String
Public Property Cidade As String
#End Region
#Region "FUNÇÕES ESPECIAIS"
Private Function TestaCPF(CPF As String) As String
Dim dadosArray() As String = {"11111111111", "22222222222", "33333333333", "44444444444",
"55555555555", "66666666666", "77777777777", "88888888888", "99999999999"}
Dim vResultado As Boolean = True
Dim i, x, n1, n2 As Integer
CPF = CPF.Trim
For i = 0 To dadosArray.Length - 1
If CPF.Length <> 11 Or dadosArray(i).Equals(CPF) Then
vResultado = False
End If
Next
If vResultado = False Then
Return "00000000000"
Else
For x = 0 To 1
n1 = 0
For i = 0 To 8 + x
n1 = n1 + Val(CPF.Substring(i, 1)) * (10 + x - i)
Next
n2 = 11 - (n1 - (Int(n1 / 11) * 11))
If n2 = 10 Or n2 = 11 Then n2 = 0
If n2 <> Val(CPF.Substring(9 + x, 1)) Then
vResultado = False
Exit For
End If
Next
If vResultado = False Then
Return "00000000000"
End If
End If
Return CPF
End Function
#End Region
End Class
End Namespace
|
'The MIT License (MIT)
'Copyright(c) 2016 M ABD AZIZ ALFIAN (http://about.me/azizalfian)
'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.
Imports System.Text
Imports System.Windows.Forms
Imports Crypto = System.Security.Cryptography
Namespace crypt
''' <summary>Class MD5</summary>
''' <author>M ABD AZIZ ALFIAN</author>
''' <lastupdate>19 April 2016</lastupdate>
''' <url>http://about.me/azizalfian</url>
''' <version>2.1.0</version>
''' <requirement>
''' - Imports System.Text
''' - Imports System.Windows.Forms
''' - Imports Crypto = System.Security.Cryptography
''' </requirement>
Public Class MD5
''' <summary>
''' Standar MD5
''' </summary>
Public Class MD5
Private ReadOnly _md5 As Crypto.MD5 = Crypto.MD5.Create()
''' <summary>
''' Membuat hash MD5
''' </summary>
''' <param name="input">Karakter string yang akan di hash MD5</param>
''' <param name="secretKey">Input secret key value</param>
''' <param name="showException">Tampilkan log exception? Default = True</param>
''' <returns>String()</returns>
Public Function Generate(input As String, secretKey As String, Optional showException As Boolean = True) As String
Try
Dim data = _md5.ComputeHash(Encoding.UTF8.GetBytes(secretKey + input + secretKey))
Dim sb As New StringBuilder()
Array.ForEach(data, Function(x) sb.Append(x.ToString("X2")))
Return sb.ToString()
Catch ex As Exception
If showException = True Then momolite.globals.Dev.CatchException(ex, globals.Dev.Icons.Errors, "momolite.crypt.MD5.MD5")
Return Nothing
Finally
GC.Collect()
End Try
End Function
''' <summary>
''' Memverifikasi enkripsi hash MD5 dengan string sebelum di enkripsi hash MD5
''' </summary>
''' <param name="input">Karakter sebelum enkripsi MD5</param>
''' <param name="secretKey">Input secret key value</param>
''' <param name="hash">Karakter setelah enkripsi MD5</param>
''' <param name="showException">Tampilkan log exception? Default = True</param>
''' <returns>Boolean</returns>
Public Function Validate(input As String, secretKey As String, hash As String, Optional showException As Boolean = True) As Boolean
Try
Dim sourceHash = Generate(input, secretKey)
Dim comparer As StringComparer = StringComparer.OrdinalIgnoreCase
Return If(comparer.Compare(sourceHash, hash) = 0, True, False)
Catch ex As Exception
If showException = True Then momolite.globals.Dev.CatchException(ex, globals.Dev.Icons.Errors, "momolite.crypt.MD5.MD5")
Return False
Finally
GC.Collect()
End Try
End Function
End Class
''' <summary>
''' MD5 mix dengan base 64
''' </summary>
Public Class MD5Base64
Private ReadOnly _md5 As Crypto.MD5 = Crypto.MD5.Create()
''' <summary>
''' Generate hash MD5 base64
''' </summary>
''' <param name="input">Karakter string yang akan di hash MD5 base64</param>
''' <param name="secretKey">Input secret key value</param>
''' <param name="showException">Tampilkan log exception? Default = True</param>
''' <returns>String</returns>
Public Function Generate(input As String, secretKey As String, Optional showException As Boolean = True) As String
Try
Dim data = _md5.ComputeHash(Encoding.UTF8.GetBytes(secretKey + input + secretKey))
Return Convert.ToBase64String(data)
Catch ex As Exception
If showException = True Then momolite.globals.Dev.CatchException(ex, globals.Dev.Icons.Errors, "momolite.crypt.MD5.MD5Base64")
Return Nothing
Finally
GC.Collect()
End Try
End Function
''' <summary>
''' Memvalidasi enkripsi hash MD5 base64 dengan string sebelum di enkripsi hash MD5 base64
''' </summary>
''' <param name="input">Karakter sebelum enkripsi MD5 base64</param>
''' <param name="secretKey">Input secret key value</param>
''' <param name="hash">Karakter setelah enkripsi MD5 base64</param>
''' <param name="showException">Tampilkan log exception? Default = True</param>
''' <returns>Boolean</returns>
Public Function Validate(input As String, secretKey As String, hash As String, Optional showException As Boolean = True) As Boolean
Try
Dim sourceHash = Generate(input, secretKey)
Dim comparer As StringComparer = StringComparer.OrdinalIgnoreCase
Return If(comparer.Compare(sourceHash, hash) = 0, True, False)
Catch ex As Exception
If showException = True Then momolite.globals.Dev.CatchException(ex, globals.Dev.Icons.Errors, "momolite.crypt.MD5.MD5Base64")
Return False
Finally
GC.Collect()
End Try
End Function
End Class
End Class
End Namespace |
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Partial Public Class Uploader
End Class
|
' Copyright (c) Microsoft Open Technologies, Inc. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Immutable
Imports System.Runtime.InteropServices
Imports System.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Namespace Microsoft.CodeAnalysis.VisualBasic
Partial Class DataFlowPass
Inherits AbstractFlowPass(Of LocalState)
Enum SlotKind
''' <summary>
''' Special slot for untracked variables
''' </summary>
NotTracked = -1
''' <summary>
''' Special slot for tracking whether code is reachable
''' </summary>
Unreachable = 0
''' <summary>
''' Special slot for tracking the implicit local for the function return value
''' </summary>
FunctionValue = 1
''' <summary>
''' The first available slot for variables
''' </summary>
''' <remarks></remarks>
FirstAvailable = 2
End Enum
''' <summary>
''' Some variables that should be considered initially assigned. Used for region analysis.
''' </summary>
Protected ReadOnly initiallyAssignedVariables As HashSet(Of Symbol)
''' <summary>
''' Defines whether or not fields of intrinsic type should be tracked. Such fields should
''' not be tracked for error reporting purposes, but should be tracked for region flow analysis
''' </summary>
Private _trackStructsWithIntrinsicTypedFields As Boolean
''' <summary>
''' Variables that were used anywhere, in the sense required to suppress warnings about unused variables.
''' </summary>
Private ReadOnly _unusedVariables As HashSet(Of LocalSymbol) = New HashSet(Of LocalSymbol)()
''' <summary>
''' Variables that were initialized or written anywhere.
''' </summary>
Private ReadOnly writtenVariables As HashSet(Of Symbol) = New HashSet(Of Symbol)()
''' <summary>
''' A mapping from local variables to the index of their slot in a flow analysis local state.
''' WARNING: if variable identifier maps into SlotKind.NotTracked, it may mean that VariableIdentifier
''' is a structure without traceable fields. This mapping is created in MakeSlotImpl(...)
''' </summary>
Dim _variableSlot As Dictionary(Of VariableIdentifier, Integer) = New Dictionary(Of VariableIdentifier, Integer)()
''' <summary>
''' A mapping from the local variable slot to the symbol for the local variable itself. This is used in the
''' implementation of region analysis (support for extract method) to compute the set of variables "always
''' assigned" in a region of code.
''' </summary>
Protected variableBySlot As VariableIdentifier() = New VariableIdentifier(10) {}
''' <summary>
''' Variable slots are allocated to local variables sequentially and never reused. This is
''' the index of the next slot number to use.
''' </summary>
Protected nextVariableSlot As Integer = SlotKind.FirstAvailable
''' <summary>
''' Tracks variables for which we have already reported a definite assignment error. This
''' allows us to report at most one such error per variable.
''' </summary>
Private alreadyReported As BitArray
''' <summary>
''' Did we see [On Error] or [Resume] statement? Used to suppress some diagnostics.
''' </summary>
Private seenOnErrorOrResume As Boolean
Friend Sub New(info As FlowAnalysisInfo, suppressConstExpressionsSupport As Boolean, Optional trackStructsWithIntrinsicTypedFields As Boolean = False)
MyBase.New(info, suppressConstExpressionsSupport)
Me.initiallyAssignedVariables = Nothing
Me._trackStructsWithIntrinsicTypedFields = trackStructsWithIntrinsicTypedFields
End Sub
Friend Sub New(info As FlowAnalysisInfo, region As FlowAnalysisRegionInfo,
suppressConstExpressionsSupport As Boolean,
Optional initiallyAssignedVariables As HashSet(Of Symbol) = Nothing,
Optional trackUnassignments As Boolean = False,
Optional trackStructsWithIntrinsicTypedFields As Boolean = False)
MyBase.New(info, region, suppressConstExpressionsSupport, trackUnassignments)
Me.initiallyAssignedVariables = initiallyAssignedVariables
Me._trackStructsWithIntrinsicTypedFields = trackStructsWithIntrinsicTypedFields
End Sub
Protected Overrides Sub InitForScan()
MyBase.InitForScan()
For Each parameter In MethodParameters
MakeSlot(parameter)
Next
Me.alreadyReported = BitArray.Empty ' no variables yet reported unassigned
Me.EnterParameters(MethodParameters) ' with parameters assigned
Dim methodMeParameter = Me.MeParameter ' and with 'Me' assigned as well
If methodMeParameter IsNot Nothing Then
Me.MakeSlot(methodMeParameter)
Me.EnterParameter(methodMeParameter)
End If
' Usually we need to treat locals used without being assigned first as assigned in the beginning of the block.
' When data flow analysis determines that the variable is sometimes used without being assigned first, we want
' to treat that variable, during region analysis, as assigned where it is introduced.
' However with goto statements that branch into for/foreach/using statements (error case) we need to treat them
' as assigned in the beginning of the method body.
'
' Example:
' Goto label1
' For x = 0 to 10
' label1:
' Dim y = [| x |] ' x should not be in dataFlowsOut.
' Next
'
' This can only happen in VB because the labels are visible in the whole method. In C# the labels are not visible
' this case.
'
If initiallyAssignedVariables IsNot Nothing Then
For Each local In initiallyAssignedVariables
SetSlotAssigned(MakeSlot(local))
Next
End If
End Sub
Protected Overrides Function Scan() As Boolean
If Not MyBase.Scan() Then
Return False
End If
' check unused variables
If Not seenOnErrorOrResume Then
For Each local In _unusedVariables
ReportUnused(local)
Next
End If
' VB doesn't support "out" so it doesn't warn for unassigned parameters. However, check variables passed
' byref are assigned so that data flow analysis detects parameters flowing out.
If ShouldAnalyzeByRefParameters Then
LeaveParameters(MethodParameters)
End If
Dim methodMeParameter = Me.MeParameter ' and also 'Me'
If methodMeParameter IsNot Nothing Then
Me.LeaveParameter(methodMeParameter)
End If
Return True
End Function
Private Sub ReportUnused(local As LocalSymbol)
' Never report that the function value is unused
' Never report that local with empty name is unused
' Locals with empty name can be generated in code with syntax errors and
' we shouldn't report such locals as unused because they were not explicitly declared
' by the user in the code
If Not local.IsFunctionValue AndAlso Not String.IsNullOrEmpty(local.Name) Then
If writtenVariables.Contains(local) Then
If local.IsConst Then
Me.diagnostics.Add(ERRID.WRN_UnusedLocalConst, local.Locations(0), If(local.Name, "dummy"))
End If
Else
Me.diagnostics.Add(ERRID.WRN_UnusedLocal, local.Locations(0), If(local.Name, "dummy"))
End If
End If
End Sub
Protected Overridable Sub ReportUnassignedByRefParameter(parameter As ParameterSymbol)
End Sub
''' <summary>
''' Perform data flow analysis, reporting all necessary diagnostics.
''' </summary>
Public Overloads Shared Sub Analyze(info As FlowAnalysisInfo, diagnostics As DiagnosticBag, suppressConstExpressionsSupport As Boolean)
Dim walker = New DataFlowPass(info, suppressConstExpressionsSupport)
Try
Dim result As Boolean = walker.Analyze()
Debug.Assert(result)
If diagnostics IsNot Nothing Then
diagnostics.AddRange(walker.diagnostics)
End If
Finally
walker.Free()
End Try
End Sub
Protected Overrides Sub Free()
Me.alreadyReported = BitArray.Null
MyBase.Free()
End Sub
Protected Overrides Function Dump(state As LocalState) As String
Dim builder As New StringBuilder()
builder.Append("[assigned ")
AppendBitNames(state.Assigned, builder)
builder.Append("]")
Return builder.ToString()
End Function
Protected Sub AppendBitNames(a As BitArray, builder As StringBuilder)
Dim any As Boolean = False
For Each bit In a.TrueBits
If any Then
builder.Append(", ")
End If
any = True
AppendBitName(bit, builder)
Next
End Sub
Protected Sub AppendBitName(bit As Integer, builder As StringBuilder)
Dim id As VariableIdentifier = variableBySlot(bit)
If id.ContainingSlot > 0 Then
AppendBitName(id.ContainingSlot, builder)
builder.Append(".")
End If
builder.Append(If(bit = 0, "*", id.Symbol.Name))
End Sub
#Region "Note Read/Write"
Protected Overridable Sub NoteRead(variable As Symbol)
If variable IsNot Nothing AndAlso variable.Kind = SymbolKind.Local Then
_unusedVariables.Remove(DirectCast(variable, LocalSymbol))
End If
End Sub
Protected Overridable Sub NoteWrite(variable As Symbol, value As BoundExpression)
If variable IsNot Nothing Then
writtenVariables.Add(variable)
Dim local = TryCast(variable, LocalSymbol)
If value IsNot Nothing AndAlso (local IsNot Nothing AndAlso Not local.IsConst AndAlso local.Type.IsReferenceType OrElse value.HasErrors) Then
' We duplicate Dev10's behavior here. The reasoning is, I would guess, that otherwise unread
' variables of reference type are useful because they keep objects alive, i.e., they are read by the
' VM. And variables that are initialized by non-constant expressions presumably are useful because
' they enable us to clearly document a discarded return value from a method invocation, e.g. var
' discardedValue = F(); >shrug<
' Note, this rule only applies to local variables and not to const locals, i.e. we always report unused
' const locals. In addition, if the value has errors then supress these diagnostics in all cases.
_unusedVariables.Remove(local)
End If
End If
End Sub
Protected Function GetNodeSymbol(node As BoundNode) As Symbol
While node IsNot Nothing
Select Case node.Kind
Case BoundKind.FieldAccess
Dim fieldAccess = DirectCast(node, BoundFieldAccess)
If FieldAccessMayRequireTracking(fieldAccess) Then
node = fieldAccess.ReceiverOpt
Continue While
End If
Return Nothing
Case BoundKind.PropertyAccess
node = DirectCast(node, BoundPropertyAccess).ReceiverOpt
Continue While
Case BoundKind.MeReference
Return MeParameter
Case BoundKind.Local
Return DirectCast(node, BoundLocal).LocalSymbol
Case BoundKind.RangeVariable
Return DirectCast(node, BoundRangeVariable).RangeVariable
Case BoundKind.Parameter
Return DirectCast(node, BoundParameter).ParameterSymbol
Case BoundKind.WithLValueExpressionPlaceholder, BoundKind.WithRValueExpressionPlaceholder
Dim substitute As BoundExpression = GetPlaceholderSubstitute(DirectCast(node, BoundValuePlaceholderBase))
If substitute IsNot Nothing Then
Return GetNodeSymbol(substitute)
End If
Return Nothing
Case BoundKind.LocalDeclaration
Return DirectCast(node, BoundLocalDeclaration).LocalSymbol
Case BoundKind.ForToStatement,
BoundKind.ForEachStatement
Return DirectCast(node, BoundForStatement).DeclaredOrInferredLocalOpt
Case BoundKind.ByRefArgumentWithCopyBack
node = DirectCast(node, BoundByRefArgumentWithCopyBack).OriginalArgument
Continue While
Case Else
Return Nothing
End Select
End While
Return Nothing
End Function
Protected Overridable Sub NoteWrite(node As BoundExpression, value As BoundExpression)
Dim symbol As Symbol = GetNodeSymbol(node)
If symbol IsNot Nothing Then
If symbol.Kind = SymbolKind.Local AndAlso DirectCast(symbol, LocalSymbol).DeclarationKind = LocalDeclarationKind.AmbiguousLocals Then
' We have several locals grouped in AmbiguousLocalsPseudoSymbol
For Each local In DirectCast(symbol, AmbiguousLocalsPseudoSymbol).Locals
NoteWrite(local, value)
Next
Else
NoteWrite(symbol, value)
End If
End If
End Sub
Protected Overridable Sub NoteRead(fieldAccess As BoundFieldAccess)
Dim symbol As Symbol = GetNodeSymbol(fieldAccess)
If symbol IsNot Nothing Then
If symbol.Kind = SymbolKind.Local AndAlso DirectCast(symbol, LocalSymbol).DeclarationKind = LocalDeclarationKind.AmbiguousLocals Then
' We have several locals grouped in AmbiguousLocalsPseudoSymbol
For Each local In DirectCast(symbol, AmbiguousLocalsPseudoSymbol).Locals
NoteRead(local)
Next
Else
NoteRead(symbol)
End If
End If
End Sub
#End Region
#Region "Operations with slots"
''' <summary>
''' Locals are given slots when their declarations are encountered. We only need give slots to local variables, and
''' the "Me" variable of a structure constructs. Other variables are not given slots, and are therefore not tracked
''' by the analysis. This returns SlotKind.NotTracked for a variable that is not tracked, for fields of structs
''' that have the same assigned status as the container, and for structs that (recursively) contain no data members.
''' We do not need to track references to variables that occur before the variable is declared, as those are reported
''' in an earlier phase as "use before declaration". That allows us to avoid giving slots to local variables before
''' processing their declarations.
''' </summary>
Protected Function VariableSlot(local As Symbol, Optional containingSlot As Integer = 0) As Integer
If local Is Nothing Then
' NOTE: This point may be hit in erroneous code, like
' referencing instance members from static methods
Return SlotKind.NotTracked
End If
Dim slot As Integer
Return If((_variableSlot.TryGetValue(New VariableIdentifier(local, containingSlot), slot)), slot, SlotKind.NotTracked)
End Function
''' <summary>
''' Return the slot for a variable, or SlotKind.NotTracked if it is not tracked (because, for example, it is an empty struct).
''' </summary>
Protected Function MakeSlotsForExpression(node As BoundExpression) As SlotCollection
Dim result As New SlotCollection() ' empty
Select Case node.Kind
Case BoundKind.MeReference, BoundKind.MyBaseReference, BoundKind.MyClassReference
If MeParameter IsNot Nothing Then
result.Append(MakeSlot(MeParameter))
End If
Case BoundKind.Local
Dim local As LocalSymbol = DirectCast(node, BoundLocal).LocalSymbol
If local.DeclarationKind = LocalDeclarationKind.AmbiguousLocals Then
' multiple locals
For Each loc In DirectCast(local, AmbiguousLocalsPseudoSymbol).Locals
result.Append(MakeSlot(loc))
Next
Else
' just one simple local
result.Append(MakeSlot(local))
End If
Case BoundKind.RangeVariable
result.Append(MakeSlot(DirectCast(node, BoundRangeVariable).RangeVariable))
Case BoundKind.Parameter
result.Append(MakeSlot(DirectCast(node, BoundParameter).ParameterSymbol))
Case BoundKind.FieldAccess
Dim fieldAccess = DirectCast(node, BoundFieldAccess)
Dim fieldsymbol = fieldAccess.FieldSymbol
Dim receiverOpt = fieldAccess.ReceiverOpt
' do not track static fields
If fieldsymbol.IsShared OrElse receiverOpt Is Nothing OrElse receiverOpt.Kind = BoundKind.TypeExpression Then
Exit Select ' empty result
End If
' do not track fields of non-structs
If receiverOpt.Type Is Nothing OrElse receiverOpt.Type.TypeKind <> TypeKind.Structure Then
Exit Select ' empty result
End If
result = MakeSlotsForExpression(receiverOpt)
' update slots, reuse collection
' NOTE: we don't filter out SlotKind.NotTracked values
For i = 0 To result.Count - 1
result(i) = MakeSlot(fieldAccess.FieldSymbol, result(0))
Next
Case BoundKind.WithLValueExpressionPlaceholder, BoundKind.WithRValueExpressionPlaceholder
Dim substitute As BoundExpression = Me.GetPlaceholderSubstitute(DirectCast(node, BoundValuePlaceholderBase))
If substitute IsNot Nothing Then
Return MakeSlotsForExpression(substitute)
End If
End Select
Return result
End Function
''' <summary>
''' Force a variable to have a slot.
''' </summary>
''' <param name = "local"></param>
''' <returns></returns>
Protected Function MakeSlot(local As Symbol, Optional containingSlot As Integer = 0) As Integer
If containingSlot = SlotKind.NotTracked Then
Return SlotKind.NotTracked
End If
' Check if the slot already exists
Dim varIdentifier As New VariableIdentifier(local, containingSlot)
Dim slot As Integer
If Not _variableSlot.TryGetValue(varIdentifier, slot) Then
If local.Kind = SymbolKind.Local Then
Me._unusedVariables.Add(DirectCast(local, LocalSymbol))
End If
Dim variableType As TypeSymbol = GetVariableType(local)
If IsEmptyStructType(variableType) Then
Return SlotKind.NotTracked
End If
' Create a slot
slot = nextVariableSlot
nextVariableSlot = nextVariableSlot + 1
_variableSlot.Add(varIdentifier, slot)
If slot >= variableBySlot.Length Then
Array.Resize(Me.variableBySlot, slot * 2)
End If
variableBySlot(slot) = varIdentifier
End If
Me.Normalize(Me.State)
Return slot
End Function
' In C#, we moved this cache to a separate cache held onto by the compilation, so we didn't
' recompute it each time.
'
' This is not so simple in VB, because we'd have to move the cache for members of the
' struct, and we'd need two different caches depending on _trackStructsWithIntrinsicTypedFields.
' So this optimization is not done for now in VB.
Private _isEmptyStructType As New Dictionary(Of NamedTypeSymbol, Boolean)()
Protected Overridable Function IsEmptyStructType(type As TypeSymbol) As Boolean
Dim namedType = TryCast(type, NamedTypeSymbol)
If namedType Is Nothing Then
Return False
End If
If Not IsTrackableStructType(namedType) Then
Return False
End If
Dim result As Boolean = False
If _isEmptyStructType.TryGetValue(namedType, result) Then
Return result
End If
' to break cycles
_isEmptyStructType(namedType) = True
For Each field In GetStructInstanceFields(namedType)
If Not IsEmptyStructType(field.Type) Then
_isEmptyStructType(namedType) = False
Return False
End If
Next
_isEmptyStructType(namedType) = True
Return True
End Function
Private Function IsTrackableStructType(symbol As TypeSymbol) As Boolean
If IsNonPrimitiveValueType(symbol) Then
Dim type = TryCast(symbol.OriginalDefinition, NamedTypeSymbol)
Return (type IsNot Nothing) AndAlso Not type.KnownCircularStruct
End If
Return False
End Function
''' <summary> Calculates the flag of being already reported; for structure types
''' the slot may be reported if ALL the children are reported </summary>
Private Function IsSlotAlreadyReported(symbolType As TypeSymbol, slot As Integer) As Boolean
If alreadyReported(slot) Then
Return True
End If
' not applicable for 'special slots'
If slot <= SlotKind.FunctionValue Then
Return False
End If
If Not IsTrackableStructType(symbolType) Then
Return False
End If
' For structures - check field slots
For Each field In GetStructInstanceFields(symbolType)
Dim childSlot = VariableSlot(field, slot)
If childSlot <> SlotKind.NotTracked Then
If Not IsSlotAlreadyReported(field.Type, childSlot) Then
Return False
End If
Else
Return False ' slot not created yet
End If
Next
' Seems to be assigned through children
alreadyReported(slot) = True
Return True
End Function
''' <summary> Marks slot as reported, propagates 'reported' flag to the children if necessary </summary>
Private Sub MarkSlotAsReported(symbolType As TypeSymbol, slot As Integer)
If alreadyReported(slot) Then
Return
End If
alreadyReported(slot) = True
' not applicable for 'special slots'
If slot <= SlotKind.FunctionValue Then
Return
End If
If Not IsTrackableStructType(symbolType) Then
Return
End If
' For structures - propagate to field slots
For Each field In GetStructInstanceFields(symbolType)
Dim childSlot = VariableSlot(field, slot)
If childSlot <> SlotKind.NotTracked Then
MarkSlotAsReported(field.Type, childSlot)
End If
Next
End Sub
''' <summary> Unassign a slot for a regular variable </summary>
Private Sub SetSlotUnassigned(slot As Integer)
Dim id As VariableIdentifier = variableBySlot(slot)
Dim type As TypeSymbol = GetVariableType(id.Symbol)
Debug.Assert(Not IsEmptyStructType(type))
If slot >= Me.State.Assigned.Capacity Then
Normalize(Me.State)
End If
' If the state of the slot is 'assigned' we need to clear it
' and possibly propagate it to all the parents
If Me.State.IsAssigned(slot) Then
Me.State.Unassign(slot)
If Me.tryState IsNot Nothing Then
Dim tryState = Me.tryState.Value
tryState.Unassign(slot)
Me.tryState = tryState
End If
' propagate to parents
While id.ContainingSlot > 0
' check the parent
Dim parentSlot = id.ContainingSlot
Dim parentIdentifier = variableBySlot(parentSlot)
Dim parentSymbol As Symbol = parentIdentifier.Symbol
If Not Me.State.IsAssigned(parentSlot) Then
Exit While
End If
' unassign and continue loop
Me.State.Unassign(parentSlot)
If Me.tryState IsNot Nothing Then
Dim tryState = Me.tryState.Value
tryState.Unassign(parentSlot)
Me.tryState = tryState
End If
If parentSymbol.Kind = SymbolKind.Local AndAlso DirectCast(parentSymbol, LocalSymbol).DeclarationKind = LocalDeclarationKind.FunctionValue Then
Me.State.Unassign(SlotKind.FunctionValue)
If Me.tryState IsNot Nothing Then
Dim tryState = Me.tryState.Value
tryState.Unassign(SlotKind.FunctionValue)
Me.tryState = tryState
End If
End If
id = parentIdentifier
End While
End If
If IsTrackableStructType(type) Then
' NOTE: we need to unassign the children in all cases
For Each field In GetStructInstanceFields(type)
' get child's slot
' NOTE: we don't need to care about possible cycles here because we took care of it
' in MakeSlotImpl when we created slots; we will just get SlotKind.NotTracked in worst case
Dim childSlot = VariableSlot(field, slot)
If childSlot >= SlotKind.FirstAvailable Then
SetSlotUnassigned(childSlot)
End If
Next
End If
End Sub
''' <summary>Assign a slot for a regular variable in a given state.</summary>
Private Sub SetSlotAssigned(slot As Integer, ByRef state As LocalState)
Dim id As VariableIdentifier = variableBySlot(slot)
Dim type As TypeSymbol = GetVariableType(id.Symbol)
Debug.Assert(Not IsEmptyStructType(type))
If slot >= Me.State.Assigned.Capacity Then
Normalize(Me.State)
End If
If Not state.IsAssigned(slot) Then
' assign this slot
state.Assign(slot)
If IsTrackableStructType(type) Then
' propagate to children
For Each field In GetStructInstanceFields(type)
' get child's slot
' NOTE: we don't need to care about possible cycles here because we took care of it
' in MakeSlotImpl when we created slots; we will just get SlotKind.NotTracked in worst case
Dim childSlot = VariableSlot(field, slot)
If childSlot >= SlotKind.FirstAvailable Then
SetSlotAssigned(childSlot, state)
End If
Next
End If
' propagate to parents
While id.ContainingSlot > 0
' check if all parent's children are set
Dim parentSlot = id.ContainingSlot
Dim parentIdentifier = variableBySlot(parentSlot)
Dim parentSymbol As Symbol = parentIdentifier.Symbol
Dim parentStructType = GetVariableType(parentSymbol)
' exit while if there is at least one child with a slot which is not assigned
For Each childSymbol In GetStructInstanceFields(parentStructType)
Dim childSlot = MakeSlot(childSymbol, parentSlot)
If childSlot <> SlotKind.NotTracked AndAlso Not state.IsAssigned(childSlot) Then
Exit While
End If
Next
' otherwise the parent can be set to assigned
state.Assign(parentSlot)
If parentSymbol.Kind = SymbolKind.Local AndAlso DirectCast(parentSymbol, LocalSymbol).DeclarationKind = LocalDeclarationKind.FunctionValue Then
state.Assign(SlotKind.FunctionValue)
End If
id = parentIdentifier
End While
End If
End Sub
''' <summary>Assign a slot for a regular variable.</summary>
Private Sub SetSlotAssigned(slot As Integer)
SetSlotAssigned(slot, Me.State)
End Sub
''' <summary> Hash structure fields as we may query them many times </summary>
Private typeToMembersCache As Dictionary(Of TypeSymbol, ImmutableArray(Of FieldSymbol)) = Nothing
Private Function ShouldIgnoreStructField(field As FieldSymbol) As Boolean
If field.IsShared Then
Return True
End If
If Me._trackStructsWithIntrinsicTypedFields Then
' If the flag is set we do not ignore any structure instance fields
Return False
End If
Dim fieldType As TypeSymbol = field.Type
' otherwise of fields of intrinsic type are ignored
If fieldType.IsIntrinsicValueType() Then
Return True
End If
' it the type is a type parameter and also type does NOT guarantee it is
' always a reference type, we igrore the field following Dev11 implementation
If fieldType.IsTypeParameter() Then
Dim typeParam = DirectCast(fieldType, TypeParameterSymbol)
If Not typeParam.IsReferenceType Then
Return True
End If
End If
' We also do NOT ignore all non-private fields
If field.DeclaredAccessibility <> Accessibility.Private Then
Return False
End If
' Do NOT ignore private fields from source
' NOTE: We should do this for all fields, but dev11 ignores private fields from
' metadata, so we need to as well to avoid breaking people. That's why we're
' distinguishing between source and metadata, rather than between the current
' compilation and another compilation.
If field.Dangerous_IsFromSomeCompilationIncludingRetargeting Then
' NOTE: Dev11 ignores fields auto-generated for events
Dim eventOrProperty As Symbol = field.AssociatedSymbol
If eventOrProperty Is Nothing OrElse eventOrProperty.Kind <> SymbolKind.Event Then
Return False
End If
End If
'' If the field is private we don't ignore it if it is a field of a generic struct
If field.ContainingType.IsGenericType Then
Return False
End If
Return True
End Function
Private Function GetStructInstanceFields(type As TypeSymbol) As ImmutableArray(Of FieldSymbol)
Dim result As ImmutableArray(Of FieldSymbol) = Nothing
If typeToMembersCache Is Nothing OrElse Not typeToMembersCache.TryGetValue(type, result) Then
' load and add to cache
Dim builder = ArrayBuilder(Of FieldSymbol).GetInstance()
For Each member In type.GetMembersUnordered()
' only fields
If member.Kind = SymbolKind.Field Then
Dim field = DirectCast(member, FieldSymbol)
' only instance fields
If Not ShouldIgnoreStructField(field) Then
' NOTE: DO NOT skip fields of intrinsic types if _trackStructsWithIntrinsicTypedFields is True
builder.Add(field)
End If
End If
Next
result = builder.ToImmutableAndFree()
If typeToMembersCache Is Nothing Then
typeToMembersCache = New Dictionary(Of TypeSymbol, ImmutableArray(Of FieldSymbol))
End If
typeToMembersCache.Add(type, result)
End If
Return result
End Function
Private Function GetVariableType(symbol As Symbol) As TypeSymbol
Select Case symbol.Kind
Case SymbolKind.Local
Return DirectCast(symbol, LocalSymbol).Type
Case SymbolKind.RangeVariable
Return DirectCast(symbol, RangeVariableSymbol).Type
Case SymbolKind.Field
Return DirectCast(symbol, FieldSymbol).Type
Case SymbolKind.Parameter
Return DirectCast(symbol, ParameterSymbol).Type
Case Else
Throw ExceptionUtilities.UnexpectedValue(symbol.Kind)
End Select
End Function
Protected Sub SetSlotState(slot As Integer, assigned As Boolean)
Debug.Assert(slot <> SlotKind.Unreachable)
If slot = SlotKind.NotTracked Then
Return
ElseIf slot = SlotKind.FunctionValue Then
' Function value slot is treated in a special way. For example it does not have Symbol assigned
' Just do a simple assign/unassign
If assigned Then
Me.State.Assign(slot)
Else
Me.State.Unassign(slot)
End If
Else
' The rest should be a regular slot
If assigned Then
SetSlotAssigned(slot)
Else
SetSlotUnassigned(slot)
End If
End If
End Sub
#End Region
#Region "Assignments: Check and Report"
''' <summary>
''' Check that the given variable is definitely assigned. If not, produce an error.
''' </summary>
Protected Sub CheckAssigned(symbol As Symbol, node As VisualBasicSyntaxNode, Optional rwContext As ReadWriteContext = ReadWriteContext.None)
If symbol IsNot Nothing Then
Dim local = TryCast(symbol, LocalSymbol)
If local IsNot Nothing AndAlso local.IsCompilerGenerated AndAlso Not Me.ProcessCompilerGeneratedLocals Then
' Do not process compiler generated temporary locals
Return
End If
' 'local' can be a pseudo-local representing a set of real locals
If local IsNot Nothing AndAlso local.DeclarationKind = LocalDeclarationKind.AmbiguousLocals Then
Dim ambiguous = DirectCast(local, AmbiguousLocalsPseudoSymbol)
' Ambiguous implicit receiver is always considered to be assigned
VisitAmbiguousLocalSymbol(ambiguous)
' Note reads of locals
For Each subLocal In ambiguous.Locals
NoteRead(subLocal)
Next
Else
Dim slot As Integer = MakeSlot(symbol)
If slot >= Me.State.Assigned.Capacity Then
Normalize(Me.State)
End If
If slot >= SlotKind.FirstAvailable AndAlso Me.State.Reachable AndAlso Not Me.State.IsAssigned(slot) Then
ReportUnassigned(symbol, node, rwContext)
End If
NoteRead(symbol)
End If
End If
End Sub
''' <summary> Version of CheckAssigned for bound field access </summary>
Private Sub CheckAssigned(fieldAccess As BoundFieldAccess, node As VisualBasicSyntaxNode, Optional rwContext As ReadWriteContext = ReadWriteContext.None)
Dim unassignedSlot As Integer
If Me.State.Reachable AndAlso Not IsAssigned(fieldAccess, unassignedSlot) Then
ReportUnassigned(fieldAccess.FieldSymbol, node, rwContext, unassignedSlot, fieldAccess)
End If
NoteRead(fieldAccess)
End Sub
Protected Overridable Sub VisitAmbiguousLocalSymbol(ambiguous As AmbiguousLocalsPseudoSymbol)
End Sub
Protected Overrides Sub VisitLvalue(node As BoundExpression, Optional dontLeaveRegion As Boolean = False)
MyBase.VisitLvalue(node, True) ' Don't leave region
If node.Kind = BoundKind.Local Then
Dim symbol As LocalSymbol = DirectCast(node, BoundLocal).LocalSymbol
If symbol.DeclarationKind = LocalDeclarationKind.AmbiguousLocals Then
VisitAmbiguousLocalSymbol(DirectCast(symbol, AmbiguousLocalsPseudoSymbol))
End If
End If
' NOTE: we can skip checking if Me._firstInRegion is nothing because 'node' is not nothing
If Not dontLeaveRegion AndAlso node Is Me._lastInRegion AndAlso IsInside Then
Me.LeaveRegion()
End If
End Sub
''' <summary> Check node for being assigned, return the value of unassigned slot in unassignedSlot </summary>
Private Function IsAssigned(node As BoundExpression, ByRef unassignedSlot As Integer) As Boolean
unassignedSlot = SlotKind.NotTracked
If IsEmptyStructType(node.Type) Then
Return True
End If
Select Case node.Kind
Case BoundKind.MeReference
unassignedSlot = VariableSlot(MeParameter)
Case BoundKind.Local
Dim local As LocalSymbol = DirectCast(node, BoundLocal).LocalSymbol
If local.DeclarationKind <> LocalDeclarationKind.AmbiguousLocals Then
unassignedSlot = VariableSlot(local)
Else
' We never report ambiguous locals pseudo-symbol as unassigned,
unassignedSlot = SlotKind.NotTracked
VisitAmbiguousLocalSymbol(DirectCast(local, AmbiguousLocalsPseudoSymbol))
End If
Case BoundKind.RangeVariable
' range variables are always assigned
unassignedSlot = -1
Return True
Case BoundKind.Parameter
unassignedSlot = VariableSlot(DirectCast(node, BoundParameter).ParameterSymbol)
Case BoundKind.FieldAccess
Dim fieldAccess = DirectCast(node, BoundFieldAccess)
If Not FieldAccessMayRequireTracking(fieldAccess) OrElse IsAssigned(fieldAccess.ReceiverOpt, unassignedSlot) Then
Return True
End If
' NOTE: unassignedSlot must have been set by previous call to IsAssigned(...)
unassignedSlot = MakeSlot(fieldAccess.FieldSymbol, unassignedSlot)
Case BoundKind.WithLValueExpressionPlaceholder, BoundKind.WithRValueExpressionPlaceholder
Dim substitute As BoundExpression = Me.GetPlaceholderSubstitute(DirectCast(node, BoundValuePlaceholderBase))
If substitute IsNot Nothing Then
Return IsAssigned(substitute, unassignedSlot)
End If
unassignedSlot = SlotKind.NotTracked
Case Else
' The value is a method call return value or something else we can assume is assigned.
unassignedSlot = SlotKind.NotTracked
End Select
Return Me.State.IsAssigned(unassignedSlot)
End Function
''' <summary>
''' Property controls Roslyn data flow analysis features which are disabled in command-line
''' compiler mode to maintain backward compatibility (mostly diagnostics not reported by Dev11),
''' but *enabled* in flow analysis API
''' </summary>
Protected Overridable ReadOnly Property EnableBreakingFlowAnalysisFeatures As Boolean
Get
Return False
End Get
End Property
''' <summary>
''' Specifies if the analysis should process compiler generated locals.
'''
''' Note that data flow API should never report compiler generated variables
''' as well as those should not generate any diagnostics (like being unassigned, etc...).
'''
''' But when the analysis is used for iterators or anync captures it should process
''' compiler generated locals as well...
''' </summary>
Protected Overridable ReadOnly Property ProcessCompilerGeneratedLocals As Boolean
Get
Return False
End Get
End Property
Private Function GetUnassignedSymbolFirstLocation(sym As Symbol, boundFieldAccess As BoundFieldAccess) As Location
Select Case sym.Kind
Case SymbolKind.Parameter
Return Nothing
Case SymbolKind.RangeVariable
Return Nothing
Case SymbolKind.Local
Dim locations As ImmutableArray(Of Location) = sym.Locations
Return If(locations.IsEmpty, Nothing, locations(0))
Case SymbolKind.Field
Debug.Assert(boundFieldAccess IsNot Nothing)
If sym.IsShared Then
Return Nothing
End If
Dim receiver As BoundExpression = boundFieldAccess.ReceiverOpt
Debug.Assert(receiver IsNot Nothing)
Select Case receiver.Kind
Case BoundKind.Local
Return GetUnassignedSymbolFirstLocation(DirectCast(receiver, BoundLocal).LocalSymbol, Nothing)
Case BoundKind.FieldAccess
Dim fieldAccess = DirectCast(receiver, BoundFieldAccess)
Return GetUnassignedSymbolFirstLocation(fieldAccess.FieldSymbol, fieldAccess)
Case Else
Return Nothing
End Select
Case Else
Debug.Assert(False, "Why is this reachable?")
Return Nothing
End Select
End Function
''' <summary>
''' Report a given variable as not definitely assigned. Once a variable has been so
''' reported, we suppress further reports of that variable.
''' </summary>
Protected Overridable Sub ReportUnassigned(sym As Symbol,
node As VisualBasicSyntaxNode,
rwContext As ReadWriteContext,
Optional slot As Integer = SlotKind.NotTracked,
Optional boundFieldAccess As BoundFieldAccess = Nothing)
If slot < SlotKind.FirstAvailable Then
slot = VariableSlot(sym)
End If
If slot >= Me.alreadyReported.Capacity Then
alreadyReported.EnsureCapacity(Me.nextVariableSlot)
End If
If sym.Kind = SymbolKind.Parameter Then
' Because there are no Out parameters in VB, general workflow should not hit this point;
' but in region analysis parameters are being unassigned, so it is reachable
Return
End If
If sym.Kind = SymbolKind.RangeVariable Then
' Range variables are always assigned for the purpose of error reporting.
Return
End If
Debug.Assert(sym.Kind = SymbolKind.Local OrElse sym.Kind = SymbolKind.Field)
Dim localOrFieldType As TypeSymbol
Dim isFunctionValue As Boolean
Dim isStaticLocal As Boolean
Dim isImplicityDeclared As Boolean = False
If sym.Kind = SymbolKind.Local Then
Dim locSym = DirectCast(sym, LocalSymbol)
localOrFieldType = locSym.Type
isFunctionValue = locSym.IsFunctionValue AndAlso EnableBreakingFlowAnalysisFeatures
isStaticLocal = locSym.IsStatic
isImplicityDeclared = locSym.IsImplicitlyDeclared
Else
isFunctionValue = False
isStaticLocal = False
localOrFieldType = DirectCast(sym, FieldSymbol).Type
End If
If Not IsSlotAlreadyReported(localOrFieldType, slot) Then
Dim warning As ERRID = Nothing
' NOTE: When a variable is being used before declaration VB generates ERR_UseOfLocalBeforeDeclaration1
' NOTE: error, thus we don't want to generate redundant warning; we base such an analysis on node
' NOTE: and symbol locations
Dim firstLocation As Location = GetUnassignedSymbolFirstLocation(sym, boundFieldAccess)
If isImplicityDeclared OrElse firstLocation Is Nothing OrElse firstLocation.SourceSpan.Start < node.SpanStart Then
' Because VB does not support out parameters, only locals OR fields of local structures can be unassigned.
If localOrFieldType IsNot Nothing AndAlso Not isStaticLocal Then
If localOrFieldType.IsIntrinsicValueType OrElse localOrFieldType.IsReferenceType Then
If localOrFieldType.IsIntrinsicValueType AndAlso Not isFunctionValue Then
warning = Nothing
Else
warning = If(rwContext = ReadWriteContext.ByRefArgument, ERRID.WRN_DefAsgUseNullRefByRef, ERRID.WRN_DefAsgUseNullRef)
End If
ElseIf localOrFieldType.IsValueType Then
' This is only reported for structures with reference type fields.
warning = If(rwContext = ReadWriteContext.ByRefArgument, ERRID.WRN_DefAsgUseNullRefByRefStr, ERRID.WRN_DefAsgUseNullRefStr)
Else
Debug.Assert(localOrFieldType.IsTypeParameter)
End If
If warning <> Nothing Then
Me.diagnostics.Add(warning, node.GetLocation(), If(sym.Name, "dummy"))
End If
End If
MarkSlotAsReported(localOrFieldType, slot)
End If
End If
End Sub
Private Sub CheckAssignedFunctionValue(local As LocalSymbol, node As VisualBasicSyntaxNode)
If Not Me.State.FunctionAssignedValue AndAlso Not seenOnErrorOrResume Then
Dim type As TypeSymbol = local.Type
' NOTE: Dev11 does NOT report warning on user-defined empty value types
' Special case: We specifically want to give a warning if the user doesn't return from a WinRT AddHandler.
' NOTE: Strictly speaking, dev11 actually checks whether the return type is EventRegistrationToken (see IsWinRTEventAddHandler),
' but the conditions should be equivalent (i.e. return EventRegistrationToken if and only if WinRT).
If EnableBreakingFlowAnalysisFeatures OrElse Not type.IsValueType OrElse type.IsIntrinsicOrEnumType OrElse Not IsEmptyStructType(type) OrElse
(Me.MethodSymbol.MethodKind = MethodKind.EventAdd AndAlso DirectCast(Me.MethodSymbol.AssociatedSymbol, EventSymbol).IsWindowsRuntimeEvent) Then
ReportUnassignedFunctionValue(local, node)
End If
End If
End Sub
Private Sub ReportUnassignedFunctionValue(local As LocalSymbol, node As VisualBasicSyntaxNode)
If Not alreadyReported(SlotKind.FunctionValue) Then
Dim type As TypeSymbol = Nothing
type = MethodReturnType
If type IsNot Nothing AndAlso
Not (MethodSymbol.IsIterator OrElse
(MethodSymbol.IsAsync AndAlso type.Equals(compilation.GetWellKnownType(WellKnownType.System_Threading_Tasks_Task)))) Then
Dim warning As ERRID = Nothing
Dim localName As String = GetFunctionLocalName(MethodSymbol.MethodKind, local)
type = type.GetEnumUnderlyingTypeOrSelf
' Actual warning depends on whether the local is a function,
' property, or operator value versus reference type.
If type.IsIntrinsicValueType Then
Select Case MethodSymbol.MethodKind
Case MethodKind.Conversion, MethodKind.UserDefinedOperator
warning = ERRID.WRN_DefAsgNoRetValOpVal1
Case MethodKind.PropertyGet
warning = ERRID.WRN_DefAsgNoRetValPropVal1
Case Else
Debug.Assert(MethodSymbol.MethodKind = MethodKind.Ordinary OrElse MethodSymbol.MethodKind = MethodKind.LambdaMethod)
warning = ERRID.WRN_DefAsgNoRetValFuncVal1
End Select
ElseIf type.IsReferenceType Then
Select Case MethodSymbol.MethodKind
Case MethodKind.Conversion, MethodKind.UserDefinedOperator
warning = ERRID.WRN_DefAsgNoRetValOpRef1
Case MethodKind.PropertyGet
warning = ERRID.WRN_DefAsgNoRetValPropRef1
Case Else
Debug.Assert(MethodSymbol.MethodKind = MethodKind.Ordinary OrElse MethodSymbol.MethodKind = MethodKind.LambdaMethod)
warning = ERRID.WRN_DefAsgNoRetValFuncRef1
End Select
ElseIf type.TypeKind = TypeKind.TypeParameter Then
' IsReferenceType was false, so this type parameter was not known to be a reference type.
' Following past practice, no warning is given in this case.
Else
Debug.Assert(type.IsValueType)
Select Case MethodSymbol.MethodKind
Case MethodKind.Conversion, MethodKind.UserDefinedOperator
' no warning is given in this case.
Case MethodKind.PropertyGet
warning = ERRID.WRN_DefAsgNoRetValPropRef1
Case MethodKind.EventAdd
' In Dev11, there wasn't time to change the syntax of AddHandler to allow the user
' to specify a return type (necessarily, EventRegistrationToken) for WinRT events.
' DevDiv #376690 reflects the fact that this leads to an incredibly confusing user
' experience if nothing is return: no diagnostics are reported, but RemoveHandler
' statements will silently fail. To prompt the user, (1) warn if there is no
' explicit return, and (2) modify the error message to say "AddHandler As
' EventRegistrationToken" to hint at the nature of the problem.
' Update: Dev11 just mangles an existing error message, but we'll introduce a new,
' clearer, one.
warning = ERRID.WRN_DefAsgNoRetValWinRtEventVal1
localName = MethodSymbol.AssociatedSymbol.Name
Case Else
warning = ERRID.WRN_DefAsgNoRetValFuncRef1
End Select
End If
If warning <> Nothing Then
Debug.Assert(localName IsNot Nothing)
Me.diagnostics.Add(warning, node.GetLocation(), localName)
End If
End If
alreadyReported(SlotKind.FunctionValue) = True
End If
End Sub
Private Shared Function GetFunctionLocalName(methodKind As MethodKind, local As LocalSymbol) As String
Select Case methodKind
Case MethodKind.LambdaMethod
Return StringConstants.AnonymousMethodName
Case MethodKind.Conversion, MethodKind.UserDefinedOperator
' the operator's function local is op_<something> and not
' VB's operator name, so we need to take the identifier token
' directly
Return local.IdentifierToken.ToString
Case Else
Return local.Name
End Select
End Function
''' <summary>
''' Mark a variable as assigned (or unassigned).
''' </summary>
Protected Overridable Sub Assign(node As BoundNode, value As BoundExpression, Optional assigned As Boolean = True)
Select Case node.Kind
Case BoundKind.LocalDeclaration
Dim local = DirectCast(node, BoundLocalDeclaration)
Debug.Assert(local.InitializerOpt Is value OrElse local.InitializedByAsNew)
Dim symbol = local.LocalSymbol
Dim slot As Integer = MakeSlot(symbol)
Dim written As Boolean = assigned OrElse Not Me.State.Reachable
SetSlotState(slot, written)
' Note write if the local has an initializer or if it is part of an as-new.
If assigned AndAlso (value IsNot Nothing OrElse local.InitializedByAsNew) Then NoteWrite(symbol, value)
Case BoundKind.ForToStatement,
BoundKind.ForEachStatement
Dim forStatement = DirectCast(node, BoundForStatement)
Dim symbol = forStatement.DeclaredOrInferredLocalOpt
Debug.Assert(symbol IsNot Nothing)
Dim slot As Integer = MakeSlot(symbol)
Dim written As Boolean = assigned OrElse Not Me.State.Reachable
SetSlotState(slot, written)
Case BoundKind.Local
Dim local = DirectCast(node, BoundLocal)
Dim symbol = local.LocalSymbol
If symbol.IsCompilerGenerated AndAlso Not Me.ProcessCompilerGeneratedLocals Then
' Do not process compiler generated temporary locals.
Return
End If
' Regular variable
Dim slot As Integer = MakeSlot(symbol)
SetSlotState(slot, assigned)
If symbol.IsFunctionValue Then
SetSlotState(SlotKind.FunctionValue, assigned)
End If
If assigned Then
NoteWrite(symbol, value)
End If
Case BoundKind.Parameter
Dim local = DirectCast(node, BoundParameter)
Dim symbol = local.ParameterSymbol
Dim slot As Integer = MakeSlot(symbol)
SetSlotState(slot, assigned)
If assigned Then NoteWrite(symbol, value)
Case BoundKind.MeReference
' var local = node as BoundThisReference;
Dim slot As Integer = MakeSlot(MeParameter)
SetSlotState(slot, assigned)
If assigned Then NoteWrite(MeParameter, value)
Case BoundKind.FieldAccess, BoundKind.PropertyAccess
Dim expression = DirectCast(node, BoundExpression)
Dim slots As SlotCollection = MakeSlotsForExpression(expression)
For i = 0 To slots.Count - 1
SetSlotState(slots(i), assigned)
Next
slots.Free()
If assigned Then NoteWrite(expression, value)
Case BoundKind.WithLValueExpressionPlaceholder, BoundKind.WithRValueExpressionPlaceholder
Dim substitute As BoundExpression = Me.GetPlaceholderSubstitute(DirectCast(node, BoundValuePlaceholderBase))
If substitute IsNot Nothing Then
Assign(substitute, value, assigned)
End If
Case BoundKind.ByRefArgumentWithCopyBack
Assign(DirectCast(node, BoundByRefArgumentWithCopyBack).OriginalArgument, value, assigned)
Case Else
' Other kinds of left-hand-sides either represent things not tracked (e.g. array elements)
' or errors that have been reported earlier (e.g. assignment to a unary increment)
End Select
End Sub
#End Region
#Region "Try statements"
' When assignments happen inside a region, they are treated as UN-assignments.
' Generally this is enough.
'
' The tricky part is that any instruction in Try/Catch/Finally must be considered as potentially throwing.
' Even if a subsequent write outside of the region may kill an assignment inside the region, it cannot prevent escape of
' the previous assignment.
'
' === Example:
'
' Dim x as integer = 0
' Try
' [| region starts here
' x = 1
' Blah() ' <- this statement may throw. (any instruction can).
' |] region ends here
' x = 2 ' <- it may seem that this assignment kills one above, where in fact "x = 1" can easily escape.
' Finally
' SomeUse(x) ' we can see side effects of "x = 1" here
' End Try
'
' As a result, when dealing with exception handling flows we need to maintain a separate state
' that collects UN-assignments only and is not affected by subsequent assignments.
Private tryState As LocalState?
Protected Overrides Sub VisitTryBlock(tryBlock As BoundStatement, node As BoundTryStatement, ByRef _tryState As LocalState)
If Me.TrackUnassignments Then
' store original try state
Dim oldTryState As LocalState? = Me.tryState
' start with AllBitsSet (means there were no assignments)
Me.tryState = AllBitsSet()
' visit try block. Any assignment inside the region will UN-assign corresponding bit in the tryState.
MyBase.VisitTryBlock(tryBlock, node, _tryState)
' merge resulting tryState into tryState that we were given.
Me.IntersectWith(_tryState, Me.tryState.Value)
' restore and merge old state with new changes.
If oldTryState IsNot Nothing Then
Dim tryState = Me.tryState.Value
Me.IntersectWith(tryState, oldTryState.Value)
Me.tryState = tryState
Else
Me.tryState = oldTryState
End If
Else
MyBase.VisitTryBlock(tryBlock, node, _tryState)
End If
End Sub
Protected Overrides Sub VisitCatchBlock(catchBlock As BoundCatchBlock, ByRef finallyState As LocalState)
If Me.TrackUnassignments Then
Dim oldTryState As LocalState? = Me.tryState
Me.tryState = AllBitsSet()
Me.VisitCatchBlockInternal(catchBlock, finallyState)
Me.IntersectWith(finallyState, Me.tryState.Value)
If oldTryState IsNot Nothing Then
Dim tryState = Me.tryState.Value
Me.IntersectWith(tryState, oldTryState.Value)
Me.tryState = tryState
Else
Me.tryState = oldTryState
End If
Else
Me.VisitCatchBlockInternal(catchBlock, finallyState)
End If
End Sub
Private Sub VisitCatchBlockInternal(catchBlock As BoundCatchBlock, ByRef finallyState As LocalState)
Dim local = catchBlock.LocalOpt
If local IsNot Nothing Then
MakeSlot(local)
End If
Dim exceptionSource = catchBlock.ExceptionSourceOpt
If exceptionSource IsNot Nothing Then
Assign(exceptionSource, value:=Nothing, assigned:=True)
End If
MyBase.VisitCatchBlock(catchBlock, finallyState)
End Sub
Protected Overrides Sub VisitFinallyBlock(finallyBlock As BoundStatement, ByRef unsetInFinally As LocalState)
If Me.TrackUnassignments Then
Dim oldTryState As LocalState? = Me.tryState
Me.tryState = AllBitsSet()
MyBase.VisitFinallyBlock(finallyBlock, unsetInFinally)
Me.IntersectWith(unsetInFinally, Me.tryState.Value)
If oldTryState IsNot Nothing Then
Dim tryState = Me.tryState.Value
Me.IntersectWith(tryState, oldTryState.Value)
Me.tryState = tryState
Else
Me.tryState = oldTryState
End If
Else
MyBase.VisitFinallyBlock(finallyBlock, unsetInFinally)
End If
End Sub
#End Region
Protected Overrides Function ReachableState() As LocalState
Return New LocalState(BitArray.Empty)
End Function
Private Sub EnterParameters(parameters As ImmutableArray(Of ParameterSymbol))
For Each parameter In parameters
EnterParameter(parameter)
Next
End Sub
Protected Overridable Sub EnterParameter(parameter As ParameterSymbol)
' this code has no effect except in the region analysis APIs, which assign
' variable slots to all parameters.
Dim slot As Integer = VariableSlot(parameter)
If slot >= SlotKind.FirstAvailable Then
Me.State.Assign(slot)
End If
NoteWrite(parameter, Nothing)
End Sub
Private Sub LeaveParameters(parameters As ImmutableArray(Of ParameterSymbol))
If Me.State.Reachable Then
For Each parameter In parameters
LeaveParameter(parameter)
Next
End If
End Sub
Private Sub LeaveParameter(parameter As ParameterSymbol)
If parameter.IsByRef Then
Dim slot = VariableSlot(parameter)
If Not Me.State.IsAssigned(slot) Then
ReportUnassignedByRefParameter(parameter)
End If
NoteRead(parameter)
End If
End Sub
Protected Overrides Function UnreachableState() As LocalState
' at this point we don't know what size of the bitarray to use, so we only set
' 'reachable' flag which mean 'all bits are set' in intersect/union
Return New LocalState(UnreachableBitsSet)
End Function
Protected Overrides Function AllBitsSet() As LocalState
Dim result = New LocalState(BitArray.AllSet(nextVariableSlot))
result.Unassign(SlotKind.Unreachable)
Return result
End Function
Protected Overrides Sub VisitLocalInReadWriteContext(node As BoundLocal, rwContext As ReadWriteContext)
MyBase.VisitLocalInReadWriteContext(node, rwContext)
CheckAssigned(node.LocalSymbol, node.Syntax, rwContext)
End Sub
Public Overrides Function VisitLocal(node As BoundLocal) As BoundNode
CheckAssigned(node.LocalSymbol, node.Syntax, ReadWriteContext.None)
Return Nothing
End Function
Public Overrides Function VisitRangeVariable(node As BoundRangeVariable) As BoundNode
' Sometimes query expressions refer to query range variable just to
' copy its value to a new compound variable. There is no reference
' to the range variable in code and, from user point of view, there is
' no access to it.
If Not node.WasCompilerGenerated Then
CheckAssigned(node.RangeVariable, node.Syntax, ReadWriteContext.None)
End If
Return Nothing
End Function
' Should this local variable be considered assigned at first? It is if in the set of initially
' assigned variables, or else the current state is not reachable.
Protected Function ConsiderLocalInitiallyAssigned(variable As LocalSymbol) As Boolean
Return Not Me.State.Reachable OrElse
initiallyAssignedVariables IsNot Nothing AndAlso initiallyAssignedVariables.Contains(variable)
End Function
Public Overrides Function VisitLocalDeclaration(node As BoundLocalDeclaration) As BoundNode
Dim placeholder As BoundValuePlaceholderBase = Nothing
Dim variableIsUsedDirectlyAndIsAlwaysAssigned = DeclaredVariableIsAlwaysAssignedBeforeInitializer(node.Syntax.Parent, node.InitializerOpt, placeholder)
Dim local As LocalSymbol = node.LocalSymbol
If variableIsUsedDirectlyAndIsAlwaysAssigned Then
SetPlaceholderSubstitute(placeholder, New BoundLocal(node.Syntax, local, local.Type))
End If
' Create a slot for the declared variable to be able to track it.
Dim slot As Integer = MakeSlot(local)
'If initializer is a lambda, we need to treat the local as assigned within the lambda.
Assign(node, node.InitializerOpt,
ConsiderLocalInitiallyAssigned(local) OrElse
variableIsUsedDirectlyAndIsAlwaysAssigned OrElse
TreatTheLocalAsAssignedWithinTheLambda(local, node.InitializerOpt))
If node.InitializerOpt IsNot Nothing OrElse node.InitializedByAsNew Then
' Assign must be called after the initializer is analyzed, because the variable needs to be
' consider unassigned which the initializer is being analyzed.
MyBase.VisitLocalDeclaration(node)
End If
AssignLocalOnDeclaration(local, node)
If variableIsUsedDirectlyAndIsAlwaysAssigned Then
RemovePlaceholderSubstitute(placeholder)
End If
Return Nothing
End Function
Protected Overridable Function TreatTheLocalAsAssignedWithinTheLambda(local As LocalSymbol, right As BoundExpression) As Boolean
Return IsConvertedLambda(right)
End Function
Private Shared Function IsConvertedLambda(value As BoundExpression) As Boolean
If value Is Nothing Then
Return False
End If
Do
Select Case value.Kind
Case BoundKind.Lambda
Return True
Case BoundKind.Conversion
value = DirectCast(value, BoundConversion).Operand
Case BoundKind.DirectCast
value = DirectCast(value, BoundDirectCast).Operand
Case BoundKind.TryCast
value = DirectCast(value, BoundTryCast).Operand
Case BoundKind.Parenthesized
value = DirectCast(value, BoundParenthesized).Expression
Case Else
Return False
End Select
Loop
End Function
Friend Overridable Sub AssignLocalOnDeclaration(local As LocalSymbol, node As BoundLocalDeclaration)
If node.InitializerOpt IsNot Nothing OrElse node.InitializedByAsNew Then
Assign(node, node.InitializerOpt)
End If
End Sub
Public Overrides Function VisitBlock(node As BoundBlock) As BoundNode
' Implicitly declared local variables don't have LocalDeclarations nodes for them. Thus,
' we need to create slots for any implicitly declared local variables in this block.
' For flow analysis purposes, we treat an implicit declared local as equivalent to a variable declared at the
' start of the method body (this block) with no initializer.
Dim localVariables = node.Locals
For Each local In localVariables
If local.IsImplicitlyDeclared Then
SetSlotState(MakeSlot(local), ConsiderLocalInitiallyAssigned(local))
End If
Next
Return MyBase.VisitBlock(node)
End Function
Public Overrides Function VisitLambda(node As BoundLambda) As BoundNode
Dim oldPending As SavedPending = SavePending()
Dim oldSymbol = Me.symbol
Me.symbol = node.LambdaSymbol
Dim finalState As LocalState = Me.State
Me.SetState(If(finalState.Reachable, finalState.Clone(), Me.AllBitsSet()))
Me.State.Assigned(SlotKind.FunctionValue) = False
Dim save_alreadyReportedFunctionValue = alreadyReported(SlotKind.FunctionValue)
alreadyReported(SlotKind.FunctionValue) = False
EnterParameters(node.LambdaSymbol.Parameters)
VisitBlock(node.Body)
LeaveParameters(node.LambdaSymbol.Parameters)
Me.symbol = oldSymbol
alreadyReported(SlotKind.FunctionValue) = save_alreadyReportedFunctionValue
Me.State.Assigned(SlotKind.FunctionValue) = True
RestorePending(oldPending)
Me.IntersectWith(finalState, Me.State)
Me.SetState(finalState)
Return Nothing
End Function
Public Overrides Function VisitQueryLambda(node As BoundQueryLambda) As BoundNode
Dim oldSymbol = Me.symbol
Me.symbol = node.LambdaSymbol
Dim finalState As LocalState = Me.State.Clone()
VisitRvalue(node.Expression)
Me.symbol = oldSymbol
Me.IntersectWith(finalState, Me.State)
Me.SetState(finalState)
Return Nothing
End Function
Public Overrides Function VisitQueryExpression(node As BoundQueryExpression) As BoundNode
Visit(node.LastOperator)
Return Nothing
End Function
Public Overrides Function VisitQuerySource(node As BoundQuerySource) As BoundNode
Visit(node.Expression)
Return Nothing
End Function
Public Overrides Function VisitQueryableSource(node As BoundQueryableSource) As BoundNode
Visit(node.Source)
Return Nothing
End Function
Public Overrides Function VisitToQueryableCollectionConversion(node As BoundToQueryableCollectionConversion) As BoundNode
Visit(node.ConversionCall)
Return Nothing
End Function
Public Overrides Function VisitQueryClause(node As BoundQueryClause) As BoundNode
Visit(node.UnderlyingExpression)
Return Nothing
End Function
Public Overrides Function VisitAggregateClause(node As BoundAggregateClause) As BoundNode
If node.CapturedGroupOpt IsNot Nothing Then
Visit(node.CapturedGroupOpt)
End If
Visit(node.UnderlyingExpression)
Return Nothing
End Function
Public Overrides Function VisitOrdering(node As BoundOrdering) As BoundNode
Visit(node.UnderlyingExpression)
Return Nothing
End Function
Public Overrides Function VisitRangeVariableAssignment(node As BoundRangeVariableAssignment) As BoundNode
Visit(node.Value)
Return Nothing
End Function
Public Overrides Function VisitMeReference(node As BoundMeReference) As BoundNode
CheckAssigned(MeParameter, node.Syntax)
Return Nothing
End Function
Public Overrides Function VisitParameter(node As BoundParameter) As BoundNode
If Not node.WasCompilerGenerated Then
CheckAssigned(node.ParameterSymbol, node.Syntax)
End If
Return Nothing
End Function
Public Overrides Function VisitFieldAccess(node As BoundFieldAccess) As BoundNode
Dim result = MyBase.VisitFieldAccess(node)
If FieldAccessMayRequireTracking(node) Then
CheckAssigned(node, node.Syntax, ReadWriteContext.None)
End If
Return result
End Function
Protected Overrides Sub VisitFieldAccessInReadWriteContext(node As BoundFieldAccess, rwContext As ReadWriteContext)
MyBase.VisitFieldAccessInReadWriteContext(node, rwContext)
If FieldAccessMayRequireTracking(node) Then
CheckAssigned(node, node.Syntax, rwContext)
End If
End Sub
Public Overrides Function VisitAssignmentOperator(node As BoundAssignmentOperator) As BoundNode
Dim left As BoundExpression = node.Left
'If right expression is a lambda, we need to treat the left side as assigned within the lambda.
Dim treatLocalAsAssigned As Boolean = False
If left.Kind = BoundKind.Local Then
treatLocalAsAssigned = TreatTheLocalAsAssignedWithinTheLambda(
DirectCast(left, BoundLocal).LocalSymbol, node.Right)
End If
If treatLocalAsAssigned Then
Assign(left, node.Right)
End If
MyBase.VisitAssignmentOperator(node)
If Not treatLocalAsAssigned Then
Assign(left, node.Right)
End If
Return Nothing
End Function
Protected Overrides ReadOnly Property SuppressRedimOperandRvalueOnPreserve As Boolean
Get
Return True
End Get
End Property
Public Overrides Function VisitRedimClause(node As BoundRedimClause) As BoundNode
MyBase.VisitRedimClause(node)
Assign(node.Operand, Nothing)
Return Nothing
End Function
Public Overrides Function VisitReferenceAssignment(node As BoundReferenceAssignment) As BoundNode
MyBase.VisitReferenceAssignment(node)
Assign(node.ByRefLocal, node.LValue)
Return Nothing
End Function
Protected Overrides Sub VisitForControlInitialization(node As BoundForToStatement)
MyBase.VisitForControlInitialization(node)
Assign(node.ControlVariable, node.InitialValue)
End Sub
Protected Overrides Sub VisitForControlInitialization(node As BoundForEachStatement)
MyBase.VisitForControlInitialization(node)
Assign(node.ControlVariable, Nothing)
End Sub
Protected Overrides Sub VisitForStatementVariableDeclation(node As BoundForStatement)
' if the for each statement declared a variable explicitly or by using local type inference we'll
' need to create a new slot for the new variable that is initially unassigned.
If node.DeclaredOrInferredLocalOpt IsNot Nothing Then
Dim slot As Integer = MakeSlot(node.DeclaredOrInferredLocalOpt) 'not initially assigned
Assign(node, Nothing, ConsiderLocalInitiallyAssigned(node.DeclaredOrInferredLocalOpt))
End If
End Sub
Public Overrides Function VisitAnonymousTypeCreationExpression(node As BoundAnonymousTypeCreationExpression) As BoundNode
MyBase.VisitAnonymousTypeCreationExpression(node)
Return Nothing
End Function
Public Overrides Function VisitWithStatement(node As BoundWithStatement) As BoundNode
Me.SetPlaceholderSubstitute(node.ExpressionPlaceholder, node.DraftPlaceholderSubstitute)
MyBase.VisitWithStatement(node)
Me.RemovePlaceholderSubstitute(node.ExpressionPlaceholder)
Return Nothing
End Function
Public Overrides Function VisitUsingStatement(node As BoundUsingStatement) As BoundNode
If node.ResourceList.IsDefaultOrEmpty Then
' only an expression. Let the base class' implementation deal with digging into the expression
Return MyBase.VisitUsingStatement(node)
End If
' all locals are considered initially assigned, even if the initialization expression is missing in source (error case)
For Each variableDeclarations In node.ResourceList
If variableDeclarations.Kind = BoundKind.AsNewLocalDeclarations Then
For Each variableDeclaration In DirectCast(variableDeclarations, BoundAsNewLocalDeclarations).LocalDeclarations
Dim local = variableDeclaration.LocalSymbol
Dim slot = MakeSlot(local)
If slot >= 0 Then
SetSlotAssigned(slot)
NoteWrite(local, Nothing)
Else
Debug.Assert(IsEmptyStructType(local.Type))
End If
Next
Else
Dim local = DirectCast(variableDeclarations, BoundLocalDeclaration).LocalSymbol
Dim slot = MakeSlot(local)
If slot >= 0 Then
SetSlotAssigned(slot)
NoteWrite(local, Nothing)
Else
Debug.Assert(IsEmptyStructType(local.Type))
End If
End If
Next
Dim result = MyBase.VisitUsingStatement(node)
' all locals are being read in the finally block.
For Each variableDeclarations In node.ResourceList
If variableDeclarations.Kind = BoundKind.AsNewLocalDeclarations Then
For Each variableDeclaration In DirectCast(variableDeclarations, BoundAsNewLocalDeclarations).LocalDeclarations
NoteRead(variableDeclaration.LocalSymbol)
Next
Else
NoteRead(DirectCast(variableDeclarations, BoundLocalDeclaration).LocalSymbol)
End If
Next
Return result
End Function
Protected Overridable ReadOnly Property IgnoreOutSemantics As Boolean
Get
Return True
End Get
End Property
Protected NotOverridable Overrides Sub VisitArgument(arg As BoundExpression, p As ParameterSymbol)
Debug.Assert(arg IsNot Nothing)
If p.IsByRef Then
If p.IsOut And Not Me.IgnoreOutSemantics Then
VisitLvalue(arg)
Else
VisitRvalue(arg, rwContext:=ReadWriteContext.ByRefArgument)
End If
Else
VisitRvalue(arg)
End If
End Sub
Protected Overrides Sub WriteArgument(arg As BoundExpression, isOut As Boolean)
If Not isOut Then
CheckAssignedFromArgumentWrite(arg, arg.Syntax)
End If
Assign(arg, Nothing)
MyBase.WriteArgument(arg, isOut)
End Sub
Protected Sub CheckAssignedFromArgumentWrite(expr As BoundExpression, node As VisualBasicSyntaxNode)
If Not Me.State.Reachable Then
Return
End If
Select Case expr.Kind
Case BoundKind.Local
CheckAssigned(DirectCast(expr, BoundLocal).LocalSymbol, node)
Case BoundKind.Parameter
CheckAssigned(DirectCast(expr, BoundParameter).ParameterSymbol, node)
Case BoundKind.FieldAccess
Dim fieldAccess = DirectCast(expr, BoundFieldAccess)
Dim field As FieldSymbol = fieldAccess.FieldSymbol
If FieldAccessMayRequireTracking(fieldAccess) Then
CheckAssigned(fieldAccess, node, ReadWriteContext.ByRefArgument)
End If
Case BoundKind.EventAccess
Debug.Assert(False) ' TODO: is this reachable at all?
Case BoundKind.MeReference,
BoundKind.MyClassReference,
BoundKind.MyBaseReference
CheckAssigned(MeParameter, node)
End Select
End Sub
Protected Overrides Sub VisitLateBoundArgument(arg As BoundExpression, isByRef As Boolean)
If isByRef Then
VisitRvalue(arg, rwContext:=ReadWriteContext.ByRefArgument)
Else
VisitRvalue(arg)
End If
End Sub
Public Overrides Function VisitReturnStatement(node As BoundReturnStatement) As BoundNode
If Not node.IsEndOfMethodReturn Then
' We should mark it as set disregarding whether or not there is an expression; if there
' is no expression, error 30654 will be generated which in Dev10 suppresses this error
SetSlotState(SlotKind.FunctionValue, True)
Else
Dim functionLocal = TryCast(node.ExpressionOpt, BoundLocal)
If functionLocal IsNot Nothing Then
CheckAssignedFunctionValue(functionLocal.LocalSymbol, node.Syntax)
End If
End If
MyBase.VisitReturnStatement(node)
Return Nothing
End Function
Public Overrides Function VisitMyBaseReference(node As BoundMyBaseReference) As BoundNode
CheckAssigned(MeParameter, node.Syntax)
Return Nothing
End Function
Public Overrides Function VisitMyClassReference(node As BoundMyClassReference) As BoundNode
CheckAssigned(MeParameter, node.Syntax)
Return Nothing
End Function
''' <summary>
''' A variable declared with As New can be considered assigned before the initializer is executed in case the variable
''' is a value type. The reason is that in this case the initialization happens in place (not in a temporary) and
''' the variable already got the object creation expression assigned.
''' </summary>
Private Function DeclaredVariableIsAlwaysAssignedBeforeInitializer(syntax As VisualBasicSyntaxNode, boundInitializer As BoundExpression,
<Out> ByRef placeholder As BoundValuePlaceholderBase) As Boolean
placeholder = Nothing
If boundInitializer IsNot Nothing AndAlso
(boundInitializer.Kind = BoundKind.ObjectCreationExpression OrElse boundInitializer.Kind = BoundKind.NewT) Then
Dim boundInitializerBase = DirectCast(boundInitializer, BoundObjectCreationExpressionBase).InitializerOpt
If boundInitializerBase IsNot Nothing AndAlso boundInitializerBase.Kind = BoundKind.ObjectInitializerExpression Then
Dim objectInitializer = DirectCast(boundInitializerBase, BoundObjectInitializerExpression)
If syntax IsNot Nothing AndAlso syntax.Kind = SyntaxKind.VariableDeclarator Then
Dim declarator = DirectCast(syntax, VariableDeclaratorSyntax)
If declarator.AsClause IsNot Nothing AndAlso declarator.AsClause.Kind = SyntaxKind.AsNewClause Then
placeholder = objectInitializer.PlaceholderOpt
Return Not objectInitializer.CreateTemporaryLocalForInitialization
End If
End If
End If
End If
Return False
End Function
Public Overrides Function VisitAsNewLocalDeclarations(node As BoundAsNewLocalDeclarations) As BoundNode
Dim placeholder As BoundValuePlaceholderBase = Nothing
Dim variableIsUsedDirectlyAndIsAlwaysAssigned =
DeclaredVariableIsAlwaysAssignedBeforeInitializer(node.Syntax, node.Initializer, placeholder)
Dim declarations As ImmutableArray(Of BoundLocalDeclaration) = node.LocalDeclarations
If declarations.IsEmpty Then
Return Nothing
End If
' An initializer might access the declared variables in the initializer and therefore need to create a slot to
' track them
For Each localDeclaration In declarations
MakeSlot(localDeclaration.LocalSymbol)
Next
' NOTE: in case 'variableIsUsedDirectlyAndIsAlwaysAssigned' is set it must be
' Dim a[, b, ...] As New Struct(...) With { ... }.
'
' In this case Roslyn (following Dev10/Dev11) consecutively calls constructors
' and executes initializers for all declared variables. Thus, when the first
' initialzier is being executed, all other locals are not assigned yet.
'
' This behavior is emulated below by assigning the first local and visiting
' the initializer before assigning all the other locals. We don't really need
' to revisit initializer after because all errors/warnings will be property
' reported in the first visit.
Dim localToUseAsSubstitute As LocalSymbol = CreateLocalSymbolForVariables(declarations)
' process the first local declaration once
Dim localDecl As BoundLocalDeclaration = declarations(0)
' A valuetype variable declared with AsNew and initialized by an object initializer is considered
' assigned when visiting the initializer, because the initialization happens inplace and the
' variable already got the object creation expression assigned (this assignment will be created
' in the local rewriter).
Assign(localDecl, node.Initializer, ConsiderLocalInitiallyAssigned(localDecl.LocalSymbol) OrElse variableIsUsedDirectlyAndIsAlwaysAssigned)
' if needed, replace the placeholders with the bound local for the current declared variable.
If variableIsUsedDirectlyAndIsAlwaysAssigned Then
Me.SetPlaceholderSubstitute(placeholder, New BoundLocal(localDecl.Syntax, localToUseAsSubstitute, localToUseAsSubstitute.Type))
End If
Visit(node.Initializer)
Visit(localDecl) ' TODO: do we really need that?
' Visit all other declarations
For index = 1 To declarations.Length - 1
localDecl = declarations(index)
' A valuetype variable declared with AsNew and initialized by an object initializer is considered
' assigned when visiting the initializer, because the initialization happens inplace and the
' variable already got the object creation expression assigned (this assignment will be created
'in the local rewriter).
Assign(localDecl, node.Initializer, ConsiderLocalInitiallyAssigned(localDecl.LocalSymbol) OrElse variableIsUsedDirectlyAndIsAlwaysAssigned)
Visit(localDecl) ' TODO: do we really need that?
Next
' We also need to mark all
If variableIsUsedDirectlyAndIsAlwaysAssigned Then
Me.RemovePlaceholderSubstitute(placeholder)
End If
Return Nothing
End Function
Protected Overridable Function CreateLocalSymbolForVariables(declarations As ImmutableArray(Of BoundLocalDeclaration)) As LocalSymbol
Debug.Assert(declarations.Length > 0)
Return declarations(0).LocalSymbol
End Function
Protected Overrides Sub VisitObjectCreationExpressionInitializer(node As BoundObjectInitializerExpressionBase)
Dim resetPlaceholder As Boolean = node IsNot Nothing AndAlso
node.Kind = BoundKind.ObjectInitializerExpression AndAlso
DirectCast(node, BoundObjectInitializerExpression).CreateTemporaryLocalForInitialization
If resetPlaceholder Then
Me.SetPlaceholderSubstitute(DirectCast(node, BoundObjectInitializerExpression).PlaceholderOpt, Nothing) ' Override substitute
End If
MyBase.VisitObjectCreationExpressionInitializer(node)
If resetPlaceholder Then
Me.RemovePlaceholderSubstitute(DirectCast(node, BoundObjectInitializerExpression).PlaceholderOpt)
End If
End Sub
Public Overrides Function VisitOnErrorStatement(node As BoundOnErrorStatement) As BoundNode
seenOnErrorOrResume = True
Return MyBase.VisitOnErrorStatement(node)
End Function
Public Overrides Function VisitResumeStatement(node As BoundResumeStatement) As BoundNode
seenOnErrorOrResume = True
Return MyBase.VisitResumeStatement(node)
End Function
End Class
End Namespace
|
Option Explicit On
Option Infer On
Option Strict On
#Region " --------------->> Imports/ usings "
Imports System.ComponentModel.DataAnnotations
Imports System.ComponentModel.DataAnnotations.Schema
Imports SSP.Data.EntityFrameworkX.Contexts
Imports SSP.Data.EntityFrameworkX.Models.Core
Imports SSP.Data.EntityFrameworkX.Models.Core.Interfaces
#End Region
Namespace Models.GitModels
Partial Public Class RepositoryProductowner
Inherits ModelBase(Of RepositoryProductowner)
Implements IModelBase(Of RepositoryProductowner, PropertyNames, GitContext)
#Region " --------------->> Enumerationen der Klasse "
Public Enum PropertyNames
RowId
id
RepositoryFID
PersonFID
End Enum
#End Region '{Enumerationen der Klasse}
#Region " --------------->> Eigenschaften der Klasse "
Private Shared _modelCore As ModelCore(Of RepositoryProductowner, PropertyNames, GitContext)
Private _rowId as Int64
Private _id AS Int64
Private _repositoryFID AS Int64
Private _personFID AS Int64
#End Region '{Eigenschaften der Klasse}
#Region " --------------->> Konstruktor und Destruktor der Klasse "
Shared Sub New()
_modelCore = New ModelCore(Of RepositoryProductowner, PropertyNames, GitContext)("git.t_repository_productowner")
_modelCore.AddMappingInformation(PropertyNames.RowId, My.Settings.RowIdName)
_modelCore.AddMappingInformation(PropertyNames.id, "id")
_modelCore.AddMappingInformation(PropertyNames.RepositoryFID, "RepositoryFID")
_modelCore.AddMappingInformation(PropertyNames.PersonFID, "PersonFID")
End Sub
#End Region '{Konstruktor und Destruktor der Klasse}
#Region " --------------->> Zugriffsmethoden der Klasse "
<DatabaseGenerated(DatabaseGeneratedOption.Identity)>
Public Property RowId As Int64 Implements IModelBase _
(Of RepositoryProductowner, PropertyNames, GitContext).RowId
Get
Return _rowId
End Get
Set(value As Int64)
MyBase.SetPropertyValueAndRaisePropertyChanged _
(Of Int64)(NameOf(Me.RowId), _rowId, value)
End Set
End Property
<DatabaseGenerated(DatabaseGeneratedOption.Identity)>
<Key>
Public Property Id As Int64
Get
Return _id
End Get
Set(value As Int64)
MyBase.SetPropertyValueAndRaisePropertyChanged _
(Of Int64)(NameOf(Me.Id), _id, value)
End Set
End Property
Public Property RepositoryFID As Int64
Get
Return _repositoryFID
End Get
Set(value As Int64)
MyBase.SetPropertyValueAndRaisePropertyChanged _
(Of Int64)(NameOf(Me.RepositoryFID), _repositoryFID, value)
End Set
End Property
Public Property PersonFID As Int64
Get
Return _personFID
End Get
Set(value As Int64)
MyBase.SetPropertyValueAndRaisePropertyChanged _
(Of Int64)(NameOf(Me.PersonFID), _personFID, value)
End Set
End Property
#End Region '{Zugriffsmethoden der Klasse}
#Region " --------------->> Ereignismethoden Methoden der Klasse "
#End Region '{Ereignismethoden der Klasse}
#Region " --------------->> Private Methoden der Klasse "
#End Region '{Private Methoden der Klasse}
#Region " --------------->> Öffentliche Methoden der Klasse "
Public Overrides Function ToString() As String
Return MyBase.ToString
End Function
Public Shared Function GetModelCore() As ModelCore _
(Of RepositoryProductowner, PropertyNames, GitContext)
Return _modelCore
End Function
Private Function IModelBase_ModelCore() As ModelCore(Of RepositoryProductowner, PropertyNames, GitContext) _
Implements IModelBase(Of RepositoryProductowner, PropertyNames, GitContext).ModelCore
Return _modelCore
End Function
Private Function IModelBase_ModelBase() As ModelBase(Of RepositoryProductowner) _
Implements IModelBase(Of RepositoryProductowner, PropertyNames, GitContext).ModelBase
Return DirectCast(Me, ModelBase(Of RepositoryProductowner))
End Function
#End Region '{Öffentliche Methoden der Klasse}
End Class
End Namespace |
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.34014
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
'NOTE: This file is auto-generated; do not modify it directly. To make changes,
' or if you encounter build errors in this file, go to the Project Designer
' (go to Project Properties or double-click the My Project node in
' Solution Explorer), and make changes on the Application tab.
'
Partial Friend Class MyApplication
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Public Sub New()
MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
Me.IsSingleInstance = false
Me.EnableVisualStyles = true
Me.SaveMySettingsOnExit = true
Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
End Sub
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Protected Overrides Sub OnCreateMainForm()
Me.MainForm = Global.admin.main
End Sub
End Class
End Namespace
|
Imports System.Xml
Namespace VecchieClassi
Public Class Provincia
#Region " PROPRIETA "
Private mID As Long
Private mIdProvincia As String
Private mDescrizione As String
Private mCodRegione As Integer
Private mErrore As Boolean
Public ReadOnly Property ID() As Long
Get
Return Me.mID
End Get
End Property
Public Property codice() As String
Get
Return mIdProvincia
End Get
Set(ByVal Value As String)
mIdProvincia = Value
End Set
End Property
Public ReadOnly Property CodiceRegione() As Integer
Get
Return Me.mCodRegione
End Get
End Property
Public Property descrizione() As String
Get
Return mDescrizione
End Get
Set(ByVal Value As String)
mDescrizione = Value.ToUpper
End Set
End Property
Public Property Errore() As Boolean
Get
Return mErrore
End Get
Set(ByVal Value As Boolean)
mErrore = Value
End Set
End Property
#End Region
#Region " METODI PUBBLICI "
Public Sub New()
Provincia()
End Sub
Public Sub New(ByVal codiceIn As String)
Provincia(codiceIn)
End Sub
Public Sub New(ByVal idProvincia As Long, ByVal fake1 As Boolean)
Provincia(idProvincia, fake1)
End Sub
#End Region
#Region " METODI PRIVATI "
Private Sub Provincia()
mIdProvincia = ""
mDescrizione = ""
Me.mID = 0
Me.mCodRegione = 0
End Sub
Private Sub Provincia(ByVal codiceIn As String)
Dim sQuery As String
Dim db As New DataBase
Dim iRet As Long
Provincia()
sQuery = "SELECT * "
sQuery = sQuery & "FROM Province "
sQuery = sQuery & "WHERE IdProvincia = '" & codiceIn & "'"
Try
With db
.SQL = sQuery
iRet = .OpenQuery()
If iRet >= 0 Then
Dim xmlDoc As New XmlDocument
xmlDoc.LoadXml(.strXML)
Me.mID = xmlDoc.GetElementsByTagName("Id").Item(0).InnerText
mIdProvincia = xmlDoc.GetElementsByTagName("IdProvincia").Item(0).InnerText
mDescrizione = xmlDoc.GetElementsByTagName("DescrizioneProvincia").Item(0).InnerText
Me.mCodRegione = xmlDoc.GetElementsByTagName("CodRegione").Item(0).InnerText
mErrore = False
ElseIf iRet < 0 Then
'listaMessaggi.aggiungi(New Messaggio(1, "Registrazione", "CodiceAccesso"))
mErrore = True
End If
End With
Catch ex As Exception
'listaMessaggi.aggiungi(New Messaggio(1, "Registrazione", "CodiceAccesso"))
mErrore = True
End Try
End Sub
Private Sub Provincia(ByVal idProvincia As Long, ByVal fake1 As Boolean)
Dim db As New DataBase
Dim iRet As Long
Provincia()
Try
With db
.SQL = "SELECT * FROM province WHERE id=" & idProvincia
iRet = .OpenQuery()
If iRet >= 0 Then
Dim xmlDoc As New XmlDocument
xmlDoc.LoadXml(.strXML)
Me.mID = xmlDoc.GetElementsByTagName("Id").Item(0).InnerText
mIdProvincia = xmlDoc.GetElementsByTagName("IdProvincia").Item(0).InnerText
mDescrizione = xmlDoc.GetElementsByTagName("DescrizioneProvincia").Item(0).InnerText
Me.mCodRegione = xmlDoc.GetElementsByTagName("CodRegione").Item(0).InnerText
mErrore = False
ElseIf iRet < 0 Then
'listaMessaggi.aggiungi(New Messaggio(1, "Registrazione", "CodiceAccesso"))
mErrore = True
End If
End With
Catch ex As Exception
'listaMessaggi.aggiungi(New Messaggio(1, "Registrazione", "CodiceAccesso"))
mErrore = True
End Try
End Sub
#End Region
End Class
End Namespace
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class absen2
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim DataGridViewCellStyle1 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Dim DataGridViewCellStyle2 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Dim DataGridViewCellStyle3 As System.Windows.Forms.DataGridViewCellStyle = New System.Windows.Forms.DataGridViewCellStyle()
Me.Label6 = New System.Windows.Forms.Label()
Me.rdalpa = New System.Windows.Forms.RadioButton()
Me.rdsakit = New System.Windows.Forms.RadioButton()
Me.rdizin = New System.Windows.Forms.RadioButton()
Me.rdhadir = New System.Windows.Forms.RadioButton()
Me.GroupBox1 = New System.Windows.Forms.GroupBox()
Me.txtalpa = New System.Windows.Forms.TextBox()
Me.Label8 = New System.Windows.Forms.Label()
Me.txtizin = New System.Windows.Forms.TextBox()
Me.Label9 = New System.Windows.Forms.Label()
Me.Label10 = New System.Windows.Forms.Label()
Me.txtsakit = New System.Windows.Forms.TextBox()
Me.Label11 = New System.Windows.Forms.Label()
Me.txthadir = New System.Windows.Forms.TextBox()
Me.txtcari = New System.Windows.Forms.TextBox()
Me.Label12 = New System.Windows.Forms.Label()
Me.Button3 = New System.Windows.Forms.Button()
Me.Button2 = New System.Windows.Forms.Button()
Me.GroupBox2 = New System.Windows.Forms.GroupBox()
Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
Me.Label5 = New System.Windows.Forms.Label()
Me.txttglakhir = New System.Windows.Forms.TextBox()
Me.DataGridView1 = New System.Windows.Forms.DataGridView()
Me.FileToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.MasterDataToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.txtnama = New System.Windows.Forms.TextBox()
Me.LaporanToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.Label1 = New System.Windows.Forms.Label()
Me.MenuStrip1 = New System.Windows.Forms.MenuStrip()
Me.AbsensiToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.HelpToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem()
Me.txtnip = New System.Windows.Forms.TextBox()
Me.Button4 = New System.Windows.Forms.Button()
Me.btnhapus = New System.Windows.Forms.Button()
Me.btnedit = New System.Windows.Forms.Button()
Me.btntambah = New System.Windows.Forms.Button()
Me.Label4 = New System.Windows.Forms.Label()
Me.Label3 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.cbmulai = New System.Windows.Forms.CheckBox()
Me.Label7 = New System.Windows.Forms.Label()
Me.txttglawal = New System.Windows.Forms.DateTimePicker()
Me.GroupBox1.SuspendLayout()
Me.GroupBox2.SuspendLayout()
CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.MenuStrip1.SuspendLayout()
Me.SuspendLayout()
'
'Label6
'
Me.Label6.AutoSize = True
Me.Label6.Font = New System.Drawing.Font("Trebuchet MS", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label6.Location = New System.Drawing.Point(542, 274)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(70, 22)
Me.Label6.TabIndex = 73
Me.Label6.Text = "Cari :"
'
'rdalpa
'
Me.rdalpa.AutoSize = True
Me.rdalpa.Font = New System.Drawing.Font("Segoe UI", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.rdalpa.Location = New System.Drawing.Point(182, 43)
Me.rdalpa.Name = "rdalpa"
Me.rdalpa.Size = New System.Drawing.Size(58, 24)
Me.rdalpa.TabIndex = 3
Me.rdalpa.TabStop = True
Me.rdalpa.Text = "Alpa"
Me.rdalpa.UseVisualStyleBackColor = True
'
'rdsakit
'
Me.rdsakit.AutoSize = True
Me.rdsakit.Font = New System.Drawing.Font("Segoe UI", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.rdsakit.Location = New System.Drawing.Point(182, 22)
Me.rdsakit.Name = "rdsakit"
Me.rdsakit.Size = New System.Drawing.Size(59, 24)
Me.rdsakit.TabIndex = 2
Me.rdsakit.TabStop = True
Me.rdsakit.Text = "Sakit"
Me.rdsakit.UseVisualStyleBackColor = True
'
'rdizin
'
Me.rdizin.AutoSize = True
Me.rdizin.Font = New System.Drawing.Font("Segoe UI", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.rdizin.Location = New System.Drawing.Point(107, 42)
Me.rdizin.Name = "rdizin"
Me.rdizin.Size = New System.Drawing.Size(50, 24)
Me.rdizin.TabIndex = 1
Me.rdizin.TabStop = True
Me.rdizin.Text = "Izin"
Me.rdizin.UseVisualStyleBackColor = True
'
'rdhadir
'
Me.rdhadir.AutoSize = True
Me.rdhadir.Font = New System.Drawing.Font("Segoe UI", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.rdhadir.Location = New System.Drawing.Point(107, 19)
Me.rdhadir.Name = "rdhadir"
Me.rdhadir.Size = New System.Drawing.Size(64, 24)
Me.rdhadir.TabIndex = 0
Me.rdhadir.TabStop = True
Me.rdhadir.Text = "Hadir"
Me.rdhadir.UseVisualStyleBackColor = True
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.rdalpa)
Me.GroupBox1.Controls.Add(Me.rdsakit)
Me.GroupBox1.Controls.Add(Me.rdizin)
Me.GroupBox1.Controls.Add(Me.rdhadir)
Me.GroupBox1.Font = New System.Drawing.Font("Microsoft Sans Serif", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.GroupBox1.Location = New System.Drawing.Point(6, 236)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(247, 73)
Me.GroupBox1.TabIndex = 68
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "Keterangan :"
'
'txtalpa
'
Me.txtalpa.Font = New System.Drawing.Font("Segoe UI", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtalpa.Location = New System.Drawing.Point(94, 117)
Me.txtalpa.Multiline = True
Me.txtalpa.Name = "txtalpa"
Me.txtalpa.Size = New System.Drawing.Size(98, 25)
Me.txtalpa.TabIndex = 43
Me.txtalpa.Text = "0"
Me.txtalpa.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'Label8
'
Me.Label8.AutoSize = True
Me.Label8.Font = New System.Drawing.Font("Trebuchet MS", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label8.Location = New System.Drawing.Point(6, 120)
Me.Label8.Name = "Label8"
Me.Label8.Size = New System.Drawing.Size(61, 22)
Me.Label8.TabIndex = 22
Me.Label8.Text = "Alpa :"
'
'txtizin
'
Me.txtizin.Font = New System.Drawing.Font("Segoe UI", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtizin.Location = New System.Drawing.Point(94, 87)
Me.txtizin.Multiline = True
Me.txtizin.Name = "txtizin"
Me.txtizin.Size = New System.Drawing.Size(98, 25)
Me.txtizin.TabIndex = 45
Me.txtizin.Text = "0"
Me.txtizin.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'Label9
'
Me.Label9.AutoSize = True
Me.Label9.Font = New System.Drawing.Font("Trebuchet MS", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label9.Location = New System.Drawing.Point(6, 87)
Me.Label9.Name = "Label9"
Me.Label9.Size = New System.Drawing.Size(61, 22)
Me.Label9.TabIndex = 21
Me.Label9.Text = "Izin :"
'
'Label10
'
Me.Label10.AutoSize = True
Me.Label10.Font = New System.Drawing.Font("Trebuchet MS", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label10.Location = New System.Drawing.Point(6, 56)
Me.Label10.Name = "Label10"
Me.Label10.Size = New System.Drawing.Size(61, 22)
Me.Label10.TabIndex = 20
Me.Label10.Text = "Sakit :"
'
'txtsakit
'
Me.txtsakit.Font = New System.Drawing.Font("Segoe UI", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtsakit.Location = New System.Drawing.Point(94, 56)
Me.txtsakit.Multiline = True
Me.txtsakit.Name = "txtsakit"
Me.txtsakit.Size = New System.Drawing.Size(98, 25)
Me.txtsakit.TabIndex = 44
Me.txtsakit.Text = "0"
Me.txtsakit.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'Label11
'
Me.Label11.AutoSize = True
Me.Label11.Font = New System.Drawing.Font("Trebuchet MS", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label11.Location = New System.Drawing.Point(6, 23)
Me.Label11.Name = "Label11"
Me.Label11.Size = New System.Drawing.Size(59, 22)
Me.Label11.TabIndex = 19
Me.Label11.Text = "Hadir :"
'
'txthadir
'
Me.txthadir.Font = New System.Drawing.Font("Segoe UI", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txthadir.Location = New System.Drawing.Point(94, 23)
Me.txthadir.Multiline = True
Me.txthadir.Name = "txthadir"
Me.txthadir.Size = New System.Drawing.Size(98, 25)
Me.txthadir.TabIndex = 43
Me.txthadir.Text = "0"
Me.txthadir.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
'
'txtcari
'
Me.txtcari.Font = New System.Drawing.Font("Segoe UI", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtcari.Location = New System.Drawing.Point(640, 272)
Me.txtcari.Name = "txtcari"
Me.txtcari.Size = New System.Drawing.Size(150, 27)
Me.txtcari.TabIndex = 74
'
'Label12
'
Me.Label12.AutoSize = True
Me.Label12.Font = New System.Drawing.Font("Segoe UI Semibold", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label12.Location = New System.Drawing.Point(525, 36)
Me.Label12.Name = "Label12"
Me.Label12.Size = New System.Drawing.Size(71, 20)
Me.Label12.TabIndex = 72
Me.Label12.Text = "Tanggal :"
'
'Button3
'
Me.Button3.BackColor = System.Drawing.SystemColors.ButtonHighlight
Me.Button3.Font = New System.Drawing.Font("Segoe UI", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button3.Location = New System.Drawing.Point(255, 262)
Me.Button3.Name = "Button3"
Me.Button3.Size = New System.Drawing.Size(36, 35)
Me.Button3.TabIndex = 71
Me.Button3.Text = "C"
Me.Button3.UseVisualStyleBackColor = False
'
'Button2
'
Me.Button2.BackColor = System.Drawing.SystemColors.ButtonHighlight
Me.Button2.Font = New System.Drawing.Font("Segoe UI Semibold", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button2.ForeColor = System.Drawing.Color.Black
Me.Button2.Location = New System.Drawing.Point(490, 183)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(82, 30)
Me.Button2.TabIndex = 70
Me.Button2.Text = "Clear"
Me.Button2.UseVisualStyleBackColor = False
'
'GroupBox2
'
Me.GroupBox2.Controls.Add(Me.txtalpa)
Me.GroupBox2.Controls.Add(Me.Label8)
Me.GroupBox2.Controls.Add(Me.txtizin)
Me.GroupBox2.Controls.Add(Me.Label9)
Me.GroupBox2.Controls.Add(Me.Label10)
Me.GroupBox2.Controls.Add(Me.txtsakit)
Me.GroupBox2.Controls.Add(Me.Label11)
Me.GroupBox2.Controls.Add(Me.txthadir)
Me.GroupBox2.Font = New System.Drawing.Font("Segoe UI", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.GroupBox2.Location = New System.Drawing.Point(582, 83)
Me.GroupBox2.Name = "GroupBox2"
Me.GroupBox2.Size = New System.Drawing.Size(213, 162)
Me.GroupBox2.TabIndex = 69
Me.GroupBox2.TabStop = False
Me.GroupBox2.Text = "Ringkasan Absen"
'
'Timer1
'
Me.Timer1.Enabled = True
Me.Timer1.Interval = 1000
'
'Label5
'
Me.Label5.AutoSize = True
Me.Label5.Font = New System.Drawing.Font("Segoe UI", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label5.Location = New System.Drawing.Point(595, 36)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(61, 20)
Me.Label5.TabIndex = 67
Me.Label5.Text = "Tanggal"
'
'txttglakhir
'
Me.txttglakhir.Enabled = False
Me.txttglakhir.Font = New System.Drawing.Font("Segoe UI", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txttglakhir.Location = New System.Drawing.Point(142, 205)
Me.txttglakhir.Multiline = True
Me.txttglakhir.Name = "txttglakhir"
Me.txttglakhir.Size = New System.Drawing.Size(191, 25)
Me.txttglakhir.TabIndex = 66
'
'DataGridView1
'
DataGridViewCellStyle1.Font = New System.Drawing.Font("Segoe UI", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.DataGridView1.AlternatingRowsDefaultCellStyle = DataGridViewCellStyle1
DataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft
DataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control
DataGridViewCellStyle2.Font = New System.Drawing.Font("Segoe UI Semibold", 12.75!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
DataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText
DataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight
DataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText
DataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.[True]
Me.DataGridView1.ColumnHeadersDefaultCellStyle = DataGridViewCellStyle2
Me.DataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
DataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft
DataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Window
DataGridViewCellStyle3.Font = New System.Drawing.Font("Segoe UI", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
DataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.ControlText
DataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight
DataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText
DataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.[False]
Me.DataGridView1.DefaultCellStyle = DataGridViewCellStyle3
Me.DataGridView1.Dock = System.Windows.Forms.DockStyle.Bottom
Me.DataGridView1.Location = New System.Drawing.Point(0, 309)
Me.DataGridView1.Name = "DataGridView1"
Me.DataGridView1.Size = New System.Drawing.Size(811, 140)
Me.DataGridView1.TabIndex = 65
'
'FileToolStripMenuItem
'
Me.FileToolStripMenuItem.Name = "FileToolStripMenuItem"
Me.FileToolStripMenuItem.Size = New System.Drawing.Size(55, 21)
Me.FileToolStripMenuItem.Text = "Home"
'
'MasterDataToolStripMenuItem
'
Me.MasterDataToolStripMenuItem.Name = "MasterDataToolStripMenuItem"
Me.MasterDataToolStripMenuItem.Size = New System.Drawing.Size(99, 21)
Me.MasterDataToolStripMenuItem.Text = "Data Pegawai"
'
'txtnama
'
Me.txtnama.Font = New System.Drawing.Font("Segoe UI", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtnama.Location = New System.Drawing.Point(142, 116)
Me.txtnama.Name = "txtnama"
Me.txtnama.Size = New System.Drawing.Size(191, 27)
Me.txtnama.TabIndex = 63
'
'LaporanToolStripMenuItem
'
Me.LaporanToolStripMenuItem.Name = "LaporanToolStripMenuItem"
Me.LaporanToolStripMenuItem.Size = New System.Drawing.Size(68, 21)
Me.LaporanToolStripMenuItem.Text = "Laporan"
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Font = New System.Drawing.Font("Sitka Text", 18.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.Location = New System.Drawing.Point(222, 21)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(283, 35)
Me.Label1.TabIndex = 54
Me.Label1.Text = "ABSENSI TANDINGAN"
'
'MenuStrip1
'
Me.MenuStrip1.BackColor = System.Drawing.SystemColors.Control
Me.MenuStrip1.Font = New System.Drawing.Font("Segoe UI", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.FileToolStripMenuItem, Me.MasterDataToolStripMenuItem, Me.AbsensiToolStripMenuItem, Me.LaporanToolStripMenuItem, Me.HelpToolStripMenuItem})
Me.MenuStrip1.Location = New System.Drawing.Point(0, 0)
Me.MenuStrip1.Name = "MenuStrip1"
Me.MenuStrip1.Size = New System.Drawing.Size(811, 25)
Me.MenuStrip1.TabIndex = 64
Me.MenuStrip1.Text = "MenuStrip1"
'
'AbsensiToolStripMenuItem
'
Me.AbsensiToolStripMenuItem.Name = "AbsensiToolStripMenuItem"
Me.AbsensiToolStripMenuItem.Size = New System.Drawing.Size(65, 21)
Me.AbsensiToolStripMenuItem.Text = "Absensi"
'
'HelpToolStripMenuItem
'
Me.HelpToolStripMenuItem.Name = "HelpToolStripMenuItem"
Me.HelpToolStripMenuItem.Size = New System.Drawing.Size(66, 21)
Me.HelpToolStripMenuItem.Text = "Tentang"
'
'txtnip
'
Me.txtnip.Font = New System.Drawing.Font("Segoe UI", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txtnip.Location = New System.Drawing.Point(142, 83)
Me.txtnip.Name = "txtnip"
Me.txtnip.Size = New System.Drawing.Size(191, 27)
Me.txtnip.TabIndex = 62
'
'Button4
'
Me.Button4.BackColor = System.Drawing.SystemColors.ButtonHighlight
Me.Button4.Font = New System.Drawing.Font("Segoe UI Semibold", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button4.ForeColor = System.Drawing.Color.Black
Me.Button4.Location = New System.Drawing.Point(490, 215)
Me.Button4.Name = "Button4"
Me.Button4.Size = New System.Drawing.Size(82, 30)
Me.Button4.TabIndex = 61
Me.Button4.Text = "Keluar"
Me.Button4.UseVisualStyleBackColor = False
'
'btnhapus
'
Me.btnhapus.BackColor = System.Drawing.SystemColors.ButtonHighlight
Me.btnhapus.Font = New System.Drawing.Font("Segoe UI Semibold", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnhapus.ForeColor = System.Drawing.Color.Black
Me.btnhapus.Location = New System.Drawing.Point(490, 152)
Me.btnhapus.Name = "btnhapus"
Me.btnhapus.Size = New System.Drawing.Size(82, 30)
Me.btnhapus.TabIndex = 60
Me.btnhapus.Text = "Hapus"
Me.btnhapus.UseVisualStyleBackColor = False
'
'btnedit
'
Me.btnedit.BackColor = System.Drawing.SystemColors.ButtonHighlight
Me.btnedit.Font = New System.Drawing.Font("Segoe UI Semibold", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btnedit.ForeColor = System.Drawing.Color.Black
Me.btnedit.Location = New System.Drawing.Point(490, 119)
Me.btnedit.Name = "btnedit"
Me.btnedit.Size = New System.Drawing.Size(82, 30)
Me.btnedit.TabIndex = 59
Me.btnedit.Text = "Absen"
Me.btnedit.UseVisualStyleBackColor = False
'
'btntambah
'
Me.btntambah.BackColor = System.Drawing.SystemColors.ButtonHighlight
Me.btntambah.Font = New System.Drawing.Font("Segoe UI Semibold", 12.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.btntambah.ForeColor = System.Drawing.Color.Black
Me.btntambah.Location = New System.Drawing.Point(490, 84)
Me.btntambah.Name = "btntambah"
Me.btntambah.Size = New System.Drawing.Size(82, 30)
Me.btntambah.TabIndex = 58
Me.btntambah.Text = "Tambah"
Me.btntambah.UseVisualStyleBackColor = False
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Font = New System.Drawing.Font("Trebuchet MS", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label4.Location = New System.Drawing.Point(12, 190)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(124, 44)
Me.Label4.TabIndex = 57
Me.Label4.Text = "Tanggal Terakhir" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "Kali Update :"
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Font = New System.Drawing.Font("Trebuchet MS", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label3.Location = New System.Drawing.Point(10, 117)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(125, 22)
Me.Label3.TabIndex = 56
Me.Label3.Text = "Nama :"
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Font = New System.Drawing.Font("Trebuchet MS", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label2.Location = New System.Drawing.Point(10, 85)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(124, 22)
Me.Label2.TabIndex = 55
Me.Label2.Text = "NIP :"
'
'cbmulai
'
Me.cbmulai.AutoSize = True
Me.cbmulai.Checked = True
Me.cbmulai.CheckState = System.Windows.Forms.CheckState.Checked
Me.cbmulai.Font = New System.Drawing.Font("Segoe UI", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.cbmulai.Location = New System.Drawing.Point(340, 163)
Me.cbmulai.Name = "cbmulai"
Me.cbmulai.Size = New System.Drawing.Size(108, 24)
Me.cbmulai.TabIndex = 75
Me.cbmulai.Text = "Mulai Ulang"
Me.cbmulai.UseVisualStyleBackColor = True
'
'Label7
'
Me.Label7.AutoSize = True
Me.Label7.Font = New System.Drawing.Font("Trebuchet MS", 12.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label7.Location = New System.Drawing.Point(10, 143)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(122, 44)
Me.Label7.TabIndex = 77
Me.Label7.Text = "Tanggal Awal" & Global.Microsoft.VisualBasic.ChrW(13) & Global.Microsoft.VisualBasic.ChrW(10) & "Update :"
'
'txttglawal
'
Me.txttglawal.CustomFormat = "yyyy/MM/dd"
Me.txttglawal.Font = New System.Drawing.Font("Microsoft Sans Serif", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.txttglawal.Format = System.Windows.Forms.DateTimePickerFormat.Custom
Me.txttglawal.Location = New System.Drawing.Point(142, 164)
Me.txttglawal.Name = "txttglawal"
Me.txttglawal.Size = New System.Drawing.Size(191, 22)
Me.txttglawal.TabIndex = 78
Me.txttglawal.Value = New Date(2019, 1, 11, 11, 1, 3, 0)
'
'absen2
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(811, 449)
Me.Controls.Add(Me.txttglawal)
Me.Controls.Add(Me.Label7)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.txtcari)
Me.Controls.Add(Me.Label12)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.GroupBox2)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.txttglakhir)
Me.Controls.Add(Me.DataGridView1)
Me.Controls.Add(Me.txtnama)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.MenuStrip1)
Me.Controls.Add(Me.txtnip)
Me.Controls.Add(Me.Button4)
Me.Controls.Add(Me.btnhapus)
Me.Controls.Add(Me.btnedit)
Me.Controls.Add(Me.btntambah)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.cbmulai)
Me.MaximizeBox = False
Me.Name = "absen2"
Me.Text = "absen2"
Me.GroupBox1.ResumeLayout(False)
Me.GroupBox1.PerformLayout()
Me.GroupBox2.ResumeLayout(False)
Me.GroupBox2.PerformLayout()
CType(Me.DataGridView1, System.ComponentModel.ISupportInitialize).EndInit()
Me.MenuStrip1.ResumeLayout(False)
Me.MenuStrip1.PerformLayout()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents Label6 As Label
Friend WithEvents rdalpa As RadioButton
Friend WithEvents rdsakit As RadioButton
Friend WithEvents rdizin As RadioButton
Friend WithEvents rdhadir As RadioButton
Friend WithEvents GroupBox1 As GroupBox
Friend WithEvents txtalpa As TextBox
Friend WithEvents Label8 As Label
Friend WithEvents txtizin As TextBox
Friend WithEvents Label9 As Label
Friend WithEvents Label10 As Label
Friend WithEvents txtsakit As TextBox
Friend WithEvents Label11 As Label
Friend WithEvents txthadir As TextBox
Friend WithEvents txtcari As TextBox
Friend WithEvents Label12 As Label
Friend WithEvents Button3 As Button
Friend WithEvents Button2 As Button
Friend WithEvents GroupBox2 As GroupBox
Friend WithEvents Timer1 As Timer
Friend WithEvents Label5 As Label
Friend WithEvents txttglakhir As TextBox
Friend WithEvents DataGridView1 As DataGridView
Friend WithEvents FileToolStripMenuItem As ToolStripMenuItem
Friend WithEvents MasterDataToolStripMenuItem As ToolStripMenuItem
Friend WithEvents txtnama As TextBox
Friend WithEvents LaporanToolStripMenuItem As ToolStripMenuItem
Friend WithEvents Label1 As Label
Friend WithEvents MenuStrip1 As MenuStrip
Friend WithEvents AbsensiToolStripMenuItem As ToolStripMenuItem
Friend WithEvents HelpToolStripMenuItem As ToolStripMenuItem
Friend WithEvents txtnip As TextBox
Friend WithEvents Button4 As Button
Friend WithEvents btnhapus As Button
Friend WithEvents btnedit As Button
Friend WithEvents btntambah As Button
Friend WithEvents Label4 As Label
Friend WithEvents Label3 As Label
Friend WithEvents Label2 As Label
Friend WithEvents cbmulai As CheckBox
Friend WithEvents Label7 As Label
Friend WithEvents txttglawal As DateTimePicker
End Class
|
Imports lm.Comol.UI.Presentation
Imports lm.Comol.Core.DomainModel
Imports lm.Comol.Core.BaseModules.ProviderManagement
Imports lm.Comol.Core.BaseModules.ProviderManagement.Presentation
Public Class ListAuthenticationProvider
Inherits PageBase
Implements IViewProvidersManagement
#Region "Context"
Private _CurrentContext As lm.Comol.Core.DomainModel.iApplicationContext
Private ReadOnly Property CurrentContext() As lm.Comol.Core.DomainModel.iApplicationContext
Get
If IsNothing(_CurrentContext) Then
_CurrentContext = New lm.Comol.Core.DomainModel.ApplicationContext() With {.UserContext = SessionHelpers.CurrentUserContext, .DataContext = SessionHelpers.CurrentDataContext}
End If
Return _CurrentContext
End Get
End Property
Private _Presenter As ProvidersManagementPresenter
Private ReadOnly Property CurrentPresenter() As ProvidersManagementPresenter
Get
If IsNothing(_Presenter) Then
_Presenter = New ProvidersManagementPresenter(Me.CurrentContext, Me)
End If
Return _Presenter
End Get
End Property
#End Region
#Region "Implements"
Public ReadOnly Property PreLoadedPageSize As Integer Implements IViewProvidersManagement.PreLoadedPageSize
Get
If IsNumeric(Request.QueryString("PageSize")) Then
Return CInt(Request.QueryString("PageSize"))
Else
Return Me.DDLpage.Items(0).Value
End If
End Get
End Property
Public Property CurrentPageSize As Integer Implements IViewProvidersManagement.CurrentPageSize
Get
Return Me.DDLpage.SelectedValue
End Get
Set(value As Integer)
Me.DDLpage.SelectedValue = value
End Set
End Property
Public Property Pager As PagerBase Implements IViewProvidersManagement.Pager
Get
Return ViewStateOrDefault("Pager", New lm.Comol.Core.DomainModel.PagerBase With {.PageSize = CurrentPageSize})
End Get
Set(value As PagerBase)
Me.ViewState("Pager") = value
Me.PGgrid.Pager = value
Me.PGgrid.Visible = Not value.Count = 0 AndAlso (value.Count + 1 > value.PageSize)
Me.DVpageSize.Visible = (Not value.Count < Me.DefaultPageSize)
End Set
End Property
#End Region
#Region "Inherits"
Public Overrides ReadOnly Property VerifyAuthentication() As Boolean
Get
Return False
End Get
End Property
Public Overrides ReadOnly Property AlwaysBind() As Boolean
Get
Return False
End Get
End Property
#End Region
#Region "Property"
Public ReadOnly Property OnLoadingTranslation As String
Get
Return Resource.getValue("LTprogress.text")
End Get
End Property
Public Function TranslateModalView(viewName As String) As String
Return Resource.getValue(viewName)
End Function
Public ReadOnly Property BackGroundItem(ByVal deleted As lm.Comol.Core.DomainModel.BaseStatusDeleted, itemType As ListItemType) As String
Get
If deleted = lm.Comol.Core.DomainModel.BaseStatusDeleted.None Then
Return IIf(itemType = ListItemType.AlternatingItem, "ROW_Alternate_Small", "ROW_Normal_Small")
Else
Return "ROW_Disabilitate_Small"
End If
End Get
End Property
Public ReadOnly Property DefaultPageSize() As Integer
Get
Return 25
End Get
End Property
#End Region
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.PGgrid.Pager = Pager
Me.Page.Form.DefaultFocus = Me.DDLpage.UniqueID
Me.Master.Page.Form.DefaultFocus = Me.DDLpage.UniqueID
End Sub
#Region "Inherits"
Public Overrides Sub BindDati()
Me.Master.ShowNoPermission = False
If Page.IsPostBack = False Then
CurrentPresenter.InitView()
End If
End Sub
Public Overrides Sub BindNoPermessi()
Me.Master.ShowNoPermission = True
End Sub
Public Overrides Function HasPermessi() As Boolean
Return True
End Function
Public Overrides Sub RegistraAccessoPagina()
End Sub
Public Overrides Sub SetCultureSettings()
MyBase.SetCulture("pg_ProviderManagement", "Modules", "ProviderManagement")
End Sub
Public Overrides Sub SetInternazionalizzazione()
With MyBase.Resource
Me.Master.ServiceTitle = .getValue("serviceManagementTitle")
Me.Master.ServiceNopermission = .getValue("serviceManagementNopermission")
.setHyperLink(Me.HYPaddProvider, True, True)
Me.HYPaddProvider.NavigateUrl = Me.BaseUrl & RootObject.AddProvider
.setLabel(LBpagesize)
.setLabel(LBproviderDisplayInfoDescription)
.setButton(BTNcloseProviderDisplayInfo, True)
End With
End Sub
Public Overrides Sub ShowMessageToPage(ByVal errorMessage As String)
End Sub
#End Region
#Region "Grid Management"
Private Sub RPTproviders_ItemDataBound(sender As Object, e As System.Web.UI.WebControls.RepeaterItemEventArgs) Handles RPTproviders.ItemDataBound
If e.Item.ItemType = ListItemType.Header Then
Dim oLabel As Label = e.Item.FindControl("LBactions_t")
Me.Resource.setLabel(oLabel)
oLabel = e.Item.FindControl("LBproviderIsEnabled_t")
Me.Resource.setLabel(oLabel)
oLabel = e.Item.FindControl("LBproviderName_t")
Me.Resource.setLabel(oLabel)
oLabel = e.Item.FindControl("LBproviderType_t")
Me.Resource.setLabel(oLabel)
oLabel = e.Item.FindControl("LBproviderUsedBy_t")
Me.Resource.setLabel(oLabel)
ElseIf e.Item.ItemType = ListItemType.Item OrElse e.Item.ItemType = ListItemType.AlternatingItem Then
Dim provider As dtoProvider = DirectCast(e.Item.DataItem, dtoProviderPermission).Provider
Dim permission As dtoPermission = DirectCast(e.Item.DataItem, dtoProviderPermission).Permission
Dim link As LinkButton = e.Item.FindControl("LNBproviderInfo")
link.Visible = permission.Info
If permission.Info Then
Resource.setLinkButton(link, True, True)
End If
Dim hyperlink As HyperLink = e.Item.FindControl("HYPedit")
hyperlink.Visible = permission.Edit
If permission.Edit Then
Dim div As HtmlControl = e.Item.FindControl("DVsettings")
Resource.setHyperLink(hyperlink, True, True)
hyperlink.NavigateUrl = Me.BaseUrl & RootObject.EditProvider(provider.IdProvider)
hyperlink = e.Item.FindControl("HYPadvancedSettings")
div.Visible = False
If (provider.Type = lm.Comol.Core.Authentication.AuthenticationProviderType.Internal OrElse provider.Type = lm.Comol.Core.Authentication.AuthenticationProviderType.None) Then
hyperlink.Visible = False
Else
div.Visible = True
hyperlink.Visible = True
Resource.setHyperLink(hyperlink, True, True)
hyperlink.NavigateUrl = Me.BaseUrl & RootObject.EditProviderSettings(provider.IdProvider, provider.Type)
End If
End If
If permission.Delete AndAlso provider.Type <> lm.Comol.Core.Authentication.AuthenticationProviderType.Internal Then
link = e.Item.FindControl("LNBdelete")
link.Visible = True
Resource.setLinkButton(link, True, True, , True)
End If
If permission.VirtualUndelete Then
link = e.Item.FindControl("LNBvirtualUnDelete")
link.Visible = True
Resource.setLinkButton(link, True, True)
ElseIf permission.VirtualDelete Then
link = e.Item.FindControl("LNBvirtualDelete")
link.Visible = True
Resource.setLinkButton(link, True, True)
End If
Dim label As Label = e.Item.FindControl("LBproviderName")
If Not IsNothing(provider.Translation) AndAlso String.IsNullOrEmpty(provider.Translation.Name) = False Then
label.Text = provider.Translation.Name
Else
label.Text = provider.Name
End If
label = e.Item.FindControl("LBproviderType")
label.Text = Resource.getValue("AuthenticationProviderType." & provider.Type.ToString)
label = e.Item.FindControl("LBproviderUsedBy")
label.Text = provider.UsedBy
label = e.Item.FindControl("LBproviderIsEnabled")
label.Text = Resource.getValue("isEnabled." & provider.isEnabled.ToString)
End If
End Sub
Private Sub PGgrid_OnPageSelected() Handles PGgrid.OnPageSelected
Me.CurrentPresenter.LoadProviders(Me.PGgrid.Pager.PageIndex, Me.CurrentPageSize)
End Sub
Private Sub RPTproviders_ItemCommand(source As Object, e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles RPTproviders.ItemCommand
Dim idProvider As Long = 0
If IsNumeric(e.CommandArgument) Then
idProvider = CLng(e.CommandArgument)
End If
If idProvider > 0 Then
Select Case e.CommandName.ToLower
Case "infoprovider"
Me.LoadProviderInfo(idProvider)
Case "virtualdelete"
Me.CurrentPresenter.VirtualDelete(idProvider)
Case "undelete"
Me.CurrentPresenter.VirtualUndelete(idProvider)
Case "delete"
Me.CurrentPresenter.PhisicalDelete(idProvider)
End Select
Else
Me.CurrentPresenter.LoadProviders(Me.PGgrid.Pager.PageIndex, Me.CurrentPageSize)
End If
End Sub
#End Region
#Region "Implements"
Public Sub LoadProviderInfo(idProvider As Long) Implements IViewProvidersManagement.LoadProviderInfo
Me.CTRLinfoProvider.InitializeControl(idProvider)
Me.DVproviderInfo.Visible = True
End Sub
Public Sub LoadProviders(items As List(Of dtoProviderPermission)) Implements IViewProvidersManagement.LoadProviders
Me.RPTproviders.Visible = (items.Count > 0)
If items.Count > 0 Then
Me.RPTproviders.DataSource = items
Me.RPTproviders.DataBind()
End If
End Sub
Public Sub DisplaySessionTimeout() Implements IViewProvidersManagement.DisplaySessionTimeout
Dim webPost As New lm.Comol.Core.DomainModel.Helpers.LogoutWebPost(PageUtility.GetDefaultLogoutPage)
Dim dto As New lm.Comol.Core.DomainModel.Helpers.dtoExpiredAccessUrl()
dto.Display = lm.Comol.Core.DomainModel.Helpers.dtoExpiredAccessUrl.DisplayMode.SameWindow
dto.DestinationUrl = RootObject.Management
webPost.Redirect(dto)
End Sub
Public Sub NoPermission() Implements IViewProvidersManagement.NoPermission
Me.BindNoPermessi()
End Sub
#End Region
Private Sub BTNcloseProviderDisplayInfo_Click(sender As Object, e As System.EventArgs) Handles BTNcloseProviderDisplayInfo.Click
Me.DVproviderInfo.Visible = False
End Sub
End Class |
Imports System, System.IO, System.Collections.Generic
Imports System.Drawing, System.Drawing.Drawing2D
Imports System.ComponentModel, System.Windows.Forms
Imports System.Runtime.InteropServices
Imports System.Drawing.Imaging
Imports System.Windows.Forms.TabControl
Imports System.ComponentModel.Design
'---------/CREDITS/-----------
'
'Themebase creator: Aeonhack
'Site: elitevs.net
'Created: 08/02/2011
'Changed: 12/06/2011
'Version: 1.5.4
'
'Theme creator: Mavamaarten
'Created: 9/12/2011
'Changed: 3/03/2012
'Version: 2.0
'
'Thanks to Tedd for helping
'with combobox & tabcontrol!
'--------/CREDITS/------------
#Region "THEMEBASE"
MustInherit Class ThemeContainer154
Inherits ContainerControl
#Region " Initialization "
Protected G As Graphics, B As Bitmap
Sub New()
SetStyle(DirectCast(139270, ControlStyles), True)
_ImageSize = Size.Empty
Font = New Font("Verdana", 8S)
MeasureBitmap = New Bitmap(1, 1)
MeasureGraphics = Graphics.FromImage(MeasureBitmap)
DrawRadialPath = New GraphicsPath
InvalidateCustimization()
End Sub
Protected NotOverridable Overrides Sub OnHandleCreated(ByVal e As EventArgs)
If DoneCreation Then InitializeMessages()
InvalidateCustimization()
ColorHook()
If Not _LockWidth = 0 Then Width = _LockWidth
If Not _LockHeight = 0 Then Height = _LockHeight
If Not _ControlMode Then MyBase.Dock = DockStyle.Fill
Transparent = _Transparent
If _Transparent AndAlso _BackColor Then BackColor = Color.Transparent
MyBase.OnHandleCreated(e)
End Sub
Private DoneCreation As Boolean
Protected NotOverridable Overrides Sub OnParentChanged(ByVal e As EventArgs)
MyBase.OnParentChanged(e)
If Parent Is Nothing Then Return
_IsParentForm = TypeOf Parent Is Form
If Not _ControlMode Then
InitializeMessages()
If _IsParentForm Then
ParentForm.FormBorderStyle = _BorderStyle
ParentForm.TransparencyKey = _TransparencyKey
If Not DesignMode Then
AddHandler ParentForm.Shown, AddressOf FormShown
End If
End If
Parent.BackColor = BackColor
End If
OnCreation()
DoneCreation = True
InvalidateTimer()
End Sub
#End Region
Private Sub DoAnimation(ByVal i As Boolean)
OnAnimation()
If i Then Invalidate()
End Sub
Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
If Width = 0 OrElse Height = 0 Then Return
If _Transparent AndAlso _ControlMode Then
PaintHook()
e.Graphics.DrawImage(B, 0, 0)
Else
G = e.Graphics
PaintHook()
End If
End Sub
Protected Overrides Sub OnHandleDestroyed(ByVal e As EventArgs)
RemoveAnimationCallback(AddressOf DoAnimation)
MyBase.OnHandleDestroyed(e)
End Sub
Private HasShown As Boolean
Private Sub FormShown(ByVal sender As Object, ByVal e As EventArgs)
If _ControlMode OrElse HasShown Then Return
If _StartPosition = FormStartPosition.CenterParent OrElse _StartPosition = FormStartPosition.CenterScreen Then
Dim SB As Rectangle = Screen.PrimaryScreen.Bounds
Dim CB As Rectangle = ParentForm.Bounds
ParentForm.Location = New Point(SB.Width \ 2 - CB.Width \ 2, SB.Height \ 2 - CB.Width \ 2)
End If
HasShown = True
End Sub
#Region " Size Handling "
Private Frame As Rectangle
Protected NotOverridable Overrides Sub OnSizeChanged(ByVal e As EventArgs)
If _Movable AndAlso Not _ControlMode Then
Frame = New Rectangle(7, 7, Width - 14, _Header - 7)
End If
InvalidateBitmap()
Invalidate()
MyBase.OnSizeChanged(e)
End Sub
Protected Overrides Sub SetBoundsCore(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal specified As BoundsSpecified)
If Not _LockWidth = 0 Then width = _LockWidth
If Not _LockHeight = 0 Then height = _LockHeight
MyBase.SetBoundsCore(x, y, width, height, specified)
End Sub
#End Region
#Region " State Handling "
Protected State As MouseState
Private Sub SetState(ByVal current As MouseState)
State = current
Invalidate()
End Sub
Protected Overrides Sub OnMouseMove(ByVal e As MouseEventArgs)
If Not (_IsParentForm AndAlso ParentForm.WindowState = FormWindowState.Maximized) Then
If _Sizable AndAlso Not _ControlMode Then InvalidateMouse()
End If
MyBase.OnMouseMove(e)
End Sub
Protected Overrides Sub OnEnabledChanged(ByVal e As EventArgs)
If Enabled Then SetState(MouseState.None) Else SetState(MouseState.Block)
MyBase.OnEnabledChanged(e)
End Sub
Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
SetState(MouseState.Over)
MyBase.OnMouseEnter(e)
End Sub
Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
SetState(MouseState.Over)
MyBase.OnMouseUp(e)
End Sub
Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
SetState(MouseState.None)
If GetChildAtPoint(PointToClient(MousePosition)) IsNot Nothing Then
If _Sizable AndAlso Not _ControlMode Then
Cursor = Cursors.Default
Previous = 0
End If
End If
MyBase.OnMouseLeave(e)
End Sub
Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
If e.Button = Windows.Forms.MouseButtons.Left Then SetState(MouseState.Down)
If Not (_IsParentForm AndAlso ParentForm.WindowState = FormWindowState.Maximized OrElse _ControlMode) Then
If _Movable AndAlso Frame.Contains(e.Location) Then
Capture = False
WM_LMBUTTONDOWN = True
DefWndProc(Messages(0))
ElseIf _Sizable AndAlso Not Previous = 0 Then
Capture = False
WM_LMBUTTONDOWN = True
DefWndProc(Messages(Previous))
End If
End If
MyBase.OnMouseDown(e)
End Sub
Private WM_LMBUTTONDOWN As Boolean
Protected Overrides Sub WndProc(ByRef m As Message)
MyBase.WndProc(m)
If WM_LMBUTTONDOWN AndAlso m.Msg = 513 Then
WM_LMBUTTONDOWN = False
SetState(MouseState.Over)
If Not _SmartBounds Then Return
If IsParentMdi Then
CorrectBounds(New Rectangle(Point.Empty, Parent.Parent.Size))
Else
CorrectBounds(Screen.FromControl(Parent).WorkingArea)
End If
End If
End Sub
Private GetIndexPoint As Point
Private B1, B2, B3, B4 As Boolean
Private Function GetIndex() As Integer
GetIndexPoint = PointToClient(MousePosition)
B1 = GetIndexPoint.X < 7
B2 = GetIndexPoint.X > Width - 7
B3 = GetIndexPoint.Y < 7
B4 = GetIndexPoint.Y > Height - 7
If B1 AndAlso B3 Then Return 4
If B1 AndAlso B4 Then Return 7
If B2 AndAlso B3 Then Return 5
If B2 AndAlso B4 Then Return 8
If B1 Then Return 1
If B2 Then Return 2
If B3 Then Return 3
If B4 Then Return 6
Return 0
End Function
Private Current, Previous As Integer
Private Sub InvalidateMouse()
Current = GetIndex()
If Current = Previous Then Return
Previous = Current
Select Case Previous
Case 0
Cursor = Cursors.Default
Case 1, 2
Cursor = Cursors.SizeWE
Case 3, 6
Cursor = Cursors.SizeNS
Case 4, 8
Cursor = Cursors.SizeNWSE
Case 5, 7
Cursor = Cursors.SizeNESW
End Select
End Sub
Private Messages(8) As Message
Private Sub InitializeMessages()
Messages(0) = Message.Create(Parent.Handle, 161, New IntPtr(2), IntPtr.Zero)
For I As Integer = 1 To 8
Messages(I) = Message.Create(Parent.Handle, 161, New IntPtr(I + 9), IntPtr.Zero)
Next
End Sub
Private Sub CorrectBounds(ByVal bounds As Rectangle)
If Parent.Width > bounds.Width Then Parent.Width = bounds.Width
If Parent.Height > bounds.Height Then Parent.Height = bounds.Height
Dim X As Integer = Parent.Location.X
Dim Y As Integer = Parent.Location.Y
If X < bounds.X Then X = bounds.X
If Y < bounds.Y Then Y = bounds.Y
Dim Width As Integer = bounds.X + bounds.Width
Dim Height As Integer = bounds.Y + bounds.Height
If X + Parent.Width > Width Then X = Width - Parent.Width
If Y + Parent.Height > Height Then Y = Height - Parent.Height
Parent.Location = New Point(X, Y)
End Sub
#End Region
#Region " Base Properties "
Overrides Property Dock As DockStyle
Get
Return MyBase.Dock
End Get
Set(ByVal value As DockStyle)
If Not _ControlMode Then Return
MyBase.Dock = value
End Set
End Property
Private _BackColor As Boolean
<Category("Misc")>
Overrides Property BackColor() As Color
Get
Return MyBase.BackColor
End Get
Set(ByVal value As Color)
If value = MyBase.BackColor Then Return
If Not IsHandleCreated AndAlso _ControlMode AndAlso value = Color.Transparent Then
_BackColor = True
Return
End If
MyBase.BackColor = value
If Parent IsNot Nothing Then
If Not _ControlMode Then Parent.BackColor = value
ColorHook()
End If
End Set
End Property
Overrides Property MinimumSize As Size
Get
Return MyBase.MinimumSize
End Get
Set(ByVal value As Size)
MyBase.MinimumSize = value
If Parent IsNot Nothing Then Parent.MinimumSize = value
End Set
End Property
Overrides Property MaximumSize As Size
Get
Return MyBase.MaximumSize
End Get
Set(ByVal value As Size)
MyBase.MaximumSize = value
If Parent IsNot Nothing Then Parent.MaximumSize = value
End Set
End Property
Overrides Property Text() As String
Get
Return MyBase.Text
End Get
Set(ByVal value As String)
MyBase.Text = value
Invalidate()
End Set
End Property
Overrides Property Font() As Font
Get
Return MyBase.Font
End Get
Set(ByVal value As Font)
MyBase.Font = value
Invalidate()
End Set
End Property
<Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
Overrides Property ForeColor() As Color
Get
Return Color.Empty
End Get
Set(ByVal value As Color)
End Set
End Property
<Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
Overrides Property BackgroundImage() As Image
Get
Return Nothing
End Get
Set(ByVal value As Image)
End Set
End Property
<Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
Overrides Property BackgroundImageLayout() As ImageLayout
Get
Return ImageLayout.None
End Get
Set(ByVal value As ImageLayout)
End Set
End Property
#End Region
#Region " Public Properties "
Private _SmartBounds As Boolean = True
Property SmartBounds() As Boolean
Get
Return _SmartBounds
End Get
Set(ByVal value As Boolean)
_SmartBounds = value
End Set
End Property
Private _Movable As Boolean = True
Property Movable() As Boolean
Get
Return _Movable
End Get
Set(ByVal value As Boolean)
_Movable = value
End Set
End Property
Private _Sizable As Boolean = True
Property Sizable() As Boolean
Get
Return _Sizable
End Get
Set(ByVal value As Boolean)
_Sizable = value
End Set
End Property
Private _TransparencyKey As Color
Property TransparencyKey() As Color
Get
If _IsParentForm AndAlso Not _ControlMode Then Return ParentForm.TransparencyKey Else Return _TransparencyKey
End Get
Set(ByVal value As Color)
If value = _TransparencyKey Then Return
_TransparencyKey = value
If _IsParentForm AndAlso Not _ControlMode Then
ParentForm.TransparencyKey = value
ColorHook()
End If
End Set
End Property
Private _BorderStyle As FormBorderStyle
Property BorderStyle() As FormBorderStyle
Get
If _IsParentForm AndAlso Not _ControlMode Then Return ParentForm.FormBorderStyle Else Return _BorderStyle
End Get
Set(ByVal value As FormBorderStyle)
_BorderStyle = value
If _IsParentForm AndAlso Not _ControlMode Then
ParentForm.FormBorderStyle = value
If Not value = FormBorderStyle.None Then
Movable = False
Sizable = False
End If
End If
End Set
End Property
Private _StartPosition As FormStartPosition
Property StartPosition As FormStartPosition
Get
If _IsParentForm AndAlso Not _ControlMode Then Return ParentForm.StartPosition Else Return _StartPosition
End Get
Set(ByVal value As FormStartPosition)
_StartPosition = value
If _IsParentForm AndAlso Not _ControlMode Then
ParentForm.StartPosition = value
End If
End Set
End Property
Private _NoRounding As Boolean
Property NoRounding() As Boolean
Get
Return _NoRounding
End Get
Set(ByVal v As Boolean)
_NoRounding = v
Invalidate()
End Set
End Property
Private _Image As Image
Property Image() As Image
Get
Return _Image
End Get
Set(ByVal value As Image)
If value Is Nothing Then _ImageSize = Size.Empty Else _ImageSize = value.Size
_Image = value
Invalidate()
End Set
End Property
Private Items As New Dictionary(Of String, Color)
Property Colors() As Bloom()
Get
Dim T As New List(Of Bloom)
Dim E As Dictionary(Of String, Color).Enumerator = Items.GetEnumerator
While E.MoveNext
T.Add(New Bloom(E.Current.Key, E.Current.Value))
End While
Return T.ToArray
End Get
Set(ByVal value As Bloom())
For Each B As Bloom In value
If Items.ContainsKey(B.Name) Then Items(B.Name) = B.Value
Next
InvalidateCustimization()
ColorHook()
Invalidate()
End Set
End Property
Private _Customization As String
Property Customization() As String
Get
Return _Customization
End Get
Set(ByVal value As String)
If value = _Customization Then Return
Dim Data As Byte()
Dim Items As Bloom() = Colors
Try
Data = Convert.FromBase64String(value)
For I As Integer = 0 To Items.Length - 1
Items(I).Value = Color.FromArgb(BitConverter.ToInt32(Data, I * 4))
Next
Catch
Return
End Try
_Customization = value
Colors = Items
ColorHook()
Invalidate()
End Set
End Property
Private _Transparent As Boolean
Property Transparent() As Boolean
Get
Return _Transparent
End Get
Set(ByVal value As Boolean)
_Transparent = value
If Not (IsHandleCreated OrElse _ControlMode) Then Return
If Not value AndAlso Not BackColor.A = 255 Then
Throw New Exception("Unable to change value to false while a transparent BackColor is in use.")
End If
SetStyle(ControlStyles.Opaque, Not value)
SetStyle(ControlStyles.SupportsTransparentBackColor, value)
InvalidateBitmap()
Invalidate()
End Set
End Property
#End Region
#Region " Private Properties "
Private _ImageSize As Size
Protected ReadOnly Property ImageSize() As Size
Get
Return _ImageSize
End Get
End Property
Private _IsParentForm As Boolean
Protected ReadOnly Property IsParentForm As Boolean
Get
Return _IsParentForm
End Get
End Property
Protected ReadOnly Property IsParentMdi As Boolean
Get
If Parent Is Nothing Then Return False
Return Parent.Parent IsNot Nothing
End Get
End Property
Private _LockWidth As Integer
Protected Property LockWidth() As Integer
Get
Return _LockWidth
End Get
Set(ByVal value As Integer)
_LockWidth = value
If Not LockWidth = 0 AndAlso IsHandleCreated Then Width = LockWidth
End Set
End Property
Private _LockHeight As Integer
Protected Property LockHeight() As Integer
Get
Return _LockHeight
End Get
Set(ByVal value As Integer)
_LockHeight = value
If Not LockHeight = 0 AndAlso IsHandleCreated Then Height = LockHeight
End Set
End Property
Private _Header As Integer = 24
Protected Property Header() As Integer
Get
Return _Header
End Get
Set(ByVal v As Integer)
_Header = v
If Not _ControlMode Then
Frame = New Rectangle(7, 7, Width - 14, v - 7)
Invalidate()
End If
End Set
End Property
Private _ControlMode As Boolean
Protected Property ControlMode() As Boolean
Get
Return _ControlMode
End Get
Set(ByVal v As Boolean)
_ControlMode = v
Transparent = _Transparent
If _Transparent AndAlso _BackColor Then BackColor = Color.Transparent
InvalidateBitmap()
Invalidate()
End Set
End Property
Private _IsAnimated As Boolean
Protected Property IsAnimated() As Boolean
Get
Return _IsAnimated
End Get
Set(ByVal value As Boolean)
_IsAnimated = value
InvalidateTimer()
End Set
End Property
#End Region
#Region " Property Helpers "
Protected Function GetPen(ByVal name As String) As Pen
Return New Pen(Items(name))
End Function
Protected Function GetPen(ByVal name As String, ByVal width As Single) As Pen
Return New Pen(Items(name), width)
End Function
Protected Function GetBrush(ByVal name As String) As SolidBrush
Return New SolidBrush(Items(name))
End Function
Protected Function GetColor(ByVal name As String) As Color
Return Items(name)
End Function
Protected Sub SetColor(ByVal name As String, ByVal value As Color)
If Items.ContainsKey(name) Then Items(name) = value Else Items.Add(name, value)
End Sub
Protected Sub SetColor(ByVal name As String, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
SetColor(name, Color.FromArgb(r, g, b))
End Sub
Protected Sub SetColor(ByVal name As String, ByVal a As Byte, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
SetColor(name, Color.FromArgb(a, r, g, b))
End Sub
Protected Sub SetColor(ByVal name As String, ByVal a As Byte, ByVal value As Color)
SetColor(name, Color.FromArgb(a, value))
End Sub
Private Sub InvalidateBitmap()
If _Transparent AndAlso _ControlMode Then
If Width = 0 OrElse Height = 0 Then Return
B = New Bitmap(Width, Height, PixelFormat.Format32bppPArgb)
G = Graphics.FromImage(B)
Else
G = Nothing
B = Nothing
End If
End Sub
Private Sub InvalidateCustimization()
Dim M As New MemoryStream(Items.Count * 4)
For Each B As Bloom In Colors
M.Write(BitConverter.GetBytes(B.Value.ToArgb), 0, 4)
Next
M.Close()
_Customization = Convert.ToBase64String(M.ToArray)
End Sub
Private Sub InvalidateTimer()
If DesignMode OrElse Not DoneCreation Then Return
If _IsAnimated Then
AddAnimationCallback(AddressOf DoAnimation)
Else
RemoveAnimationCallback(AddressOf DoAnimation)
End If
End Sub
#End Region
#Region " User Hooks "
Protected MustOverride Sub ColorHook()
Protected MustOverride Sub PaintHook()
Protected Overridable Sub OnCreation()
End Sub
Protected Overridable Sub OnAnimation()
End Sub
#End Region
#Region " Offset "
Private OffsetReturnRectangle As Rectangle
Protected Function Offset(ByVal r As Rectangle, ByVal amount As Integer) As Rectangle
OffsetReturnRectangle = New Rectangle(r.X + amount, r.Y + amount, r.Width - (amount * 2), r.Height - (amount * 2))
Return OffsetReturnRectangle
End Function
Private OffsetReturnSize As Size
Protected Function Offset(ByVal s As Size, ByVal amount As Integer) As Size
OffsetReturnSize = New Size(s.Width + amount, s.Height + amount)
Return OffsetReturnSize
End Function
Private OffsetReturnPoint As Point
Protected Function Offset(ByVal p As Point, ByVal amount As Integer) As Point
OffsetReturnPoint = New Point(p.X + amount, p.Y + amount)
Return OffsetReturnPoint
End Function
#End Region
#Region " Center "
Private CenterReturn As Point
Protected Function Center(ByVal p As Rectangle, ByVal c As Rectangle) As Point
CenterReturn = New Point((p.Width \ 2 - c.Width \ 2) + p.X + c.X, (p.Height \ 2 - c.Height \ 2) + p.Y + c.Y)
Return CenterReturn
End Function
Protected Function Center(ByVal p As Rectangle, ByVal c As Size) As Point
CenterReturn = New Point((p.Width \ 2 - c.Width \ 2) + p.X, (p.Height \ 2 - c.Height \ 2) + p.Y)
Return CenterReturn
End Function
Protected Function Center(ByVal child As Rectangle) As Point
Return Center(Width, Height, child.Width, child.Height)
End Function
Protected Function Center(ByVal child As Size) As Point
Return Center(Width, Height, child.Width, child.Height)
End Function
Protected Function Center(ByVal childWidth As Integer, ByVal childHeight As Integer) As Point
Return Center(Width, Height, childWidth, childHeight)
End Function
Protected Function Center(ByVal p As Size, ByVal c As Size) As Point
Return Center(p.Width, p.Height, c.Width, c.Height)
End Function
Protected Function Center(ByVal pWidth As Integer, ByVal pHeight As Integer, ByVal cWidth As Integer, ByVal cHeight As Integer) As Point
CenterReturn = New Point(pWidth \ 2 - cWidth \ 2, pHeight \ 2 - cHeight \ 2)
Return CenterReturn
End Function
#End Region
#Region " Measure "
Private MeasureBitmap As Bitmap
Private MeasureGraphics As Graphics
Protected Function Measure() As Size
SyncLock MeasureGraphics
Return MeasureGraphics.MeasureString(Text, Font, Width).ToSize
End SyncLock
End Function
Protected Function Measure(ByVal text As String) As Size
SyncLock MeasureGraphics
Return MeasureGraphics.MeasureString(text, Font, Width).ToSize
End SyncLock
End Function
#End Region
#Region " DrawPixel "
Private DrawPixelBrush As SolidBrush
Protected Sub DrawPixel(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer)
If _Transparent Then
B.SetPixel(x, y, c1)
Else
DrawPixelBrush = New SolidBrush(c1)
G.FillRectangle(DrawPixelBrush, x, y, 1, 1)
End If
End Sub
#End Region
#Region " DrawCorners "
Private DrawCornersBrush As SolidBrush
Protected Sub DrawCorners(ByVal c1 As Color, ByVal offset As Integer)
DrawCorners(c1, 0, 0, Width, Height, offset)
End Sub
Protected Sub DrawCorners(ByVal c1 As Color, ByVal r1 As Rectangle, ByVal offset As Integer)
DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height, offset)
End Sub
Protected Sub DrawCorners(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal offset As Integer)
DrawCorners(c1, x + offset, y + offset, width - (offset * 2), height - (offset * 2))
End Sub
Protected Sub DrawCorners(ByVal c1 As Color)
DrawCorners(c1, 0, 0, Width, Height)
End Sub
Protected Sub DrawCorners(ByVal c1 As Color, ByVal r1 As Rectangle)
DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height)
End Sub
Protected Sub DrawCorners(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
If _NoRounding Then Return
If _Transparent Then
B.SetPixel(x, y, c1)
B.SetPixel(x + (width - 1), y, c1)
B.SetPixel(x, y + (height - 1), c1)
B.SetPixel(x + (width - 1), y + (height - 1), c1)
Else
DrawCornersBrush = New SolidBrush(c1)
G.FillRectangle(DrawCornersBrush, x, y, 1, 1)
G.FillRectangle(DrawCornersBrush, x + (width - 1), y, 1, 1)
G.FillRectangle(DrawCornersBrush, x, y + (height - 1), 1, 1)
G.FillRectangle(DrawCornersBrush, x + (width - 1), y + (height - 1), 1, 1)
End If
End Sub
#End Region
#Region " DrawBorders "
Protected Sub DrawBorders(ByVal p1 As Pen, ByVal offset As Integer)
DrawBorders(p1, 0, 0, Width, Height, offset)
End Sub
Protected Sub DrawBorders(ByVal p1 As Pen, ByVal r As Rectangle, ByVal offset As Integer)
DrawBorders(p1, r.X, r.Y, r.Width, r.Height, offset)
End Sub
Protected Sub DrawBorders(ByVal p1 As Pen, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal offset As Integer)
DrawBorders(p1, x + offset, y + offset, width - (offset * 2), height - (offset * 2))
End Sub
Protected Sub DrawBorders(ByVal p1 As Pen)
DrawBorders(p1, 0, 0, Width, Height)
End Sub
Protected Sub DrawBorders(ByVal p1 As Pen, ByVal r As Rectangle)
DrawBorders(p1, r.X, r.Y, r.Width, r.Height)
End Sub
Protected Sub DrawBorders(ByVal p1 As Pen, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
G.DrawRectangle(p1, x, y, width - 1, height - 1)
End Sub
#End Region
#Region " DrawText "
Private DrawTextPoint As Point
Private DrawTextSize As Size
Protected Sub DrawText(ByVal b1 As Brush, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
DrawText(b1, Text, a, x, y)
End Sub
Protected Sub DrawText(ByVal b1 As Brush, ByVal text As String, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
If text.Length = 0 Then Return
DrawTextSize = Measure(text)
DrawTextPoint = New Point(Width \ 2 - DrawTextSize.Width \ 2, Header \ 2 - DrawTextSize.Height \ 2)
Select Case a
Case HorizontalAlignment.Left
G.DrawString(text, Font, b1, x, DrawTextPoint.Y + y)
Case HorizontalAlignment.Center
G.DrawString(text, Font, b1, DrawTextPoint.X + x, DrawTextPoint.Y + y)
Case HorizontalAlignment.Right
G.DrawString(text, Font, b1, Width - DrawTextSize.Width - x, DrawTextPoint.Y + y)
End Select
End Sub
Protected Sub DrawText(ByVal b1 As Brush, ByVal p1 As Point)
If Text.Length = 0 Then Return
G.DrawString(Text, Font, b1, p1)
End Sub
Protected Sub DrawText(ByVal b1 As Brush, ByVal x As Integer, ByVal y As Integer)
If Text.Length = 0 Then Return
G.DrawString(Text, Font, b1, x, y)
End Sub
#End Region
#Region " DrawImage "
Private DrawImagePoint As Point
Protected Sub DrawImage(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
DrawImage(_Image, a, x, y)
End Sub
Protected Sub DrawImage(ByVal image As Image, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
If image Is Nothing Then Return
DrawImagePoint = New Point(Width \ 2 - image.Width \ 2, Header \ 2 - image.Height \ 2)
Select Case a
Case HorizontalAlignment.Left
G.DrawImage(image, x, DrawImagePoint.Y + y, image.Width, image.Height)
Case HorizontalAlignment.Center
G.DrawImage(image, DrawImagePoint.X + x, DrawImagePoint.Y + y, image.Width, image.Height)
Case HorizontalAlignment.Right
G.DrawImage(image, Width - image.Width - x, DrawImagePoint.Y + y, image.Width, image.Height)
End Select
End Sub
Protected Sub DrawImage(ByVal p1 As Point)
DrawImage(_Image, p1.X, p1.Y)
End Sub
Protected Sub DrawImage(ByVal x As Integer, ByVal y As Integer)
DrawImage(_Image, x, y)
End Sub
Protected Sub DrawImage(ByVal image As Image, ByVal p1 As Point)
DrawImage(image, p1.X, p1.Y)
End Sub
Protected Sub DrawImage(ByVal image As Image, ByVal x As Integer, ByVal y As Integer)
If image Is Nothing Then Return
G.DrawImage(image, x, y, image.Width, image.Height)
End Sub
#End Region
#Region " DrawGradient "
Private DrawGradientBrush As LinearGradientBrush
Private DrawGradientRectangle As Rectangle
Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
DrawGradientRectangle = New Rectangle(x, y, width, height)
DrawGradient(blend, DrawGradientRectangle)
End Sub
Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
DrawGradientRectangle = New Rectangle(x, y, width, height)
DrawGradient(blend, DrawGradientRectangle, angle)
End Sub
Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal r As Rectangle)
DrawGradientBrush = New LinearGradientBrush(r, Color.Empty, Color.Empty, 90.0F)
DrawGradientBrush.InterpolationColors = blend
G.FillRectangle(DrawGradientBrush, r)
End Sub
Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal angle As Single)
DrawGradientBrush = New LinearGradientBrush(r, Color.Empty, Color.Empty, angle)
DrawGradientBrush.InterpolationColors = blend
G.FillRectangle(DrawGradientBrush, r)
End Sub
Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
DrawGradientRectangle = New Rectangle(x, y, width, height)
DrawGradient(c1, c2, DrawGradientRectangle)
End Sub
Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
DrawGradientRectangle = New Rectangle(x, y, width, height)
DrawGradient(c1, c2, DrawGradientRectangle, angle)
End Sub
Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
DrawGradientBrush = New LinearGradientBrush(r, c1, c2, 90.0F)
G.FillRectangle(DrawGradientBrush, r)
End Sub
Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle, ByVal angle As Single)
DrawGradientBrush = New LinearGradientBrush(r, c1, c2, angle)
G.FillRectangle(DrawGradientBrush, r)
End Sub
#End Region
#Region " DrawRadial "
Private DrawRadialPath As GraphicsPath
Private DrawRadialBrush1 As PathGradientBrush
Private DrawRadialBrush2 As LinearGradientBrush
Private DrawRadialRectangle As Rectangle
Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
DrawRadialRectangle = New Rectangle(x, y, width, height)
DrawRadial(blend, DrawRadialRectangle, width \ 2, height \ 2)
End Sub
Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal center As Point)
DrawRadialRectangle = New Rectangle(x, y, width, height)
DrawRadial(blend, DrawRadialRectangle, center.X, center.Y)
End Sub
Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal cx As Integer, ByVal cy As Integer)
DrawRadialRectangle = New Rectangle(x, y, width, height)
DrawRadial(blend, DrawRadialRectangle, cx, cy)
End Sub
Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle)
DrawRadial(blend, r, r.Width \ 2, r.Height \ 2)
End Sub
Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal center As Point)
DrawRadial(blend, r, center.X, center.Y)
End Sub
Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal cx As Integer, ByVal cy As Integer)
DrawRadialPath.Reset()
DrawRadialPath.AddEllipse(r.X, r.Y, r.Width - 1, r.Height - 1)
DrawRadialBrush1 = New PathGradientBrush(DrawRadialPath)
DrawRadialBrush1.CenterPoint = New Point(r.X + cx, r.Y + cy)
DrawRadialBrush1.InterpolationColors = blend
If G.SmoothingMode = SmoothingMode.AntiAlias Then
G.FillEllipse(DrawRadialBrush1, r.X + 1, r.Y + 1, r.Width - 3, r.Height - 3)
Else
G.FillEllipse(DrawRadialBrush1, r)
End If
End Sub
Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
DrawRadialRectangle = New Rectangle(x, y, width, height)
DrawRadial(c1, c2, DrawGradientRectangle)
End Sub
Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
DrawRadialRectangle = New Rectangle(x, y, width, height)
DrawRadial(c1, c2, DrawGradientRectangle, angle)
End Sub
Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
DrawRadialBrush2 = New LinearGradientBrush(r, c1, c2, 90.0F)
G.FillRectangle(DrawGradientBrush, r)
End Sub
Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle, ByVal angle As Single)
DrawRadialBrush2 = New LinearGradientBrush(r, c1, c2, angle)
G.FillEllipse(DrawGradientBrush, r)
End Sub
#End Region
#Region " CreateRound "
Private CreateRoundPath As GraphicsPath
Private CreateRoundRectangle As Rectangle
Function CreateRound(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal slope As Integer) As GraphicsPath
CreateRoundRectangle = New Rectangle(x, y, width, height)
Return CreateRound(CreateRoundRectangle, slope)
End Function
Function CreateRound(ByVal r As Rectangle, ByVal slope As Integer) As GraphicsPath
CreateRoundPath = New GraphicsPath(FillMode.Winding)
CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180.0F, 90.0F)
CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270.0F, 90.0F)
CreateRoundPath.AddArc(r.Right - slope, r.Bottom - slope, slope, slope, 0.0F, 90.0F)
CreateRoundPath.AddArc(r.X, r.Bottom - slope, slope, slope, 90.0F, 90.0F)
CreateRoundPath.CloseFigure()
Return CreateRoundPath
End Function
#End Region
End Class
MustInherit Class ThemeControl154
Inherits Control
#Region " Initialization "
Protected G As Graphics, B As Bitmap
Sub New()
SetStyle(DirectCast(139270, ControlStyles), True)
_ImageSize = Size.Empty
Font = New Font("Verdana", 8S)
MeasureBitmap = New Bitmap(1, 1)
MeasureGraphics = Graphics.FromImage(MeasureBitmap)
DrawRadialPath = New GraphicsPath
InvalidateCustimization() 'Remove?
End Sub
Protected NotOverridable Overrides Sub OnHandleCreated(ByVal e As EventArgs)
InvalidateCustimization()
ColorHook()
If Not _LockWidth = 0 Then Width = _LockWidth
If Not _LockHeight = 0 Then Height = _LockHeight
Transparent = _Transparent
If _Transparent AndAlso _BackColor Then BackColor = Color.Transparent
MyBase.OnHandleCreated(e)
End Sub
Private DoneCreation As Boolean
Protected NotOverridable Overrides Sub OnParentChanged(ByVal e As EventArgs)
If Parent IsNot Nothing Then
OnCreation()
DoneCreation = True
InvalidateTimer()
End If
MyBase.OnParentChanged(e)
End Sub
#End Region
Private Sub DoAnimation(ByVal i As Boolean)
OnAnimation()
If i Then Invalidate()
End Sub
Protected NotOverridable Overrides Sub OnPaint(ByVal e As PaintEventArgs)
If Width = 0 OrElse Height = 0 Then Return
If _Transparent Then
PaintHook()
e.Graphics.DrawImage(B, 0, 0)
Else
G = e.Graphics
PaintHook()
End If
End Sub
Protected Overrides Sub OnHandleDestroyed(ByVal e As EventArgs)
RemoveAnimationCallback(AddressOf DoAnimation)
MyBase.OnHandleDestroyed(e)
End Sub
#Region " Size Handling "
Protected NotOverridable Overrides Sub OnSizeChanged(ByVal e As EventArgs)
If _Transparent Then
InvalidateBitmap()
End If
Invalidate()
MyBase.OnSizeChanged(e)
End Sub
Protected Overrides Sub SetBoundsCore(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal specified As BoundsSpecified)
If Not _LockWidth = 0 Then width = _LockWidth
If Not _LockHeight = 0 Then height = _LockHeight
MyBase.SetBoundsCore(x, y, width, height, specified)
End Sub
#End Region
#Region " State Handling "
Private InPosition As Boolean
Protected Overrides Sub OnMouseEnter(ByVal e As EventArgs)
InPosition = True
SetState(MouseState.Over)
MyBase.OnMouseEnter(e)
End Sub
Protected Overrides Sub OnMouseUp(ByVal e As MouseEventArgs)
If InPosition Then SetState(MouseState.Over)
MyBase.OnMouseUp(e)
End Sub
Protected Overrides Sub OnMouseDown(ByVal e As MouseEventArgs)
If e.Button = Windows.Forms.MouseButtons.Left Then SetState(MouseState.Down)
MyBase.OnMouseDown(e)
End Sub
Protected Overrides Sub OnMouseLeave(ByVal e As EventArgs)
InPosition = False
SetState(MouseState.None)
MyBase.OnMouseLeave(e)
End Sub
Protected Overrides Sub OnEnabledChanged(ByVal e As EventArgs)
If Enabled Then SetState(MouseState.None) Else SetState(MouseState.Block)
MyBase.OnEnabledChanged(e)
End Sub
Protected State As MouseState
Private Sub SetState(ByVal current As MouseState)
State = current
Invalidate()
End Sub
#End Region
#Region " Base Properties "
<Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
Overrides Property ForeColor() As Color
Get
Return Color.Empty
End Get
Set(ByVal value As Color)
End Set
End Property
<Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
Overrides Property BackgroundImage() As Image
Get
Return Nothing
End Get
Set(ByVal value As Image)
End Set
End Property
<Browsable(False), EditorBrowsable(EditorBrowsableState.Never), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)>
Overrides Property BackgroundImageLayout() As ImageLayout
Get
Return ImageLayout.None
End Get
Set(ByVal value As ImageLayout)
End Set
End Property
Overrides Property Text() As String
Get
Return MyBase.Text
End Get
Set(ByVal value As String)
MyBase.Text = value
Invalidate()
End Set
End Property
Overrides Property Font() As Font
Get
Return MyBase.Font
End Get
Set(ByVal value As Font)
MyBase.Font = value
Invalidate()
End Set
End Property
Private _BackColor As Boolean
<Category("Misc")>
Overrides Property BackColor() As Color
Get
Return MyBase.BackColor
End Get
Set(ByVal value As Color)
If Not IsHandleCreated AndAlso value = Color.Transparent Then
_BackColor = True
Return
End If
MyBase.BackColor = value
If Parent IsNot Nothing Then ColorHook()
End Set
End Property
#End Region
#Region " Public Properties "
Private _NoRounding As Boolean
Property NoRounding() As Boolean
Get
Return _NoRounding
End Get
Set(ByVal v As Boolean)
_NoRounding = v
Invalidate()
End Set
End Property
Private _Image As Image
Property Image() As Image
Get
Return _Image
End Get
Set(ByVal value As Image)
If value Is Nothing Then
_ImageSize = Size.Empty
Else
_ImageSize = value.Size
End If
_Image = value
Invalidate()
End Set
End Property
Private _Transparent As Boolean
Property Transparent() As Boolean
Get
Return _Transparent
End Get
Set(ByVal value As Boolean)
_Transparent = value
If Not IsHandleCreated Then Return
If Not value AndAlso Not BackColor.A = 255 Then
Throw New Exception("Unable to change value to false while a transparent BackColor is in use.")
End If
SetStyle(ControlStyles.Opaque, Not value)
SetStyle(ControlStyles.SupportsTransparentBackColor, value)
If value Then InvalidateBitmap() Else B = Nothing
Invalidate()
End Set
End Property
Private Items As New Dictionary(Of String, Color)
Property Colors() As Bloom()
Get
Dim T As New List(Of Bloom)
Dim E As Dictionary(Of String, Color).Enumerator = Items.GetEnumerator
While E.MoveNext
T.Add(New Bloom(E.Current.Key, E.Current.Value))
End While
Return T.ToArray
End Get
Set(ByVal value As Bloom())
For Each B As Bloom In value
If Items.ContainsKey(B.Name) Then Items(B.Name) = B.Value
Next
InvalidateCustimization()
ColorHook()
Invalidate()
End Set
End Property
Private _Customization As String
Property Customization() As String
Get
Return _Customization
End Get
Set(ByVal value As String)
If value = _Customization Then Return
Dim Data As Byte()
Dim Items As Bloom() = Colors
Try
Data = Convert.FromBase64String(value)
For I As Integer = 0 To Items.Length - 1
Items(I).Value = Color.FromArgb(BitConverter.ToInt32(Data, I * 4))
Next
Catch
Return
End Try
_Customization = value
Colors = Items
ColorHook()
Invalidate()
End Set
End Property
#End Region
#Region " Private Properties "
Private _ImageSize As Size
Protected ReadOnly Property ImageSize() As Size
Get
Return _ImageSize
End Get
End Property
Private _LockWidth As Integer
Protected Property LockWidth() As Integer
Get
Return _LockWidth
End Get
Set(ByVal value As Integer)
_LockWidth = value
If Not LockWidth = 0 AndAlso IsHandleCreated Then Width = LockWidth
End Set
End Property
Private _LockHeight As Integer
Protected Property LockHeight() As Integer
Get
Return _LockHeight
End Get
Set(ByVal value As Integer)
_LockHeight = value
If Not LockHeight = 0 AndAlso IsHandleCreated Then Height = LockHeight
End Set
End Property
Private _IsAnimated As Boolean
Protected Property IsAnimated() As Boolean
Get
Return _IsAnimated
End Get
Set(ByVal value As Boolean)
_IsAnimated = value
InvalidateTimer()
End Set
End Property
#End Region
#Region " Property Helpers "
Protected Function GetPen(ByVal name As String) As Pen
Return New Pen(Items(name))
End Function
Protected Function GetPen(ByVal name As String, ByVal width As Single) As Pen
Return New Pen(Items(name), width)
End Function
Protected Function GetBrush(ByVal name As String) As SolidBrush
Return New SolidBrush(Items(name))
End Function
Protected Function GetColor(ByVal name As String) As Color
Return Items(name)
End Function
Protected Sub SetColor(ByVal name As String, ByVal value As Color)
If Items.ContainsKey(name) Then Items(name) = value Else Items.Add(name, value)
End Sub
Protected Sub SetColor(ByVal name As String, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
SetColor(name, Color.FromArgb(r, g, b))
End Sub
Protected Sub SetColor(ByVal name As String, ByVal a As Byte, ByVal r As Byte, ByVal g As Byte, ByVal b As Byte)
SetColor(name, Color.FromArgb(a, r, g, b))
End Sub
Protected Sub SetColor(ByVal name As String, ByVal a As Byte, ByVal value As Color)
SetColor(name, Color.FromArgb(a, value))
End Sub
Private Sub InvalidateBitmap()
If Width = 0 OrElse Height = 0 Then Return
B = New Bitmap(Width, Height, PixelFormat.Format32bppPArgb)
G = Graphics.FromImage(B)
End Sub
Private Sub InvalidateCustimization()
Dim M As New MemoryStream(Items.Count * 4)
For Each B As Bloom In Colors
M.Write(BitConverter.GetBytes(B.Value.ToArgb), 0, 4)
Next
M.Close()
_Customization = Convert.ToBase64String(M.ToArray)
End Sub
Private Sub InvalidateTimer()
If DesignMode OrElse Not DoneCreation Then Return
If _IsAnimated Then
AddAnimationCallback(AddressOf DoAnimation)
Else
RemoveAnimationCallback(AddressOf DoAnimation)
End If
End Sub
#End Region
#Region " User Hooks "
Protected MustOverride Sub ColorHook()
Protected MustOverride Sub PaintHook()
Protected Overridable Sub OnCreation()
End Sub
Protected Overridable Sub OnAnimation()
End Sub
#End Region
#Region " Offset "
Private OffsetReturnRectangle As Rectangle
Protected Function Offset(ByVal r As Rectangle, ByVal amount As Integer) As Rectangle
OffsetReturnRectangle = New Rectangle(r.X + amount, r.Y + amount, r.Width - (amount * 2), r.Height - (amount * 2))
Return OffsetReturnRectangle
End Function
Private OffsetReturnSize As Size
Protected Function Offset(ByVal s As Size, ByVal amount As Integer) As Size
OffsetReturnSize = New Size(s.Width + amount, s.Height + amount)
Return OffsetReturnSize
End Function
Private OffsetReturnPoint As Point
Protected Function Offset(ByVal p As Point, ByVal amount As Integer) As Point
OffsetReturnPoint = New Point(p.X + amount, p.Y + amount)
Return OffsetReturnPoint
End Function
#End Region
#Region " Center "
Private CenterReturn As Point
Protected Function Center(ByVal p As Rectangle, ByVal c As Rectangle) As Point
CenterReturn = New Point((p.Width \ 2 - c.Width \ 2) + p.X + c.X, (p.Height \ 2 - c.Height \ 2) + p.Y + c.Y)
Return CenterReturn
End Function
Protected Function Center(ByVal p As Rectangle, ByVal c As Size) As Point
CenterReturn = New Point((p.Width \ 2 - c.Width \ 2) + p.X, (p.Height \ 2 - c.Height \ 2) + p.Y)
Return CenterReturn
End Function
Protected Function Center(ByVal child As Rectangle) As Point
Return Center(Width, Height, child.Width, child.Height)
End Function
Protected Function Center(ByVal child As Size) As Point
Return Center(Width, Height, child.Width, child.Height)
End Function
Protected Function Center(ByVal childWidth As Integer, ByVal childHeight As Integer) As Point
Return Center(Width, Height, childWidth, childHeight)
End Function
Protected Function Center(ByVal p As Size, ByVal c As Size) As Point
Return Center(p.Width, p.Height, c.Width, c.Height)
End Function
Protected Function Center(ByVal pWidth As Integer, ByVal pHeight As Integer, ByVal cWidth As Integer, ByVal cHeight As Integer) As Point
CenterReturn = New Point(pWidth \ 2 - cWidth \ 2, pHeight \ 2 - cHeight \ 2)
Return CenterReturn
End Function
#End Region
#Region " Measure "
Private MeasureBitmap As Bitmap
Private MeasureGraphics As Graphics 'TODO: Potential issues during multi-threading.
Protected Function Measure() As Size
Return MeasureGraphics.MeasureString(Text, Font, Width).ToSize
End Function
Protected Function Measure(ByVal text As String) As Size
Return MeasureGraphics.MeasureString(text, Font, Width).ToSize
End Function
#End Region
#Region " DrawPixel "
Private DrawPixelBrush As SolidBrush
Protected Sub DrawPixel(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer)
If _Transparent Then
B.SetPixel(x, y, c1)
Else
DrawPixelBrush = New SolidBrush(c1)
G.FillRectangle(DrawPixelBrush, x, y, 1, 1)
End If
End Sub
#End Region
#Region " DrawCorners "
Private DrawCornersBrush As SolidBrush
Protected Sub DrawCorners(ByVal c1 As Color, ByVal offset As Integer)
DrawCorners(c1, 0, 0, Width, Height, offset)
End Sub
Protected Sub DrawCorners(ByVal c1 As Color, ByVal r1 As Rectangle, ByVal offset As Integer)
DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height, offset)
End Sub
Protected Sub DrawCorners(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal offset As Integer)
DrawCorners(c1, x + offset, y + offset, width - (offset * 2), height - (offset * 2))
End Sub
Protected Sub DrawCorners(ByVal c1 As Color)
DrawCorners(c1, 0, 0, Width, Height)
End Sub
Protected Sub DrawCorners(ByVal c1 As Color, ByVal r1 As Rectangle)
DrawCorners(c1, r1.X, r1.Y, r1.Width, r1.Height)
End Sub
Protected Sub DrawCorners(ByVal c1 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
If _NoRounding Then Return
If _Transparent Then
B.SetPixel(x, y, c1)
B.SetPixel(x + (width - 1), y, c1)
B.SetPixel(x, y + (height - 1), c1)
B.SetPixel(x + (width - 1), y + (height - 1), c1)
Else
DrawCornersBrush = New SolidBrush(c1)
G.FillRectangle(DrawCornersBrush, x, y, 1, 1)
G.FillRectangle(DrawCornersBrush, x + (width - 1), y, 1, 1)
G.FillRectangle(DrawCornersBrush, x, y + (height - 1), 1, 1)
G.FillRectangle(DrawCornersBrush, x + (width - 1), y + (height - 1), 1, 1)
End If
End Sub
#End Region
#Region " DrawBorders "
Protected Sub DrawBorders(ByVal p1 As Pen, ByVal offset As Integer)
DrawBorders(p1, 0, 0, Width, Height, offset)
End Sub
Protected Sub DrawBorders(ByVal p1 As Pen, ByVal r As Rectangle, ByVal offset As Integer)
DrawBorders(p1, r.X, r.Y, r.Width, r.Height, offset)
End Sub
Protected Sub DrawBorders(ByVal p1 As Pen, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal offset As Integer)
DrawBorders(p1, x + offset, y + offset, width - (offset * 2), height - (offset * 2))
End Sub
Protected Sub DrawBorders(ByVal p1 As Pen)
DrawBorders(p1, 0, 0, Width, Height)
End Sub
Protected Sub DrawBorders(ByVal p1 As Pen, ByVal r As Rectangle)
DrawBorders(p1, r.X, r.Y, r.Width, r.Height)
End Sub
Protected Sub DrawBorders(ByVal p1 As Pen, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
G.DrawRectangle(p1, x, y, width - 1, height - 1)
End Sub
#End Region
#Region " DrawText "
Private DrawTextPoint As Point
Private DrawTextSize As Size
Protected Sub DrawText(ByVal b1 As Brush, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
DrawText(b1, Text, a, x, y)
End Sub
Protected Sub DrawText(ByVal b1 As Brush, ByVal text As String, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
If text.Length = 0 Then Return
DrawTextSize = Measure(text)
DrawTextPoint = Center(DrawTextSize)
Select Case a
Case HorizontalAlignment.Left
G.DrawString(text, Font, b1, x, DrawTextPoint.Y + y)
Case HorizontalAlignment.Center
G.DrawString(text, Font, b1, DrawTextPoint.X + x, DrawTextPoint.Y + y)
Case HorizontalAlignment.Right
G.DrawString(text, Font, b1, Width - DrawTextSize.Width - x, DrawTextPoint.Y + y)
End Select
End Sub
Protected Sub DrawText(ByVal b1 As Brush, ByVal p1 As Point)
If Text.Length = 0 Then Return
G.DrawString(Text, Font, b1, p1)
End Sub
Protected Sub DrawText(ByVal b1 As Brush, ByVal x As Integer, ByVal y As Integer)
If Text.Length = 0 Then Return
G.DrawString(Text, Font, b1, x, y)
End Sub
#End Region
#Region " DrawImage "
Private DrawImagePoint As Point
Protected Sub DrawImage(ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
DrawImage(_Image, a, x, y)
End Sub
Protected Sub DrawImage(ByVal image As Image, ByVal a As HorizontalAlignment, ByVal x As Integer, ByVal y As Integer)
If image Is Nothing Then Return
DrawImagePoint = Center(image.Size)
Select Case a
Case HorizontalAlignment.Left
G.DrawImage(image, x, DrawImagePoint.Y + y, image.Width, image.Height)
Case HorizontalAlignment.Center
G.DrawImage(image, DrawImagePoint.X + x, DrawImagePoint.Y + y, image.Width, image.Height)
Case HorizontalAlignment.Right
G.DrawImage(image, Width - image.Width - x, DrawImagePoint.Y + y, image.Width, image.Height)
End Select
End Sub
Protected Sub DrawImage(ByVal p1 As Point)
DrawImage(_Image, p1.X, p1.Y)
End Sub
Protected Sub DrawImage(ByVal x As Integer, ByVal y As Integer)
DrawImage(_Image, x, y)
End Sub
Protected Sub DrawImage(ByVal image As Image, ByVal p1 As Point)
DrawImage(image, p1.X, p1.Y)
End Sub
Protected Sub DrawImage(ByVal image As Image, ByVal x As Integer, ByVal y As Integer)
If image Is Nothing Then Return
G.DrawImage(image, x, y, image.Width, image.Height)
End Sub
#End Region
#Region " DrawGradient "
Private DrawGradientBrush As LinearGradientBrush
Private DrawGradientRectangle As Rectangle
Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
DrawGradientRectangle = New Rectangle(x, y, width, height)
DrawGradient(blend, DrawGradientRectangle)
End Sub
Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
DrawGradientRectangle = New Rectangle(x, y, width, height)
DrawGradient(blend, DrawGradientRectangle, angle)
End Sub
Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal r As Rectangle)
DrawGradientBrush = New LinearGradientBrush(r, Color.Empty, Color.Empty, 90.0F)
DrawGradientBrush.InterpolationColors = blend
G.FillRectangle(DrawGradientBrush, r)
End Sub
Protected Sub DrawGradient(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal angle As Single)
DrawGradientBrush = New LinearGradientBrush(r, Color.Empty, Color.Empty, angle)
DrawGradientBrush.InterpolationColors = blend
G.FillRectangle(DrawGradientBrush, r)
End Sub
Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
DrawGradientRectangle = New Rectangle(x, y, width, height)
DrawGradient(c1, c2, DrawGradientRectangle)
End Sub
Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
DrawGradientRectangle = New Rectangle(x, y, width, height)
DrawGradient(c1, c2, DrawGradientRectangle, angle)
End Sub
Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
DrawGradientBrush = New LinearGradientBrush(r, c1, c2, 90.0F)
G.FillRectangle(DrawGradientBrush, r)
End Sub
Protected Sub DrawGradient(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle, ByVal angle As Single)
DrawGradientBrush = New LinearGradientBrush(r, c1, c2, angle)
G.FillRectangle(DrawGradientBrush, r)
End Sub
#End Region
#Region " DrawRadial "
Private DrawRadialPath As GraphicsPath
Private DrawRadialBrush1 As PathGradientBrush
Private DrawRadialBrush2 As LinearGradientBrush
Private DrawRadialRectangle As Rectangle
Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
DrawRadialRectangle = New Rectangle(x, y, width, height)
DrawRadial(blend, DrawRadialRectangle, width \ 2, height \ 2)
End Sub
Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal center As Point)
DrawRadialRectangle = New Rectangle(x, y, width, height)
DrawRadial(blend, DrawRadialRectangle, center.X, center.Y)
End Sub
Sub DrawRadial(ByVal blend As ColorBlend, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal cx As Integer, ByVal cy As Integer)
DrawRadialRectangle = New Rectangle(x, y, width, height)
DrawRadial(blend, DrawRadialRectangle, cx, cy)
End Sub
Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle)
DrawRadial(blend, r, r.Width \ 2, r.Height \ 2)
End Sub
Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal center As Point)
DrawRadial(blend, r, center.X, center.Y)
End Sub
Sub DrawRadial(ByVal blend As ColorBlend, ByVal r As Rectangle, ByVal cx As Integer, ByVal cy As Integer)
DrawRadialPath.Reset()
DrawRadialPath.AddEllipse(r.X, r.Y, r.Width - 1, r.Height - 1)
DrawRadialBrush1 = New PathGradientBrush(DrawRadialPath)
DrawRadialBrush1.CenterPoint = New Point(r.X + cx, r.Y + cy)
DrawRadialBrush1.InterpolationColors = blend
If G.SmoothingMode = SmoothingMode.AntiAlias Then
G.FillEllipse(DrawRadialBrush1, r.X + 1, r.Y + 1, r.Width - 3, r.Height - 3)
Else
G.FillEllipse(DrawRadialBrush1, r)
End If
End Sub
Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer)
DrawRadialRectangle = New Rectangle(x, y, width, height)
DrawRadial(c1, c2, DrawRadialRectangle)
End Sub
Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal angle As Single)
DrawRadialRectangle = New Rectangle(x, y, width, height)
DrawRadial(c1, c2, DrawRadialRectangle, angle)
End Sub
Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle)
DrawRadialBrush2 = New LinearGradientBrush(r, c1, c2, 90.0F)
G.FillEllipse(DrawRadialBrush2, r)
End Sub
Protected Sub DrawRadial(ByVal c1 As Color, ByVal c2 As Color, ByVal r As Rectangle, ByVal angle As Single)
DrawRadialBrush2 = New LinearGradientBrush(r, c1, c2, angle)
G.FillEllipse(DrawRadialBrush2, r)
End Sub
#End Region
#Region " CreateRound "
Private CreateRoundPath As GraphicsPath
Private CreateRoundRectangle As Rectangle
Function CreateRound(ByVal x As Integer, ByVal y As Integer, ByVal width As Integer, ByVal height As Integer, ByVal slope As Integer) As GraphicsPath
CreateRoundRectangle = New Rectangle(x, y, width, height)
Return CreateRound(CreateRoundRectangle, slope)
End Function
Function CreateRound(ByVal r As Rectangle, ByVal slope As Integer) As GraphicsPath
CreateRoundPath = New GraphicsPath(FillMode.Winding)
CreateRoundPath.AddArc(r.X, r.Y, slope, slope, 180.0F, 90.0F)
CreateRoundPath.AddArc(r.Right - slope, r.Y, slope, slope, 270.0F, 90.0F)
CreateRoundPath.AddArc(r.Right - slope, r.Bottom - slope, slope, slope, 0.0F, 90.0F)
CreateRoundPath.AddArc(r.X, r.Bottom - slope, slope, slope, 90.0F, 90.0F)
CreateRoundPath.CloseFigure()
Return CreateRoundPath
End Function
#End Region
End Class
Module ThemeShare
#Region " Animation "
Private Frames As Integer
Private Invalidate As Boolean
Public ThemeTimer As New PrecisionTimer
Public FPS As Integer = 20 '1000 / 50 = 20 FPS
Public Rate As Integer = 50
Public Delegate Sub AnimationDelegate(ByVal invalidate As Boolean)
Private Callbacks As New List(Of AnimationDelegate)
Private Sub HandleCallbacks(ByVal state As IntPtr, ByVal reserve As Boolean)
Invalidate = (Frames >= FPS)
If Invalidate Then Frames = 0
SyncLock Callbacks
For I As Integer = 0 To Callbacks.Count - 1
Callbacks(I).Invoke(Invalidate)
Next
End SyncLock
Frames += Rate
End Sub
Private Sub InvalidateThemeTimer()
If Callbacks.Count = 0 Then
ThemeTimer.Delete()
Else
ThemeTimer.Create(0, Rate, AddressOf HandleCallbacks)
End If
End Sub
Sub AddAnimationCallback(ByVal callback As AnimationDelegate)
SyncLock Callbacks
If Callbacks.Contains(callback) Then Return
Callbacks.Add(callback)
InvalidateThemeTimer()
End SyncLock
End Sub
Sub RemoveAnimationCallback(ByVal callback As AnimationDelegate)
SyncLock Callbacks
If Not Callbacks.Contains(callback) Then Return
Callbacks.Remove(callback)
InvalidateThemeTimer()
End SyncLock
End Sub
#End Region
End Module
Enum MouseState As Byte
None = 0
Over = 1
Down = 2
Block = 3
End Enum
Structure Bloom
Public _Name As String
ReadOnly Property Name() As String
Get
Return _Name
End Get
End Property
Private _Value As Color
Property Value() As Color
Get
Return _Value
End Get
Set(ByVal value As Color)
_Value = value
End Set
End Property
Property ValueHex() As String
Get
Return String.Concat("#",
_Value.R.ToString("X2", Nothing),
_Value.G.ToString("X2", Nothing),
_Value.B.ToString("X2", Nothing))
End Get
Set(ByVal value As String)
Try
_Value = ColorTranslator.FromHtml(value)
Catch
Return
End Try
End Set
End Property
Sub New(ByVal name As String, ByVal value As Color)
_Name = name
_Value = value
End Sub
End Structure
'------------------
'Creator: aeonhack
'Site: elitevs.net
'Created: 11/30/2011
'Changed: 11/30/2011
'Version: 1.0.0
'------------------
Class PrecisionTimer
Implements IDisposable
Private _Enabled As Boolean
ReadOnly Property Enabled() As Boolean
Get
Return _Enabled
End Get
End Property
Private Handle As IntPtr
Private TimerCallback As TimerDelegate
<DllImport("kernel32.dll", EntryPoint:="CreateTimerQueueTimer")>
Private Shared Function CreateTimerQueueTimer(
ByRef handle As IntPtr,
ByVal queue As IntPtr,
ByVal callback As TimerDelegate,
ByVal state As IntPtr,
ByVal dueTime As UInteger,
ByVal period As UInteger,
ByVal flags As UInteger) As Boolean
End Function
<DllImport("kernel32.dll", EntryPoint:="DeleteTimerQueueTimer")>
Private Shared Function DeleteTimerQueueTimer(
ByVal queue As IntPtr,
ByVal handle As IntPtr,
ByVal callback As IntPtr) As Boolean
End Function
Delegate Sub TimerDelegate(ByVal r1 As IntPtr, ByVal r2 As Boolean)
Sub Create(ByVal dueTime As UInteger, ByVal period As UInteger, ByVal callback As TimerDelegate)
If _Enabled Then Return
TimerCallback = callback
Dim Success As Boolean = CreateTimerQueueTimer(Handle, IntPtr.Zero, TimerCallback, IntPtr.Zero, dueTime, period, 0)
If Not Success Then ThrowNewException("CreateTimerQueueTimer")
_Enabled = Success
End Sub
Sub Delete()
If Not _Enabled Then Return
Dim Success As Boolean = DeleteTimerQueueTimer(IntPtr.Zero, Handle, IntPtr.Zero)
If Not Success AndAlso Not Marshal.GetLastWin32Error = 997 Then
'ThrowNewException("DeleteTimerQueueTimer")
End If
_Enabled = Not Success
End Sub
Private Sub ThrowNewException(ByVal name As String)
Throw New Exception(String.Format("{0} failed. Win32Error: {1}", name, Marshal.GetLastWin32Error))
End Sub
Public Sub Dispose() Implements IDisposable.Dispose
Delete()
End Sub
End Class
#End Region
Class GhostTheme
Inherits ThemeContainer154
Protected Overrides Sub ColorHook()
End Sub
Private _ShowIcon As Boolean
Public Property ShowIcon As Boolean
Get
Return _ShowIcon
End Get
Set(value As Boolean)
_ShowIcon = value
Invalidate()
End Set
End Property
Protected Overrides Sub PaintHook()
G.Clear(Color.DimGray)
Dim hatch As New ColorBlend(2)
DrawBorders(Pens.Gray, 1)
hatch.Colors(0) = Color.DimGray
hatch.Colors(1) = Color.FromArgb(60, 60, 60)
hatch.Positions(0) = 0
hatch.Positions(1) = 1
DrawGradient(hatch, New Rectangle(0, 0, Width, 24))
hatch.Colors(0) = Color.FromArgb(100, 100, 100)
hatch.Colors(1) = Color.DimGray
DrawGradient(hatch, New Rectangle(0, 0, Width, 12))
Dim asdf As HatchBrush
asdf = New HatchBrush(HatchStyle.DarkDownwardDiagonal, Color.FromArgb(15, Color.Black), Color.FromArgb(0, Color.Gray))
hatch.Colors(0) = Color.FromArgb(120, Color.Black)
hatch.Colors(1) = Color.FromArgb(0, Color.Black)
DrawGradient(hatch, New Rectangle(0, 0, Width, 30))
G.FillRectangle(asdf, 0, 0, Width, 24)
G.DrawLine(Pens.Black, 6, 24, Width - 7, 24)
G.DrawLine(Pens.Black, 6, 24, 6, Height - 7)
G.DrawLine(Pens.Black, 6, Height - 7, Width - 7, Height - 7)
G.DrawLine(Pens.Black, Width - 7, 24, Width - 7, Height - 7)
G.FillRectangle(New SolidBrush(Color.FromArgb(60, 60, 60)), New Rectangle(1, 24, 5, Height - 6 - 24))
G.FillRectangle(asdf, 1, 24, 5, Height - 6 - 24)
G.FillRectangle(New SolidBrush(Color.FromArgb(60, 60, 60)), New Rectangle(Width - 6, 24, Width - 1, Height - 6 - 24))
G.FillRectangle(asdf, Width - 6, 24, Width - 2, Height - 6 - 24)
G.FillRectangle(New SolidBrush(Color.FromArgb(60, 60, 60)), New Rectangle(1, Height - 6, Width - 2, Height - 1))
G.FillRectangle(asdf, 1, Height - 6, Width - 2, Height - 1)
DrawBorders(Pens.Black)
asdf = New HatchBrush(HatchStyle.LightDownwardDiagonal, Color.DimGray)
G.FillRectangle(asdf, 7, 25, Width - 14, Height - 24 - 8)
G.FillRectangle(New SolidBrush(Color.FromArgb(230, 20, 20, 20)), 7, 25, Width - 14, Height - 24 - 8)
DrawCorners(Color.Fuchsia)
DrawCorners(Color.Fuchsia, 0, 1, 1, 1)
DrawCorners(Color.Fuchsia, 1, 0, 1, 1)
DrawPixel(Color.Black, 1, 1)
DrawCorners(Color.Fuchsia, 0, Height - 2, 1, 1)
DrawCorners(Color.Fuchsia, 1, Height - 1, 1, 1)
DrawPixel(Color.Black, Width - 2, 1)
DrawCorners(Color.Fuchsia, Width - 1, 1, 1, 1)
DrawCorners(Color.Fuchsia, Width - 2, 0, 1, 1)
DrawPixel(Color.Black, 1, Height - 2)
DrawCorners(Color.Fuchsia, Width - 1, Height - 2, 1, 1)
DrawCorners(Color.Fuchsia, Width - 2, Height - 1, 1, 1)
DrawPixel(Color.Black, Width - 2, Height - 2)
Dim cblend As New ColorBlend(2)
cblend.Colors(0) = Color.FromArgb(35, Color.Black)
cblend.Colors(1) = Color.FromArgb(0, 0, 0, 0)
cblend.Positions(0) = 0
cblend.Positions(1) = 1
DrawGradient(cblend, 7, 25, 15, Height - 6 - 24, 0)
cblend.Colors(0) = Color.FromArgb(0, 0, 0, 0)
cblend.Colors(1) = Color.FromArgb(35, Color.Black)
DrawGradient(cblend, Width - 24, 25, 17, Height - 6 - 24, 0)
cblend.Colors(1) = Color.FromArgb(0, 0, 0, 0)
cblend.Colors(0) = Color.FromArgb(35, Color.Black)
DrawGradient(cblend, 7, 25, Me.Width - 14, 17, 90)
cblend.Colors(0) = Color.FromArgb(0, 0, 0, 0)
cblend.Colors(1) = Color.FromArgb(35, Color.Black)
DrawGradient(cblend, 8, Me.Height - 24, Me.Width - 14, 17, 90)
If _ShowIcon = False Then
G.DrawString(Text, Font, Brushes.White, New Point(6, 6))
Else
G.DrawIcon(FindForm.Icon, New Rectangle(New Point(9, 5), New Size(16, 16)))
G.DrawString(Text, Font, Brushes.White, New Point(28, 6))
End If
End Sub
Public Sub New()
TransparencyKey = Color.Fuchsia
End Sub
End Class
Class GhostButton
Inherits ThemeControl154
Private Glass As Boolean = True
Private _color As Color
Dim a As Integer = 0
Protected Overrides Sub ColorHook()
End Sub
Protected Overrides Sub OnAnimation()
MyBase.OnAnimation()
Select Case State
Case MouseState.Over
If a < 20 Then
a += 5
Invalidate()
Application.DoEvents()
End If
Case MouseState.None
If a > 0 Then
a -= 5
If a < 0 Then a = 0
Invalidate()
Application.DoEvents()
End If
End Select
End Sub
Public Property EnableGlass As Boolean
Get
Return Glass
End Get
Set(ByVal value As Boolean)
Glass = value
End Set
End Property
Public Property Color As Color
Get
Return _color
End Get
Set(value As Color)
_color = value
End Set
End Property
Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
MyBase.OnTextChanged(e)
Dim gg As Graphics = Me.CreateGraphics
Dim textSize As SizeF = Me.CreateGraphics.MeasureString(Text, Font)
gg.DrawString(Text, Font, Brushes.White, New RectangleF(0, 0, Me.Width, Me.Height))
End Sub
Protected Overrides Sub PaintHook()
G.Clear(_color)
If State = MouseState.Over Then
Dim cblend As New ColorBlend(2)
cblend.Colors(0) = Color.FromArgb(200, 50, 50, 50)
cblend.Colors(1) = Color.FromArgb(200, 70, 70, 70)
cblend.Positions(0) = 0
cblend.Positions(1) = 1
DrawGradient(cblend, New Rectangle(0, 0, Width, Height))
cblend.Colors(0) = Color.FromArgb(0, 0, 0, 0)
cblend.Colors(1) = Color.FromArgb(40, Color.White)
If Glass Then DrawGradient(cblend, New Rectangle(0, 0, Width, Height / 5 * 2))
ElseIf State = MouseState.None Then
Dim cblend As New ColorBlend(2)
cblend.Colors(0) = Color.FromArgb(200, 50, 50, 50)
cblend.Colors(1) = Color.FromArgb(200, 70, 70, 70)
cblend.Positions(0) = 0
cblend.Positions(1) = 1
DrawGradient(cblend, New Rectangle(0, 0, Width, Height))
cblend.Colors(0) = Color.FromArgb(0, 0, 0, 0)
cblend.Colors(1) = Color.FromArgb(40, Color.White)
If Glass Then DrawGradient(cblend, New Rectangle(0, 0, Width, Height / 5 * 2))
Else
Dim cblend As New ColorBlend(2)
cblend.Colors(0) = Color.FromArgb(200, 30, 30, 30)
cblend.Colors(1) = Color.FromArgb(200, 50, 50, 50)
cblend.Positions(0) = 0
cblend.Positions(1) = 1
DrawGradient(cblend, New Rectangle(0, 0, Width, Height))
cblend.Colors(0) = Color.FromArgb(0, 0, 0, 0)
cblend.Colors(1) = Color.FromArgb(40, Color.White)
If Glass Then DrawGradient(cblend, New Rectangle(0, 0, Width, Height / 5 * 2))
End If
G.FillRectangle(New SolidBrush(Color.FromArgb(a, Drawing.Color.White)), 0, 0, Width, Height)
Dim hatch As HatchBrush
hatch = New HatchBrush(HatchStyle.DarkDownwardDiagonal, Color.FromArgb(25, Color.Black), Color.FromArgb(0, Color.Gray))
G.FillRectangle(hatch, 0, 0, Width, Height)
Dim textSize As SizeF = Me.CreateGraphics.MeasureString(Text, Font, Width - 4)
Dim sf As New StringFormat
sf.LineAlignment = StringAlignment.Center
sf.Alignment = StringAlignment.Center
G.DrawString(Text, Font, Brushes.White, New RectangleF(2, 2, Me.Width - 5, Me.Height - 4), sf)
DrawBorders(Pens.Black)
DrawBorders(New Pen(Color.FromArgb(90, 90, 90)), 1)
End Sub
Sub New()
IsAnimated = True
End Sub
End Class
Class GhostProgressbar
Inherits ThemeControl154
Private _Maximum As Integer = 100
Private _Value As Integer
Private HOffset As Integer = 0
Private Progress As Integer
Protected Overrides Sub ColorHook()
End Sub
Public Property Maximum As Integer
Get
Return _Maximum
End Get
Set(ByVal V As Integer)
If V < 1 Then V = 1
If V < _Value Then _Value = V
_Maximum = V
Invalidate()
End Set
End Property
Public Property Value As Integer
Get
Return _Value
End Get
Set(ByVal V As Integer)
If V > _Maximum Then V = Maximum
_Value = V
Invalidate()
End Set
End Property
Public Property Animated As Boolean
Get
Return IsAnimated
End Get
Set(ByVal V As Boolean)
IsAnimated = V
Invalidate()
End Set
End Property
Protected Overrides Sub OnAnimation()
HOffset -= 1
If HOffset = 7 Then HOffset = 0
End Sub
Protected Overrides Sub PaintHook()
Dim hatch As New HatchBrush(HatchStyle.DarkDownwardDiagonal, Color.FromArgb(60, Color.Black))
G.Clear(Color.FromArgb(0, 30, 30, 30))
Dim cblend As New ColorBlend(2)
cblend.Colors(0) = Color.FromArgb(50, 50, 50)
cblend.Colors(1) = Color.FromArgb(70, 70, 70)
cblend.Positions(0) = 0
cblend.Positions(1) = 1
DrawGradient(cblend, New Rectangle(0, 0, CInt(((Width / _Maximum) * _Value) - 2), Height - 2))
cblend.Colors(1) = Color.FromArgb(80, 80, 80)
DrawGradient(cblend, New Rectangle(0, 0, CInt(((Width / _Maximum) * _Value) - 2), Height / 5 * 2))
G.RenderingOrigin = New Point(HOffset, 0)
hatch = New HatchBrush(HatchStyle.ForwardDiagonal, Color.FromArgb(40, Color.Black), Color.FromArgb(0, Color.Gray))
G.FillRectangle(hatch, 0, 0, CInt(((Width / _Maximum) * _Value) - 2), Height - 2)
DrawBorders(Pens.Black)
DrawBorders(New Pen(Color.FromArgb(90, 90, 90)), 1)
DrawCorners(Color.Black)
G.DrawLine(New Pen(Color.FromArgb(200, 90, 90, 90)), CInt(((Width / _Maximum) * _Value) - 2), 1, CInt(((Width / _Maximum) * _Value) - 2), Height - 2)
G.DrawLine(Pens.Black, CInt(((Width / _Maximum) * _Value) - 2) + 1, 2, CInt(((Width / _Maximum) * _Value) - 2) + 1, Height - 3)
Progress = CInt(((Width / _Maximum) * _Value))
Dim cblend2 As New ColorBlend(3)
cblend2.Colors(0) = Color.FromArgb(0, Color.Gray)
cblend2.Colors(1) = Color.FromArgb(80, Color.DimGray)
cblend2.Colors(2) = Color.FromArgb(0, Color.Gray)
cblend2.Positions = {0, 0.5, 1}
If Value > 0 Then G.FillRectangle(New SolidBrush(Color.FromArgb(5, 5, 5)), CInt(((Width / _Maximum) * _Value)) - 1, 2, Width - CInt(((Width / _Maximum) * _Value)) - 1, Height - 4)
End Sub
Public Sub New()
_Maximum = 100
IsAnimated = True
End Sub
End Class
<DefaultEvent("CheckedChanged")>
Class GhostCheckbox
Inherits ThemeControl154
Private _Checked As Boolean
Private X As Integer
Event CheckedChanged(ByVal sender As Object)
Public Property Checked As Boolean
Get
Return _Checked
End Get
Set(ByVal V As Boolean)
_Checked = V
Invalidate()
RaiseEvent CheckedChanged(Me)
End Set
End Property
Protected Overrides Sub ColorHook()
End Sub
Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
MyBase.OnTextChanged(e)
Dim textSize As Integer
textSize = Me.CreateGraphics.MeasureString(Text, Font).Width
Me.Width = 20 + textSize
End Sub
Protected Overrides Sub OnMouseMove(e As System.Windows.Forms.MouseEventArgs)
MyBase.OnMouseMove(e)
X = e.X
Invalidate()
End Sub
Protected Overrides Sub OnMouseDown(e As System.Windows.Forms.MouseEventArgs)
MyBase.OnMouseDown(e)
If _Checked = True Then _Checked = False Else _Checked = True
End Sub
Protected Overrides Sub PaintHook()
G.Clear(Color.FromArgb(60, 60, 60))
Dim asdf As HatchBrush
asdf = New HatchBrush(HatchStyle.DarkDownwardDiagonal, Color.FromArgb(35, Color.Black), Color.FromArgb(0, Color.Gray))
G.FillRectangle(New SolidBrush(Color.FromArgb(60, 60, 60)), New Rectangle(0, 0, Width, Height))
asdf = New HatchBrush(HatchStyle.LightDownwardDiagonal, Color.DimGray)
G.FillRectangle(asdf, 0, 0, Width, Height)
G.FillRectangle(New SolidBrush(Color.FromArgb(230, 20, 20, 20)), 0, 0, Width, Height)
G.FillRectangle(New SolidBrush(Color.FromArgb(10, 10, 10)), 3, 3, 10, 10)
If _Checked Then
Dim cblend As New ColorBlend(2)
cblend.Colors(0) = Color.FromArgb(60, 60, 60)
cblend.Colors(1) = Color.FromArgb(80, 80, 80)
cblend.Positions(0) = 0
cblend.Positions(1) = 1
DrawGradient(cblend, New Rectangle(3, 3, 10, 10))
cblend.Colors(0) = Color.FromArgb(70, 70, 70)
cblend.Colors(1) = Color.FromArgb(100, 100, 100)
DrawGradient(cblend, New Rectangle(3, 3, 10, 4))
Dim hatch As HatchBrush
hatch = New HatchBrush(HatchStyle.LightDownwardDiagonal, Color.FromArgb(60, Color.Black), Color.FromArgb(0, Color.Gray))
G.FillRectangle(hatch, 3, 3, 10, 10)
Else
Dim hatch As HatchBrush
hatch = New HatchBrush(HatchStyle.LightDownwardDiagonal, Color.FromArgb(20, Color.White), Color.FromArgb(0, Color.Gray))
G.FillRectangle(hatch, 3, 3, 10, 10)
End If
If State = MouseState.Over And X < 15 Then
G.FillRectangle(New SolidBrush(Color.FromArgb(30, Color.Gray)), New Rectangle(3, 3, 10, 10))
ElseIf State = MouseState.Down Then
G.FillRectangle(New SolidBrush(Color.FromArgb(30, Color.Black)), New Rectangle(3, 3, 10, 10))
End If
G.DrawRectangle(Pens.Black, 0, 0, 15, 15)
G.DrawRectangle(New Pen(Color.FromArgb(90, 90, 90)), 1, 1, 13, 13)
G.DrawString(Text, Font, Brushes.White, 17, 1)
End Sub
Public Sub New()
Me.Size = New Point(16, 50)
End Sub
End Class
<DefaultEvent("CheckedChanged")>
Class GhostRadiobutton
Inherits ThemeControl154
Private X As Integer
Private _Checked As Boolean
Property Checked() As Boolean
Get
Return _Checked
End Get
Set(ByVal value As Boolean)
_Checked = value
InvalidateControls()
RaiseEvent CheckedChanged(Me)
Invalidate()
End Set
End Property
Event CheckedChanged(ByVal sender As Object)
Protected Overrides Sub OnCreation()
InvalidateControls()
End Sub
Private Sub InvalidateControls()
If Not IsHandleCreated OrElse Not _Checked Then Return
For Each C As Control In Parent.Controls
If C IsNot Me AndAlso TypeOf C Is GhostRadiobutton Then
DirectCast(C, GhostRadiobutton).Checked = False
End If
Next
End Sub
Protected Overrides Sub OnMouseDown(ByVal e As System.Windows.Forms.MouseEventArgs)
If Not _Checked Then Checked = True
MyBase.OnMouseDown(e)
End Sub
Protected Overrides Sub OnMouseMove(e As System.Windows.Forms.MouseEventArgs)
MyBase.OnMouseMove(e)
X = e.X
Invalidate()
End Sub
Protected Overrides Sub ColorHook()
End Sub
Protected Overrides Sub OnTextChanged(ByVal e As System.EventArgs)
MyBase.OnTextChanged(e)
Dim textSize As Integer
textSize = Me.CreateGraphics.MeasureString(Text, Font).Width
Me.Width = 20 + textSize
End Sub
Protected Overrides Sub PaintHook()
G.Clear(Color.FromArgb(60, 60, 60))
Dim asdf As HatchBrush
asdf = New HatchBrush(HatchStyle.DarkDownwardDiagonal, Color.FromArgb(35, Color.Black), Color.FromArgb(0, Color.Gray))
G.FillRectangle(New SolidBrush(Color.FromArgb(60, 60, 60)), New Rectangle(0, 0, Width, Height))
asdf = New HatchBrush(HatchStyle.LightDownwardDiagonal, Color.DimGray)
G.FillRectangle(asdf, 0, 0, Width, Height)
G.FillRectangle(New SolidBrush(Color.FromArgb(230, 20, 20, 20)), 0, 0, Width, Height)
G.SmoothingMode = SmoothingMode.AntiAlias
G.FillEllipse(New SolidBrush(Color.Black), 2, 2, 11, 11)
G.DrawEllipse(Pens.Black, 0, 0, 13, 13)
G.DrawEllipse(New Pen(Color.FromArgb(90, 90, 90)), 1, 1, 11, 11)
If _Checked = False Then
Dim hatch As HatchBrush
hatch = New HatchBrush(HatchStyle.LightDownwardDiagonal, Color.FromArgb(20, Color.White), Color.FromArgb(0, Color.Gray))
G.FillEllipse(hatch, 2, 2, 10, 10)
Else
G.FillEllipse(New SolidBrush(Color.FromArgb(80, 80, 80)), 3, 3, 7, 7)
Dim hatch As HatchBrush
hatch = New HatchBrush(HatchStyle.LightDownwardDiagonal, Color.FromArgb(60, Color.Black), Color.FromArgb(0, Color.Gray))
G.FillRectangle(hatch, 3, 3, 7, 7)
End If
If State = MouseState.Over And X < 13 Then
G.FillEllipse(New SolidBrush(Color.FromArgb(20, Color.White)), 2, 2, 11, 11)
End If
G.DrawString(Text, Font, Brushes.White, 16, 0)
End Sub
Public Sub New()
Me.Size = New Point(50, 14)
End Sub
End Class
Class GhostTabControl
Inherits TabControl
Private Xstart(9999) As Integer 'Stupid VB.Net bug. Please don't use more than 9999 tabs :3
Private Xstop(9999) As Integer 'Stupid VB.Net bug. Please don't use more than 9999 tabs :3
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.DoubleBuffer, True)
DoubleBuffered = True
For Each p As TabPage In TabPages
p.BackColor = Color.White
Application.DoEvents()
p.BackColor = Color.Transparent
Next
End Sub
Protected Overrides Sub CreateHandle()
MyBase.CreateHandle()
Alignment = TabAlignment.Top
End Sub
Protected Overrides Sub OnMouseClick(ByVal e As System.Windows.Forms.MouseEventArgs)
MyBase.OnMouseClick(e)
Dim index As Integer = 0
Dim height As Integer = Me.CreateGraphics.MeasureString("Mava is awesome", Font).Height + 8
For Each a As Integer In Xstart
If e.X > a And e.X < Xstop(index) And e.Y < height And e.Button = Windows.Forms.MouseButtons.Left Then
SelectedIndex = index
Invalidate()
Else
End If
index += 1
Next
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim B As New Bitmap(Width, Height)
Dim G As Graphics = Graphics.FromImage(B)
G.Clear(Color.FromArgb(60, 60, 60))
Dim asdf As HatchBrush
asdf = New HatchBrush(HatchStyle.DarkDownwardDiagonal, Color.FromArgb(35, Color.Black), Color.FromArgb(0, Color.Gray))
G.FillRectangle(New SolidBrush(Color.FromArgb(60, 60, 60)), New Rectangle(0, 0, Width, Height))
asdf = New HatchBrush(HatchStyle.LightDownwardDiagonal, Color.DimGray)
G.FillRectangle(asdf, 0, 0, Width, Height)
G.FillRectangle(New SolidBrush(Color.FromArgb(230, 20, 20, 20)), 0, 0, Width, Height)
G.FillRectangle(Brushes.Black, 0, 0, Width, Me.CreateGraphics.MeasureString("Mava is awesome", Font).Height + 8)
G.FillRectangle(New SolidBrush(Color.FromArgb(20, Color.Black)), 2, Me.CreateGraphics.MeasureString("Mava is awesome", Font).Height + 7, Width - 2, Height - 2)
Dim totallength As Integer = 0
Dim index As Integer = 0
For Each tab As TabPage In TabPages
If SelectedIndex = index Then
G.FillRectangle(New SolidBrush(Color.FromArgb(60, 60, 60)), totallength, 1, Me.CreateGraphics.MeasureString(tab.Text, Font).Width + 15, Me.CreateGraphics.MeasureString("Mava is awesome", Font).Height + 10)
asdf = New HatchBrush(HatchStyle.DarkDownwardDiagonal, Color.FromArgb(35, Color.Black), Color.FromArgb(0, Color.Gray))
G.FillRectangle(New SolidBrush(Color.FromArgb(60, 60, 60)), totallength, 1, Me.CreateGraphics.MeasureString(tab.Text, Font).Width + 15, Me.CreateGraphics.MeasureString("Mava is awesome", Font).Height + 10)
asdf = New HatchBrush(HatchStyle.LightDownwardDiagonal, Color.DimGray)
G.FillRectangle(asdf, totallength, 1, Me.CreateGraphics.MeasureString(tab.Text, Font).Width + 15, Me.CreateGraphics.MeasureString("Mava is awesome", Font).Height + 10)
G.FillRectangle(New SolidBrush(Color.FromArgb(230, 20, 20, 20)), totallength, 1, Me.CreateGraphics.MeasureString(tab.Text, Font).Width + 15, Me.CreateGraphics.MeasureString("Mava is awesome", Font).Height + 10)
Dim gradient As New LinearGradientBrush(New Point(totallength, 1), New Point(totallength, Me.CreateGraphics.MeasureString("Mava is awesome", Font).Height + 8), Color.FromArgb(15, Color.White), Color.Transparent)
G.FillRectangle(gradient, totallength, 1, Me.CreateGraphics.MeasureString(tab.Text, Font).Width + 15, Me.CreateGraphics.MeasureString("Mava is awesome", Font).Height + 5)
G.DrawLine(New Pen(Color.FromArgb(60, 60, 60)), totallength + Me.CreateGraphics.MeasureString(tab.Text, Font).Width + 15, 2, totallength + Me.CreateGraphics.MeasureString(tab.Text, Font).Width + 15, Me.CreateGraphics.MeasureString("Mava is awesome", Font).Height + 8)
G.DrawLine(New Pen(Color.FromArgb(60, 60, 60)), totallength, 2, totallength, Me.CreateGraphics.MeasureString("Mava is awesome", Font).Height + 8)
G.DrawLine(New Pen(Color.FromArgb(60, 60, 60)), totallength + Me.CreateGraphics.MeasureString(tab.Text, Font).Width + 15, Me.CreateGraphics.MeasureString("Mava is awesome", Font).Height + 8, Width - 1, Me.CreateGraphics.MeasureString("Mava is awesome", Font).Height + 8)
G.DrawLine(New Pen(Color.FromArgb(60, 60, 60)), 1, Me.CreateGraphics.MeasureString("Mava is awesome", Font).Height + 8, totallength, Me.CreateGraphics.MeasureString("Mava is awesome", Font).Height + 8)
End If
Xstart(index) = totallength
Xstop(index) = totallength + Me.CreateGraphics.MeasureString(tab.Text, Font).Width + 15
G.DrawString(tab.Text, Font, Brushes.White, totallength + 8, 5)
totallength += Me.CreateGraphics.MeasureString(tab.Text, Font).Width + 15
index += 1
Next
G.DrawLine(New Pen(Color.FromArgb(90, 90, 90)), 1, 1, Width - 2, 1) 'boven
G.DrawLine(New Pen(Color.FromArgb(90, 90, 90)), 1, Height - 2, Width - 2, Height - 2) 'onder
G.DrawLine(New Pen(Color.FromArgb(90, 90, 90)), 1, 1, 1, Height - 2) 'links
G.DrawLine(New Pen(Color.FromArgb(90, 90, 90)), Width - 2, 1, Width - 2, Height - 2) 'rechts
G.DrawLine(Pens.Black, 0, 0, Width - 1, 0) 'boven
G.DrawLine(Pens.Black, 0, Height - 1, Width, Height - 1) 'onder
G.DrawLine(Pens.Black, 0, 0, 0, Height - 1) 'links
G.DrawLine(Pens.Black, Width - 1, 0, Width - 1, Height - 1) 'rechts
e.Graphics.DrawImage(B.Clone, 0, 0)
G.Dispose() : B.Dispose()
End Sub
Protected Overrides Sub OnSelectedIndexChanged(ByVal e As System.EventArgs)
MyBase.OnSelectedIndexChanged(e)
Invalidate()
End Sub
End Class
Class GhostTabControlLagFree
Inherits TabControl
Private _Forecolor As Color = Color.White
Public Property ForeColor As Color
Get
Return _Forecolor
End Get
Set(value As Color)
_Forecolor = value
End Set
End Property
Sub New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.DoubleBuffer, True)
DoubleBuffered = True
For Each p As TabPage In TabPages
Try
p.BackColor = Color.Black
p.BackColor = Color.Transparent
Catch ex As Exception
End Try
Next
End Sub
Protected Overrides Sub CreateHandle()
MyBase.CreateHandle()
Alignment = TabAlignment.Top
For Each p As TabPage In TabPages
Try
p.BackColor = Color.Black
p.BackColor = Color.Transparent
Catch ex As Exception
End Try
Next
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
Dim B As New Bitmap(Width, Height)
Dim G As Graphics = Graphics.FromImage(B)
G.Clear(Color.FromArgb(60, 60, 60))
Dim asdf As HatchBrush
asdf = New HatchBrush(HatchStyle.DarkDownwardDiagonal, Color.FromArgb(35, Color.Black), Color.FromArgb(0, Color.Gray))
G.FillRectangle(New SolidBrush(Color.FromArgb(60, 60, 60)), New Rectangle(0, 0, Width, Height))
asdf = New HatchBrush(HatchStyle.LightDownwardDiagonal, Color.DimGray)
G.FillRectangle(asdf, 0, 0, Width, Height)
G.FillRectangle(New SolidBrush(Color.FromArgb(230, 20, 20, 20)), 0, 0, Width, Height)
G.FillRectangle(Brushes.Black, New Rectangle(New Point(0, 4), New Size(Width - 2, 20)))
G.DrawRectangle(Pens.Black, New Rectangle(New Point(0, 3), New Size(Width - 1, Height - 4)))
G.DrawRectangle(New Pen(Color.FromArgb(90, 90, 90)), New Rectangle(New Point(1, 4), New Size(Width - 3, Height - 6)))
For i = 0 To TabCount - 1
If i = SelectedIndex Then
Dim x2 As Rectangle = New Rectangle(GetTabRect(i).X, GetTabRect(i).Y + 2, GetTabRect(i).Width + 2, GetTabRect(i).Height - 1)
asdf = New HatchBrush(HatchStyle.DarkDownwardDiagonal, Color.FromArgb(35, Color.Black), Color.FromArgb(0, Color.Gray))
G.FillRectangle(New SolidBrush(Color.FromArgb(60, 60, 60)), New Rectangle(GetTabRect(i).X, GetTabRect(i).Y + 3, GetTabRect(i).Width + 1, GetTabRect(i).Height - 2))
asdf = New HatchBrush(HatchStyle.LightDownwardDiagonal, Color.DimGray)
G.FillRectangle(asdf, New Rectangle(GetTabRect(i).X, GetTabRect(i).Y + 3, GetTabRect(i).Width + 1, GetTabRect(i).Height - 2))
G.FillRectangle(New SolidBrush(Color.FromArgb(230, 20, 20, 20)), New Rectangle(GetTabRect(i).X, GetTabRect(i).Y + 3, GetTabRect(i).Width + 1, GetTabRect(i).Height - 2))
Dim gradient As New LinearGradientBrush(New Rectangle(GetTabRect(i).X, GetTabRect(i).Y + 2, GetTabRect(i).Width + 2, GetTabRect(i).Height - 1), Color.FromArgb(15, Color.White), Color.Transparent, 90.0F)
G.FillRectangle(gradient, New Rectangle(GetTabRect(i).X, GetTabRect(i).Y + 2, GetTabRect(i).Width + 2, GetTabRect(i).Height - 1))
G.DrawLine(New Pen(Color.FromArgb(90, 90, 90)), New Point(GetTabRect(i).Right, 4), New Point(GetTabRect(i).Right, GetTabRect(i).Height + 3))
If Not SelectedIndex = 0 Then
G.DrawLine(New Pen(Color.FromArgb(90, 90, 90)), New Point(GetTabRect(i).X, 4), New Point(GetTabRect(i).X, GetTabRect(i).Height + 3))
G.DrawLine(New Pen(Color.FromArgb(90, 90, 90)), New Point(1, GetTabRect(i).Height + 3), New Point(GetTabRect(i).X, GetTabRect(i).Height + 3))
End If
G.DrawLine(New Pen(Color.FromArgb(90, 90, 90)), New Point(GetTabRect(i).Right, GetTabRect(i).Height + 3), New Point(Width - 2, GetTabRect(i).Height + 3))
G.DrawString(TabPages(i).Text, Font, New SolidBrush(_Forecolor), x2, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
Else
Dim x2 As Rectangle = New Rectangle(GetTabRect(i).X, GetTabRect(i).Y + 2, GetTabRect(i).Width + 2, GetTabRect(i).Height - 1)
G.DrawString(TabPages(i).Text, Font, New SolidBrush(_Forecolor), x2, New StringFormat With {.LineAlignment = StringAlignment.Center, .Alignment = StringAlignment.Center})
End If
Next
e.Graphics.DrawImage(B.Clone, 0, 0)
G.Dispose() : B.Dispose()
End Sub
End Class
Class GhostListBoxPretty
Inherits ThemeControl154
Public WithEvents LBox As New ListBox
Private __Items As String() = {""}
Public Property Items As String()
Get
Return __Items
Invalidate()
End Get
Set(ByVal value As String())
__Items = value
LBox.Items.Clear()
Invalidate()
LBox.Items.AddRange(value)
Invalidate()
End Set
End Property
Public ReadOnly Property SelectedItem() As String
Get
Return LBox.SelectedItem
End Get
End Property
Sub New()
Controls.Add(LBox)
Size = New Size(131, 101)
LBox.BackColor = Color.FromArgb(0, 0, 0)
LBox.BorderStyle = BorderStyle.None
LBox.DrawMode = Windows.Forms.DrawMode.OwnerDrawVariable
LBox.Location = New Point(3, 3)
LBox.ForeColor = Color.White
LBox.ItemHeight = 20
LBox.Items.Clear()
LBox.IntegralHeight = False
Invalidate()
End Sub
Protected Overrides Sub ColorHook()
End Sub
Protected Overrides Sub OnResize(e As System.EventArgs)
MyBase.OnResize(e)
LBox.Width = Width - 4
LBox.Height = Height - 4
End Sub
Protected Overrides Sub PaintHook()
G.Clear(Color.Black)
G.DrawRectangle(Pens.Black, 0, 0, Width - 2, Height - 2)
G.DrawRectangle(New Pen(Color.FromArgb(90, 90, 90)), 1, 1, Width - 3, Height - 3)
LBox.Size = New Size(Width - 5, Height - 5)
End Sub
Sub DrawItem(ByVal sender As Object, ByVal e As System.Windows.Forms.DrawItemEventArgs) Handles LBox.DrawItem
If e.Index < 0 Then Exit Sub
e.DrawBackground()
e.DrawFocusRectangle()
If InStr(e.State.ToString, "Selected,") > 0 Then
e.Graphics.FillRectangle(Brushes.Black, e.Bounds)
Dim x2 As Rectangle = New Rectangle(e.Bounds.Location, New Size(e.Bounds.Width - 1, e.Bounds.Height))
Dim x3 As Rectangle = New Rectangle(x2.Location, New Size(x2.Width, (x2.Height / 2) - 2))
Dim G1 As New LinearGradientBrush(New Point(x2.X, x2.Y), New Point(x2.X, x2.Y + x2.Height), Color.FromArgb(60, 60, 60), Color.FromArgb(50, 50, 50))
Dim H As New HatchBrush(HatchStyle.DarkDownwardDiagonal, Color.FromArgb(15, Color.Black), Color.Transparent)
e.Graphics.FillRectangle(G1, x2) : G1.Dispose()
e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(25, Color.White)), x3)
e.Graphics.FillRectangle(H, x2) : G1.Dispose()
e.Graphics.DrawString(" " & LBox.Items(e.Index).ToString(), Font, Brushes.White, e.Bounds.X, e.Bounds.Y + 2)
Else
e.Graphics.DrawString(" " & LBox.Items(e.Index).ToString(), Font, Brushes.White, e.Bounds.X, e.Bounds.Y + 2)
End If
End Sub
Sub AddRange(ByVal Items As Object())
LBox.Items.Remove("")
LBox.Items.AddRange(Items)
Invalidate()
End Sub
Sub AddItem(ByVal Item As Object)
LBox.Items.Remove("")
LBox.Items.Add(Item)
Invalidate()
End Sub
End Class
Class GhostListboxLessPretty
Inherits ListBox
Sub New()
SetStyle(ControlStyles.DoubleBuffer, True)
Font = New Font("Microsoft Sans Serif", 9)
BorderStyle = Windows.Forms.BorderStyle.None
DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
ItemHeight = 20
ForeColor = Color.DeepSkyBlue
BackColor = Color.FromArgb(7, 7, 7)
IntegralHeight = False
End Sub
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
MyBase.WndProc(m)
If m.Msg = 15 Then CustomPaint()
End Sub
Protected Overrides Sub OnDrawItem(e As System.Windows.Forms.DrawItemEventArgs)
Try
If e.Index < 0 Then Exit Sub
e.DrawBackground()
Dim rect As New Rectangle(New Point(e.Bounds.Left, e.Bounds.Top + 2), New Size(Bounds.Width, 16))
e.DrawFocusRectangle()
If InStr(e.State.ToString, "Selected,") > 0 Then
e.Graphics.FillRectangle(Brushes.Black, e.Bounds)
Dim x2 As Rectangle = New Rectangle(e.Bounds.Location, New Size(e.Bounds.Width - 1, e.Bounds.Height))
Dim x3 As Rectangle = New Rectangle(x2.Location, New Size(x2.Width, (x2.Height / 2)))
Dim G1 As New LinearGradientBrush(New Point(x2.X, x2.Y), New Point(x2.X, x2.Y + x2.Height), Color.FromArgb(60, 60, 60), Color.FromArgb(50, 50, 50))
Dim H As New HatchBrush(HatchStyle.DarkDownwardDiagonal, Color.FromArgb(15, Color.Black), Color.Transparent)
e.Graphics.FillRectangle(G1, x2) : G1.Dispose()
e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(25, Color.White)), x3)
e.Graphics.FillRectangle(H, x2) : G1.Dispose()
e.Graphics.DrawString(" " & Items(e.Index).ToString(), Font, Brushes.White, e.Bounds.X, e.Bounds.Y + 1)
Else
e.Graphics.DrawString(" " & Items(e.Index).ToString(), Font, Brushes.White, e.Bounds.X, e.Bounds.Y + 1)
End If
e.Graphics.DrawRectangle(New Pen(Color.FromArgb(0, 0, 0)), New Rectangle(1, 1, Width - 3, Height - 3))
e.Graphics.DrawRectangle(New Pen(Color.FromArgb(90, 90, 90)), New Rectangle(0, 0, Width - 1, Height - 1))
MyBase.OnDrawItem(e)
Catch ex As Exception : End Try
End Sub
Sub CustomPaint()
CreateGraphics.DrawRectangle(New Pen(Color.FromArgb(0, 0, 0)), New Rectangle(1, 1, Width - 3, Height - 3))
CreateGraphics.DrawRectangle(New Pen(Color.FromArgb(90, 90, 90)), New Rectangle(0, 0, Width - 1, Height - 1))
End Sub
End Class
Class GhostComboBox
Inherits ComboBox
Private X As Integer
Sub New()
MyBase.New()
SetStyle(ControlStyles.AllPaintingInWmPaint Or ControlStyles.ResizeRedraw Or ControlStyles.UserPaint Or ControlStyles.DoubleBuffer, True)
DrawMode = Windows.Forms.DrawMode.OwnerDrawFixed
ItemHeight = 20
BackColor = Color.FromArgb(30, 30, 30)
DropDownStyle = ComboBoxStyle.DropDownList
End Sub
Protected Overrides Sub OnMouseMove(e As System.Windows.Forms.MouseEventArgs)
MyBase.OnMouseMove(e)
X = e.X
Invalidate()
End Sub
Protected Overrides Sub OnMouseLeave(e As System.EventArgs)
MyBase.OnMouseLeave(e)
X = -1
Invalidate()
End Sub
Protected Overrides Sub OnPaint(ByVal e As PaintEventArgs)
If Not DropDownStyle = ComboBoxStyle.DropDownList Then DropDownStyle = ComboBoxStyle.DropDownList
Dim B As New Bitmap(Width, Height)
Dim G As Graphics = Graphics.FromImage(B)
G.Clear(Color.FromArgb(50, 50, 50))
Dim GradientBrush As LinearGradientBrush = New LinearGradientBrush(New Rectangle(0, 0, Width, Height / 5 * 2), Color.FromArgb(20, 0, 0, 0), Color.FromArgb(15, Color.White), 90.0F)
G.FillRectangle(GradientBrush, New Rectangle(0, 0, Width, Height / 5 * 2))
Dim hatch As HatchBrush
hatch = New HatchBrush(HatchStyle.DarkDownwardDiagonal, Color.FromArgb(20, Color.Black), Color.FromArgb(0, Color.Gray))
G.FillRectangle(hatch, 0, 0, Width, Height)
Dim S1 As Integer = G.MeasureString("...", Font).Height
If SelectedIndex <> -1 Then
G.DrawString(Items(SelectedIndex), Font, New SolidBrush(Color.White), 4, Height \ 2 - S1 \ 2)
Else
If Not Items Is Nothing And Items.Count > 0 Then
G.DrawString(Items(0), Font, New SolidBrush(Color.White), 4, Height \ 2 - S1 \ 2)
Else
G.DrawString("...", Font, New SolidBrush(Color.White), 4, Height \ 2 - S1 \ 2)
End If
End If
If MouseButtons = Windows.Forms.MouseButtons.None And X > Width - 25 Then
G.FillRectangle(New SolidBrush(Color.FromArgb(7, Color.White)), Width - 25, 1, Width - 25, Height - 3)
ElseIf MouseButtons = Windows.Forms.MouseButtons.None And X < Width - 25 And X >= 0 Then
G.FillRectangle(New SolidBrush(Color.FromArgb(7, Color.White)), 2, 1, Width - 27, Height - 3)
End If
G.DrawRectangle(Pens.Black, 0, 0, Width - 1, Height - 1)
G.DrawRectangle(New Pen(Color.FromArgb(90, 90, 90)), 1, 1, Width - 3, Height - 3)
G.DrawLine(New Pen(Color.FromArgb(90, 90, 90)), Width - 25, 1, Width - 25, Height - 3)
G.DrawLine(Pens.Black, Width - 24, 0, Width - 24, Height)
G.DrawLine(New Pen(Color.FromArgb(90, 90, 90)), Width - 23, 1, Width - 23, Height - 3)
G.FillPolygon(Brushes.Black, Triangle(New Point(Width - 14, Height \ 2), New Size(5, 3)))
G.FillPolygon(Brushes.White, Triangle(New Point(Width - 15, Height \ 2 - 1), New Size(5, 3)))
e.Graphics.DrawImage(B.Clone, 0, 0)
G.Dispose() : B.Dispose()
End Sub
Protected Overrides Sub OnDrawItem(e As DrawItemEventArgs)
If e.Index < 0 Then Exit Sub
Dim rect As New Rectangle()
rect.X = e.Bounds.X
rect.Y = e.Bounds.Y
rect.Width = e.Bounds.Width - 1
rect.Height = e.Bounds.Height - 1
e.DrawBackground()
If e.State = 785 Or e.State = 17 Then
e.Graphics.FillRectangle(Brushes.Black, e.Bounds)
Dim x2 As Rectangle = New Rectangle(e.Bounds.Location, New Size(e.Bounds.Width - 1, e.Bounds.Height))
Dim x3 As Rectangle = New Rectangle(x2.Location, New Size(x2.Width, (x2.Height / 2) - 1))
Dim G1 As New LinearGradientBrush(New Point(x2.X, x2.Y), New Point(x2.X, x2.Y + x2.Height), Color.FromArgb(60, 60, 60), Color.FromArgb(50, 50, 50))
Dim H As New HatchBrush(HatchStyle.DarkDownwardDiagonal, Color.FromArgb(15, Color.Black), Color.Transparent)
e.Graphics.FillRectangle(G1, x2) : G1.Dispose()
e.Graphics.FillRectangle(New SolidBrush(Color.FromArgb(25, Color.White)), x3)
e.Graphics.FillRectangle(H, x2) : G1.Dispose()
e.Graphics.DrawString(" " & Items(e.Index).ToString(), Font, Brushes.White, e.Bounds.X, e.Bounds.Y + 2)
Else
e.Graphics.FillRectangle(New SolidBrush(BackColor), e.Bounds)
e.Graphics.DrawString(" " & Items(e.Index).ToString(), Font, Brushes.White, e.Bounds.X, e.Bounds.Y + 2)
End If
MyBase.OnDrawItem(e)
End Sub
Public Function Triangle(ByVal Location As Point, ByVal Size As Size) As Point()
Dim ReturnPoints(0 To 3) As Point
ReturnPoints(0) = Location
ReturnPoints(1) = New Point(Location.X + Size.Width, Location.Y)
ReturnPoints(2) = New Point(Location.X + Size.Width \ 2, Location.Y + Size.Height)
ReturnPoints(3) = Location
Return ReturnPoints
End Function
Private Sub GhostComboBox_DropDownClosed(sender As Object, e As System.EventArgs) Handles Me.DropDownClosed
DropDownStyle = ComboBoxStyle.Simple
Application.DoEvents()
DropDownStyle = ComboBoxStyle.DropDownList
End Sub
Private Sub GhostCombo_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.TextChanged
Invalidate()
End Sub
End Class
<Designer("System.Windows.Forms.Design.ParentControlDesigner,System.Design", GetType(IDesigner))>
Class GhostGroupBox
Inherits ThemeControl154
Sub New()
MyBase.New()
SetStyle(ControlStyles.ResizeRedraw, True)
SetStyle(ControlStyles.ContainerControl, True)
DoubleBuffered = True
BackColor = Color.Transparent
End Sub
Protected Overrides Sub ColorHook()
End Sub
Protected Overrides Sub PaintHook()
G.Clear(Color.FromArgb(60, 60, 60))
Dim asdf As HatchBrush
asdf = New HatchBrush(HatchStyle.DarkDownwardDiagonal, Color.FromArgb(35, Color.Black), Color.FromArgb(0, Color.Gray))
G.FillRectangle(New SolidBrush(Color.FromArgb(60, 60, 60)), New Rectangle(0, 0, Width, Height))
asdf = New HatchBrush(HatchStyle.LightDownwardDiagonal, Color.DimGray)
G.FillRectangle(asdf, 0, 0, Width, Height)
G.FillRectangle(New SolidBrush(Color.FromArgb(230, 20, 20, 20)), 0, 0, Width, Height)
G.FillRectangle(New SolidBrush(Color.FromArgb(70, Color.Black)), 1, 1, Width - 2, Me.CreateGraphics.MeasureString(Text, Font).Height + 8)
G.DrawLine(New Pen(Color.FromArgb(90, 90, 90)), 1, Me.CreateGraphics.MeasureString(Text, Font).Height + 8, Width - 2, Me.CreateGraphics.MeasureString(Text, Font).Height + 8)
DrawBorders(Pens.Black)
DrawBorders(New Pen(Color.FromArgb(90, 90, 90)), 1)
G.DrawString(Text, Font, Brushes.White, 5, 5)
End Sub
End Class
<DefaultEvent("TextChanged")>
Class GhostTextBox
Inherits ThemeControl154
Private _TextAlign As HorizontalAlignment = HorizontalAlignment.Left
Property TextAlign() As HorizontalAlignment
Get
Return _TextAlign
End Get
Set(ByVal value As HorizontalAlignment)
_TextAlign = value
If Base IsNot Nothing Then
Base.TextAlign = value
End If
End Set
End Property
Private _MaxLength As Integer = 32767
Property MaxLength() As Integer
Get
Return _MaxLength
End Get
Set(ByVal value As Integer)
_MaxLength = value
If Base IsNot Nothing Then
Base.MaxLength = value
End If
End Set
End Property
Private _ReadOnly As Boolean
Property [ReadOnly]() As Boolean
Get
Return _ReadOnly
End Get
Set(ByVal value As Boolean)
_ReadOnly = value
If Base IsNot Nothing Then
Base.ReadOnly = value
End If
End Set
End Property
Private _UseSystemPasswordChar As Boolean
Property UseSystemPasswordChar() As Boolean
Get
Return _UseSystemPasswordChar
End Get
Set(ByVal value As Boolean)
_UseSystemPasswordChar = value
If Base IsNot Nothing Then
Base.UseSystemPasswordChar = value
End If
End Set
End Property
Private _Multiline As Boolean
Property Multiline() As Boolean
Get
Return _Multiline
End Get
Set(ByVal value As Boolean)
_Multiline = value
If Base IsNot Nothing Then
Base.Multiline = value
If value Then
LockHeight = 0
Base.Height = Height - 11
Else
LockHeight = Base.Height + 11
End If
End If
End Set
End Property
Overrides Property Text As String
Get
Return MyBase.Text
End Get
Set(ByVal value As String)
MyBase.Text = value
If Base IsNot Nothing Then
Base.Text = value
End If
End Set
End Property
Overrides Property Font As Font
Get
Return MyBase.Font
End Get
Set(ByVal value As Font)
MyBase.Font = value
If Base IsNot Nothing Then
Base.Font = value
Base.Location = New Point(3, 5)
Base.Width = Width - 6
If Not _Multiline Then
LockHeight = Base.Height + 11
End If
End If
End Set
End Property
Protected Overrides Sub OnCreation()
If Not Controls.Contains(Base) Then
Controls.Add(Base)
End If
End Sub
Private Base As TextBox
Sub New()
Base = New TextBox
Base.Font = Font
Base.Text = Text
Base.MaxLength = _MaxLength
Base.Multiline = _Multiline
Base.ReadOnly = _ReadOnly
Base.UseSystemPasswordChar = _UseSystemPasswordChar
Base.BorderStyle = BorderStyle.None
Base.Location = New Point(5, 5)
Base.Width = Width - 10
If _Multiline Then
Base.Height = Height - 11
Else
LockHeight = Base.Height + 11
End If
AddHandler Base.TextChanged, AddressOf OnBaseTextChanged
AddHandler Base.KeyDown, AddressOf OnBaseKeyDown
SetColor("Text", Color.White)
SetColor("Back", 0, 0, 0)
SetColor("Border1", Color.Black)
SetColor("Border2", 90, 90, 90)
End Sub
Private C1 As Color
Private P1, P2 As Pen
Protected Overrides Sub ColorHook()
C1 = GetColor("Back")
P1 = GetPen("Border1")
P2 = GetPen("Border2")
Base.ForeColor = GetColor("Text")
Base.BackColor = C1
End Sub
Protected Overrides Sub PaintHook()
G.Clear(C1)
DrawBorders(P1, 1)
DrawBorders(P2)
End Sub
Private Sub OnBaseTextChanged(ByVal s As Object, ByVal e As EventArgs)
Text = Base.Text
End Sub
Private Sub OnBaseKeyDown(ByVal s As Object, ByVal e As KeyEventArgs)
If e.Control AndAlso e.KeyCode = Keys.A Then
Base.SelectAll()
e.SuppressKeyPress = True
End If
End Sub
Protected Overrides Sub OnResize(ByVal e As EventArgs)
Base.Location = New Point(5, 5)
Base.Width = Width - 10
If _Multiline Then
Base.Height = Height - 11
End If
MyBase.OnResize(e)
End Sub
End Class
Class GhostControlBox
Inherits ThemeControl154
Private X As Integer
Dim BG, Edge As Color
Dim BEdge As Pen
Protected Overrides Sub ColorHook()
BG = GetColor("Background")
Edge = GetColor("Edge color")
BEdge = New Pen(GetColor("Button edge color"))
End Sub
Sub New()
SetColor("Background", Color.FromArgb(64, 64, 64))
SetColor("Edge color", Color.Black)
SetColor("Button edge color", Color.FromArgb(90, 90, 90))
Me.Size = New Size(71, 19)
Me.Anchor = AnchorStyles.Top Or AnchorStyles.Right
End Sub
Protected Overrides Sub OnMouseMove(e As System.Windows.Forms.MouseEventArgs)
MyBase.OnMouseMove(e)
X = e.X
Invalidate()
End Sub
Protected Overrides Sub OnClick(e As System.EventArgs)
MyBase.OnClick(e)
If X <= 22 Then
FindForm.WindowState = FormWindowState.Minimized
ElseIf X > 22 And X <= 44 Then
If FindForm.WindowState <> FormWindowState.Maximized Then FindForm.WindowState = FormWindowState.Maximized Else FindForm.WindowState = FormWindowState.Normal
ElseIf X > 44 Then
FindForm.Close()
End If
End Sub
Protected Overrides Sub PaintHook()
'Draw outer edge
G.Clear(Edge)
'Fill buttons
Dim SB As New LinearGradientBrush(New Rectangle(New Point(1, 1), New Size(Width - 2, Height - 2)), BG, Color.FromArgb(30, 30, 30), 90.0F)
G.FillRectangle(SB, New Rectangle(New Point(1, 1), New Size(Width - 2, Height - 2)))
'Draw icons
G.DrawString("0", New Font("Marlett", 8.25), Brushes.White, New Point(5, 5))
If FindForm.WindowState <> FormWindowState.Maximized Then G.DrawString("1", New Font("Marlett", 8.25), Brushes.White, New Point(27, 4)) Else G.DrawString("2", New Font("Marlett", 8.25), Brushes.White, New Point(27, 4))
G.DrawString("r", New Font("Marlett", 10), Brushes.White, New Point(49, 3))
'Glassy effect
Dim CBlend As New ColorBlend(2)
CBlend.Colors = {Color.FromArgb(100, Color.Black), Color.Transparent}
CBlend.Positions = {0, 1}
DrawGradient(CBlend, New Rectangle(New Point(1, 8), New Size(68, 8)), 90.0F)
'Draw button outlines
G.DrawRectangle(BEdge, New Rectangle(New Point(1, 1), New Size(20, 16)))
G.DrawRectangle(BEdge, New Rectangle(New Point(23, 1), New Size(20, 16)))
G.DrawRectangle(BEdge, New Rectangle(New Point(45, 1), New Size(24, 16)))
'Mouse states
Select Case State
Case MouseState.Over
If X <= 22 Then
G.FillRectangle(New SolidBrush(Color.FromArgb(20, Color.White)), New Rectangle(New Point(1, 1), New Size(21, Height - 2)))
ElseIf X > 22 And X <= 44 Then
G.FillRectangle(New SolidBrush(Color.FromArgb(20, Color.White)), New Rectangle(New Point(23, 1), New Size(21, Height - 2)))
ElseIf X > 44 Then
G.FillRectangle(New SolidBrush(Color.FromArgb(20, Color.White)), New Rectangle(New Point(45, 1), New Size(25, Height - 2)))
End If
Case MouseState.Down
If X <= 22 Then
G.FillRectangle(New SolidBrush(Color.FromArgb(20, Color.Black)), New Rectangle(New Point(1, 1), New Size(21, Height - 2)))
ElseIf X > 22 And X <= 44 Then
G.FillRectangle(New SolidBrush(Color.FromArgb(20, Color.Black)), New Rectangle(New Point(23, 1), New Size(21, Height - 2)))
ElseIf X > 44 Then
G.FillRectangle(New SolidBrush(Color.FromArgb(20, Color.Black)), New Rectangle(New Point(45, 1), New Size(25, Height - 2)))
End If
End Select
End Sub
End Class
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Immutable
Imports System.Threading
Imports Microsoft.CodeAnalysis.GenerateMember.GenerateParameterizedMember
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis.CodeActions
Imports Microsoft.CodeAnalysis.CodeFixes
Imports Microsoft.CodeAnalysis.CodeFixes.GenerateMember
Imports System.Composition
Namespace Microsoft.CodeAnalysis.VisualBasic.CodeFixes.GenerateMethod
<ExportCodeFixProvider(LanguageNames.VisualBasic, Name:=PredefinedCodeFixProviderNames.GenerateMethod), [Shared]>
<ExtensionOrder(After:=PredefinedCodeFixProviderNames.GenerateEvent)>
Friend Class GenerateParameterizedMemberCodeFixProvider
Inherits AbstractGenerateMemberCodeFixProvider
Friend Const BC30057 As String = "BC30057" ' error BC30057: Too many arguments to 'Public Sub Baz()'
Friend Const BC30518 As String = "BC30518" ' error BC30518: Overload resolution failed because no accessible 'sub1' can be called with these arguments.
Friend Const BC30519 As String = "BC30519" ' error BC30519: Overload resolution failed because no accessible 'sub1' can be called without a narrowing conversion.
Friend Const BC30520 As String = "BC30520" ' error BC30520: Argument matching parameter 'blah' narrows from 'A' to 'B'.
Friend Const BC30521 As String = "BC30521" ' error BC30521: Overload resolution failed because no accessible 'Baz' is most specific for these arguments.
Friend Const BC30112 As String = "BC30112" ' error BC30112: 'blah' is a namespace and cannot be used as a type/
Friend Const BC30451 As String = "BC30451" ' error BC30451: 'Foo' is not declared. It may be inaccessible due to its protection level.
Friend Const BC30455 As String = "BC30455" ' error BC30455: Argument not specified for parameter 'two' of 'Public Sub Baz(one As System.Func(Of String), two As Integer)'.
Friend Const BC30456 As String = "BC30456" ' error BC30456: 'Foo' is not a member of 'Sibling'.
Friend Const BC30401 As String = "BC30401" ' error BC30401: 'Blah' cannot implement 'Snarf' because there is no matching sub on interface 'IFoo'.
Friend Const BC30516 As String = "BC30516" ' error BC30516: Overload resolution failed because no accessible 'Blah' accepts this number of arguments.
Friend Const BC32016 As String = "BC32016" ' error BC32016: 'blah' has no parameters and its return type cannot be indexed.
Friend Const BC32045 As String = "BC32045" ' error BC32045: 'Private Sub Blah()' has no type parameters and so cannot have type arguments.
Friend Const BC32087 As String = "BC32087" ' error BC32087: Overload resolution failed because no accessible 'Blah' accepts this number of type arguments.
Friend Const BC36625 As String = "BC36625" ' error BC36625: Lambda expression cannot be converted to 'Integer' because 'Integer' is not a delegate type.
Public Overrides ReadOnly Property FixableDiagnosticIds As ImmutableArray(Of String)
Get
Return ImmutableArray.Create(BC30518, BC30519, BC30520, BC30521, BC30057, BC30112, BC30451, BC30455, BC30456, BC30401, BC30516, BC32016, BC32045, BC32087, BC36625)
End Get
End Property
Protected Overrides Function GetCodeActionsAsync(document As Document, node As SyntaxNode, cancellationToken As CancellationToken) As Task(Of IEnumerable(Of CodeAction))
Dim service = document.GetLanguageService(Of IGenerateParameterizedMemberService)()
Return service.GenerateMethodAsync(document, node, cancellationToken)
End Function
Protected Overrides Function IsCandidate(node As SyntaxNode, diagnostic As Diagnostic) As Boolean
Return TypeOf node Is QualifiedNameSyntax OrElse
TypeOf node Is SimpleNameSyntax OrElse
TypeOf node Is MemberAccessExpressionSyntax OrElse
TypeOf node Is InvocationExpressionSyntax OrElse
TypeOf node Is ExpressionSyntax OrElse
TypeOf node Is IdentifierNameSyntax
End Function
Protected Overrides Function GetTargetNode(node As SyntaxNode) As SyntaxNode
Dim memberAccess = TryCast(node, MemberAccessExpressionSyntax)
If memberAccess IsNot Nothing Then
Return memberAccess.Name
End If
Dim invocationExpression = TryCast(node, InvocationExpressionSyntax)
If invocationExpression IsNot Nothing Then
Return invocationExpression.Expression
End If
Return node
End Function
End Class
End Namespace
|
'{**
' This code block adds the method `GetSampleModelDataAsync()` to the SampleDataService of your project.
'**}
'{[{
Imports System.Threading.Tasks
'}]}
Namespace Services
Public Module SampleDataService
'^^
'{[{
' TODO WTS: Remove this once your MasterDetail pages are displaying real data
Public Async Function GetSampleModelDataAsync() As Task(Of IEnumerable(Of SampleOrder))
Await Task.CompletedTask
Return AllOrders()
End Function
'}]}
End Module
End Namespace
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class FormTraHobi
Inherits DevExpress.XtraEditors.XtraForm
'Form 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 Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(FormTraHobi))
Me.DataSetPelengkapPendaftaran = New StudentEnrollment.DataSetPelengkapPendaftaran()
Me.PelamarHobiBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.PelamarHobiTableAdapter = New StudentEnrollment.DataSetPelengkapPendaftaranTableAdapters.pelamarHobiTableAdapter()
Me.TableAdapterManager = New StudentEnrollment.DataSetPelengkapPendaftaranTableAdapters.TableAdapterManager()
Me.PelamarHobiBindingNavigator = New System.Windows.Forms.BindingNavigator(Me.components)
Me.BindingNavigatorAddNewItem = New System.Windows.Forms.ToolStripButton()
Me.BindingNavigatorCountItem = New System.Windows.Forms.ToolStripLabel()
Me.BindingNavigatorDeleteItem = New System.Windows.Forms.ToolStripButton()
Me.BindingNavigatorMoveFirstItem = New System.Windows.Forms.ToolStripButton()
Me.BindingNavigatorMovePreviousItem = New System.Windows.Forms.ToolStripButton()
Me.BindingNavigatorSeparator = New System.Windows.Forms.ToolStripSeparator()
Me.BindingNavigatorPositionItem = New System.Windows.Forms.ToolStripTextBox()
Me.BindingNavigatorSeparator1 = New System.Windows.Forms.ToolStripSeparator()
Me.BindingNavigatorMoveNextItem = New System.Windows.Forms.ToolStripButton()
Me.BindingNavigatorMoveLastItem = New System.Windows.Forms.ToolStripButton()
Me.BindingNavigatorSeparator2 = New System.Windows.Forms.ToolStripSeparator()
Me.PelamarHobiBindingNavigatorSaveItem = New System.Windows.Forms.ToolStripButton()
Me.PelamarHobiGridControl = New DevExpress.XtraGrid.GridControl()
Me.GridView1 = New DevExpress.XtraGrid.Views.Grid.GridView()
Me.colid = New DevExpress.XtraGrid.Columns.GridColumn()
Me.colidPelamar = New DevExpress.XtraGrid.Columns.GridColumn()
Me.colidHobi = New DevExpress.XtraGrid.Columns.GridColumn()
Me.RepositoryItemLookUpEdit1 = New DevExpress.XtraEditors.Repository.RepositoryItemLookUpEdit()
Me.PelamarHobiBindingSource1 = New System.Windows.Forms.BindingSource(Me.components)
Me.MstHobiBindingSource = New System.Windows.Forms.BindingSource(Me.components)
Me.MstHobiTableAdapter = New StudentEnrollment.DataSetPelengkapPendaftaranTableAdapters.mstHobiTableAdapter()
Me.LayoutControl1 = New DevExpress.XtraLayout.LayoutControl()
Me.LayoutControlGroup1 = New DevExpress.XtraLayout.LayoutControlGroup()
Me.LayoutControlItem1 = New DevExpress.XtraLayout.LayoutControlItem()
Me.LabelControl1 = New DevExpress.XtraEditors.LabelControl()
Me.LayoutControlItem2 = New DevExpress.XtraLayout.LayoutControlItem()
CType(Me.DataSetPelengkapPendaftaran, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.PelamarHobiBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.PelamarHobiBindingNavigator, System.ComponentModel.ISupportInitialize).BeginInit()
Me.PelamarHobiBindingNavigator.SuspendLayout()
CType(Me.PelamarHobiGridControl, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.GridView1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.RepositoryItemLookUpEdit1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.PelamarHobiBindingSource1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.MstHobiBindingSource, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.LayoutControl1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.LayoutControl1.SuspendLayout()
CType(Me.LayoutControlGroup1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.LayoutControlItem1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.LayoutControlItem2, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'DataSetPelengkapPendaftaran
'
Me.DataSetPelengkapPendaftaran.DataSetName = "DataSetPelengkapPendaftaran"
Me.DataSetPelengkapPendaftaran.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema
'
'PelamarHobiBindingSource
'
Me.PelamarHobiBindingSource.DataMember = "pelamarHobi"
Me.PelamarHobiBindingSource.DataSource = Me.DataSetPelengkapPendaftaran
'
'PelamarHobiTableAdapter
'
Me.PelamarHobiTableAdapter.ClearBeforeFill = True
'
'TableAdapterManager
'
Me.TableAdapterManager.BackupDataSetBeforeUpdate = False
Me.TableAdapterManager.pelamarHobiTableAdapter = Me.PelamarHobiTableAdapter
Me.TableAdapterManager.pendidikanNonFormalTableAdapter = Nothing
Me.TableAdapterManager.pengalamanOrganisasiTableAdapter = Nothing
Me.TableAdapterManager.prestasiTableAdapter = Nothing
Me.TableAdapterManager.traNilaiUNTableAdapter = Nothing
Me.TableAdapterManager.UpdateOrder = StudentEnrollment.DataSetPelengkapPendaftaranTableAdapters.TableAdapterManager.UpdateOrderOption.InsertUpdateDelete
'
'PelamarHobiBindingNavigator
'
Me.PelamarHobiBindingNavigator.AddNewItem = Me.BindingNavigatorAddNewItem
Me.PelamarHobiBindingNavigator.BindingSource = Me.PelamarHobiBindingSource
Me.PelamarHobiBindingNavigator.CountItem = Me.BindingNavigatorCountItem
Me.PelamarHobiBindingNavigator.DeleteItem = Me.BindingNavigatorDeleteItem
Me.PelamarHobiBindingNavigator.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.BindingNavigatorMoveFirstItem, Me.BindingNavigatorMovePreviousItem, Me.BindingNavigatorSeparator, Me.BindingNavigatorPositionItem, Me.BindingNavigatorCountItem, Me.BindingNavigatorSeparator1, Me.BindingNavigatorMoveNextItem, Me.BindingNavigatorMoveLastItem, Me.BindingNavigatorSeparator2, Me.BindingNavigatorAddNewItem, Me.BindingNavigatorDeleteItem, Me.PelamarHobiBindingNavigatorSaveItem})
Me.PelamarHobiBindingNavigator.Location = New System.Drawing.Point(0, 0)
Me.PelamarHobiBindingNavigator.MoveFirstItem = Me.BindingNavigatorMoveFirstItem
Me.PelamarHobiBindingNavigator.MoveLastItem = Me.BindingNavigatorMoveLastItem
Me.PelamarHobiBindingNavigator.MoveNextItem = Me.BindingNavigatorMoveNextItem
Me.PelamarHobiBindingNavigator.MovePreviousItem = Me.BindingNavigatorMovePreviousItem
Me.PelamarHobiBindingNavigator.Name = "PelamarHobiBindingNavigator"
Me.PelamarHobiBindingNavigator.PositionItem = Me.BindingNavigatorPositionItem
Me.PelamarHobiBindingNavigator.Size = New System.Drawing.Size(686, 25)
Me.PelamarHobiBindingNavigator.TabIndex = 0
Me.PelamarHobiBindingNavigator.Text = "BindingNavigator1"
'
'BindingNavigatorAddNewItem
'
Me.BindingNavigatorAddNewItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.BindingNavigatorAddNewItem.Image = CType(resources.GetObject("BindingNavigatorAddNewItem.Image"), System.Drawing.Image)
Me.BindingNavigatorAddNewItem.Name = "BindingNavigatorAddNewItem"
Me.BindingNavigatorAddNewItem.RightToLeftAutoMirrorImage = True
Me.BindingNavigatorAddNewItem.Size = New System.Drawing.Size(23, 22)
Me.BindingNavigatorAddNewItem.Text = "Add new"
'
'BindingNavigatorCountItem
'
Me.BindingNavigatorCountItem.Name = "BindingNavigatorCountItem"
Me.BindingNavigatorCountItem.Size = New System.Drawing.Size(35, 22)
Me.BindingNavigatorCountItem.Text = "of {0}"
Me.BindingNavigatorCountItem.ToolTipText = "Total number of items"
'
'BindingNavigatorDeleteItem
'
Me.BindingNavigatorDeleteItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.BindingNavigatorDeleteItem.Image = CType(resources.GetObject("BindingNavigatorDeleteItem.Image"), System.Drawing.Image)
Me.BindingNavigatorDeleteItem.Name = "BindingNavigatorDeleteItem"
Me.BindingNavigatorDeleteItem.RightToLeftAutoMirrorImage = True
Me.BindingNavigatorDeleteItem.Size = New System.Drawing.Size(23, 22)
Me.BindingNavigatorDeleteItem.Text = "Delete"
'
'BindingNavigatorMoveFirstItem
'
Me.BindingNavigatorMoveFirstItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.BindingNavigatorMoveFirstItem.Image = CType(resources.GetObject("BindingNavigatorMoveFirstItem.Image"), System.Drawing.Image)
Me.BindingNavigatorMoveFirstItem.Name = "BindingNavigatorMoveFirstItem"
Me.BindingNavigatorMoveFirstItem.RightToLeftAutoMirrorImage = True
Me.BindingNavigatorMoveFirstItem.Size = New System.Drawing.Size(23, 22)
Me.BindingNavigatorMoveFirstItem.Text = "Move first"
'
'BindingNavigatorMovePreviousItem
'
Me.BindingNavigatorMovePreviousItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.BindingNavigatorMovePreviousItem.Image = CType(resources.GetObject("BindingNavigatorMovePreviousItem.Image"), System.Drawing.Image)
Me.BindingNavigatorMovePreviousItem.Name = "BindingNavigatorMovePreviousItem"
Me.BindingNavigatorMovePreviousItem.RightToLeftAutoMirrorImage = True
Me.BindingNavigatorMovePreviousItem.Size = New System.Drawing.Size(23, 22)
Me.BindingNavigatorMovePreviousItem.Text = "Move previous"
'
'BindingNavigatorSeparator
'
Me.BindingNavigatorSeparator.Name = "BindingNavigatorSeparator"
Me.BindingNavigatorSeparator.Size = New System.Drawing.Size(6, 25)
'
'BindingNavigatorPositionItem
'
Me.BindingNavigatorPositionItem.AccessibleName = "Position"
Me.BindingNavigatorPositionItem.AutoSize = False
Me.BindingNavigatorPositionItem.Name = "BindingNavigatorPositionItem"
Me.BindingNavigatorPositionItem.Size = New System.Drawing.Size(50, 23)
Me.BindingNavigatorPositionItem.Text = "0"
Me.BindingNavigatorPositionItem.ToolTipText = "Current position"
'
'BindingNavigatorSeparator1
'
Me.BindingNavigatorSeparator1.Name = "BindingNavigatorSeparator1"
Me.BindingNavigatorSeparator1.Size = New System.Drawing.Size(6, 25)
'
'BindingNavigatorMoveNextItem
'
Me.BindingNavigatorMoveNextItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.BindingNavigatorMoveNextItem.Image = CType(resources.GetObject("BindingNavigatorMoveNextItem.Image"), System.Drawing.Image)
Me.BindingNavigatorMoveNextItem.Name = "BindingNavigatorMoveNextItem"
Me.BindingNavigatorMoveNextItem.RightToLeftAutoMirrorImage = True
Me.BindingNavigatorMoveNextItem.Size = New System.Drawing.Size(23, 22)
Me.BindingNavigatorMoveNextItem.Text = "Move next"
'
'BindingNavigatorMoveLastItem
'
Me.BindingNavigatorMoveLastItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.BindingNavigatorMoveLastItem.Image = CType(resources.GetObject("BindingNavigatorMoveLastItem.Image"), System.Drawing.Image)
Me.BindingNavigatorMoveLastItem.Name = "BindingNavigatorMoveLastItem"
Me.BindingNavigatorMoveLastItem.RightToLeftAutoMirrorImage = True
Me.BindingNavigatorMoveLastItem.Size = New System.Drawing.Size(23, 22)
Me.BindingNavigatorMoveLastItem.Text = "Move last"
'
'BindingNavigatorSeparator2
'
Me.BindingNavigatorSeparator2.Name = "BindingNavigatorSeparator2"
Me.BindingNavigatorSeparator2.Size = New System.Drawing.Size(6, 25)
'
'PelamarHobiBindingNavigatorSaveItem
'
Me.PelamarHobiBindingNavigatorSaveItem.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image
Me.PelamarHobiBindingNavigatorSaveItem.Image = CType(resources.GetObject("PelamarHobiBindingNavigatorSaveItem.Image"), System.Drawing.Image)
Me.PelamarHobiBindingNavigatorSaveItem.Name = "PelamarHobiBindingNavigatorSaveItem"
Me.PelamarHobiBindingNavigatorSaveItem.Size = New System.Drawing.Size(23, 22)
Me.PelamarHobiBindingNavigatorSaveItem.Text = "Save Data"
'
'PelamarHobiGridControl
'
Me.PelamarHobiGridControl.DataSource = Me.PelamarHobiBindingSource
Me.PelamarHobiGridControl.Location = New System.Drawing.Point(12, 29)
Me.PelamarHobiGridControl.MainView = Me.GridView1
Me.PelamarHobiGridControl.Name = "PelamarHobiGridControl"
Me.PelamarHobiGridControl.RepositoryItems.AddRange(New DevExpress.XtraEditors.Repository.RepositoryItem() {Me.RepositoryItemLookUpEdit1})
Me.PelamarHobiGridControl.Size = New System.Drawing.Size(662, 495)
Me.PelamarHobiGridControl.TabIndex = 2
Me.PelamarHobiGridControl.ViewCollection.AddRange(New DevExpress.XtraGrid.Views.Base.BaseView() {Me.GridView1})
'
'GridView1
'
Me.GridView1.Columns.AddRange(New DevExpress.XtraGrid.Columns.GridColumn() {Me.colid, Me.colidPelamar, Me.colidHobi})
Me.GridView1.GridControl = Me.PelamarHobiGridControl
Me.GridView1.Name = "GridView1"
'
'colid
'
Me.colid.FieldName = "id"
Me.colid.Name = "colid"
'
'colidPelamar
'
Me.colidPelamar.FieldName = "idPelamar"
Me.colidPelamar.Name = "colidPelamar"
'
'colidHobi
'
Me.colidHobi.ColumnEdit = Me.RepositoryItemLookUpEdit1
Me.colidHobi.FieldName = "idHobi"
Me.colidHobi.Name = "colidHobi"
Me.colidHobi.Visible = True
Me.colidHobi.VisibleIndex = 0
'
'RepositoryItemLookUpEdit1
'
Me.RepositoryItemLookUpEdit1.AutoHeight = False
Me.RepositoryItemLookUpEdit1.Buttons.AddRange(New DevExpress.XtraEditors.Controls.EditorButton() {New DevExpress.XtraEditors.Controls.EditorButton(DevExpress.XtraEditors.Controls.ButtonPredefines.Combo)})
Me.RepositoryItemLookUpEdit1.DataSource = Me.MstHobiBindingSource
Me.RepositoryItemLookUpEdit1.DisplayMember = "varchar"
Me.RepositoryItemLookUpEdit1.Name = "RepositoryItemLookUpEdit1"
Me.RepositoryItemLookUpEdit1.ValueMember = "id"
'
'PelamarHobiBindingSource1
'
Me.PelamarHobiBindingSource1.DataMember = "pelamarHobi"
Me.PelamarHobiBindingSource1.DataSource = Me.DataSetPelengkapPendaftaran
'
'MstHobiBindingSource
'
Me.MstHobiBindingSource.DataMember = "mstHobi"
Me.MstHobiBindingSource.DataSource = Me.DataSetPelengkapPendaftaran
'
'MstHobiTableAdapter
'
Me.MstHobiTableAdapter.ClearBeforeFill = True
'
'LayoutControl1
'
Me.LayoutControl1.Controls.Add(Me.LabelControl1)
Me.LayoutControl1.Controls.Add(Me.PelamarHobiGridControl)
Me.LayoutControl1.Dock = System.Windows.Forms.DockStyle.Fill
Me.LayoutControl1.Location = New System.Drawing.Point(0, 25)
Me.LayoutControl1.Name = "LayoutControl1"
Me.LayoutControl1.Root = Me.LayoutControlGroup1
Me.LayoutControl1.Size = New System.Drawing.Size(686, 536)
Me.LayoutControl1.TabIndex = 3
Me.LayoutControl1.Text = "LayoutControl1"
'
'LayoutControlGroup1
'
Me.LayoutControlGroup1.EnableIndentsWithoutBorders = DevExpress.Utils.DefaultBoolean.[True]
Me.LayoutControlGroup1.GroupBordersVisible = False
Me.LayoutControlGroup1.Items.AddRange(New DevExpress.XtraLayout.BaseLayoutItem() {Me.LayoutControlItem1, Me.LayoutControlItem2})
Me.LayoutControlGroup1.Location = New System.Drawing.Point(0, 0)
Me.LayoutControlGroup1.Name = "LayoutControlGroup1"
Me.LayoutControlGroup1.Size = New System.Drawing.Size(686, 536)
Me.LayoutControlGroup1.TextVisible = False
'
'LayoutControlItem1
'
Me.LayoutControlItem1.Control = Me.PelamarHobiGridControl
Me.LayoutControlItem1.Location = New System.Drawing.Point(0, 17)
Me.LayoutControlItem1.Name = "LayoutControlItem1"
Me.LayoutControlItem1.Size = New System.Drawing.Size(666, 499)
Me.LayoutControlItem1.TextSize = New System.Drawing.Size(0, 0)
Me.LayoutControlItem1.TextVisible = False
'
'LabelControl1
'
Me.LabelControl1.Location = New System.Drawing.Point(12, 12)
Me.LabelControl1.Name = "LabelControl1"
Me.LabelControl1.Size = New System.Drawing.Size(66, 13)
Me.LabelControl1.StyleController = Me.LayoutControl1
Me.LabelControl1.TabIndex = 4
Me.LabelControl1.Text = "LabelControl1"
'
'LayoutControlItem2
'
Me.LayoutControlItem2.Control = Me.LabelControl1
Me.LayoutControlItem2.Location = New System.Drawing.Point(0, 0)
Me.LayoutControlItem2.Name = "LayoutControlItem2"
Me.LayoutControlItem2.Size = New System.Drawing.Size(666, 17)
Me.LayoutControlItem2.TextSize = New System.Drawing.Size(0, 0)
Me.LayoutControlItem2.TextVisible = False
'
'FormTraHobi
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(686, 561)
Me.Controls.Add(Me.LayoutControl1)
Me.Controls.Add(Me.PelamarHobiBindingNavigator)
Me.Name = "FormTraHobi"
Me.Text = "FormTraHobi"
CType(Me.DataSetPelengkapPendaftaran, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.PelamarHobiBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.PelamarHobiBindingNavigator, System.ComponentModel.ISupportInitialize).EndInit()
Me.PelamarHobiBindingNavigator.ResumeLayout(False)
Me.PelamarHobiBindingNavigator.PerformLayout()
CType(Me.PelamarHobiGridControl, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.GridView1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.RepositoryItemLookUpEdit1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.PelamarHobiBindingSource1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.MstHobiBindingSource, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.LayoutControl1, System.ComponentModel.ISupportInitialize).EndInit()
Me.LayoutControl1.ResumeLayout(False)
CType(Me.LayoutControlGroup1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.LayoutControlItem1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.LayoutControlItem2, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents DataSetPelengkapPendaftaran As DataSetPelengkapPendaftaran
Friend WithEvents PelamarHobiBindingSource As BindingSource
Friend WithEvents PelamarHobiTableAdapter As DataSetPelengkapPendaftaranTableAdapters.pelamarHobiTableAdapter
Friend WithEvents TableAdapterManager As DataSetPelengkapPendaftaranTableAdapters.TableAdapterManager
Friend WithEvents PelamarHobiBindingNavigator As BindingNavigator
Friend WithEvents BindingNavigatorAddNewItem As ToolStripButton
Friend WithEvents BindingNavigatorCountItem As ToolStripLabel
Friend WithEvents BindingNavigatorDeleteItem As ToolStripButton
Friend WithEvents BindingNavigatorMoveFirstItem As ToolStripButton
Friend WithEvents BindingNavigatorMovePreviousItem As ToolStripButton
Friend WithEvents BindingNavigatorSeparator As ToolStripSeparator
Friend WithEvents BindingNavigatorPositionItem As ToolStripTextBox
Friend WithEvents BindingNavigatorSeparator1 As ToolStripSeparator
Friend WithEvents BindingNavigatorMoveNextItem As ToolStripButton
Friend WithEvents BindingNavigatorMoveLastItem As ToolStripButton
Friend WithEvents BindingNavigatorSeparator2 As ToolStripSeparator
Friend WithEvents PelamarHobiBindingNavigatorSaveItem As ToolStripButton
Friend WithEvents PelamarHobiGridControl As XtraGrid.GridControl
Friend WithEvents GridView1 As XtraGrid.Views.Grid.GridView
Friend WithEvents colid As XtraGrid.Columns.GridColumn
Friend WithEvents colidPelamar As XtraGrid.Columns.GridColumn
Friend WithEvents colidHobi As XtraGrid.Columns.GridColumn
Friend WithEvents RepositoryItemLookUpEdit1 As Repository.RepositoryItemLookUpEdit
Friend WithEvents PelamarHobiBindingSource1 As BindingSource
Friend WithEvents MstHobiBindingSource As BindingSource
Friend WithEvents MstHobiTableAdapter As DataSetPelengkapPendaftaranTableAdapters.mstHobiTableAdapter
Friend WithEvents LayoutControl1 As XtraLayout.LayoutControl
Friend WithEvents LabelControl1 As LabelControl
Friend WithEvents LayoutControlGroup1 As XtraLayout.LayoutControlGroup
Friend WithEvents LayoutControlItem1 As XtraLayout.LayoutControlItem
Friend WithEvents LayoutControlItem2 As XtraLayout.LayoutControlItem
End Class
|
Imports System
Imports System.Collections.Generic
Imports INDArray = org.nd4j.linalg.api.ndarray.INDArray
Imports org.nd4j.linalg.learning
Imports ISchedule = org.nd4j.linalg.schedule.ISchedule
Imports JsonAutoDetect = org.nd4j.shade.jackson.annotation.JsonAutoDetect
Imports JsonInclude = org.nd4j.shade.jackson.annotation.JsonInclude
Imports JsonTypeInfo = org.nd4j.shade.jackson.annotation.JsonTypeInfo
'
' * ******************************************************************************
' * *
' * *
' * * This program and the accompanying materials are made available under the
' * * terms of the Apache License, Version 2.0 which is available at
' * * https://www.apache.org/licenses/LICENSE-2.0.
' * *
' * * See the NOTICE file distributed with this work for additional
' * * information regarding copyright ownership.
' * * Unless required by applicable law or agreed to in writing, software
' * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
' * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
' * * License for the specific language governing permissions and limitations
' * * under the License.
' * *
' * * SPDX-License-Identifier: Apache-2.0
' * *****************************************************************************
'
Namespace org.nd4j.linalg.learning.config
'JAVA TO VB CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
'ORIGINAL LINE: @JsonInclude(JsonInclude.Include.NON_NULL) @JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE, setterVisibility = JsonAutoDetect.Visibility.NONE) @JsonTypeInfo(use = JsonTypeInfo.Id.@CLASS, include = JsonTypeInfo.@As.@PROPERTY, property = "@class") public interface IUpdater extends java.io.Serializable, Cloneable
Public Interface IUpdater
Inherits ICloneable
''' <summary>
''' Determine the updater state size for the given number of parameters. Usually a integer multiple (0,1 or 2)
''' times the number of parameters in a layer.
''' </summary>
''' <param name="numParams"> Number of parameters </param>
''' <returns> Updater state size for the given number of parameters </returns>
Function stateSize(ByVal numParams As Long) As Long
''' <summary>
''' Create a new gradient updater
''' </summary>
''' <param name="viewArray"> The updater state size view away </param>
''' <param name="initializeViewArray"> If true: initialise the updater state
''' @return </param>
Function instantiate(ByVal viewArray As INDArray, ByVal initializeViewArray As Boolean) As GradientUpdater
Function instantiate(ByVal updaterState As IDictionary(Of String, INDArray), ByVal initializeStateArrays As Boolean) As GradientUpdater
Function Equals(ByVal updater As Object) As Boolean
''' <summary>
''' Clone the updater
''' </summary>
Function clone() As IUpdater
''' <summary>
''' Get the learning rate - if any - for the updater, at the specified iteration and epoch.
''' Note that if no learning rate is applicable (AdaDelta, NoOp updaters etc) then Double.NaN should
''' be return
''' </summary>
''' <param name="iteration"> Iteration at which to get the learning rate </param>
''' <param name="epoch"> Epoch at which to get the learning rate </param>
''' <returns> Learning rate, or Double.NaN if no learning rate is applicable for this updater </returns>
Function getLearningRate(ByVal iteration As Integer, ByVal epoch As Integer) As Double
''' <returns> True if the updater has a learning rate hyperparameter, false otherwise </returns>
Function hasLearningRate() As Boolean
''' <summary>
''' Set the learning rate and schedule. Note: may throw an exception if <seealso cref="hasLearningRate()"/> returns false. </summary>
''' <param name="lr"> Learning rate to set (typically not used if LR schedule is non-null) </param>
''' <param name="lrSchedule"> Learning rate schedule to set (may be null) </param>
Sub setLrAndSchedule(ByVal lr As Double, ByVal lrSchedule As ISchedule)
End Interface
End Namespace |
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.1
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
'NOTE: This file is auto-generated; do not modify it directly. To make changes,
' or if you encounter build errors in this file, go to the Project Designer
' (go to Project Properties or double-click the My Project node in
' Solution Explorer), and make changes on the Application tab.
'
Partial Friend Class MyApplication
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Public Sub New()
MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.AuthenticationMode.Windows)
Me.IsSingleInstance = false
Me.EnableVisualStyles = true
Me.SaveMySettingsOnExit = true
Me.ShutDownStyle = Global.Microsoft.VisualBasic.ApplicationServices.ShutdownMode.AfterMainFormCloses
End Sub
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Protected Overrides Sub OnCreateMainForm()
Me.MainForm = Global.AsyncDataPortalWinTest.Form1
End Sub
End Class
End Namespace
|
'
' News Articles for DotNetNuke - http://www.dotnetnuke.com
' Copyright (c) 2002-2008
' by Ventrian ( [email protected] ) ( http://www.ventrian.com )
'
Imports System.IO
Imports System.Xml
Imports DotNetNuke.Application
Imports DotNetNuke.Common
Imports DotNetNuke.Common.Utilities
Imports DotNetNuke.Entities.Host
Imports DotNetNuke.Entities.Portals
Imports DotNetNuke.Services.Cache
Imports DotNetNuke.Services.Localization
Namespace Ventrian.NewsArticles.Components.Utility
Public Class LocalizationUtil
#Region " Private Members "
Private Shared _strUseLanguageInUrlDefault As String = Null.NullString
#End Region
#Region " Public Methods "
'Private Shared Function GetHostSettingAsBoolean(ByVal key As String, ByVal defaultValue As Boolean) As Boolean
' Dim retValue As Boolean = defaultValue
' Try
' Dim setting As String = DotNetNuke.Entities.Host.HostSettings.GetHostSetting(key)
' If String.IsNullOrEmpty(setting) = False Then
' retValue = (setting.ToUpperInvariant().StartsWith("Y") OrElse setting.ToUpperInvariant = "TRUE")
' End If
' Catch ex As Exception
' 'we just want to trap the error as we may not be installed so there will be no Settings
' End Try
' Return retValue
'End Function
'Private Shared Function GetPortalSettingAsBoolean(ByVal portalID As Integer, ByVal key As String, ByVal defaultValue As Boolean) As Boolean
' Dim retValue As Boolean = defaultValue
' Try
' Dim setting As String = DotNetNuke.Entities.Portals.PortalSettings.GetSiteSetting(portalID, key)
' If String.IsNullOrEmpty(setting) = False Then
' retValue = (setting.ToUpperInvariant().StartsWith("Y") OrElse setting.ToUpperInvariant = "TRUE")
' End If
' Catch ex As Exception
' 'we just want to trap the error as we may not be installed so there will be no Settings
' End Try
' Return retValue
'End Function
Public Shared Function UseLanguageInUrl() As Boolean
If (Host.EnableUrlLanguage) Then
Return Host.EnableUrlLanguage
End If
If (PortalSettings.Current.EnableUrlLanguage) Then
Return PortalSettings.Current.EnableUrlLanguage
End If
If (File.Exists(HttpContext.Current.Server.MapPath(Localization.ApplicationResourceDirectory + "/Locales.xml")) = False) Then
Return Host.EnableUrlLanguage
End If
Dim cacheKey As String = ""
Dim objPortalSettings As PortalSettings = PortalController.Instance.GetCurrentPortalSettings()
Dim useLanguage As Boolean = False
' check default host setting
If String.IsNullOrEmpty(_strUseLanguageInUrlDefault) Then
Dim xmldoc As New XmlDocument
Dim languageInUrl As XmlNode
xmldoc.Load(HttpContext.Current.Server.MapPath(Localization.ApplicationResourceDirectory + "/Locales.xml"))
languageInUrl = xmldoc.SelectSingleNode("//root/languageInUrl")
If Not languageInUrl Is Nothing Then
_strUseLanguageInUrlDefault = languageInUrl.Attributes("enabled").InnerText
Else
Try
Dim version As Integer = Convert.ToInt32(DotNetNukeContext.Current.Application.Version.ToString().Replace(".", ""))
If (version >= 490) Then
_strUseLanguageInUrlDefault = "true"
Else
_strUseLanguageInUrlDefault = "false"
End If
Catch
_strUseLanguageInUrlDefault = "false"
End Try
End If
End If
useLanguage = Boolean.Parse(_strUseLanguageInUrlDefault)
' check current portal setting
Dim FilePath As String = HttpContext.Current.Server.MapPath(Localization.ApplicationResourceDirectory + "/Locales.Portal-" + objPortalSettings.PortalId.ToString + ".xml")
If File.Exists(FilePath) Then
cacheKey = "dotnetnuke-uselanguageinurl" & objPortalSettings.PortalId.ToString
Try
Dim o As Object = DataCache.GetCache(cacheKey)
If o Is Nothing Then
Dim xmlLocales As New XmlDocument
Dim bXmlLoaded As Boolean = False
xmlLocales.Load(FilePath)
bXmlLoaded = True
Dim d As New XmlDocument
d.Load(FilePath)
If bXmlLoaded AndAlso Not xmlLocales.SelectSingleNode("//locales/languageInUrl") Is Nothing Then
useLanguage = Boolean.Parse(xmlLocales.SelectSingleNode("//locales/languageInUrl").Attributes("enabled").InnerText)
End If
If Host.PerformanceSetting <> Globals.PerformanceSettings.NoCaching Then
Dim dp As New DNNCacheDependency(FilePath)
DataCache.SetCache(cacheKey, useLanguage, dp)
End If
Else
useLanguage = CType(o, Boolean)
End If
Catch ex As Exception
End Try
Return useLanguage
Else
Return useLanguage
End If
End Function
#End Region
End Class
End Namespace
|
Public Class ThisWorkbook
Private Sub ThisWorkbook_Startup() Handles Me.Startup
End Sub
Private Sub ThisWorkbook_Shutdown() Handles Me.Shutdown
End Sub
End Class
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class home
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> _
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(home))
Me.lg = New System.Windows.Forms.PictureBox()
Me.Timer1 = New System.Windows.Forms.Timer(Me.components)
Me.Label1 = New System.Windows.Forms.Label()
Me.b1 = New System.Windows.Forms.PictureBox()
Me.b3 = New System.Windows.Forms.PictureBox()
Me.b4 = New System.Windows.Forms.PictureBox()
Me.b2 = New System.Windows.Forms.PictureBox()
CType(Me.lg, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.b1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.b3, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.b4, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.b2, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'lg
'
Me.lg.BackColor = System.Drawing.Color.Transparent
Me.lg.Location = New System.Drawing.Point(12, 12)
Me.lg.Name = "lg"
Me.lg.Size = New System.Drawing.Size(273, 243)
Me.lg.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
Me.lg.TabIndex = 1
Me.lg.TabStop = False
'
'Timer1
'
Me.Timer1.Enabled = True
Me.Timer1.Interval = 5000
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Location = New System.Drawing.Point(957, 707)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(13, 13)
Me.Label1.TabIndex = 2
Me.Label1.Text = "0"
'
'home
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(1008, 729)
Me.Controls.Add(Me.b2)
Me.Controls.Add(Me.b4)
Me.Controls.Add(Me.b3)
Me.Controls.Add(Me.b1)
Me.Controls.Add(Me.Label1)
Me.Controls.Add(Me.lg)
Me.Icon = CType(resources.GetObject("$this.Icon"), System.Drawing.Icon)
Me.MaximizeBox = False
Me.Name = "home"
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.Text = "Check Knowledge"
CType(Me.lg, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.b1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.b3, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.b4, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.b2, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
Friend WithEvents lg As System.Windows.Forms.PictureBox
Friend WithEvents Timer1 As System.Windows.Forms.Timer
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents b1 As System.Windows.Forms.PictureBox
Friend WithEvents b3 As System.Windows.Forms.PictureBox
Friend WithEvents b4 As System.Windows.Forms.PictureBox
Friend WithEvents b2 As System.Windows.Forms.PictureBox
End Class
|
Imports CefSharp
Imports CefSharp.Wpf
Public Class Navegador
Dim pwd As String
Dim usr As String
Public Sub SetAux(l As String())
pwd = l(1)
usr = l(0)
End Sub
Private Sub BtnAtras_Click(sender As Object, e As RoutedEventArgs) Handles BtnAtras.Click
Dim WinAdminMenu As New MenuAdministrador
Dim winMenu As New Menu
If (My.Settings.USER_ROLE.ToString = "administrador ") Then
WinAdminMenu.Show()
Close()
ElseIf (My.Settings.USER_ROLE.ToString = "transportista ") Then
winMenu.Show()
Close()
End If
End Sub
Private Sub Browser_FrameLoadEnd(sender As Object, e As FrameLoadEndEventArgs)
Browser.SetZoomLevel(-5.0)
Browser.ExecuteScriptAsync("document.getElementById('identifierId').value=""" & usr & """")
Browser.ExecuteScriptAsync("document.getElementById('identifierNext').click()")
End Sub
Private Sub Window_Loaded(sender As Object, e As RoutedEventArgs)
TxtBoxContraseña.Text = pwd
End Sub
End Class
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.18213
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("Login_Server.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set(ByVal value As Global.System.Globalization.CultureInfo)
resourceCulture = value
End Set
End Property
End Module
End Namespace
|
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("MeuOS browser")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("HP Inc.")>
<Assembly: AssemblyProduct("MeuOS browser")>
<Assembly: AssemblyCopyright("Copyright © HP Inc. 2021")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("f50d2a61-eb85-4c68-9b8d-b00619c89cdd")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
' Copyright 2018 Google LLC
'
' Licensed under the Apache License, Version 2.0 (the "License");
' you may not use this file except in compliance with the License.
' You may obtain a copy of the License at
'
' http://www.apache.org/licenses/LICENSE-2.0
'
' Unless required by applicable law or agreed to in writing, software
' distributed under the License is distributed on an "AS IS" BASIS,
' WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
' See the License for the specific language governing permissions and
' limitations under the License.
Imports Google.Api.Ads.AdWords.Lib
Imports Google.Api.Ads.AdWords.v201806
Namespace Google.Api.Ads.AdWords.Examples.VB.v201806
''' <summary>
''' This code example illustrates how to retrieve all the ad groups for a
''' campaign. To create an ad group, run AddAdGroup.vb.
''' </summary>
Public Class GetAdGroups
Inherits ExampleBase
''' <summary>
''' Main method, to run this code example as a standalone application.
''' </summary>
''' <param name="args">The command line arguments.</param>
Public Shared Sub Main(ByVal args As String())
Dim codeExample As New GetAdGroups
Console.WriteLine(codeExample.Description)
Try
Dim campaignId As Long = Long.Parse("INSERT_CAMPAIGN_ID_HERE")
codeExample.Run(New AdWordsUser, campaignId)
Catch e As Exception
Console.WriteLine("An exception occurred while running this code example. {0}",
ExampleUtilities.FormatException(e))
End Try
End Sub
''' <summary>
''' Returns a description about the code example.
''' </summary>
Public Overrides ReadOnly Property Description() As String
Get
Return "This code example illustrates how to retrieve all the ad groups for a " &
"campaign. To create an ad group, run AddAdGroup.vb."
End Get
End Property
''' <summary>
''' Runs the code example.
''' </summary>
''' <param name="user">The AdWords user.</param>
''' <param name="campaignId">Id of the campaign for which ad groups are
''' retrieved.</param>
Public Sub Run(ByVal user As AdWordsUser, ByVal campaignId As Long)
Using adGroupService As AdGroupService = CType(user.GetService(
AdWordsService.v201806.AdGroupService), AdGroupService)
' Create the selector.
Dim selector As New Selector
selector.fields = New String() {
AdGroup.Fields.Id, AdGroup.Fields.Name
}
selector.predicates = New Predicate() {
Predicate.Equals(AdGroup.Fields.CampaignId, campaignId)
}
selector.ordering = New OrderBy() {OrderBy.Asc(AdGroup.Fields.Name)}
selector.paging = Paging.Default
Dim page As New AdGroupPage
Try
Do
' Get the ad groups.
page = adGroupService.get(selector)
' Display the results.
If ((Not page Is Nothing) AndAlso (Not page.entries Is Nothing)) Then
Dim i As Integer = selector.paging.startIndex
For Each adGroup As AdGroup In page.entries
Console.WriteLine("{0}) Ad group name is ""{1}"" and id is ""{2}"".", i + 1,
adGroup.name, adGroup.id)
i += 1
Next
End If
selector.paging.IncreaseOffset()
Loop While (selector.paging.startIndex < page.totalNumEntries)
Console.WriteLine("Number of ad groups found: {0}", page.totalNumEntries)
Catch e As Exception
Throw New System.ApplicationException("Failed to retrieve ad group(s).", e)
End Try
End Using
End Sub
End Class
End Namespace
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Partial Class VetAggregateSummaryActionDetail
Inherits bv.common.win.BaseDetailForm
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
AggregateCaseDbService = New VetAggregateSummaryAction_DB
DbService = AggregateCaseDbService
PermissionObject = eidss.model.Enums.EIDSSPermissionObject.VetCase
AggregateSummaryHeader1.CaseType = model.Enums.AggregateCaseType.VetAggregateAction
'AggregateSummaryHeader1.UseParentDataset = True
'RegisterChildObject(AggregateSummaryHeader1, RelatedPostOrder.SkipPost)
'RegisterChildObject(fgDiagnosticAction, RelatedPostOrder.PostLast)
'RegisterChildObject(fgProphylacticAction, RelatedPostOrder.PostLast)
'RegisterChildObject(fgSanitaryAction, RelatedPostOrder.PostLast)
'minYear = 1900
End Sub
'Public Sub New(ByVal _MinYear As Integer)
' MyBase.New()
' 'This call is required by the Windows Form Designer.
' InitializeComponent()
' 'Add any initialization after the InitializeComponent() call
' AggregateCaseDbService = New VetAggregateSummaryAction_DB
' DbService = AggregateCaseDbService
' PermissionObject = eidss.model.Enums.EIDSSPermissionObject.VetCase
' RegisterChildObject(fgDiagnosticAction, RelatedPostOrder.PostLast)
' RegisterChildObject(fgProphylacticAction, RelatedPostOrder.PostLast)
' RegisterChildObject(fgSanitaryAction, RelatedPostOrder.PostLast)
' If (_MinYear) > 0 AndAlso (_MinYear <= Date.Today.Year) Then
' minYear = _MinYear
' Else
' minYear = 1900
' End If
'End Sub
'Form 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 Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> _
Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(VetAggregateSummaryActionDetail))
Me.btnRefresh = New DevExpress.XtraEditors.SimpleButton()
Me.btnClose = New DevExpress.XtraEditors.SimpleButton()
Me.btnViewDetailForm = New DevExpress.XtraEditors.SimpleButton()
Me.btnShowSummary = New DevExpress.XtraEditors.SimpleButton()
Me.PopUpButton1 = New bv.common.win.PopUpButton()
Me.cmRep = New System.Windows.Forms.ContextMenu()
Me.MenuItem1 = New System.Windows.Forms.MenuItem()
Me.AggregateSummaryHeader1 = New EIDSS.winclient.AggregateCase.AggregateSummaryHeader()
Me.xtcDetailInfo = New DevExpress.XtraTab.XtraTabControl()
Me.xtpDiagnosticAction = New DevExpress.XtraTab.XtraTabPage()
Me.fgDiagnosticAction = New EIDSS.FlexibleForms.FFPresenter()
Me.lbNoDiagnosticActionMatrix = New DevExpress.XtraEditors.LabelControl()
Me.xtpProphilacticAction = New DevExpress.XtraTab.XtraTabPage()
Me.fgProphylacticAction = New EIDSS.FlexibleForms.FFPresenter()
Me.lbNoProphylacticActionMatrix = New DevExpress.XtraEditors.LabelControl()
Me.xtpSanitaryAction = New DevExpress.XtraTab.XtraTabPage()
Me.fgSanitaryAction = New EIDSS.FlexibleForms.FFPresenter()
Me.lbNoSanitaryActionMatrix = New DevExpress.XtraEditors.LabelControl()
CType(Me.xtcDetailInfo, System.ComponentModel.ISupportInitialize).BeginInit()
Me.xtcDetailInfo.SuspendLayout()
Me.xtpDiagnosticAction.SuspendLayout()
Me.xtpProphilacticAction.SuspendLayout()
Me.xtpSanitaryAction.SuspendLayout()
Me.SuspendLayout()
'
'btnRefresh
'
resources.ApplyResources(Me.btnRefresh, "btnRefresh")
Me.btnRefresh.Image = Global.EIDSS.My.Resources.Resources.refresh
Me.btnRefresh.Name = "btnRefresh"
'
'btnClose
'
resources.ApplyResources(Me.btnClose, "btnClose")
Me.btnClose.Image = Global.EIDSS.My.Resources.Resources.Close
Me.btnClose.Name = "btnClose"
'
'btnViewDetailForm
'
resources.ApplyResources(Me.btnViewDetailForm, "btnViewDetailForm")
Me.btnViewDetailForm.Image = Global.EIDSS.My.Resources.Resources.View1
Me.btnViewDetailForm.Name = "btnViewDetailForm"
'
'btnShowSummary
'
resources.ApplyResources(Me.btnShowSummary, "btnShowSummary")
Me.btnShowSummary.Name = "btnShowSummary"
'
'PopUpButton1
'
resources.ApplyResources(Me.PopUpButton1, "PopUpButton1")
Me.PopUpButton1.ButtonType = bv.common.win.PopUpButton.PopUpButtonStyles.Reports
Me.PopUpButton1.Name = "PopUpButton1"
Me.PopUpButton1.PopUpMenu = Me.cmRep
Me.PopUpButton1.Tag = "{Immovable}{AlwaysEditable}"
'
'cmRep
'
Me.cmRep.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1})
'
'MenuItem1
'
Me.MenuItem1.Index = 0
resources.ApplyResources(Me.MenuItem1, "MenuItem1")
'
'AggregateSummaryHeader1
'
resources.ApplyResources(Me.AggregateSummaryHeader1, "AggregateSummaryHeader1")
Me.AggregateSummaryHeader1.CaseType = EIDSS.model.Enums.AggregateCaseType.VetAggregateAction
Me.AggregateSummaryHeader1.Name = "AggregateSummaryHeader1"
'
'xtcDetailInfo
'
resources.ApplyResources(Me.xtcDetailInfo, "xtcDetailInfo")
Me.xtcDetailInfo.Name = "xtcDetailInfo"
Me.xtcDetailInfo.SelectedTabPage = Me.xtpDiagnosticAction
Me.xtcDetailInfo.TabPages.AddRange(New DevExpress.XtraTab.XtraTabPage() {Me.xtpDiagnosticAction, Me.xtpProphilacticAction, Me.xtpSanitaryAction})
'
'xtpDiagnosticAction
'
Me.xtpDiagnosticAction.Controls.Add(Me.fgDiagnosticAction)
Me.xtpDiagnosticAction.Controls.Add(Me.lbNoDiagnosticActionMatrix)
Me.xtpDiagnosticAction.Name = "xtpDiagnosticAction"
resources.ApplyResources(Me.xtpDiagnosticAction, "xtpDiagnosticAction")
'
'fgDiagnosticAction
'
resources.ApplyResources(Me.fgDiagnosticAction, "fgDiagnosticAction")
Me.fgDiagnosticAction.DefaultFormState = System.Windows.Forms.FormWindowState.Normal
Me.fgDiagnosticAction.DynamicParameterEnabled = False
Me.fgDiagnosticAction.FormID = Nothing
Me.fgDiagnosticAction.HelpTopicID = Nothing
Me.fgDiagnosticAction.IsStatusReadOnly = False
Me.fgDiagnosticAction.KeyFieldName = Nothing
Me.fgDiagnosticAction.MultiSelect = False
Me.fgDiagnosticAction.Name = "fgDiagnosticAction"
Me.fgDiagnosticAction.ObjectName = Nothing
Me.fgDiagnosticAction.SectionTableCaptionsIsVisible = True
Me.fgDiagnosticAction.Status = bv.common.win.FormStatus.Draft
Me.fgDiagnosticAction.TableName = Nothing
'
'lbNoDiagnosticActionMatrix
'
Me.lbNoDiagnosticActionMatrix.Appearance.ForeColor = CType(resources.GetObject("lbNoDiagnosticActionMatrix.Appearance.ForeColor"), System.Drawing.Color)
Me.lbNoDiagnosticActionMatrix.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center
Me.lbNoDiagnosticActionMatrix.Appearance.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap
resources.ApplyResources(Me.lbNoDiagnosticActionMatrix, "lbNoDiagnosticActionMatrix")
Me.lbNoDiagnosticActionMatrix.Name = "lbNoDiagnosticActionMatrix"
'
'xtpProphilacticAction
'
Me.xtpProphilacticAction.Controls.Add(Me.fgProphylacticAction)
Me.xtpProphilacticAction.Controls.Add(Me.lbNoProphylacticActionMatrix)
Me.xtpProphilacticAction.Name = "xtpProphilacticAction"
resources.ApplyResources(Me.xtpProphilacticAction, "xtpProphilacticAction")
'
'fgProphylacticAction
'
resources.ApplyResources(Me.fgProphylacticAction, "fgProphylacticAction")
Me.fgProphylacticAction.DefaultFormState = System.Windows.Forms.FormWindowState.Normal
Me.fgProphylacticAction.DynamicParameterEnabled = False
Me.fgProphylacticAction.FormID = Nothing
Me.fgProphylacticAction.HelpTopicID = Nothing
Me.fgProphylacticAction.IsStatusReadOnly = False
Me.fgProphylacticAction.KeyFieldName = Nothing
Me.fgProphylacticAction.MultiSelect = False
Me.fgProphylacticAction.Name = "fgProphylacticAction"
Me.fgProphylacticAction.ObjectName = Nothing
Me.fgProphylacticAction.SectionTableCaptionsIsVisible = True
Me.fgProphylacticAction.Status = bv.common.win.FormStatus.Draft
Me.fgProphylacticAction.TableName = Nothing
'
'lbNoProphylacticActionMatrix
'
Me.lbNoProphylacticActionMatrix.Appearance.ForeColor = CType(resources.GetObject("lbNoProphylacticActionMatrix.Appearance.ForeColor"), System.Drawing.Color)
Me.lbNoProphylacticActionMatrix.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center
Me.lbNoProphylacticActionMatrix.Appearance.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap
resources.ApplyResources(Me.lbNoProphylacticActionMatrix, "lbNoProphylacticActionMatrix")
Me.lbNoProphylacticActionMatrix.Name = "lbNoProphylacticActionMatrix"
'
'xtpSanitaryAction
'
Me.xtpSanitaryAction.Controls.Add(Me.fgSanitaryAction)
Me.xtpSanitaryAction.Controls.Add(Me.lbNoSanitaryActionMatrix)
Me.xtpSanitaryAction.Name = "xtpSanitaryAction"
resources.ApplyResources(Me.xtpSanitaryAction, "xtpSanitaryAction")
'
'fgSanitaryAction
'
resources.ApplyResources(Me.fgSanitaryAction, "fgSanitaryAction")
Me.fgSanitaryAction.DefaultFormState = System.Windows.Forms.FormWindowState.Normal
Me.fgSanitaryAction.DynamicParameterEnabled = False
Me.fgSanitaryAction.FormID = Nothing
Me.fgSanitaryAction.HelpTopicID = Nothing
Me.fgSanitaryAction.IsStatusReadOnly = False
Me.fgSanitaryAction.KeyFieldName = Nothing
Me.fgSanitaryAction.MultiSelect = False
Me.fgSanitaryAction.Name = "fgSanitaryAction"
Me.fgSanitaryAction.ObjectName = Nothing
Me.fgSanitaryAction.SectionTableCaptionsIsVisible = True
Me.fgSanitaryAction.Status = bv.common.win.FormStatus.Draft
Me.fgSanitaryAction.TableName = Nothing
'
'lbNoSanitaryActionMatrix
'
Me.lbNoSanitaryActionMatrix.Appearance.ForeColor = CType(resources.GetObject("lbNoSanitaryActionMatrix.Appearance.ForeColor"), System.Drawing.Color)
Me.lbNoSanitaryActionMatrix.Appearance.TextOptions.HAlignment = DevExpress.Utils.HorzAlignment.Center
Me.lbNoSanitaryActionMatrix.Appearance.TextOptions.WordWrap = DevExpress.Utils.WordWrap.Wrap
resources.ApplyResources(Me.lbNoSanitaryActionMatrix, "lbNoSanitaryActionMatrix")
Me.lbNoSanitaryActionMatrix.Name = "lbNoSanitaryActionMatrix"
'
'VetAggregateSummaryActionDetail
'
resources.ApplyResources(Me, "$this")
Me.Controls.Add(Me.xtcDetailInfo)
Me.Controls.Add(Me.AggregateSummaryHeader1)
Me.Controls.Add(Me.PopUpButton1)
Me.Controls.Add(Me.btnClose)
Me.Controls.Add(Me.btnViewDetailForm)
Me.Controls.Add(Me.btnShowSummary)
Me.Controls.Add(Me.btnRefresh)
Me.FormID = "V14"
Me.HelpTopicID = "VetAggregateActionSummary"
Me.KeyFieldName = "idfAggrCase"
Me.LeftIcon = Global.EIDSS.My.Resources.Resources.Vet_Aggregate_Actions_Summary__large__06_
Me.Name = "VetAggregateSummaryActionDetail"
Me.ObjectName = "VetAggregateSummaryAction"
Me.ShowCancelButton = False
Me.ShowDeleteButton = False
Me.ShowOkButton = False
Me.ShowSaveButton = False
Me.Sizable = True
Me.TableName = "AggregateHeader"
Me.Controls.SetChildIndex(Me.btnRefresh, 0)
Me.Controls.SetChildIndex(Me.btnShowSummary, 0)
Me.Controls.SetChildIndex(Me.btnViewDetailForm, 0)
Me.Controls.SetChildIndex(Me.btnClose, 0)
Me.Controls.SetChildIndex(Me.PopUpButton1, 0)
Me.Controls.SetChildIndex(Me.AggregateSummaryHeader1, 0)
Me.Controls.SetChildIndex(Me.xtcDetailInfo, 0)
CType(Me.xtcDetailInfo, System.ComponentModel.ISupportInitialize).EndInit()
Me.xtcDetailInfo.ResumeLayout(False)
Me.xtpDiagnosticAction.ResumeLayout(False)
Me.xtpProphilacticAction.ResumeLayout(False)
Me.xtpSanitaryAction.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
Friend WithEvents btnRefresh As DevExpress.XtraEditors.SimpleButton
Friend WithEvents btnClose As DevExpress.XtraEditors.SimpleButton
Friend WithEvents btnViewDetailForm As DevExpress.XtraEditors.SimpleButton
Friend WithEvents btnShowSummary As DevExpress.XtraEditors.SimpleButton
Friend WithEvents PopUpButton1 As bv.common.win.PopUpButton
Friend WithEvents cmRep As System.Windows.Forms.ContextMenu
Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
Friend WithEvents AggregateSummaryHeader1 As EIDSS.winclient.AggregateCase.AggregateSummaryHeader
Friend WithEvents xtcDetailInfo As DevExpress.XtraTab.XtraTabControl
Friend WithEvents xtpDiagnosticAction As DevExpress.XtraTab.XtraTabPage
Friend WithEvents fgDiagnosticAction As EIDSS.FlexibleForms.FFPresenter
Friend WithEvents lbNoDiagnosticActionMatrix As DevExpress.XtraEditors.LabelControl
Friend WithEvents xtpProphilacticAction As DevExpress.XtraTab.XtraTabPage
Friend WithEvents fgProphylacticAction As EIDSS.FlexibleForms.FFPresenter
Friend WithEvents lbNoProphylacticActionMatrix As DevExpress.XtraEditors.LabelControl
Friend WithEvents xtpSanitaryAction As DevExpress.XtraTab.XtraTabPage
Friend WithEvents fgSanitaryAction As EIDSS.FlexibleForms.FFPresenter
Friend WithEvents lbNoSanitaryActionMatrix As DevExpress.XtraEditors.LabelControl
End Class
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System
Imports System.Globalization
Imports System.Text
Imports System.Xml.Linq
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Microsoft.CodeAnalysis.Text
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.VisualBasic.Syntax
Imports Microsoft.CodeAnalysis.VisualBasic.UnitTests.Symbols
Imports Roslyn.Test.Utilities
Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests
Public Class ImplementsTests
Inherits BasicTestBase
<Fact>
Public Sub SimpleImplementation()
CompileAndVerify(
<compilation name="SimpleImplementation">
<file name="a.vb">
Option Strict On
Interface IFoo
Sub SayItWithStyle(ByVal style As String)
Sub SayItWithStyle(ByVal answer As Integer)
End Interface
Class Foo
Implements IFoo
Public Sub X(ByVal style As String) Implements IFoo.SayItWithStyle
System.Console.WriteLine("I said: {0}", style)
End Sub
Public Sub Y(ByVal a As Integer) Implements IFoo.SayItWithStyle
System.Console.WriteLine("The answer is: {0}", a)
End Sub
Public Overridable Sub SayItWithStyle(ByVal style As String)
System.Console.WriteLine("You don't say: {0}", style)
End Sub
End Class
Class Bar
Inherits Foo
Public Overrides Sub SayItWithStyle(ByVal style As String)
System.Console.WriteLine("You don't say: {0}", style)
End Sub
End Class
Module Module1
Sub Main()
Dim f As IFoo = New Foo
f.SayItWithStyle("Eric Clapton rocks!")
f.SayItWithStyle(42)
Dim g As IFoo = New Bar
g.SayItWithStyle("Lady Gaga rules!")
g.SayItWithStyle(13)
End Sub
End Module
</file>
</compilation>,
expectedOutput:=<![CDATA[
I said: Eric Clapton rocks!
The answer is: 42
I said: Lady Gaga rules!
The answer is: 13
]]>)
End Sub
<Fact>
Public Sub SimpleImplementationProperties()
CompileAndVerify(
<compilation name="SimpleImplementationProperties">
<file name="a.vb">
Option Strict On
Interface IFoo
Property MyString As String
Property MyInt As Integer
End Interface
Class Foo
Implements IFoo
Private s As String
Public Property IGotYourInt As Integer Implements IFoo.MyInt
Public Property IGotYourString As String Implements IFoo.MyString
Get
Return "You got: " + s
End Get
Set(value As String)
s = value
End Set
End Property
Public Overridable Property MyString As String
End Class
Class Bar
Inherits Foo
Private s As String
Public Overrides Property MyString As String
Get
Return "I got: " + s
End Get
Set(value As String)
s = value + " and then some"
End Set
End Property
End Class
Module Module1
Sub Main()
Dim f As IFoo = New Foo
f.MyInt = 178
f.MyString = "Lady Gaga"
System.Console.WriteLine(f.MyInt)
System.Console.WriteLine(f.MyString)
Dim g As IFoo = New Bar
g.MyInt = 12
g.MyString = "Eric Clapton"
System.Console.WriteLine(g.MyInt)
System.Console.WriteLine(g.MyString)
End Sub
End Module
</file>
</compilation>,
expectedOutput:=<![CDATA[
178
You got: Lady Gaga
12
You got: Eric Clapton
]]>)
End Sub
<Fact>
Public Sub SimpleImplementationOverloadedProperties()
CompileAndVerify(
<compilation name="SimpleImplementationOverloadedProperties">
<file name="a.vb">
Option Strict On
Interface IFoo
Property MyString As String
Property MyString(x As Integer) As String
Property MyString(x As String) As String
Property MyInt As Integer
End Interface
Class Foo
Implements IFoo
Private s, t, u As String
Public Property IGotYourInt As Integer Implements IFoo.MyInt
Public Property IGotYourString As String Implements IFoo.MyString
Get
Return "You got: " + s
End Get
Set(value As String)
s = value
End Set
End Property
Public Property IGotYourString2(x As Integer) As String Implements IFoo.MyString
Get
Return "You got: " & t & " and " & x
End Get
Set(value As String)
t = value + "2"
End Set
End Property
Public Property IGotYourString3(x As String) As String Implements IFoo.MyString
Get
Return "You used to have: " & u & " and " & x
End Get
Set(value As String)
u = value + "3"
End Set
End Property
Public Overridable Property MyString As String
End Class
Module Module1
Sub Main()
Dim f As IFoo = New Foo
f.MyInt = 178
f.MyString = "Lady Gaga"
f.MyString(8) = "Eric Clapton"
f.MyString("foo") = "Katy Perry"
System.Console.WriteLine(f.MyInt)
System.Console.WriteLine(f.MyString)
System.Console.WriteLine(f.MyString(4))
System.Console.WriteLine(f.MyString("Bob Marley"))
End Sub
End Module
</file>
</compilation>,
expectedOutput:=<![CDATA[
178
You got: Lady Gaga
You got: Eric Clapton2 and 4
You used to have: Katy Perry3 and Bob Marley
]]>)
End Sub
<Fact>
Public Sub ReImplementation()
CompileAndVerify(
<compilation name="ReImplementation">
<file name="a.vb">
Option Strict On
Interface IFoo
Sub SayItWithStyle(ByVal style As String)
Sub SayItWithStyle(ByVal answer As Integer)
End Interface
Class Foo
Implements IFoo
Public Sub X(ByVal style As String) Implements IFoo.SayItWithStyle
System.Console.WriteLine("I said: {0}", style)
End Sub
Public Sub Y(ByVal a As Integer) Implements IFoo.SayItWithStyle
System.Console.WriteLine("The answer is: {0}", a)
End Sub
Public Overridable Sub SayItWithStyle(ByVal style As String)
System.Console.WriteLine("You don't say: {0}", style)
End Sub
End Class
Class Bar
Inherits Foo
Implements IFoo
Private Sub Z(ByVal a As Integer) Implements IFoo.SayItWithStyle
System.Console.WriteLine("The question is: {0}", a)
End Sub
Public Overrides Sub SayItWithStyle(ByVal style As String)
System.Console.WriteLine("I don't say: {0}", style)
End Sub
End Class
Module Module1
Sub Main()
Dim f As IFoo = New Foo
f.SayItWithStyle("Eric Clapton rocks!")
f.SayItWithStyle(42)
Dim g As IFoo = New Bar
g.SayItWithStyle("Lady Gaga rules!")
g.SayItWithStyle(13)
End Sub
End Module
</file>
</compilation>,
expectedOutput:=<![CDATA[
I said: Eric Clapton rocks!
The answer is: 42
I said: Lady Gaga rules!
The question is: 13
]]>)
End Sub
<Fact>
Public Sub ReImplementationProperties()
CompileAndVerify(
<compilation name="ReImplementationProperties">
<file name="a.vb">
Option Strict On
Interface IFoo
Property MyString As String
Property MyInt As Integer
End Interface
Class Foo
Implements IFoo
Private s As String
Public Property IGotYourInt As Integer Implements IFoo.MyInt
Public Property IGotYourString As String Implements IFoo.MyString
Get
Return "You got: " + s
End Get
Set(value As String)
s = value
End Set
End Property
Public Overridable Property MyString As String
End Class
Class Bar
Inherits Foo
Implements IFoo
Private s As String
Public Property AnotherString As String Implements IFoo.MyString
Get
Return "I got your: " + s
End Get
Set(value As String)
s = value + " right here"
End Set
End Property
End Class
Module Module1
Sub Main()
Dim f As IFoo = New Foo
f.MyInt = 178
f.MyString = "Lady Gaga"
System.Console.WriteLine(f.MyInt)
System.Console.WriteLine(f.MyString)
Dim g As IFoo = New Bar
g.MyInt = 12
g.MyString = "Eric Clapton"
System.Console.WriteLine(g.MyInt)
System.Console.WriteLine(g.MyString)
End Sub
End Module
</file>
</compilation>,
expectedOutput:=<![CDATA[
178
You got: Lady Gaga
12
I got your: Eric Clapton right here
]]>)
End Sub
<Fact>
Public Sub ImplementationOfGenericMethod()
CompileAndVerify(
<compilation name="ImplementationOfGenericMethod">
<file name="a.vb">
Option Strict On
Imports System
Imports System.Collections.Generic
Interface IFoo
Sub SayItWithStyle(Of T)(ByVal style As T)
Sub SayItWithStyle(Of T)(ByVal style As IList(Of T))
End Interface
Class Foo
Implements IFoo
Public Sub SayItWithStyle(Of U)(ByVal style As System.Collections.Generic.IList(Of U)) Implements IFoo.SayItWithStyle
System.Console.WriteLine("style is IList(Of U)")
End Sub
Public Sub SayItWithStyle(Of V)(ByVal style As V) Implements IFoo.SayItWithStyle
System.Console.WriteLine("style is V")
End Sub
End Class
Module Module1
Sub Main()
Dim f As IFoo = New Foo
Dim g As List(Of Integer) = New List(Of Integer)
g.Add(42)
g.Add(13)
g.Add(14)
f.SayItWithStyle(Of String)("Eric Clapton rocks!")
f.SayItWithStyle(Of Integer)(g)
End Sub
End Module
</file>
</compilation>,
expectedOutput:=<![CDATA[
style is V
style is IList(Of U)
]]>)
End Sub
<Fact>
Public Sub ImplementationOfGenericMethod2()
CompileAndVerify(
<compilation name="ImplementationOfGenericMethod2">
<file name="a.vb">
Option Strict On
Imports System
Imports System.Collections.Generic
Interface IFoo(Of K, L)
Sub SayItWithStyle(Of T)(ByVal style As T, ByVal a As K, ByVal b As Dictionary(Of L, K))
Sub SayItWithStyle(Of T)(ByVal style As IList(Of T), ByVal a As L, ByVal b As Dictionary(Of K, L))
End Interface
Class Foo(Of M)
Implements IFoo(Of M, ULong)
Public Sub SayItWithStyle(Of T)(ByVal style As T, ByVal a As M, ByVal b As Dictionary(Of ULong, M)) Implements IFoo(Of M, ULong).SayItWithStyle
Console.WriteLine("first")
End Sub
Public Sub SayItWithStyle(Of T)(ByVal style As System.Collections.Generic.IList(Of T), ByVal a As ULong, ByVal b As Dictionary(Of M, ULong)) Implements IFoo(Of M, ULong).SayItWithStyle
Console.WriteLine("second")
End Sub
End Class
Module Module1
Sub Main()
Dim f As IFoo(Of String, ULong) = New Foo(Of String)()
Dim g As List(Of Integer) = New List(Of Integer)
g.Add(42)
g.Add(13)
g.Add(14)
Dim h As Dictionary(Of String, ULong) = Nothing
Dim i As Dictionary(Of ULong, String) = Nothing
f.SayItWithStyle(Of String)("Eric Clapton rocks!", "hi", i)
f.SayItWithStyle(Of Integer)(g, 17, h)
End Sub
End Module
</file>
</compilation>,
expectedOutput:=<![CDATA[
first
second
]]>)
End Sub
<Fact>
Public Sub ImplementationOfGenericMethod3()
CompileAndVerify(
<compilation name="ImplementationOfGenericMethod3">
<file name="a.vb">
Option Strict On
Namespace MyNS
Interface I1(Of T)
Sub Foo(ByVal i As T, ByVal j As String)
End Interface
Interface I2
Inherits I1(Of String)
End Interface
Public Class Class1
Implements I2
Public Sub A2(ByVal i As String, ByVal j As String) Implements I1(Of String).Foo
System.Console.WriteLine("{0} {1}", i, j)
End Sub
End Class
End Namespace
Module Module1
Sub Main()
Dim x As MyNS.I2 = New MyNS.Class1()
x.Foo("hello", "world")
End Sub
End Module
</file>
</compilation>,
expectedOutput:="hello world")
End Sub
<Fact>
Public Sub ImplementNonInterface()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="ImplementNonInterface">
<file name="a.vb">
Option Strict On
Public Structure S1
Public Sub foo()
End Sub
Public Property Zip As Integer
End Structure
Public Enum E1
Red
green
End Enum
Public Delegate Sub D1(ByVal x As Integer)
Public Class Class1
Public Sub foo() Implements S1.foo
End Sub
Public Property zap As Integer Implements S1.Zip
Get
return 3
End Get
Set
End Set
End Property
Public Sub bar() Implements E1.Red
End Sub
Public Sub baz() Implements System.Object.GetHashCode
End Sub
Public Sub quux() Implements D1.Invoke
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC30232: Implemented type must be an interface.
Public Sub foo() Implements S1.foo
~~
BC30232: Implemented type must be an interface.
Public Property zap As Integer Implements S1.Zip
~~
BC30232: Implemented type must be an interface.
Public Sub bar() Implements E1.Red
~~
BC30232: Implemented type must be an interface.
Public Sub baz() Implements System.Object.GetHashCode
~~~~~~~~~~~~~
BC30232: Implemented type must be an interface.
Public Sub quux() Implements D1.Invoke
~~
</expected>)
End Sub
<WorkItem(531308, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/531308")>
<Fact>
Public Sub ImplementsClauseAndObsoleteAttribute()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="ImplementsClauseAndObsoleteAttribute">
<file name="a.vb">
Imports System
Interface i1
<Obsolete("", True)> Sub foo()
<Obsolete("", True)> Property moo()
<Obsolete("", True)> Event goo()
End Interface
Class c1
Implements i1
'COMPILEERROR: BC30668, "i1.foo"
Public Sub foo() Implements i1.foo
End Sub
'COMPILEERROR: BC30668, "i1.moo"
Public Property moo() As Object Implements i1.moo
Get
Return Nothing
End Get
Set(ByVal Value As Object)
End Set
End Property
'COMPILEERROR: BC30668, "i1.goo"
Public Event goo() Implements i1.goo
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation,
<expected>
BC31075: 'Sub foo()' is obsolete.
Public Sub foo() Implements i1.foo
~~~~~~~~~~~~~~~~~
BC31075: 'Property moo As Object' is obsolete.
Public Property moo() As Object Implements i1.moo
~~~~~~~~~~~~~~~~~
BC31075: 'Event goo()' is obsolete.
Public Event goo() Implements i1.goo
~~~~~~~~~~~~~~~~~
</expected>)
End Sub
<Fact>
Public Sub UnimplementedInterface()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="UnimplementedInterface">
<file name="a.vb">
Option Strict On
Namespace MyNS
Interface I1
Sub Bar(ByVal x As String)
Property Zap As Integer
End Interface
Public Class Class1
Public Sub Foo(ByVal x As String) Implements I1.Bar
End Sub
Public Property Quuz As Integer Implements I1.Zap
End Class
End Namespace
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC31035: Interface 'I1' is not implemented by this class.
Public Sub Foo(ByVal x As String) Implements I1.Bar
~~
BC31035: Interface 'I1' is not implemented by this class.
Public Property Quuz As Integer Implements I1.Zap
~~
</expected>)
End Sub
<Fact>
Public Sub UnimplementedInterface2()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="UnimplementedInterface2">
<file name="a.vb">
Option Strict On
Namespace MyNS
Interface I1
Sub Bar(ByVal x As String)
Property Zap As Integer
End Interface
Public Class Class1
Implements I1
Public Sub Foo(ByVal x As String) Implements I1.Bar
End Sub
Public Property Quuz As Integer Implements I1.Zap
End Class
Public Class Class2
Inherits Class1
Public Sub Quux(ByVal x As String) Implements I1.Bar
End Sub
Public Property Dingo As Integer Implements I1.Zap
End Class
End Namespace
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC31035: Interface 'I1' is not implemented by this class.
Public Sub Quux(ByVal x As String) Implements I1.Bar
~~
BC31035: Interface 'I1' is not implemented by this class.
Public Property Dingo As Integer Implements I1.Zap
~~
</expected>)
End Sub
<Fact>
Public Sub ImplementUnknownType()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="ImplementUnknownType">
<file name="a.vb">
Option Strict On
Public Class Class1
Public Sub foo() Implements UnknownType.foo
End Sub
Public Sub bar() Implements System.UnknownType(Of String).bar
End Sub
Public Property quux As Integer Implements UnknownType.foo
Public Property quuz As String Implements System.UnknownType(Of String).bar
Get
return ""
End Get
Set
End Set
End Property
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC30002: Type 'UnknownType' is not defined.
Public Sub foo() Implements UnknownType.foo
~~~~~~~~~~~
BC30002: Type 'System.UnknownType' is not defined.
Public Sub bar() Implements System.UnknownType(Of String).bar
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC30002: Type 'UnknownType' is not defined.
Public Property quux As Integer Implements UnknownType.foo
~~~~~~~~~~~
BC30002: Type 'System.UnknownType' is not defined.
Public Property quuz As String Implements System.UnknownType(Of String).bar
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
</expected>)
End Sub
<Fact>
Public Sub AmbiguousInterface_01()
' Somewhat surprisingly, perhaps, I3.Foo is considered ambiguous between I1.Foo(String, String) and
' I2.Foo(Integer), even though only I2.Foo(String, String) matches the method arguments provided. This
' matches Dev10 behavior.
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="AmbiguousInterface">
<file name="a.vb">
Option Strict On
Interface I1
Sub Foo(ByVal i As String, ByVal j As String)
End Interface
Interface I2
Sub Foo(ByVal x As Integer)
End Interface
Interface I3
Inherits I1, I2
End Interface
Public Class Class1
Implements I3
Public Sub Foo(ByVal i As String, ByVal j As String) Implements I3.Foo
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC30149: Class 'Class1' must implement 'Sub Foo(x As Integer)' for interface 'I2'.
Implements I3
~~
</expected>)
End Sub
<Fact>
Public Sub AmbiguousInterface_02()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="AmbiguousInterface">
<file name="a.vb">
Option Strict On
Interface I1
Sub Foo(ByVal i As String, ByVal j As String)
End Interface
Interface I2
Sub Foo(ByVal i As String, ByVal j As String)
End Interface
Interface I3
Inherits I1, I2
End Interface
Public Class Class1
Implements I3
Public Sub Foo(ByVal i As String, ByVal j As String) Implements I3.Foo
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC30149: Class 'Class1' must implement 'Sub Foo(i As String, j As String)' for interface 'I2'.
Implements I3
~~
BC31040: 'Foo' exists in multiple base interfaces. Use the name of the interface that declares 'Foo' in the 'Implements' clause instead of the name of the derived interface.
Public Sub Foo(ByVal i As String, ByVal j As String) Implements I3.Foo
~~~~~~
</expected>)
End Sub
<Fact>
Public Sub AmbiguousInterface_03()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="AmbiguousInterface">
<file name="a.vb">
Option Strict On
Interface I1(Of T, S)
Sub Foo(ByVal i As T, ByVal j As S)
Sub Foo(ByVal i As S, ByVal j As T)
End Interface
Interface I3
Inherits I1(Of Integer, Short), I1(Of Short, Integer)
End Interface
Public Class Class1
Implements I3
Public Sub Foo(ByVal i As Integer, ByVal j As Short) Implements I3.Foo
End Sub
Public Sub Foo(ByVal i As Short, ByVal j As Integer) Implements I3.Foo
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC30149: Class 'Class1' must implement 'Sub Foo(i As Integer, j As Short)' for interface 'I1(Of Short, Integer)'.
Implements I3
~~
BC30149: Class 'Class1' must implement 'Sub Foo(i As Short, j As Integer)' for interface 'I1(Of Short, Integer)'.
Implements I3
~~
BC31040: 'Foo' exists in multiple base interfaces. Use the name of the interface that declares 'Foo' in the 'Implements' clause instead of the name of the derived interface.
Public Sub Foo(ByVal i As Integer, ByVal j As Short) Implements I3.Foo
~~~~~~
BC31040: 'Foo' exists in multiple base interfaces. Use the name of the interface that declares 'Foo' in the 'Implements' clause instead of the name of the derived interface.
Public Sub Foo(ByVal i As Short, ByVal j As Integer) Implements I3.Foo
~~~~~~
</expected>)
End Sub
<Fact>
Public Sub AmbiguousInterface_04()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="AmbiguousInterface">
<file name="a.vb">
Option Strict On
Interface I1(Of T, S)
Sub Foo(ByVal i As T)
Sub Foo(ByVal i As S)
End Interface
Public Class Class1
Implements I1(Of Integer, Integer)
Public Sub Foo(ByVal i As Integer) Implements I1(Of Integer, Integer).Foo
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC30149: Class 'Class1' must implement 'Sub Foo(i As Integer)' for interface 'I1(Of Integer, Integer)'.
Implements I1(Of Integer, Integer)
~~~~~~~~~~~~~~~~~~~~~~~
BC30937: Member 'I1(Of Integer, Integer).Foo' that matches this signature cannot be implemented because the interface 'I1(Of Integer, Integer)' contains multiple members with this same name and signature:
'Sub Foo(i As Integer)'
'Sub Foo(i As Integer)'
Public Sub Foo(ByVal i As Integer) Implements I1(Of Integer, Integer).Foo
~~~~~~~~~~~~~~~~~~~~~~~~~~~
</expected>)
End Sub
<Fact>
Public Sub AmbiguousInterface_05()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="AmbiguousInterface">
<file name="a.vb">
Option Strict On
Interface I1
Sub Foo(ByVal i As String)
End Interface
Interface I2
Inherits I1
Overloads Sub Foo(ByVal i As String)
End Interface
Interface I3
Inherits I1, I2
End Interface
Interface I4
Inherits I2, I1
End Interface
Public Class Class1
Implements I3
Public Sub Foo(ByVal i As String) Implements I3.Foo
End Sub
End Class
Public Class Class2
Implements I4
Public Sub Foo(ByVal i As String) Implements I4.Foo
End Sub
End Class
Public Class Class3
Implements I3
Public Sub Foo1(ByVal i As String) Implements I3.Foo
End Sub
Public Sub Foo2(ByVal i As String) Implements I1.Foo
End Sub
End Class
Public Class Class4
Implements I4
Public Sub Foo1(ByVal i As String) Implements I4.Foo
End Sub
Public Sub Foo2(ByVal i As String) Implements I1.Foo
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC30149: Class 'Class1' must implement 'Sub Foo(i As String)' for interface 'I1'.
Implements I3
~~
BC30149: Class 'Class2' must implement 'Sub Foo(i As String)' for interface 'I1'.
Implements I4
~~
</expected>)
End Sub
<Fact>
Public Sub AmbiguousInterfaceProperty()
' Somewhat surprisingly, perhaps, I3.Foo is considered ambiguous between I1.Foo(String, String) and
' I2.Foo(Integer), even though only I2.Foo(String, String) matches the method arguments provided. This
' matches Dev10 behavior.
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="AmbiguousInterfaceProperty">
<file name="a.vb">
Option Strict On
Interface I1
Sub Foo(ByVal i As String, ByVal j As String)
End Interface
Interface I2
Property Foo As Integer
End Interface
Interface I3
Inherits I1, I2
End Interface
Public Class Class1
Implements I3
Public Property Bar As Integer Implements I3.Foo
Get
Return 3
End Get
Set(value As Integer)
End Set
End Property
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC30149: Class 'Class1' must implement 'Property Foo As Integer' for interface 'I2'.
Implements I3
~~
BC30149: Class 'Class1' must implement 'Sub Foo(i As String, j As String)' for interface 'I1'.
Implements I3
~~
BC31040: 'Foo' exists in multiple base interfaces. Use the name of the interface that declares 'Foo' in the 'Implements' clause instead of the name of the derived interface.
Public Property Bar As Integer Implements I3.Foo
~~~~~~
</expected>)
End Sub
<Fact>
Public Sub NoMethodOfSig()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="NoMethodOfSig">
<file name="a.vb">
Option Strict On
Namespace MyNS
Interface I1
Sub Foo(ByVal i As String, ByVal j As String)
Function Foo(ByVal i As Long) As Integer
Property P(i As Long) As Integer
End Interface
Public Class Class1
Implements I1
Public Sub X(ByVal i As Long) Implements I1.Foo
End Sub
Public Sub Y(ByRef i As String, ByVal j As String) Implements I1.Foo
End Sub
Public Property Z1 As Integer Implements I1.P
Public Property Z2(i as Integer) As Integer Implements I1.P
Get
return 3
End Get
Set
End Set
End Property
Public Property Z3 As Integer Implements I1.Foo
End Class
End Namespace</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC30149: Class 'Class1' must implement 'Function Foo(i As Long) As Integer' for interface 'I1'.
Implements I1
~~
BC30149: Class 'Class1' must implement 'Property P(i As Long) As Integer' for interface 'I1'.
Implements I1
~~
BC30149: Class 'Class1' must implement 'Sub Foo(i As String, j As String)' for interface 'I1'.
Implements I1
~~
BC30401: 'X' cannot implement 'Foo' because there is no matching sub on interface 'I1'.
Public Sub X(ByVal i As Long) Implements I1.Foo
~~~~~~
BC30401: 'Y' cannot implement 'Foo' because there is no matching sub on interface 'I1'.
Public Sub Y(ByRef i As String, ByVal j As String) Implements I1.Foo
~~~~~~
BC30401: 'Z1' cannot implement 'P' because there is no matching property on interface 'I1'.
Public Property Z1 As Integer Implements I1.P
~~~~
BC30401: 'Z2' cannot implement 'P' because there is no matching property on interface 'I1'.
Public Property Z2(i as Integer) As Integer Implements I1.P
~~~~
BC30401: 'Z3' cannot implement 'Foo' because there is no matching property on interface 'I1'.
Public Property Z3 As Integer Implements I1.Foo
~~~~~~
</expected>)
End Sub
<WorkItem(577934, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/577934")>
<Fact>
Public Sub Bug577934a()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation>
<file name="a.vb">
Option Strict On
Interface I
Sub Foo(Of T)(Optional x As T = CType(Nothing, T))
End Interface
Class C
Implements I
Public Sub Foo(Of T)(Optional x As T = Nothing) Implements I.Foo
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected></expected>)
End Sub
<WorkItem(577934, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/577934")>
<Fact>
Public Sub Bug577934b()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation>
<file name="a.vb">
Option Strict On
Interface I
Sub Foo(Of T)(Optional x As T = DirectCast(Nothing, T))
End Interface
Class C
Implements I
Public Sub Foo(Of T)(Optional x As T = Nothing) Implements I.Foo
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected></expected>)
End Sub
<WorkItem(577934, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/577934")>
<Fact>
Public Sub Bug577934c()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation>
<file name="a.vb">
Option Strict On
Interface I
Sub Foo(Of T As Class)(Optional x As T = TryCast(Nothing, T))
End Interface
Class C
Implements I
Public Sub Foo(Of T As Class)(Optional x As T = Nothing) Implements I.Foo
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected></expected>)
End Sub
<Fact>
Public Sub NoMethodOfName()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="NoMethodOfName">
<file name="a.vb">
Option Strict On
Namespace MyNS
Interface I1
Sub Foo(ByVal i As String, ByVal j As String)
End Interface
Public Class Class1
Implements I1
Public Sub Foo(ByVal i As String, ByVal j As String) Implements I1.Foo
End Sub
Public Sub Bar() Implements MyNS.I1.Quux
End Sub
Public Function Zap() As Integer Implements I1.GetHashCode
Return 0
End Function
Public Property Zip As Integer Implements I1.GetHashCode
Public ReadOnly Property Zing(x As String) As String Implements I1.Zing, I1.Foo
Get
return ""
End Get
End Property
End Class
End Namespace
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC30401: 'Bar' cannot implement 'Quux' because there is no matching sub on interface 'I1'.
Public Sub Bar() Implements MyNS.I1.Quux
~~~~~~~~~~~~
BC30401: 'Zap' cannot implement 'GetHashCode' because there is no matching function on interface 'I1'.
Public Function Zap() As Integer Implements I1.GetHashCode
~~~~~~~~~~~~~~
BC30401: 'Zip' cannot implement 'GetHashCode' because there is no matching property on interface 'I1'.
Public Property Zip As Integer Implements I1.GetHashCode
~~~~~~~~~~~~~~
BC30401: 'Zing' cannot implement 'Zing' because there is no matching property on interface 'I1'.
Public ReadOnly Property Zing(x As String) As String Implements I1.Zing, I1.Foo
~~~~~~~
BC30401: 'Zing' cannot implement 'Foo' because there is no matching property on interface 'I1'.
Public ReadOnly Property Zing(x As String) As String Implements I1.Zing, I1.Foo
~~~~~~
</expected>)
End Sub
<Fact>
Public Sub GenericSubstitutionAmbiguity()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="GenericSubstitutionAmbiguity">
<file name="a.vb">
Option Strict On
Namespace MyNS
Interface I1(Of T)
Sub Foo(ByVal i As T, ByVal j As String)
Sub Bar(ByVal x As T)
Sub Bar(ByVal x As String)
End Interface
Interface I2
Inherits I1(Of String)
Overloads Sub Foo(ByVal i As String, ByVal j As String)
End Interface
Public Class Class1
Implements I2
Public Sub A1(ByVal i As String, ByVal j As String) Implements I2.Foo
End Sub
Public Sub A2(ByVal i As String, ByVal j As String) Implements I1(Of String).Foo
End Sub
Public Sub B(ByVal x As String) Implements I2.Bar
End Sub
End Class
End Namespace
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC30149: Class 'Class1' must implement 'Sub Bar(x As String)' for interface 'I1(Of String)'.
Implements I2
~~
BC30937: Member 'I1(Of String).Bar' that matches this signature cannot be implemented because the interface 'I1(Of String)' contains multiple members with this same name and signature:
'Sub Bar(x As String)'
'Sub Bar(x As String)'
Public Sub B(ByVal x As String) Implements I2.Bar
~~~~~~
</expected>)
End Sub
<Fact>
Public Sub GenericSubstitutionAmbiguityProperty()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="GenericSubstitutionAmbiguityProperty">
<file name="a.vb">
Option Strict On
Namespace MyNS
Interface I1(Of T)
Property Foo As T
Property Bar(ByVal x As T) As Integer
Property Bar(ByVal x As String) As Integer
End Interface
Interface I2
Inherits I1(Of String)
Overloads Property Foo As String
End Interface
Public Class Class1
Implements I2
Public Property A1 As String Implements I1(Of String).Foo
Get
Return ""
End Get
Set(value As String)
End Set
End Property
Public Overloads Property A2 As String Implements I2.Foo
Get
Return ""
End Get
Set(value As String)
End Set
End Property
Public Property B(x As String) As Integer Implements I1(Of String).Bar
Get
Return 0
End Get
Set(value As Integer)
End Set
End Property
End Class
End Namespace
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC30149: Class 'Class1' must implement 'Property Bar(x As String) As Integer' for interface 'I1(Of String)'.
Implements I2
~~
BC30937: Member 'I1(Of String).Bar' that matches this signature cannot be implemented because the interface 'I1(Of String)' contains multiple members with this same name and signature:
'Property Bar(x As String) As Integer'
'Property Bar(x As String) As Integer'
Public Property B(x As String) As Integer Implements I1(Of String).Bar
~~~~~~~~~~~~~~~~~
</expected>)
End Sub
<Fact>
Public Sub InterfaceReimplementation2()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="InterfaceReimplementation2">
<file name="a.vb">
Option Strict On
Namespace MyNS
Interface I1
Sub Bar(ByVal x As String)
Function Baz() As Integer
ReadOnly Property Zip As Integer
End Interface
Interface I2
Inherits I1
End Interface
Public Class Class1
Implements I1
Public Sub FooXX(ByVal x As String) Implements I1.Bar
End Sub
Public Function BazXX() As Integer Implements I1.Baz
Return 0
End Function
Public ReadOnly Property ZipXX As Integer Implements I1.Zip
Get
Return 0
End Get
End Property
End Class
Public Class Class2
Inherits Class1
Implements I2
Public Sub Quux(ByVal x As String) Implements I1.Bar
End Sub
Public Function Quux2() As Integer Implements I1.Baz
Return 0
End Function
Public ReadOnly Property Quux3 As Integer Implements I1.Zip
Get
Return 0
End Get
End Property
End Class
Public Class Class3
Inherits Class1
Implements I1
Public Sub Zap(ByVal x As String) Implements I1.Bar
End Sub
Public Function Zap2() As Integer Implements I1.Baz
Return 0
End Function
Public ReadOnly Property Zap3 As Integer Implements I1.Zip
Get
Return 0
End Get
End Property
End Class
End Namespace
</file>
</compilation>)
' BC42015 is deprecated
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
</expected>)
End Sub
<Fact>
Public Sub UnimplementedMembers()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(
<compilation name="UnimplementedMembers">
<file name="a.vb">
Option Strict On
Imports System
Imports System.Collections.Generic
Namespace MyNS
Interface I1(Of T, U)
Sub Foo(ByVal i As T, ByVal j As U)
Function Quack(ByVal o As Integer) As Long
ReadOnly Property Zing(i As U) As T
End Interface
Interface I2(Of W)
Inherits I1(Of String, IEnumerable(Of W))
Sub Bar(ByVal i As Long)
End Interface
Interface I3
Sub Zap()
End Interface
Public Class Class1(Of T)
Implements I2(Of T), I3
Public Function Quack(ByVal o As Integer) As Long Implements I1(Of String, System.Collections.Generic.IEnumerable(Of T)).Quack
Return 0
End Function
End Class
End Namespace
Module Module1
Sub Main()
End Sub
End Module
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC30149: Class 'Class1' must implement 'ReadOnly Property Zing(i As IEnumerable(Of T)) As String' for interface 'I1(Of String, IEnumerable(Of T))'.
Implements I2(Of T), I3
~~~~~~~~
BC30149: Class 'Class1' must implement 'Sub Bar(i As Long)' for interface 'I2(Of T)'.
Implements I2(Of T), I3
~~~~~~~~
BC30149: Class 'Class1' must implement 'Sub Foo(i As String, j As IEnumerable(Of T))' for interface 'I1(Of String, IEnumerable(Of T))'.
Implements I2(Of T), I3
~~~~~~~~
BC30149: Class 'Class1' must implement 'Sub Zap()' for interface 'I3'.
Implements I2(Of T), I3
~~
</expected>)
End Sub
<Fact>
Public Sub ImplementTwice()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="ImplementTwice">
<file name="a.vb">
Interface IFoo
Sub Foo(x As Integer)
WriteOnly Property Bang As Integer
End Interface
Interface IBar
Sub Bar(x As Integer)
End Interface
Public Class Class1
Implements IFoo, IBar
Public Sub Foo(x As Integer) Implements IFoo.Foo
End Sub
Public Sub Baz(x As Integer) Implements IBar.Bar, IFoo.Foo
End Sub
Public WriteOnly Property A As Integer Implements IFoo.Bang
Set
End Set
End Property
Public Property B As Integer Implements IFoo.Bang
Get
Return 0
End Get
Set
End Set
End Property
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC30583: 'IFoo.Foo' cannot be implemented more than once.
Public Sub Baz(x As Integer) Implements IBar.Bar, IFoo.Foo
~~~~~~~~
BC30583: 'IFoo.Bang' cannot be implemented more than once.
Public Property B As Integer Implements IFoo.Bang
~~~~~~~~~
</expected>)
End Sub
' DEV10 gave BC31415 for this case, but (at least for now), just use BC30401 since BC31415 is such a bad
' error message.
<Fact>
Public Sub ImplementStatic()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndReferences(
<compilation name="ImplementStatic">
<file name="a.vb">
Public Class Class1
Implements ContainsStatic
Public Sub Foo() Implements ContainsStatic.Bar
End Sub
Public Sub Baz() Implements ContainsStatic.StaticMethod
End Sub
End Class
</file>
</compilation>, {TestReferences.SymbolsTests.Interface.StaticMethodInInterface})
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC30401: 'Baz' cannot implement 'StaticMethod' because there is no matching sub on interface 'ContainsStatic'.
Public Sub Baz() Implements ContainsStatic.StaticMethod
~~~~~~~~~~~~~~~~~~~~~~~~~~~
</expected>)
End Sub
<Fact>
Public Sub InterfaceUnification1()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="InterfaceUnification1">
<file name="a.vb">
Imports System.Collections.Generic
Namespace Q
Interface IFoo(Of T)
Sub M(i As T)
End Interface
Interface Z(Of W)
Inherits IFoo(Of W)
End Interface
Class Outer(Of X)
Class Inner(Of Y)
Implements IFoo(Of List(Of X)), Z(Of Y)
Public Sub M1(i As List(Of X)) Implements IFoo(Of List(Of X)).M
End Sub
Public Sub M2(i As Y) Implements IFoo(Of Y).M
End Sub
End Class
End Class
End Namespace
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC32131: Cannot implement interface 'Z(Of Y)' because the interface 'IFoo(Of Y)' from which it inherits could be identical to implemented interface 'IFoo(Of List(Of X))' for some type arguments.
Implements IFoo(Of List(Of X)), Z(Of Y)
~~~~~~~
</expected>)
End Sub
<Fact>
Public Sub InterfaceUnification2()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="InterfaceUnification2">
<file name="a.vb">
Interface I(Of T)
End Interface
Class G1(Of T1, T2)
Implements I(Of T1), I(Of T2) 'bad
End Class
Class G2(Of T1, T2)
Implements I(Of Integer), I(Of T2) 'bad
End Class
Class G3(Of T1, T2)
Implements I(Of Integer), I(Of Short) 'ok
End Class
Class G4(Of T1, T2)
Implements I(Of I(Of T1)), I(Of T1) 'ok
End Class
Class G5(Of T1, T2)
Implements I(Of I(Of T1)), I(Of T2) 'bad
End Class
Interface I2(Of T)
Inherits I(Of T)
End Interface
Class G6(Of T1, T2)
Implements I(Of T1), I2(Of T2) 'bad
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC32072: Cannot implement interface 'I(Of T2)' because its implementation could conflict with the implementation of another implemented interface 'I(Of T1)' for some type arguments.
Implements I(Of T1), I(Of T2) 'bad
~~~~~~~~
BC32072: Cannot implement interface 'I(Of T2)' because its implementation could conflict with the implementation of another implemented interface 'I(Of Integer)' for some type arguments.
Implements I(Of Integer), I(Of T2) 'bad
~~~~~~~~
BC32072: Cannot implement interface 'I(Of T2)' because its implementation could conflict with the implementation of another implemented interface 'I(Of I(Of T1))' for some type arguments.
Implements I(Of I(Of T1)), I(Of T2) 'bad
~~~~~~~~
BC32131: Cannot implement interface 'I2(Of T2)' because the interface 'I(Of T2)' from which it inherits could be identical to implemented interface 'I(Of T1)' for some type arguments.
Implements I(Of T1), I2(Of T2) 'bad
~~~~~~~~~
</expected>)
End Sub
<Fact>
Public Sub InterfaceUnification3()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="InterfaceUnification1">
<file name="a.vb">
Interface I(Of T, S)
End Interface
Class A(Of T, S)
Implements I(Of I(Of T, T), T)
Implements I(Of I(Of T, S), S)
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC32072: Cannot implement interface 'I(Of I(Of T, S), S)' because its implementation could conflict with the implementation of another implemented interface 'I(Of I(Of T, T), T)' for some type arguments.
Implements I(Of I(Of T, S), S)
~~~~~~~~~~~~~~~~~~~
</expected>)
End Sub
<Fact>
Public Sub InterfaceUnification4()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="InterfaceUnification4">
<file name="a.vb">
Class A(Of T, S)
Class B
Inherits A(Of B, B)
End Class
Interface IA
Sub M()
End Interface
Interface IB
Inherits B.IA
Inherits B.B.IA
End Interface 'ok
End Class
</file>
</compilation>)
CompilationUtils.AssertNoErrors(compilation)
End Sub
<Fact>
Public Sub InterfaceUnification5()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="InterfaceUnification5">
<file name="a.vb">
Option Strict On
Imports System.Collections.Generic
Class Outer(Of X, Y)
Interface IFoo(Of T, U)
End Interface
End Class
Class OuterFoo(Of A, B)
Class Foo(Of C, D)
Implements Outer(Of C, B).IFoo(Of A, D), Outer(Of D, A).IFoo(Of B, C) 'error
End Class
Class Bar(Of C, D)
Implements Outer(Of C, B).IFoo(Of A, D), Outer(Of D, A).IFoo(Of B, List(Of C)) ' ok
End Class
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC32072: Cannot implement interface 'Outer(Of D, A).IFoo(Of B, C)' because its implementation could conflict with the implementation of another implemented interface 'Outer(Of C, B).IFoo(Of A, D)' for some type arguments.
Implements Outer(Of C, B).IFoo(Of A, D), Outer(Of D, A).IFoo(Of B, C) 'error
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
</expected>)
End Sub
<Fact>
Public Sub SimpleImplementationApi()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="SimpleImplementation">
<file name="a.vb">
Option Strict On
Interface IFoo
Sub SayItWithStyle(ByVal style As String)
Sub SayItWithStyle(ByVal answer As Integer)
End Interface
Class Foo
Implements IFoo
Public Sub X(ByVal style As String) Implements IFoo.SayItWithStyle
System.Console.WriteLine("I said: {0}", style)
End Sub
Public Sub Y(ByVal a As Integer) Implements IFoo.SayItWithStyle
System.Console.WriteLine("The answer is: {0}", a)
End Sub
Public Overridable Sub SayItWithStyle(ByVal style As String)
System.Console.WriteLine("You don't say: {0}", style)
End Sub
End Class
Class Bar
Inherits Foo
Public Overrides Sub SayItWithStyle(ByVal style As String)
System.Console.WriteLine("You don't say: {0}", style)
End Sub
End Class
</file>
</compilation>)
Dim globalNS = comp.GlobalNamespace
Dim iFooType = DirectCast(globalNS.GetMembers("IFoo").First(), NamedTypeSymbol)
Dim fooType = DirectCast(globalNS.GetMembers("Foo").First(), NamedTypeSymbol)
Dim barType = DirectCast(globalNS.GetMembers("Bar").First(), NamedTypeSymbol)
Dim ifooMethods = iFooType.GetMembers("SayItWithStyle").AsEnumerable().Cast(Of MethodSymbol)()
Dim ifooTypeSayWithString = (From m In ifooMethods Where m.Parameters(0).Type.SpecialType = SpecialType.System_String).First()
Dim ifooTypeSayWithInt = (From m In ifooMethods Where m.Parameters(0).Type.SpecialType = SpecialType.System_Int32).First()
Dim fooX = DirectCast(fooType.GetMembers("X").First(), MethodSymbol)
Dim fooY = DirectCast(fooType.GetMembers("Y").First(), MethodSymbol)
Dim fooSay = DirectCast(fooType.GetMembers("SayItWithStyle").First(), MethodSymbol)
Dim barSay = DirectCast(barType.GetMembers("SayItWithStyle").First(), MethodSymbol)
Assert.Equal(fooY, barType.FindImplementationForInterfaceMember(ifooTypeSayWithInt))
Assert.Equal(fooX, barType.FindImplementationForInterfaceMember(ifooTypeSayWithString))
Assert.Equal(fooY, fooType.FindImplementationForInterfaceMember(ifooTypeSayWithInt))
Assert.Equal(fooX, fooType.FindImplementationForInterfaceMember(ifooTypeSayWithString))
Assert.Equal(1, fooX.ExplicitInterfaceImplementations.Length)
Assert.Equal(ifooTypeSayWithString, fooX.ExplicitInterfaceImplementations(0))
Assert.Equal(1, fooY.ExplicitInterfaceImplementations.Length)
Assert.Equal(ifooTypeSayWithInt, fooY.ExplicitInterfaceImplementations(0))
Assert.Equal(0, fooSay.ExplicitInterfaceImplementations.Length)
Assert.Equal(0, barSay.ExplicitInterfaceImplementations.Length)
CompilationUtils.AssertNoErrors(comp)
End Sub
<WorkItem(545581, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545581")>
<Fact>
Public Sub ImplementInterfaceMethodWithNothingDefaultValue()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="ImplementInterfaceMethodWithNothingDefaultValue">
<file name="a.vb">
Option Strict On
Interface I(Of T)
Sub Foo(Optional x As T = Nothing)
End Interface
Class C
Implements I(Of Integer)
Sub Foo(Optional x As Integer = 0) Implements I(Of Integer).Foo
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(comp, <errors></errors>)
End Sub
<WorkItem(545581, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545581")>
<Fact>
Public Sub ImplementInterfaceMethodWithNothingDefaultValue2()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="ImplementInterfaceMethodWithNothingDefaultValue2">
<file name="a.vb">
Option Strict On
Interface I(Of T)
Sub Foo(Optional x As T = Nothing)
End Interface
Class C
Implements I(Of Date)
Sub Foo(Optional x As Date = Nothing) Implements I(Of Date).Foo
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(comp, <errors></errors>)
End Sub
<WorkItem(545581, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545581")>
<Fact>
Public Sub ImplementInterfaceMethodWithNothingDefaultValue3()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(
<compilation name="ImplementInterfaceMethodWithNothingDefaultValue3">
<file name="a.vb">
Option Strict On
Imports Microsoft.VisualBasic
Interface I(Of T)
Sub Foo(Optional x As T = Nothing)
End Interface
Class C
Implements I(Of Char)
Sub Foo(Optional x As Char = ChrW(0)) Implements I(Of Char).Foo
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(comp, <errors></errors>)
End Sub
<WorkItem(545581, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545581")>
<Fact>
Public Sub ImplementInterfaceMethodWithNothingDefaultValue4()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="ImplementInterfaceMethodWithNothingDefaultValue4">
<file name="a.vb">
Option Strict On
Interface I(Of T)
Sub Foo(Optional x As T = Nothing)
End Interface
Class C
Implements I(Of Single)
Sub Foo(Optional x As Single = Nothing) Implements I(Of Single).Foo
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(comp, <errors></errors>)
End Sub
<WorkItem(545581, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545581")>
<Fact>
Public Sub ImplementInterfaceMethodWithNothingDefaultValue5()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="ImplementInterfaceMethodWithNothingDefaultValue5">
<file name="a.vb">
Option Strict On
Imports System
Interface I(Of T)
Sub Foo(Optional x As T = Nothing)
End Interface
Class C
Implements I(Of DayOfWeek)
Public Sub Foo(Optional x As DayOfWeek = 0) Implements I(Of DayOfWeek).Foo
Throw New NotImplementedException()
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(comp, <errors></errors>)
End Sub
<WorkItem(545891, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545891")>
<Fact>
Public Sub ImplementInterfaceMethodWithNothingDefaultValue6()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="ImplementInterfaceMethodWithNothingDefaultValue6">
<file name="a.vb">
Interface I(Of T)
Sub Foo(Optional x As T = Nothing)
End Interface
Class C
Implements I(Of Decimal)
Public Sub Foo(Optional x As Decimal = 0.0D) Implements I(Of Decimal).Foo
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(comp, <errors></errors>)
End Sub
<WorkItem(545891, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545891")>
<Fact>
Public Sub ImplementInterfaceMethodWithNothingDefaultValue7()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="ImplementInterfaceMethodWithNothingDefaultValue7">
<file name="a.vb">
Interface I(Of T)
Sub Foo(Optional x As T = Nothing)
End Interface
Class C
Implements I(Of Double)
Public Sub Foo(Optional x As Double = -0D) Implements I(Of Double).Foo
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(comp, <errors></errors>)
End Sub
<WorkItem(545891, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545891")>
<Fact>
Public Sub ImplementInterfaceMethodWithNothingDefaultValue8()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="ImplementInterfaceMethodWithNothingDefaultValue7">
<file name="a.vb">
Interface I(Of T)
Sub Foo(Optional x As T = Nothing)
End Interface
Class C
Implements I(Of Single)
Public Sub Foo(Optional x As Single = -0D) Implements I(Of Single).Foo
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(comp, <errors></errors>)
End Sub
<WorkItem(545596, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545596")>
<Fact>
Public Sub ImplementInterfaceMethodWithNanDefaultValue()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="ImplementInterfaceMethodWithNanDefaultValue">
<file name="a.vb">
Option Strict On
Interface I
Sub Foo(Optional x As Double = Double.NaN)
End Interface
Class C
Implements I
Sub Foo(Optional x As Double = Double.NaN) Implements I.Foo
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(comp, <errors></errors>)
End Sub
<WorkItem(545596, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545596")>
<Fact>
Public Sub ImplementInterfaceMethodWithNanDefaultValue2()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="ImplementInterfaceMethodWithNanDefaultValue2">
<file name="a.vb">
Option Strict On
Interface I
Sub Foo(Optional x As Single = Single.NaN)
End Interface
Class C
Implements I
Sub Foo(Optional x As Single = Single.NaN) Implements I.Foo
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(comp, <errors></errors>)
End Sub
<WorkItem(545596, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545596")>
<Fact>
Public Sub ImplementInterfaceMethodWithNanDefaultValue3()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="ImplementInterfaceMethodWithNanDefaultValue3">
<file name="a.vb">
Option Strict On
Interface I
Sub Foo(Optional x As Single = Single.NaN)
End Interface
Class C
Implements I
Sub Foo(Optional x As Single = Double.NaN) Implements I.Foo
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(comp, <errors></errors>)
End Sub
<WorkItem(545596, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545596")>
<Fact>
Public Sub ImplementInterfaceMethodWithNanDefaultValue4()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="ImplementInterfaceMethodWithNanDefaultValue4">
<file name="a.vb">
Option Strict On
Interface I
Sub Foo(Optional x As Single = Single.NaN)
End Interface
Class C
Implements I
Sub Foo(Optional x As Single = 0/0) Implements I.Foo
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(comp, <errors></errors>)
End Sub
<WorkItem(545596, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545596")>
<Fact>
Public Sub ImplementInterfacePropertyWithNanDefaultValue()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="ImplementInterfacePropertyWithNanDefaultValue">
<file name="a.vb">
Option Strict On
Interface I
ReadOnly Property Foo(Optional x As Double = Double.NaN) As Integer
End Interface
Class C
Implements I
Public ReadOnly Property Foo(Optional x As Double = Double.NaN) As Integer Implements I.Foo
Get
Return 0
End Get
End Property
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(comp, <errors></errors>)
End Sub
<WorkItem(545596, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545596")>
<Fact>
Public Sub ImplementInterfacePropertyWithNanDefaultValue2()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="ImplementInterfacePropertyWithNanDefaultValue2">
<file name="a.vb">
Option Strict On
Interface I
ReadOnly Property Foo(Optional x As Double = Double.NegativeInfinity) As Integer
End Interface
Class C
Implements I
Public ReadOnly Property Foo(Optional x As Double = Single.NegativeInfinity) As Integer Implements I.Foo
Get
Return 0
End Get
End Property
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(comp, <errors></errors>)
End Sub
<WorkItem(545596, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545596")>
<Fact>
Public Sub ImplementInterfacePropertyWithNanDefaultValue3()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="ImplementInterfacePropertyWithNanDefaultValue3">
<file name="a.vb">
Option Strict On
Interface I
ReadOnly Property Foo(Optional x As Double = Double.NegativeInfinity) As Integer
End Interface
Class C
Implements I
Public ReadOnly Property Foo(Optional x As Double = (-1.0)/0) As Integer Implements I.Foo
Get
Return 0
End Get
End Property
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(comp, <errors></errors>)
End Sub
<WorkItem(545596, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545596")>
<Fact>
Public Sub ImplementInterfacePropertyWithNanDefaultValue4()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="ImplementInterfacePropertyWithNanDefaultValue4">
<file name="a.vb">
Option Strict On
Interface I
ReadOnly Property Foo(Optional x As Double = Double.NegativeInfinity) As Integer
End Interface
Class C
Implements I
Public ReadOnly Property Foo(Optional x As Double = 1.0/0) As Integer Implements I.Foo
Get
Return 0
End Get
End Property
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(comp,
<errors>
BC30149: Class 'C' must implement 'ReadOnly Property Foo([x As Double = -Infinity]) As Integer' for interface 'I'.
Implements I
~
BC30401: 'Foo' cannot implement 'Foo' because there is no matching property on interface 'I'.
Public ReadOnly Property Foo(Optional x As Double = 1.0/0) As Integer Implements I.Foo
~~~~~
</errors>)
End Sub
<Fact>
Public Sub SimpleImplementationApiProperty()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="SimpleImplementationProperty">
<file name="a.vb">
Option Strict On
Interface IFoo
ReadOnly Property Style(ByVal s As String) As String
ReadOnly Property Style(ByVal answer As Integer) As String
End Interface
Class Foo
Implements IFoo
Public Property X(ByVal style As String) As String Implements IFoo.Style
Get
Return "I said: " + style
End Get
Set
End Set
End Property
Public ReadOnly Property Y(ByVal a As Integer) As String Implements IFoo.Style
Get
Return "I said: " + a.ToString()
End Get
End Property
Public Overridable ReadOnly Property Style(ByVal s As String) As String
Get
Return "You dont say: " + s
End Get
End Property
End Class
Class Bar
Inherits Foo
Public Overrides ReadOnly Property Style(ByVal s As String) As String
Get
Return "I dont say: " + s
End Get
End Property
End Class
</file>
</compilation>)
Dim globalNS = comp.GlobalNamespace
Dim iFooType = DirectCast(globalNS.GetMembers("IFoo").First(), NamedTypeSymbol)
Dim fooType = DirectCast(globalNS.GetMembers("Foo").First(), NamedTypeSymbol)
Dim barType = DirectCast(globalNS.GetMembers("Bar").First(), NamedTypeSymbol)
Dim ifooProps = iFooType.GetMembers("Style").AsEnumerable().Cast(Of PropertySymbol)()
Dim ifooTypeStyleWithString = (From m In ifooProps Where m.Parameters(0).Type.SpecialType = SpecialType.System_String).First()
Dim ifooTypeStyleWithStringGetter = ifooTypeStyleWithString.GetMethod
Dim ifooTypeStyleWithInt = (From m In ifooProps Where m.Parameters(0).Type.SpecialType = SpecialType.System_Int32).First()
Dim ifooTypeStyleWithIntGetter = ifooTypeStyleWithInt.GetMethod
Dim fooX = DirectCast(fooType.GetMembers("X").First(), PropertySymbol)
Dim fooXGetter = fooX.GetMethod
Dim fooXSetter = fooX.SetMethod
Dim fooY = DirectCast(fooType.GetMembers("Y").First(), PropertySymbol)
Dim fooYGetter = fooY.GetMethod
Dim fooStyle = DirectCast(fooType.GetMembers("Style").First(), PropertySymbol)
Dim fooStyleGetter = fooStyle.GetMethod
Dim barStyle = DirectCast(barType.GetMembers("Style").First(), PropertySymbol)
Dim barStyleGetter = barStyle.GetMethod
Assert.Equal(fooY, barType.FindImplementationForInterfaceMember(ifooTypeStyleWithInt))
Assert.Equal(fooYGetter, barType.FindImplementationForInterfaceMember(ifooTypeStyleWithIntGetter))
Assert.Equal(fooX, barType.FindImplementationForInterfaceMember(ifooTypeStyleWithString))
Assert.Equal(fooXGetter, barType.FindImplementationForInterfaceMember(ifooTypeStyleWithStringGetter))
Assert.Equal(fooY, fooType.FindImplementationForInterfaceMember(ifooTypeStyleWithInt))
Assert.Equal(fooYGetter, fooType.FindImplementationForInterfaceMember(ifooTypeStyleWithIntGetter))
Assert.Equal(fooX, fooType.FindImplementationForInterfaceMember(ifooTypeStyleWithString))
Assert.Equal(fooXGetter, fooType.FindImplementationForInterfaceMember(ifooTypeStyleWithStringGetter))
Assert.Equal(1, fooX.ExplicitInterfaceImplementations.Length)
Assert.Equal(1, fooXGetter.ExplicitInterfaceImplementations.Length)
Assert.Equal(0, fooXSetter.ExplicitInterfaceImplementations.Length)
Assert.Equal(ifooTypeStyleWithString, fooX.ExplicitInterfaceImplementations(0))
Assert.Equal(ifooTypeStyleWithStringGetter, fooXGetter.ExplicitInterfaceImplementations(0))
Assert.Equal(1, fooY.ExplicitInterfaceImplementations.Length)
Assert.Equal(1, fooYGetter.ExplicitInterfaceImplementations.Length)
Assert.Equal(ifooTypeStyleWithInt, fooY.ExplicitInterfaceImplementations(0))
Assert.Equal(ifooTypeStyleWithIntGetter, fooYGetter.ExplicitInterfaceImplementations(0))
Assert.Equal(0, fooStyle.ExplicitInterfaceImplementations.Length)
Assert.Equal(0, barStyle.ExplicitInterfaceImplementations.Length)
Assert.Equal(0, fooStyleGetter.ExplicitInterfaceImplementations.Length)
Assert.Equal(0, barStyleGetter.ExplicitInterfaceImplementations.Length)
CompilationUtils.AssertNoErrors(comp)
End Sub
<Fact>
Public Sub UnimplementedMethods()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="SimpleImplementation">
<file name="a.vb">
Option Strict On
Interface IFoo
Sub SayItWithStyle(ByVal style As String)
Sub SayItWithStyle(ByVal answer As Integer)
Sub SayItWithStyle(ByVal answer As Long)
End Interface
Class Foo
Implements IFoo
Public Sub Y(ByVal a As Integer) Implements IFoo.SayItWithStyle
System.Console.WriteLine("The answer is: {0}", a)
End Sub
Public Overridable Sub SayItWithStyle(ByVal answer As Long)
System.Console.WriteLine("You don't say: {0}", answer)
End Sub
End Class
Class Bar
Inherits Foo
Implements IFoo
Public Overrides Sub SayItWithStyle(ByVal answer As Long)
System.Console.WriteLine("You don't say: {0}", answer)
End Sub
Public Sub X(ByVal style As String) Implements IFoo.SayItWithStyle
System.Console.WriteLine("I said: {0}", style)
End Sub
End Class
</file>
</compilation>)
Dim globalNS = comp.GlobalNamespace
Dim iFooType = DirectCast(globalNS.GetMembers("IFoo").First(), NamedTypeSymbol)
Dim fooType = DirectCast(globalNS.GetMembers("Foo").First(), NamedTypeSymbol)
Dim barType = DirectCast(globalNS.GetMembers("Bar").First(), NamedTypeSymbol)
Dim ifooMethods = iFooType.GetMembers("SayItWithStyle").AsEnumerable().Cast(Of MethodSymbol)()
Dim ifooTypeSayWithString = (From m In ifooMethods Where m.Parameters(0).Type.SpecialType = SpecialType.System_String).First()
Dim ifooTypeSayWithInt = (From m In ifooMethods Where m.Parameters(0).Type.SpecialType = SpecialType.System_Int32).First()
Dim ifooTypeSayWithLong = (From m In ifooMethods Where m.Parameters(0).Type.SpecialType = SpecialType.System_Int64).First()
Dim barX = DirectCast(barType.GetMembers("X").First(), MethodSymbol)
Dim fooY = DirectCast(fooType.GetMembers("Y").First(), MethodSymbol)
Dim fooSay = DirectCast(fooType.GetMembers("SayItWithStyle").First(), MethodSymbol)
Dim barSay = DirectCast(barType.GetMembers("SayItWithStyle").First(), MethodSymbol)
Assert.Equal(fooY, barType.FindImplementationForInterfaceMember(ifooTypeSayWithInt))
Assert.Equal(barX, barType.FindImplementationForInterfaceMember(ifooTypeSayWithString))
Assert.Equal(fooY, fooType.FindImplementationForInterfaceMember(ifooTypeSayWithInt))
Assert.Null(fooType.FindImplementationForInterfaceMember(ifooTypeSayWithString))
Assert.Null(fooType.FindImplementationForInterfaceMember(ifooTypeSayWithLong))
Assert.Null(barType.FindImplementationForInterfaceMember(ifooTypeSayWithLong))
Assert.Equal(1, barX.ExplicitInterfaceImplementations.Length)
Assert.Equal(ifooTypeSayWithString, barX.ExplicitInterfaceImplementations(0))
Assert.Equal(1, fooY.ExplicitInterfaceImplementations.Length)
Assert.Equal(ifooTypeSayWithInt, fooY.ExplicitInterfaceImplementations(0))
Assert.Equal(0, fooSay.ExplicitInterfaceImplementations.Length)
Assert.Equal(0, barSay.ExplicitInterfaceImplementations.Length)
CompilationUtils.AssertTheseDiagnostics(comp, <expected>
BC30149: Class 'Foo' must implement 'Sub SayItWithStyle(answer As Long)' for interface 'IFoo'.
Implements IFoo
~~~~
BC30149: Class 'Foo' must implement 'Sub SayItWithStyle(style As String)' for interface 'IFoo'.
Implements IFoo
~~~~
</expected>)
End Sub
<Fact>
Public Sub UnimplementedProperties()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="UnimplementedProperties">
<file name="a.vb">
Option Strict On
Interface IFoo
ReadOnly Property Style(ByVal s As String) As String
ReadOnly Property Style(ByVal answer As Integer) As String
ReadOnly Property Style(ByVal answer As Long) As String
End Interface
Class Foo
Implements IFoo
Public ReadOnly Property Y(ByVal a As Integer) As String Implements IFoo.Style
Get
Return "I said: " + a.ToString()
End Get
End Property
Public Overridable ReadOnly Property Style(ByVal s As Long) As String
Get
Return "You dont say: "
End Get
End Property
End Class
Class Bar
Inherits Foo
Implements IFoo
Public Overrides ReadOnly Property Style(ByVal s As Long) As String
Get
Return "You dont say: "
End Get
End Property
Public ReadOnly Property X(ByVal a As String) As String Implements IFoo.Style
Get
Return "I said: " + a.ToString()
End Get
End Property
End Class
</file>
</compilation>)
Dim globalNS = comp.GlobalNamespace
Dim iFooType = DirectCast(globalNS.GetMembers("IFoo").First(), NamedTypeSymbol)
Dim fooType = DirectCast(globalNS.GetMembers("Foo").First(), NamedTypeSymbol)
Dim barType = DirectCast(globalNS.GetMembers("Bar").First(), NamedTypeSymbol)
Dim ifooProps = iFooType.GetMembers("Style").AsEnumerable().Cast(Of PropertySymbol)()
Dim ifooTypeStyleWithString = (From m In ifooProps Where m.Parameters(0).Type.SpecialType = SpecialType.System_String).First()
Dim ifooTypeStyleWithStringGetter = ifooTypeStyleWithString.GetMethod
Dim ifooTypeStyleWithInt = (From m In ifooProps Where m.Parameters(0).Type.SpecialType = SpecialType.System_Int32).First()
Dim ifooTypeStyleWithIntGetter = ifooTypeStyleWithInt.GetMethod
Dim ifooTypeStyleWithLong = (From m In ifooProps Where m.Parameters(0).Type.SpecialType = SpecialType.System_Int64).First()
Dim ifooTypeStyleWithLongGetter = ifooTypeStyleWithLong.GetMethod
Dim barX = DirectCast(barType.GetMembers("X").First(), PropertySymbol)
Dim barXGetter = barX.GetMethod
Dim fooY = DirectCast(fooType.GetMembers("Y").First(), PropertySymbol)
Dim fooYGetter = fooY.GetMethod
Dim fooStyle = DirectCast(fooType.GetMembers("Style").First(), PropertySymbol)
Dim fooStyleGetter = fooStyle.GetMethod
Dim barStyle = DirectCast(barType.GetMembers("Style").First(), PropertySymbol)
Dim barStyleGetter = barStyle.GetMethod
Assert.Equal(fooY, barType.FindImplementationForInterfaceMember(ifooTypeStyleWithInt))
Assert.Equal(fooYGetter, barType.FindImplementationForInterfaceMember(ifooTypeStyleWithIntGetter))
Assert.Equal(barX, barType.FindImplementationForInterfaceMember(ifooTypeStyleWithString))
Assert.Equal(barXGetter, barType.FindImplementationForInterfaceMember(ifooTypeStyleWithStringGetter))
Assert.Equal(fooY, fooType.FindImplementationForInterfaceMember(ifooTypeStyleWithInt))
Assert.Equal(fooYGetter, fooType.FindImplementationForInterfaceMember(ifooTypeStyleWithIntGetter))
Assert.Null(fooType.FindImplementationForInterfaceMember(ifooTypeStyleWithString))
Assert.Null(fooType.FindImplementationForInterfaceMember(ifooTypeStyleWithStringGetter))
Assert.Null(fooType.FindImplementationForInterfaceMember(ifooTypeStyleWithLong))
Assert.Null(fooType.FindImplementationForInterfaceMember(ifooTypeStyleWithLongGetter))
Assert.Null(barType.FindImplementationForInterfaceMember(ifooTypeStyleWithLong))
Assert.Null(barType.FindImplementationForInterfaceMember(ifooTypeStyleWithLongGetter))
Assert.Equal(1, barX.ExplicitInterfaceImplementations.Length)
Assert.Equal(ifooTypeStyleWithString, barX.ExplicitInterfaceImplementations(0))
Assert.Equal(1, barXGetter.ExplicitInterfaceImplementations.Length)
Assert.Equal(ifooTypeStyleWithStringGetter, barXGetter.ExplicitInterfaceImplementations(0))
Assert.Equal(1, fooY.ExplicitInterfaceImplementations.Length)
Assert.Equal(ifooTypeStyleWithInt, fooY.ExplicitInterfaceImplementations(0))
Assert.Equal(1, fooYGetter.ExplicitInterfaceImplementations.Length)
Assert.Equal(ifooTypeStyleWithIntGetter, fooYGetter.ExplicitInterfaceImplementations(0))
Assert.Equal(0, fooStyle.ExplicitInterfaceImplementations.Length)
Assert.Equal(0, fooStyleGetter.ExplicitInterfaceImplementations.Length)
Assert.Equal(0, barStyle.ExplicitInterfaceImplementations.Length)
Assert.Equal(0, barStyleGetter.ExplicitInterfaceImplementations.Length)
CompilationUtils.AssertTheseDiagnostics(comp, <expected>
BC30149: Class 'Foo' must implement 'ReadOnly Property Style(answer As Long) As String' for interface 'IFoo'.
Implements IFoo
~~~~
BC30149: Class 'Foo' must implement 'ReadOnly Property Style(s As String) As String' for interface 'IFoo'.
Implements IFoo
~~~~
</expected>)
End Sub
<Fact>
Public Sub UnimplementedInterfaceAPI()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="UnimplementedInterfaceAPI">
<file name="a.vb">
Option Strict On
Interface IFoo
Sub SayItWithStyle(ByVal a As Integer)
End Interface
Class Foo
Public Sub Y(ByVal a As Integer) Implements IFoo.SayItWithStyle
System.Console.WriteLine("The answer is: {0}", a)
End Sub
Public Overridable Sub SayItWithStyle(ByVal answer As Long)
System.Console.WriteLine("You don't say: {0}", answer)
End Sub
End Class
</file>
</compilation>)
Dim globalNS = comp.GlobalNamespace
Dim iFooType = DirectCast(globalNS.GetMembers("IFoo").First(), NamedTypeSymbol)
Dim fooType = DirectCast(globalNS.GetMembers("Foo").First(), NamedTypeSymbol)
Dim ifooMethods = iFooType.GetMembers("SayItWithStyle").AsEnumerable().Cast(Of MethodSymbol)()
Dim ifooTypeSayWithInt = (From m In ifooMethods Where m.Parameters(0).Type.SpecialType = SpecialType.System_Int32).First()
Dim fooY = DirectCast(fooType.GetMembers("Y").First(), MethodSymbol)
Assert.Null(fooType.FindImplementationForInterfaceMember(ifooTypeSayWithInt))
Assert.Equal(1, fooY.ExplicitInterfaceImplementations.Length)
Assert.Equal(ifooTypeSayWithInt, fooY.ExplicitInterfaceImplementations(0))
CompilationUtils.AssertTheseDiagnostics(comp, <expected>
BC31035: Interface 'IFoo' is not implemented by this class.
Public Sub Y(ByVal a As Integer) Implements IFoo.SayItWithStyle
~~~~
</expected>)
End Sub
<Fact>
Public Sub GenericInterface()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="SimpleImplementation">
<file name="a.vb"><![CDATA[
Option Strict On
Imports System.Collections.Generic
Class Outer(Of X)
Interface IFoo(Of T, U)
Sub SayItWithStyle(ByVal a As T, c As X)
Sub SayItWithStyle(ByVal b As U, c As X)
End Interface
Class Foo(Of Y)
Implements IFoo(Of X, List(Of Y))
Public Sub M1(a As X, c As X) Implements Outer(Of X).IFoo(Of X, List(Of Y)).SayItWithStyle
End Sub
Public Sub M2(b As List(Of Y), c As X) Implements Outer(Of X).IFoo(Of X, List(Of Y)).SayItWithStyle
End Sub
End Class
<System.Serializable>
Class FooS(Of T, U)
End Class
End Class
]]></file>
</compilation>)
Dim globalNS = comp.GlobalNamespace
Dim listOfT = comp.GetTypeByMetadataName("System.Collections.Generic.List`1")
Dim listOfString = listOfT.Construct(comp.GetSpecialType(SpecialType.System_String))
Dim outerOfX = DirectCast(globalNS.GetMembers("Outer").First(), NamedTypeSymbol)
Dim outerOfInt = outerOfX.Construct(comp.GetSpecialType(SpecialType.System_Int32))
Dim iFooOfIntTU = DirectCast(outerOfInt.GetMembers("IFoo").First(), NamedTypeSymbol)
Assert.IsType(Of SubstitutedNamedType.SpecializedGenericType)(iFooOfIntTU)
Assert.False(DirectCast(iFooOfIntTU, INamedTypeSymbol).IsSerializable)
Dim fooSOfIntTU = DirectCast(outerOfInt.GetMembers("FooS").First(), NamedTypeSymbol)
Assert.IsType(Of SubstitutedNamedType.SpecializedGenericType)(fooSOfIntTU)
Assert.True(DirectCast(fooSOfIntTU, INamedTypeSymbol).IsSerializable)
Dim iFooOfIntIntListOfString = iFooOfIntTU.Construct(comp.GetSpecialType(SpecialType.System_Int32), listOfString)
Dim fooOfIntY = DirectCast(outerOfInt.GetMembers("Foo").First(), NamedTypeSymbol)
Dim fooOfIntString = fooOfIntY.Construct(comp.GetSpecialType(SpecialType.System_String))
Dim iFooOfIntIntListOfStringMethods = iFooOfIntIntListOfString.GetMembers("SayItWithStyle").AsEnumerable().Cast(Of MethodSymbol)()
Dim ifooOfIntIntStringSay1 = (From m In iFooOfIntIntListOfStringMethods Where TypeSymbol.Equals(m.Parameters(0).Type, comp.GetSpecialType(SpecialType.System_Int32), TypeCompareKind.ConsiderEverything)).First()
Dim ifooOfIntIntStringSay2 = (From m In iFooOfIntIntListOfStringMethods Where Not TypeSymbol.Equals(m.Parameters(0).Type, comp.GetSpecialType(SpecialType.System_Int32), TypeCompareKind.ConsiderEverything)).First()
Dim fooOfIntStringM1 = DirectCast(fooOfIntString.GetMembers("M1").First(), MethodSymbol)
Dim fooOfIntStringM2 = DirectCast(fooOfIntString.GetMembers("M2").First(), MethodSymbol)
Assert.Equal(1, fooOfIntStringM1.ExplicitInterfaceImplementations.Length)
Assert.Equal(ifooOfIntIntStringSay1, fooOfIntStringM1.ExplicitInterfaceImplementations(0))
Assert.Equal(1, fooOfIntStringM2.ExplicitInterfaceImplementations.Length)
Assert.Equal(ifooOfIntIntStringSay2, fooOfIntStringM2.ExplicitInterfaceImplementations(0))
CompilationUtils.AssertNoErrors(comp)
End Sub
' See MDInterfaceMapping.cs to understand this test case.
<Fact>
Public Sub MetadataInterfaceMapping()
Dim comp = CompilationUtils.CreateCompilationWithMscorlib40AndReferences(
<compilation name="ImplementStatic">
<file name="a.vb">
Public Class D
Inherits C
Implements IFoo
End Class
</file>
</compilation>, {TestReferences.SymbolsTests.Interface.MDInterfaceMapping})
Dim globalNS = comp.GlobalNamespace
Dim iFoo = DirectCast(globalNS.GetMembers("IFoo").Single(), NamedTypeSymbol)
Dim dClass = DirectCast(globalNS.GetMembers("D").Single(), NamedTypeSymbol)
Dim iFooMethod = DirectCast(iFoo.GetMembers("Foo").Single(), MethodSymbol)
' IFoo.Foo should be found in A.
Dim implementedMethod = dClass.FindImplementationForInterfaceMember(iFooMethod)
Assert.Equal("A", implementedMethod.ContainingType.Name)
CompilationUtils.AssertNoErrors(comp)
End Sub
<Fact>
Public Sub InterfaceReimplementation()
CompileAndVerify(
<compilation name="InterfaceReimplementation">
<file name="a.vb">
Imports System
Interface I1
Sub foo()
Sub quux()
End Interface
Interface I2
Inherits I1
Sub bar()
End Interface
Class X
Implements I1
Public Sub foo1() Implements I1.foo
Console.WriteLine("X.foo1")
End Sub
Public Sub quux1() Implements I1.quux
Console.WriteLine("X.quux1")
End Sub
Public Overridable Sub foo()
Console.WriteLine("x.foo")
End Sub
End Class
Class Y
Inherits X
Implements I2
Public Overridable Sub bar()
Console.WriteLine("Y.bar")
End Sub
Public Overridable Sub quux()
Console.WriteLine("Y.quux")
End Sub
Public Overrides Sub foo()
Console.WriteLine("Y.foo")
End Sub
Public Sub bar1() Implements I2.bar
Console.WriteLine("Y.bar1")
End Sub
End Class
Module Module1
Sub Main()
Dim a As Y = New Y()
a.foo()
a.bar()
a.quux()
Dim b As I2 = a
b.foo()
b.bar()
b.quux()
End Sub
End Module
</file>
</compilation>,
expectedOutput:=<![CDATA[
Y.foo
Y.bar
Y.quux
X.foo1
Y.bar1
X.quux1
]]>)
End Sub
<Fact>
Public Sub Bug6095()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40AndVBRuntime(
<compilation name="Bug6095">
<file name="a.vb">
Imports System
Namespace ArExtByVal001
Friend Module ArExtByVal001mod
Class Cls7
Implements I7
Interface I7
Function Scen7(ByVal Ary() As Single)
End Interface
Function Cls7_Scen7(ByVal Ary() As Single) Implements I7.Scen7
Ary(70) = Ary(70) + 100
Return Ary(0)
End Function
End Class
End Module
End Namespace
</file>
</compilation>)
CompilationUtils.AssertNoErrors(compilation)
End Sub
<Fact>
Public Sub Bug7931()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="Bug6095">
<file name="a.vb">
Imports System
Imports System.Collections.Generic
Namespace NS
Interface IFoo(Of T)
Function F(Of R)(ParamArray p As R()) As R
End Interface
Interface IBar(Of R)
Function F(ParamArray p As R()) As R
End Interface
Class Impl
Implements NS.IFoo(Of Char)
Implements IBar(Of Short)
Function F(ParamArray p As Short()) As Short Implements IFoo(Of Char).F, IBar(Of Short).F
Return Nothing
End Function
End Class
End Namespace
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation,
<expected>
BC30149: Class 'Impl' must implement 'Function F(Of R)(ParamArray p As R()) As R' for interface 'IFoo(Of Char)'.
Implements NS.IFoo(Of Char)
~~~~~~~~~~~~~~~~
BC30401: 'F' cannot implement 'F' because there is no matching function on interface 'IFoo(Of Char)'.
Function F(ParamArray p As Short()) As Short Implements IFoo(Of Char).F, IBar(Of Short).F
~~~~~~~~~~~~~~~
</expected>)
End Sub
<WorkItem(543664, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543664")>
<Fact()>
Public Sub Bug11554()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="Bug11554">
<file name="a.vb">
Interface I
Sub M(Optional ByRef x As Short = 1)
End Interface
Class C
'COMPILEERROR: BC30149, "I"
Implements I
'COMPILEERROR: BC30401, "I.M"
Sub M(Optional ByRef x As Short = 0) Implements I.M
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation,
<expected>
BC30149: Class 'C' must implement 'Sub M([ByRef x As Short = 1])' for interface 'I'.
Implements I
~
BC30401: 'M' cannot implement 'M' because there is no matching sub on interface 'I'.
Sub M(Optional ByRef x As Short = 0) Implements I.M
~~~
</expected>)
End Sub
<Fact>
Public Sub PropAccessorAgreement()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="PropAccessorAgreement">
<file name="a.vb">
Interface I1
Property rw1 As Integer
Property rw2 As Integer
Property rw3 As Integer
ReadOnly Property ro1 As Integer
ReadOnly Property ro2 As Integer
ReadOnly Property ro3 As Integer
WriteOnly Property wo1 As Integer
WriteOnly Property wo2 As Integer
WriteOnly Property wo3 As Integer
End Interface
Class X
Implements I1
Public Property a As Integer Implements I1.ro1
Get
Return 0
End Get
Set(value As Integer)
End Set
End Property
Public ReadOnly Property b As Integer Implements I1.ro2
Get
Return 0
End Get
End Property
Public WriteOnly Property c As Integer Implements I1.ro3
Set(value As Integer)
End Set
End Property
Public Property d As Integer Implements I1.rw1
Get
Return 0
End Get
Set(value As Integer)
End Set
End Property
Public ReadOnly Property e As Integer Implements I1.rw2
Get
Return 0
End Get
End Property
Public WriteOnly Property f As Integer Implements I1.rw3
Set(value As Integer)
End Set
End Property
Public Property g As Integer Implements I1.wo1
Get
Return 0
End Get
Set(value As Integer)
End Set
End Property
Public ReadOnly Property h As Integer Implements I1.wo2
Get
Return 0
End Get
End Property
Public WriteOnly Property i As Integer Implements I1.wo3
Set(value As Integer)
End Set
End Property
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC31444: 'ReadOnly Property ro3 As Integer' cannot be implemented by a WriteOnly property.
Public WriteOnly Property c As Integer Implements I1.ro3
~~~~~~
BC31444: 'Property rw2 As Integer' cannot be implemented by a ReadOnly property.
Public ReadOnly Property e As Integer Implements I1.rw2
~~~~~~
BC31444: 'Property rw3 As Integer' cannot be implemented by a WriteOnly property.
Public WriteOnly Property f As Integer Implements I1.rw3
~~~~~~
BC31444: 'WriteOnly Property wo2 As Integer' cannot be implemented by a ReadOnly property.
Public ReadOnly Property h As Integer Implements I1.wo2
~~~~~~
</expected>)
End Sub
<Fact>
Public Sub ImplementDefaultProperty()
Dim source =
<compilation>
<file name="a.vb">
Interface I1
Default Property P1(param1 As Integer) As String
End Interface
Class C1 : Implements I1
Private _p1 As String
Private _p2 As String
Public Property P1(param1 As Integer) As String Implements I1.P1
Get
Return _p1
End Get
Set(value As String)
_p1 = value
End Set
End Property
Default Public Property P2(param1 As Integer) As String
Get
Return _p2
End Get
Set(value As String)
_p2 = value
End Set
End Property
End Class
Module Program
Sub Main(args As String())
Dim c As C1 = New C1()
DirectCast(c, I1)(1) = "P1"
c(1) = "P2"
System.Console.WriteLine(String.Join(",", c.P1(1), c.P2(1)))
End Sub
End Module
</file>
</compilation>
CompileAndVerify(source, expectedOutput:="P1,P2")
End Sub
<Fact>
Public Sub ImplementReadOnlyUsingReadWriteWithPrivateSet()
Dim source =
<compilation>
<file name="a.vb">
Interface I1
ReadOnly Property bar() As Integer
End Interface
Public Class C2
Implements I1
Public Property bar() As Integer Implements I1.bar
Get
Return 2
End Get
Private Set(ByVal value As Integer)
End Set
End Property
End Class
</file>
</compilation>
CompileAndVerify(source)
End Sub
<WorkItem(541934, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/541934")>
<Fact>
Public Sub ImplementGenericInterfaceProperties()
Dim source =
<compilation>
<file name="a.vb">
Imports ImportedAlias = System.Int32
Interface I1(Of T)
ReadOnly Property P1() As T
End Interface
Public Class C1(Of T)
Implements I1(Of T)
Public ReadOnly Property P() As T Implements I1(Of T).P1
Get
Return Nothing
End Get
End Property
End Class
Public Class C2
Implements I1(Of Integer)
Public ReadOnly Property P1() As Integer Implements I1(Of Integer).P1
Get
Return 2
End Get
End Property
End Class
</file>
</compilation>
CompileAndVerify(source)
End Sub
<Fact>
Public Sub ImplementGenericInterfaceMethods()
Dim source =
<compilation>
<file name="a.vb">
Imports System.Collections.Generic
Imports ImportedAlias = System.Int32
Interface I1(Of T)
Sub M1()
Function M1(Of U)(x As U, y As List(Of U), z As T, w As List(Of T)) As Dictionary(Of T, List(Of U))
End Interface
Public Class C1(Of T)
Implements I1(Of T)
Public Sub M() Implements I1(Of T).M1
End Sub
Public Function M(Of U)(x As U, y As List(Of U), z As T, w As List(Of T)) As Dictionary(Of T, List(Of U)) Implements I1(Of T).M1
Return Nothing
End Function
End Class
Public Class C2
Implements I1(Of Integer)
Public Sub M1() Implements I1(Of ImportedAlias).M1
End Sub
Public Function M1(Of U)(x As U, y As List(Of U), z As ImportedAlias, w As List(Of ImportedAlias)) As Dictionary(Of ImportedAlias, List(Of U)) Implements I1(Of ImportedAlias).M1
Return Nothing
End Function
End Class
</file>
</compilation>
CompileAndVerify(source)
End Sub
<WorkItem(543253, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/543253")>
<Fact()>
Public Sub ImplementMethodWithOptionalParameter()
Dim source =
<compilation>
<file name="a.vb">
Public Enum E1
A
B
C
End Enum
Public Interface I1
Sub S1(i as integer, optional j as integer = 10, optional e as E1 = E1.B)
End Interface
Public Class C1
Implements I1
Sub C1_S1(i as integer, optional j as integer = 10, optional e as E1 = E1.B) implements I1.S1
End Sub
End Class
</file>
</compilation>
CompileAndVerify(source).VerifyDiagnostics()
End Sub
<Fact, WorkItem(544531, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544531")>
Public Sub VarianceAmbiguity1()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="VarianceAmbiguity1">
<file name="a.vb">
Option Strict On
Class Animals : End Class
Class Mammals : Inherits Animals
End Class
Class Fish
Inherits Mammals
End Class
Interface IEnumerable(Of Out T)
Function Foo() As T
End Interface
Class C
Implements IEnumerable(Of Fish)
Implements IEnumerable(Of Mammals)
Implements IEnumerable(Of Animals)
Public Function Foo() As Fish Implements IEnumerable(Of Fish).Foo
Return New Fish
End Function
Public Function Foo1() As Mammals Implements IEnumerable(Of Mammals).Foo
Return New Mammals
End Function
Public Function Foo2() As Animals Implements IEnumerable(Of Animals).Foo
Return New Animals
End Function
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC42333: Interface 'IEnumerable(Of Mammals)' is ambiguous with another implemented interface 'IEnumerable(Of Fish)' due to the 'In' and 'Out' parameters in 'Interface IEnumerable(Of Out T)'.
Implements IEnumerable(Of Mammals)
~~~~~~~~~~~~~~~~~~~~~~~
BC42333: Interface 'IEnumerable(Of Animals)' is ambiguous with another implemented interface 'IEnumerable(Of Fish)' due to the 'In' and 'Out' parameters in 'Interface IEnumerable(Of Out T)'.
Implements IEnumerable(Of Animals)
~~~~~~~~~~~~~~~~~~~~~~~
BC42333: Interface 'IEnumerable(Of Animals)' is ambiguous with another implemented interface 'IEnumerable(Of Mammals)' due to the 'In' and 'Out' parameters in 'Interface IEnumerable(Of Out T)'.
Implements IEnumerable(Of Animals)
~~~~~~~~~~~~~~~~~~~~~~~
</expected>)
End Sub
<Fact, WorkItem(544531, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/544531")>
Public Sub VarianceAmbiguity2()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="VarianceAmbiguity2">
<file name="a.vb">
Option Strict On
Class Animals : End Class
Class Mammals : Inherits Animals
End Class
Class Fish
Inherits Mammals
End Class
Interface IEnumerable(Of Out T)
Function Foo() As T
End Interface
Interface EnumFish
Inherits IEnumerable(Of Fish)
End Interface
Interface EnumAnimals
Inherits IEnumerable(Of Animals)
End Interface
Interface I
Inherits EnumFish, EnumAnimals, IEnumerable(Of Mammals)
End Interface
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC42333: Interface 'EnumAnimals' is ambiguous with another implemented interface 'EnumFish' due to the 'In' and 'Out' parameters in 'Interface IEnumerable(Of Out T)'.
Inherits EnumFish, EnumAnimals, IEnumerable(Of Mammals)
~~~~~~~~~~~
BC42333: Interface 'IEnumerable(Of Mammals)' is ambiguous with another implemented interface 'EnumAnimals' due to the 'In' and 'Out' parameters in 'Interface IEnumerable(Of Out T)'.
Inherits EnumFish, EnumAnimals, IEnumerable(Of Mammals)
~~~~~~~~~~~~~~~~~~~~~~~
BC42333: Interface 'IEnumerable(Of Mammals)' is ambiguous with another implemented interface 'EnumFish' due to the 'In' and 'Out' parameters in 'Interface IEnumerable(Of Out T)'.
Inherits EnumFish, EnumAnimals, IEnumerable(Of Mammals)
~~~~~~~~~~~~~~~~~~~~~~~
</expected>)
End Sub
<Fact()>
Public Sub VarianceAmbiguity3()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="VarianceAmbiguity3">
<file name="a.vb">
Option Strict On
Public Interface IFoo(Of Out T, U)
End Interface
Class X
End Class
Class Y
End Class
Class GX(Of T)
End Class
Class GY(Of T)
End Class
Class A
' Not conflicting: 2nd type parameter is invariant, types are different and cannot unify
' Dev11 reports not conflicting
Implements IFoo(Of X, X), IFoo(Of Y, Y)
End Class
Class B(Of T)
' Not conflicting: 2nd type parameter is invariant, types are different and cannot unify
' Dev11 reports conflicting
Implements IFoo(Of X, GX(Of Integer)), IFoo(Of Y, GY(Of Integer))
End Class
Class C(Of T, U)
' Conflicting: 2nd type parameter is invariant, GX(Of T) and GX(Of U) might unify
' Dev11 reports conflicting
Implements IFoo(Of X, GX(Of T)), IFoo(Of Y, GX(Of U))
End Class
Class D(Of T, U)
' Conflicting: 2nd type parameter is invariant, T and U might unify
' E.g., If D(Of String, String) is cast to IFoo(Of Object, String), its implementation is ambiguous.
' Dev11 reports non-conflicting
Implements IFoo(Of X, T), IFoo(Of Y, U)
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC42333: Interface 'IFoo(Of Y, GX(Of U))' is ambiguous with another implemented interface 'IFoo(Of X, GX(Of T))' due to the 'In' and 'Out' parameters in 'Interface IFoo(Of Out T, U)'.
Implements IFoo(Of X, GX(Of T)), IFoo(Of Y, GX(Of U))
~~~~~~~~~~~~~~~~~~~~
BC42333: Interface 'IFoo(Of Y, U)' is ambiguous with another implemented interface 'IFoo(Of X, T)' due to the 'In' and 'Out' parameters in 'Interface IFoo(Of Out T, U)'.
Implements IFoo(Of X, T), IFoo(Of Y, U)
~~~~~~~~~~~~~
</expected>)
End Sub
<Fact()>
Public Sub VarianceAmbiguity4()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="VarianceAmbiguity4">
<file name="a.vb">
Option Strict On
Public Interface IFoo(Of Out T, Out U)
End Interface
Class X
End Class
Class Y
End Class
Class GX(Of T)
End Class
Class GY(Of T)
End Class
Structure S(Of T)
End Structure
Class A
' Not conflicting: 2nd type parameter is "Out", types can't unify and one is value type
' Dev11 reports not conflicting
Implements IFoo(Of X, Integer), IFoo(Of Y, Y)
End Class
Class B(Of T)
' Conflicting: 2nd type parameter is "Out", 2nd type parameter could unify in B(Of Integer)
' Dev11 reports not conflicting
Implements IFoo(Of X, Integer), IFoo(Of Y, T)
End Class
Class C(Of T, U)
' Conflicting: 2nd type parameter is "Out", , S(Of T) and S(Of U) might unify
' Dev11 reports conflicting
Implements IFoo(Of X, S(Of T)), IFoo(Of Y, S(Of U))
End Class
Class D(Of T, U)
' Not Conflicting: 2nd type parameter is "Out", String and S(Of U) can't unify and S(Of U) is a value type.
' Dev11 reports conflicting
Implements IFoo(Of X, String), IFoo(Of Y, S(Of U))
End Class
Class E(Of T, U)
' Not Conflicting: 1st type parameter; one is Object; 2nd type parameter is "Out", S(Of T) is a value type.
' Dev11 reports not conflicting
Implements IFoo(Of Object, S(Of T)), IFoo(Of X, S(Of U))
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC42333: Interface 'IFoo(Of Y, T)' is ambiguous with another implemented interface 'IFoo(Of X, Integer)' due to the 'In' and 'Out' parameters in 'Interface IFoo(Of Out T, Out U)'.
Implements IFoo(Of X, Integer), IFoo(Of Y, T)
~~~~~~~~~~~~~
BC42333: Interface 'IFoo(Of Y, S(Of U))' is ambiguous with another implemented interface 'IFoo(Of X, S(Of T))' due to the 'In' and 'Out' parameters in 'Interface IFoo(Of Out T, Out U)'.
Implements IFoo(Of X, S(Of T)), IFoo(Of Y, S(Of U))
~~~~~~~~~~~~~~~~~~~
</expected>)
End Sub
<Fact()>
Public Sub VarianceAmbiguity5()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="VarianceAmbiguity5">
<file name="a.vb">
Option Strict On
Public Interface IFoo(Of In T, In U)
End Interface
Class X
End Class
Class Y
End Class
NotInheritable Class Z
End Class
Class W
Inherits X
End Class
Interface J
End Interface
Interface K
End Interface
Class GX(Of T)
End Class
Class GY(Of T)
End Class
Structure S(Of T)
End Structure
Class A
' Not conflicting: Neither X or Y derives from each other
' Dev11 reports conflicting
Implements IFoo(Of X, Integer), IFoo(Of Y, Integer)
End Class
Class B
' Conflicting: 1st type argument could convert to type deriving from X implementing J.
' Dev11 reports conflicting
Implements IFoo(Of X, Integer), IFoo(Of J, Integer)
End Class
Class C(Of T, U)
' Not conflicting: 1st type argument has sealed type Z.
' Dev11 reports conflicting
Implements IFoo(Of J, Integer), IFoo(Of Z, Integer)
End Class
Class D(Of T, U)
' Not conflicting: 1st type argument has value type Integer.
' Dev11 reports not conflicting
Implements IFoo(Of Integer, Integer), IFoo(Of X, Integer)
End Class
Class E
' Conflicting, W derives from X
' Dev11 reports conflicting
Implements IFoo(Of W, Integer), IFoo(Of X, Integer)
End Class
Class F(Of T)
' Conflicting: X and J cause ambiguity, T and Integer could unify
' Dev11 reports not conflicting
Implements IFoo(Of X, Integer), IFoo(Of J, T)
End Class
Class G(Of T)
' Not conflicting: X and J cause ambiguity, GX(Of T) and Integer can't unify, Integer is value type prevents ambiguity
' Dev11 reports conflicting
Implements IFoo(Of X, Integer), IFoo(Of J, GX(Of T))
End Class
Class H
' Not conflicting, X and J cause ambiguity, neither X or Z derive from each other.
' Dev11 reports conflicting
Implements IFoo(Of X, Z), IFoo(Of J, X)
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC42333: Interface 'IFoo(Of J, Integer)' is ambiguous with another implemented interface 'IFoo(Of X, Integer)' due to the 'In' and 'Out' parameters in 'Interface IFoo(Of In T, In U)'.
Implements IFoo(Of X, Integer), IFoo(Of J, Integer)
~~~~~~~~~~~~~~~~~~~
BC42333: Interface 'IFoo(Of X, Integer)' is ambiguous with another implemented interface 'IFoo(Of W, Integer)' due to the 'In' and 'Out' parameters in 'Interface IFoo(Of In T, In U)'.
Implements IFoo(Of W, Integer), IFoo(Of X, Integer)
~~~~~~~~~~~~~~~~~~~
BC42333: Interface 'IFoo(Of J, T)' is ambiguous with another implemented interface 'IFoo(Of X, Integer)' due to the 'In' and 'Out' parameters in 'Interface IFoo(Of In T, In U)'.
Implements IFoo(Of X, Integer), IFoo(Of J, T)
~~~~~~~~~~~~~
</expected>)
End Sub
<WorkItem(545863, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/545863")>
<Fact>
Public Sub Bug14589()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation name="Bug14589">
<file name="a.vb">
Interface I(Of T)
Sub Foo(x As T)
End Interface
Class A(Of T)
Class B
Inherits A(Of B)
Implements I(Of B.B)
End Class
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected>
BC30149: Class 'B' must implement 'Sub Foo(x As A(Of A(Of A(Of T).B).B).B)' for interface 'I(Of B)'.
Implements I(Of B.B)
~~~~~~~~~
</expected>)
End Sub
<WorkItem(578706, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/578706")>
<Fact>
Public Sub ImplicitImplementationSourceVsMetadata()
Dim source1 = <![CDATA[
public interface I
{
void Implicit();
void Explicit();
}
public class A
{
public void Implicit()
{
System.Console.WriteLine("A.Implicit");
}
public void Explicit()
{
System.Console.WriteLine("A.Explicit");
}
}
public class B : A, I
{
}
]]>
Dim source2 =
<compilation name="Lib2">
<file name="a.vb">
Public Class C
Inherits B
Public Shadows Sub Implicit()
System.Console.WriteLine("C.Implicit")
End Sub
Public Shadows Sub Explicit()
System.Console.WriteLine("C.Explicit")
End Sub
End Class
Public Class D
Inherits C
Implements I
Public Shadows Sub Explicit() Implements I.Explicit
System.Console.WriteLine("D.Explicit")
End Sub
End Class
</file>
</compilation>
Dim source3 =
<compilation name="Test">
<file name="a.vb">
Module Test
Sub Main()
Dim a As New A()
Dim b As New B()
Dim c As New C()
Dim d As New D()
a.Implicit()
b.Implicit()
c.Implicit()
d.Implicit()
System.Console.WriteLine()
a.Explicit()
b.Explicit()
c.Explicit()
d.Explicit()
System.Console.WriteLine()
Dim i As I
'i = a
'i.Implicit()
'i.Explicit()
i = b
i.Implicit()
i.Explicit()
i = c
i.Implicit()
i.Explicit()
i = d
i.Implicit()
i.Explicit()
End Sub
End Module
</file>
</compilation>
Dim expectedOutput = <![CDATA[
A.Implicit
A.Implicit
C.Implicit
C.Implicit
A.Explicit
A.Explicit
C.Explicit
D.Explicit
A.Implicit
A.Explicit
A.Implicit
A.Explicit
A.Implicit
D.Explicit
]]>
Dim comp1 = CreateCSharpCompilation("Lib1", source1)
Dim ref1a = comp1.EmitToImageReference()
Dim ref1b = comp1.EmitToImageReference()
Dim comp2 = CreateCompilationWithMscorlib40AndReferences(source2, {ref1a})
Dim ref2Metadata = comp2.EmitToImageReference()
Dim ref2Source = New VisualBasicCompilationReference(comp2)
Dim verifyComp3 As Action(Of MetadataReference, MetadataReference) =
Sub(ref1, ref2)
Dim comp3 = CreateCompilationWithMscorlib40AndVBRuntimeAndReferences(source3, {ref1, ref2}, TestOptions.ReleaseExe)
CompileAndVerify(comp3, expectedOutput:=expectedOutput)
Dim globalNamespace = comp3.GlobalNamespace
Dim typeI = globalNamespace.GetMember(Of NamedTypeSymbol)("I")
Dim typeA = globalNamespace.GetMember(Of NamedTypeSymbol)("A")
Dim typeB = globalNamespace.GetMember(Of NamedTypeSymbol)("B")
Dim typeC = globalNamespace.GetMember(Of NamedTypeSymbol)("C")
Dim typeD = globalNamespace.GetMember(Of NamedTypeSymbol)("D")
Dim interfaceImplicit = typeI.GetMember(Of MethodSymbol)("Implicit")
Dim interfaceExplicit = typeI.GetMember(Of MethodSymbol)("Explicit")
Assert.Null(typeA.FindImplementationForInterfaceMember(interfaceImplicit))
Assert.Null(typeA.FindImplementationForInterfaceMember(interfaceExplicit))
Assert.Equal(typeA, typeB.FindImplementationForInterfaceMember(interfaceImplicit).ContainingType)
Assert.Equal(typeA, typeB.FindImplementationForInterfaceMember(interfaceExplicit).ContainingType)
Assert.Equal(typeA, typeC.FindImplementationForInterfaceMember(interfaceImplicit).ContainingType)
Assert.Equal(typeA, typeC.FindImplementationForInterfaceMember(interfaceExplicit).ContainingType)
Assert.Equal(typeA, typeD.FindImplementationForInterfaceMember(interfaceImplicit).ContainingType)
Assert.Equal(typeD, typeD.FindImplementationForInterfaceMember(interfaceExplicit).ContainingType)
' In metadata, D does not declare that it implements I.
Assert.Equal(If(TypeOf ref2 Is MetadataImageReference, 0, 1), typeD.Interfaces.Length)
End Sub
' Normal
verifyComp3(ref1a, ref2Metadata)
verifyComp3(ref1a, ref2Source)
' Retargeting
verifyComp3(ref1b, ref2Metadata)
verifyComp3(ref1b, ref2Source)
End Sub
<WorkItem(578746, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/578746")>
<Fact>
Public Sub Bug578746a()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation>
<file name="a.vb">
Interface I(Of T)
Sub Foo(Optional x As Integer = Nothing)
End Interface
Class C
Implements I(Of Integer)
Public Sub Foo(Optional x As Integer = 0) Implements I(Of Integer).Foo
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected></expected>)
End Sub
<WorkItem(578746, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/578746")>
<Fact>
Public Sub Bug578746b()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation>
<file name="a.vb">
Interface I
Sub Foo(Optional x As Decimal = Nothing)
End Interface
Class C
Implements I
Public Sub Foo(Optional x As Decimal = 0.0f) Implements I.Foo
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected></expected>)
End Sub
<WorkItem(578746, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/578746")>
<Fact>
Public Sub Bug578746c()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation>
<file name="a.vb">
Interface I
Sub Foo(Optional x As Object = Nothing)
End Interface
Class C
Implements I
Public Sub Foo(Optional x As Object = 0) Implements I.Foo
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation,
<expected>
BC30149: Class 'C' must implement 'Sub Foo([x As Object = Nothing])' for interface 'I'.
Implements I
~
BC30401: 'Foo' cannot implement 'Foo' because there is no matching sub on interface 'I'.
Public Sub Foo(Optional x As Object = 0) Implements I.Foo
~~~~~
</expected>)
End Sub
<WorkItem(578746, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/578746")>
<Fact>
Public Sub Bug578746d()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation>
<file name="a.vb">
Class A : End Class
Interface I
Sub Foo(Of T As A)(Optional x As A = DirectCast(Nothing, T))
End Interface
Class C: Implements I
Public Sub Foo(Of T As A)(Optional x As A = Nothing) Implements I.Foo
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected></expected>)
End Sub
<WorkItem(578074, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/578074")>
<Fact>
Public Sub Bug578074()
Dim compilation = CompilationUtils.CreateCompilationWithMscorlib40(
<compilation>
<file name="a.vb">
Interface I
Sub Foo(Optional x As Object = 1D)
End Interface
Class C
Implements I
Public Sub Foo(Optional x As Object = 1.0D) Implements I.Foo
End Sub
End Class
</file>
</compilation>)
CompilationUtils.AssertTheseDiagnostics(compilation, <expected></expected>)
End Sub
<WorkItem(608228, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/608228")>
<Fact>
Public Sub ImplementPropertyWithByRefParameter()
Dim il = <![CDATA[
.class interface public abstract auto ansi IRef
{
.method public newslot specialname abstract strict virtual
instance string get_P(int32& x) cil managed
{
} // end of method IRef::get_P
.method public newslot specialname abstract strict virtual
instance void set_P(int32& x,
string Value) cil managed
{
} // end of method IRef::set_P
.property instance string P(int32&)
{
.get instance string IRef::get_P(int32&)
.set instance void IRef::set_P(int32&,
string)
} // end of property IRef::P
} // end of class IRef
]]>
Dim source =
<compilation>
<file name="a.vb">
Public Class Impl
Implements IRef
Public Property P(x As Integer) As String Implements IRef.P
Get
Return Nothing
End Get
Set(value As String)
End Set
End Property
End Class
</file>
</compilation>
Dim compilation = CreateCompilationWithCustomILSource(source, il)
' CONSIDER: Dev11 doesn't report ERR_UnimplementedMember3.
compilation.VerifyDiagnostics(
Diagnostic(ERRID.ERR_IdentNotMemberOfInterface4, "IRef.P").WithArguments("P", "P", "property", "IRef"),
Diagnostic(ERRID.ERR_UnimplementedMember3, "IRef").WithArguments("Class", "Impl", "Property P(ByRef x As Integer) As String", "IRef"))
Dim globalNamespace = compilation.GlobalNamespace
Dim interfaceType = globalNamespace.GetMember(Of NamedTypeSymbol)("IRef")
Dim interfaceProperty = interfaceType.GetMember(Of PropertySymbol)("P")
Assert.True(interfaceProperty.Parameters.Single().IsByRef)
Dim classType = globalNamespace.GetMember(Of NamedTypeSymbol)("Impl")
Dim classProperty = classType.GetMember(Of PropertySymbol)("P")
Assert.False(classProperty.Parameters.Single().IsByRef)
Assert.Null(classType.FindImplementationForInterfaceMember(interfaceProperty))
End Sub
<WorkItem(718115, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/718115")>
<Fact>
Public Sub ExplicitlyImplementedAccessorsWithoutEvent()
Dim il = <![CDATA[
.class interface public abstract auto ansi I
{
.method public hidebysig newslot specialname abstract virtual
instance void add_E(class [mscorlib]System.Action 'value') cil managed
{
}
.method public hidebysig newslot specialname abstract virtual
instance void remove_E(class [mscorlib]System.Action 'value') cil managed
{
}
.event [mscorlib]System.Action E
{
.addon instance void I::add_E(class [mscorlib]System.Action)
.removeon instance void I::remove_E(class [mscorlib]System.Action)
}
} // end of class I
.class public auto ansi beforefieldinit Base
extends [mscorlib]System.Object
implements I
{
.method private hidebysig newslot specialname virtual final
instance void I.add_E(class [mscorlib]System.Action 'value') cil managed
{
.override I::add_E
ldstr "Explicit implementation"
call void [mscorlib]System.Console::WriteLine(string)
ret
}
.method private hidebysig newslot specialname virtual final
instance void I.remove_E(class [mscorlib]System.Action 'value') cil managed
{
.override I::remove_E
ret
}
.method family hidebysig specialname instance void
add_E(class [mscorlib]System.Action 'value') cil managed
{
ldstr "Protected event"
call void [mscorlib]System.Console::WriteLine(string)
ret
}
.method family hidebysig specialname instance void
remove_E(class [mscorlib]System.Action 'value') cil managed
{
ret
}
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
ldarg.0
call instance void [mscorlib]System.Object::.ctor()
ret
}
// NOTE: No event I.E
.event [mscorlib]System.Action E
{
.addon instance void Base::add_E(class [mscorlib]System.Action)
.removeon instance void Base::remove_E(class [mscorlib]System.Action)
}
} // end of class Base
]]>
Dim source =
<compilation>
<file name="a.vb">
Public Class Derived
Inherits Base
Implements I
Public Sub Test()
AddHandler DirectCast(Me, I).E, Nothing
End Sub
End Class
Module Program
Sub Main()
Dim d As New Derived()
d.Test()
Dim id As I = d
AddHandler id.E, Nothing
End Sub
End Module
</file>
</compilation>
Dim ilRef = CompileIL(il.Value)
Dim compilation = CreateCompilationWithMscorlib40AndVBRuntimeAndReferences(source, {ilRef}, TestOptions.ReleaseExe)
CompileAndVerify(compilation, expectedOutput:=<![CDATA[
Explicit implementation
Explicit implementation
]]>)
Dim [global] = compilation.GlobalNamespace
Dim [interface] = [global].GetMember(Of NamedTypeSymbol)("I")
Dim baseType = [global].GetMember(Of NamedTypeSymbol)("Base")
Dim derivedType = [global].GetMember(Of NamedTypeSymbol)("Derived")
Dim interfaceEvent = [interface].GetMember(Of EventSymbol)("E")
Dim interfaceAdder = interfaceEvent.AddMethod
Dim baseAdder = baseType.GetMembers().OfType(Of MethodSymbol)().
Where(Function(m) m.ExplicitInterfaceImplementations.Any()).
Single(Function(m) m.ExplicitInterfaceImplementations.Single().MethodKind = MethodKind.EventAdd)
Assert.Equal(baseAdder, derivedType.FindImplementationForInterfaceMember(interfaceAdder))
Assert.Equal(baseAdder, baseType.FindImplementationForInterfaceMember(interfaceAdder))
Assert.Null(derivedType.FindImplementationForInterfaceMember(interfaceEvent))
Assert.Null(baseType.FindImplementationForInterfaceMember(interfaceEvent))
End Sub
<WorkItem(819295, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/819295")>
<Fact>
Public Sub CustomModifiers_01()
Dim ilSource = <![CDATA[
.class interface public abstract auto ansi I1
{
.method public newslot abstract strict virtual
instance int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) [] M1(int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) x) cil managed
{
} // end of method I1::M1
.method public newslot abstract strict virtual
instance int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) M2(int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) [] x) cil managed
{
} // end of method I1::M2
} // end of class I1
]]>.Value
Dim vbSource =
<compilation>
<file name="c.vb"><![CDATA[
Module Module1
Sub Main()
Dim v As I1 = New Implementation()
v.M1(Nothing)
v.M2(Nothing)
End Sub
End Module
Class Implementation
Implements I1
Public Function M1(x As Integer) As Integer() Implements I1.M1
System.Console.WriteLine("Implementation.M1")
Return Nothing
End Function
Public Function M2(x() As Integer) As Integer Implements I1.M2
System.Console.WriteLine("Implementation.M2")
Return Nothing
End Function
End Class
]]>
</file>
</compilation>
Dim reference As MetadataReference = Nothing
Using tempAssembly = IlasmUtilities.CreateTempAssembly(ilSource)
reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path))
End Using
Dim compilation = CreateEmptyCompilationWithReferences(vbSource, {MscorlibRef, MsvbRef, reference}, TestOptions.ReleaseExe.WithMetadataImportOptions(MetadataImportOptions.All))
CompileAndVerify(compilation,
<![CDATA[
Implementation.M1
Implementation.M2
]]>,
symbolValidator:=Sub(m As ModuleSymbol)
Dim t = m.GlobalNamespace.GetTypeMember("Implementation")
Dim m1 = t.GetMember(Of MethodSymbol)("M1")
Assert.Equal(0, m1.ExplicitInterfaceImplementations.Length)
Dim m1_stub = t.GetMember(Of MethodSymbol)("$VB$Stub_M1")
Assert.Equal("Function Implementation.$VB$Stub_M1(x As System.Int32 modopt(System.Runtime.CompilerServices.IsLong)) As System.Int32 modopt(System.Runtime.CompilerServices.IsLong) ()", m1_stub.ToTestDisplayString())
Assert.Equal(1, m1_stub.ExplicitInterfaceImplementations.Length)
Assert.Equal("Function I1.M1(x As System.Int32 modopt(System.Runtime.CompilerServices.IsLong)) As System.Int32 modopt(System.Runtime.CompilerServices.IsLong) ()", m1_stub.ExplicitInterfaceImplementations(0).ToTestDisplayString())
Assert.Equal(Accessibility.Private, m1_stub.DeclaredAccessibility)
Assert.True(m1_stub.IsMetadataVirtual)
Assert.True(m1_stub.IsMetadataNewSlot)
Assert.False(m1_stub.IsOverridable)
End Sub)
End Sub
<WorkItem(819295, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/819295")>
<Fact>
Public Sub CustomModifiers_02()
Dim ilSource = <![CDATA[
.class interface public abstract auto ansi I1
{
.method public newslot abstract strict virtual
instance !!T[] M1<T>(!!T modopt([mscorlib]System.Runtime.CompilerServices.IsLong) & x) cil managed
{
} // end of method I1::M1
.method public newslot abstract strict virtual
instance !!S modopt([mscorlib]System.Runtime.CompilerServices.IsLong) M2<S>(!!S modopt([mscorlib]System.Runtime.CompilerServices.IsLong) []& x) cil managed
{
} // end of method I1::M2
} // end of class I1
]]>.Value
Dim vbSource =
<compilation>
<file name="c.vb"><![CDATA[
Module Module1
Sub Main()
Dim v As I1 = New Implementation()
Dim x1 As Integer = 1
Dim x2 As Integer() = Nothing
v.M1(Of Integer)(x1)
System.Console.WriteLine(x1)
v.M2(Of Integer)(x2)
System.Console.WriteLine(x2)
End Sub
End Module
Class Implementation
Implements I1
Public Function M1(Of U)(ByRef x As U) As U() Implements I1.M1
System.Console.WriteLine("Implementation.M1")
x = Nothing
Return Nothing
End Function
Public Function M2(Of W)(ByRef x() As W) As W Implements I1.M2
System.Console.WriteLine("Implementation.M2")
x = New W() {}
Return Nothing
End Function
End Class
]]>
</file>
</compilation>
Dim reference As MetadataReference = Nothing
Using tempAssembly = IlasmUtilities.CreateTempAssembly(ilSource)
reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path))
End Using
Dim compilation = CreateEmptyCompilationWithReferences(vbSource, {MscorlibRef, MsvbRef, reference}, TestOptions.ReleaseExe.WithMetadataImportOptions(MetadataImportOptions.All))
CompileAndVerify(compilation,
<![CDATA[
Implementation.M1
0
Implementation.M2
System.Int32[]
]]>,
symbolValidator:=Sub(m As ModuleSymbol)
Dim t = m.GlobalNamespace.GetTypeMember("Implementation")
Dim m1_stub = t.GetMember(Of MethodSymbol)("$VB$Stub_M1")
Assert.Equal("Function Implementation.$VB$Stub_M1(Of U)(ByRef x As U modopt(System.Runtime.CompilerServices.IsLong)) As U()", m1_stub.ToTestDisplayString())
End Sub)
End Sub
<WorkItem(819295, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/819295")>
<Fact>
Public Sub CustomModifiers_03()
Dim ilSource = <![CDATA[
.class interface public abstract auto ansi I1
{
.method public newslot specialname abstract strict virtual
instance int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) [] get_P1(int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) x) cil managed
{
} // end of method I1::get_P1
.method public newslot specialname abstract strict virtual
instance void modopt([mscorlib]System.Runtime.CompilerServices.IsLong) set_P1(int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) x,
int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) [] Value) cil managed
{
} // end of method I1::set_P1
.method public newslot specialname abstract strict virtual
instance int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) get_P2() cil managed
{
} // end of method I1::get_P2
.method public newslot specialname abstract strict virtual
instance void modopt([mscorlib]System.Runtime.CompilerServices.IsLong) set_P2(int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) Value) cil managed
{
} // end of method I1::set_P2
.property instance int32[] P1(int32)
{
.get instance int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) [] I1::get_P1(int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) )
.set instance void modopt([mscorlib]System.Runtime.CompilerServices.IsLong) I1::set_P1(int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) ,
int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) [])
} // end of property I1::P1
.property instance int32 P2()
{
.get instance int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) I1::get_P2()
.set instance void modopt([mscorlib]System.Runtime.CompilerServices.IsLong) I1::set_P2(int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) )
} // end of property I1::P2
} // end of class I1
]]>.Value
Dim vbSource =
<compilation>
<file name="c.vb"><![CDATA[
Module Module1
Sub Main()
Dim v As I1 = New Implementation()
v.P1(Nothing) = v.P1(Nothing)
v.P2 = 123
System.Console.WriteLine(v.P2)
System.Console.WriteLine(DirectCast(v, Implementation).P2)
End Sub
End Module
Class Implementation
Implements I1
Public Property P1(x As Integer) As Integer() Implements I1.P1
Get
System.Console.WriteLine("Implementation.P1_get")
Return Nothing
End Get
Set(value As Integer())
System.Console.WriteLine("Implementation.P1_set")
End Set
End Property
Public Property P2 As Integer Implements I1.P2
End Class
]]>
</file>
</compilation>
Dim reference As MetadataReference = Nothing
Using tempAssembly = IlasmUtilities.CreateTempAssembly(ilSource)
reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path))
End Using
Dim compilation = CreateEmptyCompilationWithReferences(vbSource, {MscorlibRef, MsvbRef, reference}, TestOptions.ReleaseExe.WithMetadataImportOptions(MetadataImportOptions.All))
CompileAndVerify(compilation,
<![CDATA[
Implementation.P1_get
Implementation.P1_set
123
123
]]>)
End Sub
<WorkItem(819295, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/819295")>
<Fact>
Public Sub CustomModifiers_04()
Dim ilSource = <![CDATA[
.class interface public abstract auto ansi I1
{
.method public newslot abstract strict virtual
instance int32[] M1(int32 x) cil managed
{
} // end of method I1::M1
.method public newslot abstract strict virtual
instance int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) [] M2(int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) x) cil managed
{
} // end of method I1::M1
} // end of class I1
]]>.Value
Dim vbSource =
<compilation>
<file name="c.vb"><![CDATA[
Module Module1
Sub Main()
Dim v As I1 = New Implementation()
v.M1(Nothing)
v.M2(Nothing)
End Sub
End Module
Class Implementation
Implements I1
Public Function M12(x As Integer) As Integer() Implements I1.M1, I1.M2
System.Console.WriteLine("Implementation.M12")
Return Nothing
End Function
End Class
]]>
</file>
</compilation>
Dim reference As MetadataReference = Nothing
Using tempAssembly = IlasmUtilities.CreateTempAssembly(ilSource)
reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path))
End Using
Dim compilation = CreateEmptyCompilationWithReferences(vbSource, {MscorlibRef, MsvbRef, reference}, TestOptions.ReleaseExe.WithMetadataImportOptions(MetadataImportOptions.All))
CompileAndVerify(compilation,
<![CDATA[
Implementation.M12
Implementation.M12
]]>,
symbolValidator:=Sub(m As ModuleSymbol)
Dim t = m.GlobalNamespace.GetTypeMember("Implementation")
Dim m1 = t.GetMember(Of MethodSymbol)("M12")
Assert.Equal(1, m1.ExplicitInterfaceImplementations.Length)
Assert.Equal("Function I1.M1(x As System.Int32) As System.Int32()", m1.ExplicitInterfaceImplementations(0).ToTestDisplayString())
Dim m1_stub = t.GetMember(Of MethodSymbol)("$VB$Stub_M12")
Assert.Equal("Function Implementation.$VB$Stub_M12(x As System.Int32 modopt(System.Runtime.CompilerServices.IsLong)) As System.Int32 modopt(System.Runtime.CompilerServices.IsLong) ()", m1_stub.ToTestDisplayString())
Assert.Equal(1, m1_stub.ExplicitInterfaceImplementations.Length)
Assert.Equal("Function I1.M2(x As System.Int32 modopt(System.Runtime.CompilerServices.IsLong)) As System.Int32 modopt(System.Runtime.CompilerServices.IsLong) ()", m1_stub.ExplicitInterfaceImplementations(0).ToTestDisplayString())
End Sub)
End Sub
<WorkItem(819295, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/819295")>
<Fact>
Public Sub CustomModifiers_05()
Dim ilSource = <![CDATA[
.class interface public abstract auto ansi I1
{
.method public newslot abstract strict virtual
instance int32[] M1(int32 x) cil managed
{
} // end of method I1::M1
.method public newslot abstract strict virtual
instance int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) [] M2(int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) x) cil managed
{
} // end of method I1::M1
} // end of class I1
]]>.Value
Dim vbSource =
<compilation>
<file name="c.vb"><![CDATA[
Module Module1
Sub Main()
Dim v As I1 = New Implementation()
v.M1(Nothing)
v.M2(Nothing)
End Sub
End Module
Class Implementation
Implements I1
Public Function M12(x As Integer) As Integer() Implements I1.M2, I1.M1
System.Console.WriteLine("Implementation.M12")
Return Nothing
End Function
End Class
]]>
</file>
</compilation>
Dim reference As MetadataReference = Nothing
Using tempAssembly = IlasmUtilities.CreateTempAssembly(ilSource)
reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path))
End Using
Dim compilation = CreateEmptyCompilationWithReferences(vbSource, {MscorlibRef, MsvbRef, reference}, TestOptions.ReleaseExe.WithMetadataImportOptions(MetadataImportOptions.All))
CompileAndVerify(compilation,
<![CDATA[
Implementation.M12
Implementation.M12
]]>,
symbolValidator:=Sub(m As ModuleSymbol)
Dim t = m.GlobalNamespace.GetTypeMember("Implementation")
Dim m1 = t.GetMember(Of MethodSymbol)("M12")
Assert.Equal(1, m1.ExplicitInterfaceImplementations.Length)
Assert.Equal("Function I1.M1(x As System.Int32) As System.Int32()", m1.ExplicitInterfaceImplementations(0).ToTestDisplayString())
Dim m1_stub = t.GetMember(Of MethodSymbol)("$VB$Stub_M12")
Assert.Equal("Function Implementation.$VB$Stub_M12(x As System.Int32 modopt(System.Runtime.CompilerServices.IsLong)) As System.Int32 modopt(System.Runtime.CompilerServices.IsLong) ()", m1_stub.ToTestDisplayString())
Assert.Equal(1, m1_stub.ExplicitInterfaceImplementations.Length)
Assert.Equal("Function I1.M2(x As System.Int32 modopt(System.Runtime.CompilerServices.IsLong)) As System.Int32 modopt(System.Runtime.CompilerServices.IsLong) ()", m1_stub.ExplicitInterfaceImplementations(0).ToTestDisplayString())
End Sub)
End Sub
<WorkItem(819295, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/819295")>
<Fact>
Public Sub CustomModifiers_06()
Dim ilSource = <![CDATA[
.class interface public abstract auto ansi I1
{
.method public newslot abstract strict virtual
instance int32[] modopt([mscorlib]System.Runtime.CompilerServices.IsLong) M1(int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) x) cil managed
{
} // end of method I1::M1
.method public newslot abstract strict virtual
instance int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) [] M2(int32 x) cil managed
{
} // end of method I1::M1
} // end of class I1
]]>.Value
Dim vbSource =
<compilation>
<file name="c.vb"><![CDATA[
Module Module1
Sub Main()
Dim v As I1 = New Implementation()
v.M1(Nothing)
v.M2(Nothing)
End Sub
End Module
Class Implementation
Implements I1
Public Function M12(x As Integer) As Integer() Implements I1.M2, I1.M1
System.Console.WriteLine("Implementation.M12")
Return Nothing
End Function
End Class
]]>
</file>
</compilation>
Dim reference As MetadataReference = Nothing
Using tempAssembly = IlasmUtilities.CreateTempAssembly(ilSource)
reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path))
End Using
Dim compilation = CreateEmptyCompilationWithReferences(vbSource, {MscorlibRef, MsvbRef, reference}, TestOptions.ReleaseExe.WithMetadataImportOptions(MetadataImportOptions.All))
CompileAndVerify(compilation,
<![CDATA[
Implementation.M12
Implementation.M12
]]>,
symbolValidator:=Sub(m As ModuleSymbol)
Dim t = m.GlobalNamespace.GetTypeMember("Implementation")
Dim m1 = t.GetMember(Of MethodSymbol)("M12")
Assert.Equal(0, m1.ExplicitInterfaceImplementations.Length)
Dim m12_stubs = t.GetMembers("$VB$Stub_M12")
Assert.Equal(2, m12_stubs.Length)
Dim m1_stub As MethodSymbol
Dim m2_stub As MethodSymbol
If DirectCast(m12_stubs(0), MethodSymbol).ReturnTypeCustomModifiers.IsEmpty Then
m2_stub = DirectCast(m12_stubs(0), MethodSymbol)
m1_stub = DirectCast(m12_stubs(1), MethodSymbol)
Else
m2_stub = DirectCast(m12_stubs(1), MethodSymbol)
m1_stub = DirectCast(m12_stubs(0), MethodSymbol)
End If
Assert.Equal("Function Implementation.$VB$Stub_M12(x As System.Int32 modopt(System.Runtime.CompilerServices.IsLong)) As System.Int32() modopt(System.Runtime.CompilerServices.IsLong)", m1_stub.ToTestDisplayString())
Assert.Equal(1, m1_stub.ExplicitInterfaceImplementations.Length)
Assert.Equal("Function I1.M1(x As System.Int32 modopt(System.Runtime.CompilerServices.IsLong)) As System.Int32() modopt(System.Runtime.CompilerServices.IsLong)", m1_stub.ExplicitInterfaceImplementations(0).ToTestDisplayString())
Assert.Equal("Function Implementation.$VB$Stub_M12(x As System.Int32) As System.Int32 modopt(System.Runtime.CompilerServices.IsLong) ()", m2_stub.ToTestDisplayString())
Assert.Equal(1, m2_stub.ExplicitInterfaceImplementations.Length)
Assert.Equal("Function I1.M2(x As System.Int32) As System.Int32 modopt(System.Runtime.CompilerServices.IsLong) ()", m2_stub.ExplicitInterfaceImplementations(0).ToTestDisplayString())
End Sub)
End Sub
<WorkItem(819295, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/819295")>
<Fact>
Public Sub CustomModifiers_07()
Dim ilSource = <![CDATA[
.class interface public abstract auto ansi I1
{
.method public newslot abstract strict virtual
instance int32[] modopt([mscorlib]System.Runtime.CompilerServices.IsLong) M1(int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) x) cil managed
{
} // end of method I1::M1
.method public newslot abstract strict virtual
instance int32[] modopt([mscorlib]System.Runtime.CompilerServices.IsLong) M2(int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) x) cil managed
{
} // end of method I1::M1
} // end of class I1
]]>.Value
Dim vbSource =
<compilation>
<file name="c.vb"><![CDATA[
Module Module1
Sub Main()
Dim v As I1 = New Implementation()
v.M1(Nothing)
v.M2(Nothing)
End Sub
End Module
Class Implementation
Implements I1
Public Function M12(x As Integer) As Integer() Implements I1.M2, I1.M1
System.Console.WriteLine("Implementation.M12")
Return Nothing
End Function
End Class
]]>
</file>
</compilation>
Dim reference As MetadataReference = Nothing
Using tempAssembly = IlasmUtilities.CreateTempAssembly(ilSource)
reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path))
End Using
Dim compilation = CreateEmptyCompilationWithReferences(vbSource, {MscorlibRef, MsvbRef, reference}, TestOptions.ReleaseExe.WithMetadataImportOptions(MetadataImportOptions.All))
CompileAndVerify(compilation,
<![CDATA[
Implementation.M12
Implementation.M12
]]>,
symbolValidator:=Sub(m As ModuleSymbol)
Dim t = m.GlobalNamespace.GetTypeMember("Implementation")
Dim m1 = t.GetMember(Of MethodSymbol)("M12")
Assert.Equal(0, m1.ExplicitInterfaceImplementations.Length)
Dim m12_stub = t.GetMember(Of MethodSymbol)("$VB$Stub_M12")
Assert.Equal(2, m12_stub.ExplicitInterfaceImplementations.Length)
End Sub)
End Sub
<WorkItem(819295, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/819295")>
<Fact>
Public Sub CustomModifiers_08()
Dim ilSource = <![CDATA[
.class interface public abstract auto ansi I1
{
.method public newslot abstract strict virtual
instance int32[] M1(int32 & modopt([mscorlib]System.Runtime.CompilerServices.IsLong) x) cil managed
{
} // end of method I1::M1
.method public newslot abstract strict virtual
instance int32[] M2(int32 modopt([mscorlib]System.Runtime.CompilerServices.IsLong) & x) cil managed
{
} // end of method I1::M1
} // end of class I1
]]>.Value
Dim vbSource =
<compilation>
<file name="c.vb"><![CDATA[
Module Module1
Sub Main()
Dim v As I1 = New Implementation()
v.M1(Nothing)
v.M2(Nothing)
End Sub
End Module
Class Implementation
Implements I1
Public Function M12(ByRef x As Integer) As Integer() Implements I1.M2, I1.M1
System.Console.WriteLine("Implementation.M12")
Return Nothing
End Function
End Class
]]>
</file>
</compilation>
Dim reference As MetadataReference = Nothing
Using tempAssembly = IlasmUtilities.CreateTempAssembly(ilSource)
reference = MetadataReference.CreateFromImage(ReadFromFile(tempAssembly.Path))
End Using
Dim compilation = CreateEmptyCompilationWithReferences(vbSource, {MscorlibRef, MsvbRef, reference}, TestOptions.ReleaseExe.WithMetadataImportOptions(MetadataImportOptions.All))
CompileAndVerify(compilation,
<![CDATA[
Implementation.M12
Implementation.M12
]]>,
symbolValidator:=Sub(m As ModuleSymbol)
Dim t = m.GlobalNamespace.GetTypeMember("Implementation")
Dim m1 = t.GetMember(Of MethodSymbol)("M12")
Assert.Equal(0, m1.ExplicitInterfaceImplementations.Length)
Dim m12_stubs = t.GetMembers("$VB$Stub_M12")
Assert.Equal(2, m12_stubs.Length)
For Each stub As MethodSymbol In m12_stubs
Assert.Equal(1, stub.ExplicitInterfaceImplementations.Length)
Next
End Sub)
End Sub
End Class
End Namespace
|
Imports System
Imports Data = lombok.Data
Imports EqualsAndHashCode = lombok.EqualsAndHashCode
Imports val = lombok.val
Imports InputType = org.deeplearning4j.nn.conf.inputs.InputType
Imports InvalidInputTypeException = org.deeplearning4j.nn.conf.inputs.InvalidInputTypeException
Imports LayerMemoryReport = org.deeplearning4j.nn.conf.memory.LayerMemoryReport
Imports MemoryReport = org.deeplearning4j.nn.conf.memory.MemoryReport
Imports ComputationGraph = org.deeplearning4j.nn.graph.ComputationGraph
Imports DataType = org.nd4j.linalg.api.buffer.DataType
Imports INDArray = org.nd4j.linalg.api.ndarray.INDArray
Imports JsonProperty = org.nd4j.shade.jackson.annotation.JsonProperty
'
' * ******************************************************************************
' * *
' * *
' * * This program and the accompanying materials are made available under the
' * * terms of the Apache License, Version 2.0 which is available at
' * * https://www.apache.org/licenses/LICENSE-2.0.
' * *
' * * See the NOTICE file distributed with this work for additional
' * * information regarding copyright ownership.
' * * Unless required by applicable law or agreed to in writing, software
' * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
' * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
' * * License for the specific language governing permissions and limitations
' * * under the License.
' * *
' * * SPDX-License-Identifier: Apache-2.0
' * *****************************************************************************
'
Namespace org.deeplearning4j.nn.conf.graph
'JAVA TO VB CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
'ORIGINAL LINE: @Data @EqualsAndHashCode(callSuper = false) public class L2NormalizeVertex extends GraphVertex
<Serializable>
Public Class L2NormalizeVertex
Inherits GraphVertex
Public Const DEFAULT_EPS As Double = 1e-8
Protected Friend dimension() As Integer
Protected Friend eps As Double
Public Sub New()
Me.New(Nothing, DEFAULT_EPS)
End Sub
'JAVA TO VB CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
'ORIGINAL LINE: public L2NormalizeVertex(@JsonProperty("dimension") int[] dimension, @JsonProperty("eps") double eps)
Public Sub New(ByVal dimension() As Integer, ByVal eps As Double)
Me.dimension = dimension
Me.eps = eps
End Sub
Public Overrides Function clone() As L2NormalizeVertex
Return New L2NormalizeVertex(dimension, eps)
End Function
Public Overrides Function numParams(ByVal backprop As Boolean) As Long
Return 0
End Function
Public Overrides Function minVertexInputs() As Integer
Return 1
End Function
Public Overrides Function maxVertexInputs() As Integer
Return 1
End Function
Public Overrides Function instantiate(ByVal graph As ComputationGraph, ByVal name As String, ByVal idx As Integer, ByVal paramsView As INDArray, ByVal initializeParams As Boolean, ByVal networkDatatype As DataType) As org.deeplearning4j.nn.graph.vertex.GraphVertex
Return New org.deeplearning4j.nn.graph.vertex.impl.L2NormalizeVertex(graph, name, idx, dimension, eps, networkDatatype)
End Function
'JAVA TO VB CONVERTER WARNING: Method 'throws' clauses are not available in VB:
'ORIGINAL LINE: @Override public org.deeplearning4j.nn.conf.inputs.InputType getOutputType(int layerIndex, org.deeplearning4j.nn.conf.inputs.InputType... vertexInputs) throws org.deeplearning4j.nn.conf.inputs.InvalidInputTypeException
Public Overrides Function getOutputType(ByVal layerIndex As Integer, ParamArray ByVal vertexInputs() As InputType) As InputType
If vertexInputs.Length = 1 Then
Return vertexInputs(0)
End If
Dim first As InputType = vertexInputs(0)
Return first 'Same output shape/size as
End Function
Public Overrides Function getMemoryReport(ParamArray ByVal inputTypes() As InputType) As MemoryReport
Dim outputType As InputType = getOutputType(-1, inputTypes)
'norm2 value (inference working mem): 1 per example during forward pass
'Training working mem: 2 per example + 2x input size + 1 per example (in addition to epsilons)
Dim trainModePerEx As val = 3 + 2 * inputTypes(0).arrayElementsPerExample()
Return (New LayerMemoryReport.Builder(Nothing, GetType(L2NormalizeVertex), inputTypes(0), outputType)).standardMemory(0, 0).workingMemory(0, 1, 0, trainModePerEx).cacheMemory(0, 0).build()
End Function
End Class
End Namespace |
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
<Assembly: AssemblyTitle("WindowsApplication1")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("WindowsApplication1")>
<Assembly: AssemblyCopyright("Copyright © 2012")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(False)>
'The following GUID is for the ID of the typelib if this project is exposed to COM
<Assembly: Guid("c84f09af-85a8-4e4b-9a52-bd5bbd67b323")>
' Version information for an assembly consists of the following four values:
'
' Major Version
' Minor Version
' Build Number
' Revision
'
' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
Imports org.deeplearning4j.models.sequencevectors
Imports ListenerEvent = org.deeplearning4j.models.sequencevectors.enums.ListenerEvent
Imports SequenceElement = org.deeplearning4j.models.sequencevectors.sequence.SequenceElement
'
' * ******************************************************************************
' * *
' * *
' * * This program and the accompanying materials are made available under the
' * * terms of the Apache License, Version 2.0 which is available at
' * * https://www.apache.org/licenses/LICENSE-2.0.
' * *
' * * See the NOTICE file distributed with this work for additional
' * * information regarding copyright ownership.
' * * Unless required by applicable law or agreed to in writing, software
' * * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
' * * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
' * * License for the specific language governing permissions and limitations
' * * under the License.
' * *
' * * SPDX-License-Identifier: Apache-2.0
' * *****************************************************************************
'
Namespace org.deeplearning4j.models.sequencevectors.interfaces
Public Interface VectorsListener(Of T As org.deeplearning4j.models.sequencevectors.sequence.SequenceElement)
''' <summary>
''' This method is called prior each processEvent call, to check if this specific VectorsListener implementation is viable for specific event
''' </summary>
''' <param name="event"> </param>
''' <param name="argument"> </param>
''' <returns> TRUE, if this event can and should be processed with this listener, FALSE otherwise </returns>
Function validateEvent(ByVal [event] As ListenerEvent, ByVal argument As Long) As Boolean
''' <summary>
''' This method is called at each epoch end
''' </summary>
''' <param name="event"> </param>
''' <param name="sequenceVectors"> </param>
Sub processEvent(ByVal [event] As ListenerEvent, ByVal sequenceVectors As SequenceVectors(Of T), ByVal argument As Long)
End Interface
End Namespace |
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:2.0.50727.3053
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict Off
Option Explicit On
'''<summary>
'''Represents a strongly typed in-memory cache of data.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"), _
Global.System.Serializable(), _
Global.System.ComponentModel.DesignerCategoryAttribute("code"), _
Global.System.ComponentModel.ToolboxItem(true), _
Global.System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedDataSetSchema"), _
Global.System.Xml.Serialization.XmlRootAttribute("DataSetCashCountDaily"), _
Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.DataSet")> _
Partial Public Class DataSetCashCountDaily
Inherits Global.System.Data.DataSet
Private tabletblPatientReceipt As tblPatientReceiptDataTable
Private _schemaSerializationMode As Global.System.Data.SchemaSerializationMode = Global.System.Data.SchemaSerializationMode.IncludeSchema
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Sub New()
MyBase.New
Me.BeginInit
Me.InitClass
Dim schemaChangedHandler As Global.System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged
AddHandler MyBase.Tables.CollectionChanged, schemaChangedHandler
AddHandler MyBase.Relations.CollectionChanged, schemaChangedHandler
Me.EndInit
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Protected Sub New(ByVal info As Global.System.Runtime.Serialization.SerializationInfo, ByVal context As Global.System.Runtime.Serialization.StreamingContext)
MyBase.New(info, context, false)
If (Me.IsBinarySerialized(info, context) = true) Then
Me.InitVars(false)
Dim schemaChangedHandler1 As Global.System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged
AddHandler Me.Tables.CollectionChanged, schemaChangedHandler1
AddHandler Me.Relations.CollectionChanged, schemaChangedHandler1
Return
End If
Dim strSchema As String = CType(info.GetValue("XmlSchema", GetType(String)),String)
If (Me.DetermineSchemaSerializationMode(info, context) = Global.System.Data.SchemaSerializationMode.IncludeSchema) Then
Dim ds As Global.System.Data.DataSet = New Global.System.Data.DataSet
ds.ReadXmlSchema(New Global.System.Xml.XmlTextReader(New Global.System.IO.StringReader(strSchema)))
If (Not (ds.Tables("tblPatientReceipt")) Is Nothing) Then
MyBase.Tables.Add(New tblPatientReceiptDataTable(ds.Tables("tblPatientReceipt")))
End If
Me.DataSetName = ds.DataSetName
Me.Prefix = ds.Prefix
Me.Namespace = ds.Namespace
Me.Locale = ds.Locale
Me.CaseSensitive = ds.CaseSensitive
Me.EnforceConstraints = ds.EnforceConstraints
Me.Merge(ds, false, Global.System.Data.MissingSchemaAction.Add)
Me.InitVars
Else
Me.ReadXmlSchema(New Global.System.Xml.XmlTextReader(New Global.System.IO.StringReader(strSchema)))
End If
Me.GetSerializationData(info, context)
Dim schemaChangedHandler As Global.System.ComponentModel.CollectionChangeEventHandler = AddressOf Me.SchemaChanged
AddHandler MyBase.Tables.CollectionChanged, schemaChangedHandler
AddHandler Me.Relations.CollectionChanged, schemaChangedHandler
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.ComponentModel.Browsable(false), _
Global.System.ComponentModel.DesignerSerializationVisibility(Global.System.ComponentModel.DesignerSerializationVisibility.Content)> _
Public ReadOnly Property tblPatientReceipt() As tblPatientReceiptDataTable
Get
Return Me.tabletblPatientReceipt
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.ComponentModel.BrowsableAttribute(true), _
Global.System.ComponentModel.DesignerSerializationVisibilityAttribute(Global.System.ComponentModel.DesignerSerializationVisibility.Visible)> _
Public Overrides Property SchemaSerializationMode() As Global.System.Data.SchemaSerializationMode
Get
Return Me._schemaSerializationMode
End Get
Set
Me._schemaSerializationMode = value
End Set
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.ComponentModel.DesignerSerializationVisibilityAttribute(Global.System.ComponentModel.DesignerSerializationVisibility.Hidden)> _
Public Shadows ReadOnly Property Tables() As Global.System.Data.DataTableCollection
Get
Return MyBase.Tables
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.ComponentModel.DesignerSerializationVisibilityAttribute(Global.System.ComponentModel.DesignerSerializationVisibility.Hidden)> _
Public Shadows ReadOnly Property Relations() As Global.System.Data.DataRelationCollection
Get
Return MyBase.Relations
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Protected Overrides Sub InitializeDerivedDataSet()
Me.BeginInit
Me.InitClass
Me.EndInit
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Overrides Function Clone() As Global.System.Data.DataSet
Dim cln As DataSetCashCountDaily = CType(MyBase.Clone,DataSetCashCountDaily)
cln.InitVars
cln.SchemaSerializationMode = Me.SchemaSerializationMode
Return cln
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Protected Overrides Function ShouldSerializeTables() As Boolean
Return false
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Protected Overrides Function ShouldSerializeRelations() As Boolean
Return false
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Protected Overrides Sub ReadXmlSerializable(ByVal reader As Global.System.Xml.XmlReader)
If (Me.DetermineSchemaSerializationMode(reader) = Global.System.Data.SchemaSerializationMode.IncludeSchema) Then
Me.Reset
Dim ds As Global.System.Data.DataSet = New Global.System.Data.DataSet
ds.ReadXml(reader)
If (Not (ds.Tables("tblPatientReceipt")) Is Nothing) Then
MyBase.Tables.Add(New tblPatientReceiptDataTable(ds.Tables("tblPatientReceipt")))
End If
Me.DataSetName = ds.DataSetName
Me.Prefix = ds.Prefix
Me.Namespace = ds.Namespace
Me.Locale = ds.Locale
Me.CaseSensitive = ds.CaseSensitive
Me.EnforceConstraints = ds.EnforceConstraints
Me.Merge(ds, false, Global.System.Data.MissingSchemaAction.Add)
Me.InitVars
Else
Me.ReadXml(reader)
Me.InitVars
End If
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Protected Overrides Function GetSchemaSerializable() As Global.System.Xml.Schema.XmlSchema
Dim stream As Global.System.IO.MemoryStream = New Global.System.IO.MemoryStream
Me.WriteXmlSchema(New Global.System.Xml.XmlTextWriter(stream, Nothing))
stream.Position = 0
Return Global.System.Xml.Schema.XmlSchema.Read(New Global.System.Xml.XmlTextReader(stream), Nothing)
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Friend Overloads Sub InitVars()
Me.InitVars(true)
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Friend Overloads Sub InitVars(ByVal initTable As Boolean)
Me.tabletblPatientReceipt = CType(MyBase.Tables("tblPatientReceipt"),tblPatientReceiptDataTable)
If (initTable = true) Then
If (Not (Me.tabletblPatientReceipt) Is Nothing) Then
Me.tabletblPatientReceipt.InitVars
End If
End If
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Private Sub InitClass()
Me.DataSetName = "DataSetCashCountDaily"
Me.Prefix = ""
Me.Namespace = "http://tempuri.org/DataSetCashCountDaily.xsd"
Me.EnforceConstraints = true
Me.SchemaSerializationMode = Global.System.Data.SchemaSerializationMode.IncludeSchema
Me.tabletblPatientReceipt = New tblPatientReceiptDataTable
MyBase.Tables.Add(Me.tabletblPatientReceipt)
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Private Function ShouldSerializetblPatientReceipt() As Boolean
Return false
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Private Sub SchemaChanged(ByVal sender As Object, ByVal e As Global.System.ComponentModel.CollectionChangeEventArgs)
If (e.Action = Global.System.ComponentModel.CollectionChangeAction.Remove) Then
Me.InitVars
End If
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Shared Function GetTypedDataSetSchema(ByVal xs As Global.System.Xml.Schema.XmlSchemaSet) As Global.System.Xml.Schema.XmlSchemaComplexType
Dim ds As DataSetCashCountDaily = New DataSetCashCountDaily
Dim type As Global.System.Xml.Schema.XmlSchemaComplexType = New Global.System.Xml.Schema.XmlSchemaComplexType
Dim sequence As Global.System.Xml.Schema.XmlSchemaSequence = New Global.System.Xml.Schema.XmlSchemaSequence
Dim any As Global.System.Xml.Schema.XmlSchemaAny = New Global.System.Xml.Schema.XmlSchemaAny
any.Namespace = ds.Namespace
sequence.Items.Add(any)
type.Particle = sequence
Dim dsSchema As Global.System.Xml.Schema.XmlSchema = ds.GetSchemaSerializable
If xs.Contains(dsSchema.TargetNamespace) Then
Dim s1 As Global.System.IO.MemoryStream = New Global.System.IO.MemoryStream
Dim s2 As Global.System.IO.MemoryStream = New Global.System.IO.MemoryStream
Try
Dim schema As Global.System.Xml.Schema.XmlSchema = Nothing
dsSchema.Write(s1)
Dim schemas As Global.System.Collections.IEnumerator = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator
Do While schemas.MoveNext
schema = CType(schemas.Current,Global.System.Xml.Schema.XmlSchema)
s2.SetLength(0)
schema.Write(s2)
If (s1.Length = s2.Length) Then
s1.Position = 0
s2.Position = 0
Do While ((s1.Position <> s1.Length) _
AndAlso (s1.ReadByte = s2.ReadByte))
Loop
If (s1.Position = s1.Length) Then
Return type
End If
End If
Loop
Finally
If (Not (s1) Is Nothing) Then
s1.Close
End If
If (Not (s2) Is Nothing) Then
s2.Close
End If
End Try
End If
xs.Add(dsSchema)
Return type
End Function
Public Delegate Sub tblPatientReceiptRowChangeEventHandler(ByVal sender As Object, ByVal e As tblPatientReceiptRowChangeEvent)
'''<summary>
'''Represents the strongly named DataTable class.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"), _
Global.System.Serializable(), _
Global.System.Xml.Serialization.XmlSchemaProviderAttribute("GetTypedTableSchema")> _
Partial Public Class tblPatientReceiptDataTable
Inherits Global.System.Data.DataTable
Implements Global.System.Collections.IEnumerable
Private columnDateIn As Global.System.Data.DataColumn
Private columnCashUSD As Global.System.Data.DataColumn
Private columnCashRiel As Global.System.Data.DataColumn
Private columnOutPatientUSD As Global.System.Data.DataColumn
Private columnOutPatientRiel As Global.System.Data.DataColumn
Private columnInPatientUSD As Global.System.Data.DataColumn
Private columnInPatientRiel As Global.System.Data.DataColumn
Private columnGlassFeeUSD As Global.System.Data.DataColumn
Private columnGlassFeeRiel As Global.System.Data.DataColumn
Private columnArtificialEyeFeeUSD As Global.System.Data.DataColumn
Private columnArtificialEyeFeeRiel As Global.System.Data.DataColumn
Private columnOtherFeeUSD As Global.System.Data.DataColumn
Private columnOtherFeeRiel As Global.System.Data.DataColumn
Private columnHN As Global.System.Data.DataColumn
Private columnID As Global.System.Data.DataColumn
Private columnIDCashReceipt As Global.System.Data.DataColumn
Private columnReceiptNo As Global.System.Data.DataColumn
Private columnHN1 As Global.System.Data.DataColumn
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Sub New()
MyBase.New
Me.TableName = "tblPatientReceipt"
Me.BeginInit
Me.InitClass
Me.EndInit
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Friend Sub New(ByVal table As Global.System.Data.DataTable)
MyBase.New
Me.TableName = table.TableName
If (table.CaseSensitive <> table.DataSet.CaseSensitive) Then
Me.CaseSensitive = table.CaseSensitive
End If
If (table.Locale.ToString <> table.DataSet.Locale.ToString) Then
Me.Locale = table.Locale
End If
If (table.Namespace <> table.DataSet.Namespace) Then
Me.Namespace = table.Namespace
End If
Me.Prefix = table.Prefix
Me.MinimumCapacity = table.MinimumCapacity
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Protected Sub New(ByVal info As Global.System.Runtime.Serialization.SerializationInfo, ByVal context As Global.System.Runtime.Serialization.StreamingContext)
MyBase.New(info, context)
Me.InitVars
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public ReadOnly Property DateInColumn() As Global.System.Data.DataColumn
Get
Return Me.columnDateIn
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public ReadOnly Property CashUSDColumn() As Global.System.Data.DataColumn
Get
Return Me.columnCashUSD
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public ReadOnly Property CashRielColumn() As Global.System.Data.DataColumn
Get
Return Me.columnCashRiel
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public ReadOnly Property OutPatientUSDColumn() As Global.System.Data.DataColumn
Get
Return Me.columnOutPatientUSD
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public ReadOnly Property OutPatientRielColumn() As Global.System.Data.DataColumn
Get
Return Me.columnOutPatientRiel
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public ReadOnly Property InPatientUSDColumn() As Global.System.Data.DataColumn
Get
Return Me.columnInPatientUSD
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public ReadOnly Property InPatientRielColumn() As Global.System.Data.DataColumn
Get
Return Me.columnInPatientRiel
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public ReadOnly Property GlassFeeUSDColumn() As Global.System.Data.DataColumn
Get
Return Me.columnGlassFeeUSD
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public ReadOnly Property GlassFeeRielColumn() As Global.System.Data.DataColumn
Get
Return Me.columnGlassFeeRiel
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public ReadOnly Property ArtificialEyeFeeUSDColumn() As Global.System.Data.DataColumn
Get
Return Me.columnArtificialEyeFeeUSD
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public ReadOnly Property ArtificialEyeFeeRielColumn() As Global.System.Data.DataColumn
Get
Return Me.columnArtificialEyeFeeRiel
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public ReadOnly Property OtherFeeUSDColumn() As Global.System.Data.DataColumn
Get
Return Me.columnOtherFeeUSD
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public ReadOnly Property OtherFeeRielColumn() As Global.System.Data.DataColumn
Get
Return Me.columnOtherFeeRiel
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public ReadOnly Property HNColumn() As Global.System.Data.DataColumn
Get
Return Me.columnHN
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public ReadOnly Property IDColumn() As Global.System.Data.DataColumn
Get
Return Me.columnID
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public ReadOnly Property IDCashReceiptColumn() As Global.System.Data.DataColumn
Get
Return Me.columnIDCashReceipt
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public ReadOnly Property ReceiptNoColumn() As Global.System.Data.DataColumn
Get
Return Me.columnReceiptNo
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public ReadOnly Property HN1Column() As Global.System.Data.DataColumn
Get
Return Me.columnHN1
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.ComponentModel.Browsable(false)> _
Public ReadOnly Property Count() As Integer
Get
Return Me.Rows.Count
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Default ReadOnly Property Item(ByVal index As Integer) As tblPatientReceiptRow
Get
Return CType(Me.Rows(index),tblPatientReceiptRow)
End Get
End Property
Public Event tblPatientReceiptRowChanging As tblPatientReceiptRowChangeEventHandler
Public Event tblPatientReceiptRowChanged As tblPatientReceiptRowChangeEventHandler
Public Event tblPatientReceiptRowDeleting As tblPatientReceiptRowChangeEventHandler
Public Event tblPatientReceiptRowDeleted As tblPatientReceiptRowChangeEventHandler
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Overloads Sub AddtblPatientReceiptRow(ByVal row As tblPatientReceiptRow)
Me.Rows.Add(row)
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Overloads Function AddtblPatientReceiptRow( _
ByVal DateIn As String, _
ByVal CashUSD As Double, _
ByVal CashRiel As Double, _
ByVal OutPatientUSD As Double, _
ByVal OutPatientRiel As Double, _
ByVal InPatientUSD As Double, _
ByVal InPatientRiel As Double, _
ByVal GlassFeeUSD As Double, _
ByVal GlassFeeRiel As Double, _
ByVal ArtificialEyeFeeUSD As Double, _
ByVal ArtificialEyeFeeRiel As Double, _
ByVal OtherFeeUSD As Double, _
ByVal OtherFeeRiel As Double, _
ByVal HN As Long, _
ByVal IDCashReceipt As String, _
ByVal ReceiptNo As Long, _
ByVal HN1 As Decimal) As tblPatientReceiptRow
Dim rowtblPatientReceiptRow As tblPatientReceiptRow = CType(Me.NewRow,tblPatientReceiptRow)
Dim columnValuesArray() As Object = New Object() {DateIn, CashUSD, CashRiel, OutPatientUSD, OutPatientRiel, InPatientUSD, InPatientRiel, GlassFeeUSD, GlassFeeRiel, ArtificialEyeFeeUSD, ArtificialEyeFeeRiel, OtherFeeUSD, OtherFeeRiel, HN, Nothing, IDCashReceipt, ReceiptNo, HN1}
rowtblPatientReceiptRow.ItemArray = columnValuesArray
Me.Rows.Add(rowtblPatientReceiptRow)
Return rowtblPatientReceiptRow
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Function FindByIDReceiptNo(ByVal ID As Long, ByVal ReceiptNo As Long) As tblPatientReceiptRow
Return CType(Me.Rows.Find(New Object() {ID, ReceiptNo}),tblPatientReceiptRow)
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Overridable Function GetEnumerator() As Global.System.Collections.IEnumerator Implements Global.System.Collections.IEnumerable.GetEnumerator
Return Me.Rows.GetEnumerator
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Overrides Function Clone() As Global.System.Data.DataTable
Dim cln As tblPatientReceiptDataTable = CType(MyBase.Clone,tblPatientReceiptDataTable)
cln.InitVars
Return cln
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Protected Overrides Function CreateInstance() As Global.System.Data.DataTable
Return New tblPatientReceiptDataTable
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Friend Sub InitVars()
Me.columnDateIn = MyBase.Columns("DateIn")
Me.columnCashUSD = MyBase.Columns("CashUSD")
Me.columnCashRiel = MyBase.Columns("CashRiel")
Me.columnOutPatientUSD = MyBase.Columns("OutPatientUSD")
Me.columnOutPatientRiel = MyBase.Columns("OutPatientRiel")
Me.columnInPatientUSD = MyBase.Columns("InPatientUSD")
Me.columnInPatientRiel = MyBase.Columns("InPatientRiel")
Me.columnGlassFeeUSD = MyBase.Columns("GlassFeeUSD")
Me.columnGlassFeeRiel = MyBase.Columns("GlassFeeRiel")
Me.columnArtificialEyeFeeUSD = MyBase.Columns("ArtificialEyeFeeUSD")
Me.columnArtificialEyeFeeRiel = MyBase.Columns("ArtificialEyeFeeRiel")
Me.columnOtherFeeUSD = MyBase.Columns("OtherFeeUSD")
Me.columnOtherFeeRiel = MyBase.Columns("OtherFeeRiel")
Me.columnHN = MyBase.Columns("HN")
Me.columnID = MyBase.Columns("ID")
Me.columnIDCashReceipt = MyBase.Columns("IDCashReceipt")
Me.columnReceiptNo = MyBase.Columns("ReceiptNo")
Me.columnHN1 = MyBase.Columns("HN1")
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Private Sub InitClass()
Me.columnDateIn = New Global.System.Data.DataColumn("DateIn", GetType(String), Nothing, Global.System.Data.MappingType.Element)
MyBase.Columns.Add(Me.columnDateIn)
Me.columnCashUSD = New Global.System.Data.DataColumn("CashUSD", GetType(Double), Nothing, Global.System.Data.MappingType.Element)
MyBase.Columns.Add(Me.columnCashUSD)
Me.columnCashRiel = New Global.System.Data.DataColumn("CashRiel", GetType(Double), Nothing, Global.System.Data.MappingType.Element)
MyBase.Columns.Add(Me.columnCashRiel)
Me.columnOutPatientUSD = New Global.System.Data.DataColumn("OutPatientUSD", GetType(Double), Nothing, Global.System.Data.MappingType.Element)
MyBase.Columns.Add(Me.columnOutPatientUSD)
Me.columnOutPatientRiel = New Global.System.Data.DataColumn("OutPatientRiel", GetType(Double), Nothing, Global.System.Data.MappingType.Element)
MyBase.Columns.Add(Me.columnOutPatientRiel)
Me.columnInPatientUSD = New Global.System.Data.DataColumn("InPatientUSD", GetType(Double), Nothing, Global.System.Data.MappingType.Element)
MyBase.Columns.Add(Me.columnInPatientUSD)
Me.columnInPatientRiel = New Global.System.Data.DataColumn("InPatientRiel", GetType(Double), Nothing, Global.System.Data.MappingType.Element)
MyBase.Columns.Add(Me.columnInPatientRiel)
Me.columnGlassFeeUSD = New Global.System.Data.DataColumn("GlassFeeUSD", GetType(Double), Nothing, Global.System.Data.MappingType.Element)
MyBase.Columns.Add(Me.columnGlassFeeUSD)
Me.columnGlassFeeRiel = New Global.System.Data.DataColumn("GlassFeeRiel", GetType(Double), Nothing, Global.System.Data.MappingType.Element)
MyBase.Columns.Add(Me.columnGlassFeeRiel)
Me.columnArtificialEyeFeeUSD = New Global.System.Data.DataColumn("ArtificialEyeFeeUSD", GetType(Double), Nothing, Global.System.Data.MappingType.Element)
MyBase.Columns.Add(Me.columnArtificialEyeFeeUSD)
Me.columnArtificialEyeFeeRiel = New Global.System.Data.DataColumn("ArtificialEyeFeeRiel", GetType(Double), Nothing, Global.System.Data.MappingType.Element)
MyBase.Columns.Add(Me.columnArtificialEyeFeeRiel)
Me.columnOtherFeeUSD = New Global.System.Data.DataColumn("OtherFeeUSD", GetType(Double), Nothing, Global.System.Data.MappingType.Element)
MyBase.Columns.Add(Me.columnOtherFeeUSD)
Me.columnOtherFeeRiel = New Global.System.Data.DataColumn("OtherFeeRiel", GetType(Double), Nothing, Global.System.Data.MappingType.Element)
MyBase.Columns.Add(Me.columnOtherFeeRiel)
Me.columnHN = New Global.System.Data.DataColumn("HN", GetType(Long), Nothing, Global.System.Data.MappingType.Element)
MyBase.Columns.Add(Me.columnHN)
Me.columnID = New Global.System.Data.DataColumn("ID", GetType(Long), Nothing, Global.System.Data.MappingType.Element)
MyBase.Columns.Add(Me.columnID)
Me.columnIDCashReceipt = New Global.System.Data.DataColumn("IDCashReceipt", GetType(String), Nothing, Global.System.Data.MappingType.Element)
MyBase.Columns.Add(Me.columnIDCashReceipt)
Me.columnReceiptNo = New Global.System.Data.DataColumn("ReceiptNo", GetType(Long), Nothing, Global.System.Data.MappingType.Element)
MyBase.Columns.Add(Me.columnReceiptNo)
Me.columnHN1 = New Global.System.Data.DataColumn("HN1", GetType(Decimal), Nothing, Global.System.Data.MappingType.Element)
MyBase.Columns.Add(Me.columnHN1)
Me.Constraints.Add(New Global.System.Data.UniqueConstraint("Constraint1", New Global.System.Data.DataColumn() {Me.columnID, Me.columnReceiptNo}, true))
Me.columnDateIn.ReadOnly = true
Me.columnDateIn.MaxLength = 11
Me.columnOutPatientUSD.ReadOnly = true
Me.columnOutPatientRiel.ReadOnly = true
Me.columnInPatientUSD.ReadOnly = true
Me.columnInPatientRiel.ReadOnly = true
Me.columnHN.AllowDBNull = false
Me.columnID.AutoIncrement = true
Me.columnID.AllowDBNull = false
Me.columnID.ReadOnly = true
Me.columnIDCashReceipt.AllowDBNull = false
Me.columnIDCashReceipt.MaxLength = 50
Me.columnReceiptNo.AllowDBNull = false
Me.columnHN1.AllowDBNull = false
Me.columnHN1.Caption = "HN"
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Function NewtblPatientReceiptRow() As tblPatientReceiptRow
Return CType(Me.NewRow,tblPatientReceiptRow)
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Protected Overrides Function NewRowFromBuilder(ByVal builder As Global.System.Data.DataRowBuilder) As Global.System.Data.DataRow
Return New tblPatientReceiptRow(builder)
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Protected Overrides Function GetRowType() As Global.System.Type
Return GetType(tblPatientReceiptRow)
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Protected Overrides Sub OnRowChanged(ByVal e As Global.System.Data.DataRowChangeEventArgs)
MyBase.OnRowChanged(e)
If (Not (Me.tblPatientReceiptRowChangedEvent) Is Nothing) Then
RaiseEvent tblPatientReceiptRowChanged(Me, New tblPatientReceiptRowChangeEvent(CType(e.Row,tblPatientReceiptRow), e.Action))
End If
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Protected Overrides Sub OnRowChanging(ByVal e As Global.System.Data.DataRowChangeEventArgs)
MyBase.OnRowChanging(e)
If (Not (Me.tblPatientReceiptRowChangingEvent) Is Nothing) Then
RaiseEvent tblPatientReceiptRowChanging(Me, New tblPatientReceiptRowChangeEvent(CType(e.Row,tblPatientReceiptRow), e.Action))
End If
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Protected Overrides Sub OnRowDeleted(ByVal e As Global.System.Data.DataRowChangeEventArgs)
MyBase.OnRowDeleted(e)
If (Not (Me.tblPatientReceiptRowDeletedEvent) Is Nothing) Then
RaiseEvent tblPatientReceiptRowDeleted(Me, New tblPatientReceiptRowChangeEvent(CType(e.Row,tblPatientReceiptRow), e.Action))
End If
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Protected Overrides Sub OnRowDeleting(ByVal e As Global.System.Data.DataRowChangeEventArgs)
MyBase.OnRowDeleting(e)
If (Not (Me.tblPatientReceiptRowDeletingEvent) Is Nothing) Then
RaiseEvent tblPatientReceiptRowDeleting(Me, New tblPatientReceiptRowChangeEvent(CType(e.Row,tblPatientReceiptRow), e.Action))
End If
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Sub RemovetblPatientReceiptRow(ByVal row As tblPatientReceiptRow)
Me.Rows.Remove(row)
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Shared Function GetTypedTableSchema(ByVal xs As Global.System.Xml.Schema.XmlSchemaSet) As Global.System.Xml.Schema.XmlSchemaComplexType
Dim type As Global.System.Xml.Schema.XmlSchemaComplexType = New Global.System.Xml.Schema.XmlSchemaComplexType
Dim sequence As Global.System.Xml.Schema.XmlSchemaSequence = New Global.System.Xml.Schema.XmlSchemaSequence
Dim ds As DataSetCashCountDaily = New DataSetCashCountDaily
Dim any1 As Global.System.Xml.Schema.XmlSchemaAny = New Global.System.Xml.Schema.XmlSchemaAny
any1.Namespace = "http://www.w3.org/2001/XMLSchema"
any1.MinOccurs = New Decimal(0)
any1.MaxOccurs = Decimal.MaxValue
any1.ProcessContents = Global.System.Xml.Schema.XmlSchemaContentProcessing.Lax
sequence.Items.Add(any1)
Dim any2 As Global.System.Xml.Schema.XmlSchemaAny = New Global.System.Xml.Schema.XmlSchemaAny
any2.Namespace = "urn:schemas-microsoft-com:xml-diffgram-v1"
any2.MinOccurs = New Decimal(1)
any2.ProcessContents = Global.System.Xml.Schema.XmlSchemaContentProcessing.Lax
sequence.Items.Add(any2)
Dim attribute1 As Global.System.Xml.Schema.XmlSchemaAttribute = New Global.System.Xml.Schema.XmlSchemaAttribute
attribute1.Name = "namespace"
attribute1.FixedValue = ds.Namespace
type.Attributes.Add(attribute1)
Dim attribute2 As Global.System.Xml.Schema.XmlSchemaAttribute = New Global.System.Xml.Schema.XmlSchemaAttribute
attribute2.Name = "tableTypeName"
attribute2.FixedValue = "tblPatientReceiptDataTable"
type.Attributes.Add(attribute2)
type.Particle = sequence
Dim dsSchema As Global.System.Xml.Schema.XmlSchema = ds.GetSchemaSerializable
If xs.Contains(dsSchema.TargetNamespace) Then
Dim s1 As Global.System.IO.MemoryStream = New Global.System.IO.MemoryStream
Dim s2 As Global.System.IO.MemoryStream = New Global.System.IO.MemoryStream
Try
Dim schema As Global.System.Xml.Schema.XmlSchema = Nothing
dsSchema.Write(s1)
Dim schemas As Global.System.Collections.IEnumerator = xs.Schemas(dsSchema.TargetNamespace).GetEnumerator
Do While schemas.MoveNext
schema = CType(schemas.Current,Global.System.Xml.Schema.XmlSchema)
s2.SetLength(0)
schema.Write(s2)
If (s1.Length = s2.Length) Then
s1.Position = 0
s2.Position = 0
Do While ((s1.Position <> s1.Length) _
AndAlso (s1.ReadByte = s2.ReadByte))
Loop
If (s1.Position = s1.Length) Then
Return type
End If
End If
Loop
Finally
If (Not (s1) Is Nothing) Then
s1.Close
End If
If (Not (s2) Is Nothing) Then
s2.Close
End If
End Try
End If
xs.Add(dsSchema)
Return type
End Function
End Class
'''<summary>
'''Represents strongly named DataRow class.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")> _
Partial Public Class tblPatientReceiptRow
Inherits Global.System.Data.DataRow
Private tabletblPatientReceipt As tblPatientReceiptDataTable
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Friend Sub New(ByVal rb As Global.System.Data.DataRowBuilder)
MyBase.New(rb)
Me.tabletblPatientReceipt = CType(Me.Table,tblPatientReceiptDataTable)
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property DateIn() As String
Get
Try
Return CType(Me(Me.tabletblPatientReceipt.DateInColumn),String)
Catch e As Global.System.InvalidCastException
Throw New Global.System.Data.StrongTypingException("The value for column 'DateIn' in table 'tblPatientReceipt' is DBNull.", e)
End Try
End Get
Set
Me(Me.tabletblPatientReceipt.DateInColumn) = value
End Set
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property CashUSD() As Double
Get
Try
Return CType(Me(Me.tabletblPatientReceipt.CashUSDColumn),Double)
Catch e As Global.System.InvalidCastException
Throw New Global.System.Data.StrongTypingException("The value for column 'CashUSD' in table 'tblPatientReceipt' is DBNull.", e)
End Try
End Get
Set
Me(Me.tabletblPatientReceipt.CashUSDColumn) = value
End Set
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property CashRiel() As Double
Get
Try
Return CType(Me(Me.tabletblPatientReceipt.CashRielColumn),Double)
Catch e As Global.System.InvalidCastException
Throw New Global.System.Data.StrongTypingException("The value for column 'CashRiel' in table 'tblPatientReceipt' is DBNull.", e)
End Try
End Get
Set
Me(Me.tabletblPatientReceipt.CashRielColumn) = value
End Set
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property OutPatientUSD() As Double
Get
Try
Return CType(Me(Me.tabletblPatientReceipt.OutPatientUSDColumn),Double)
Catch e As Global.System.InvalidCastException
Throw New Global.System.Data.StrongTypingException("The value for column 'OutPatientUSD' in table 'tblPatientReceipt' is DBNull.", e)
End Try
End Get
Set
Me(Me.tabletblPatientReceipt.OutPatientUSDColumn) = value
End Set
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property OutPatientRiel() As Double
Get
Try
Return CType(Me(Me.tabletblPatientReceipt.OutPatientRielColumn),Double)
Catch e As Global.System.InvalidCastException
Throw New Global.System.Data.StrongTypingException("The value for column 'OutPatientRiel' in table 'tblPatientReceipt' is DBNull.", e)
End Try
End Get
Set
Me(Me.tabletblPatientReceipt.OutPatientRielColumn) = value
End Set
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property InPatientUSD() As Double
Get
Try
Return CType(Me(Me.tabletblPatientReceipt.InPatientUSDColumn),Double)
Catch e As Global.System.InvalidCastException
Throw New Global.System.Data.StrongTypingException("The value for column 'InPatientUSD' in table 'tblPatientReceipt' is DBNull.", e)
End Try
End Get
Set
Me(Me.tabletblPatientReceipt.InPatientUSDColumn) = value
End Set
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property InPatientRiel() As Double
Get
Try
Return CType(Me(Me.tabletblPatientReceipt.InPatientRielColumn),Double)
Catch e As Global.System.InvalidCastException
Throw New Global.System.Data.StrongTypingException("The value for column 'InPatientRiel' in table 'tblPatientReceipt' is DBNull.", e)
End Try
End Get
Set
Me(Me.tabletblPatientReceipt.InPatientRielColumn) = value
End Set
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property GlassFeeUSD() As Double
Get
Try
Return CType(Me(Me.tabletblPatientReceipt.GlassFeeUSDColumn),Double)
Catch e As Global.System.InvalidCastException
Throw New Global.System.Data.StrongTypingException("The value for column 'GlassFeeUSD' in table 'tblPatientReceipt' is DBNull.", e)
End Try
End Get
Set
Me(Me.tabletblPatientReceipt.GlassFeeUSDColumn) = value
End Set
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property GlassFeeRiel() As Double
Get
Try
Return CType(Me(Me.tabletblPatientReceipt.GlassFeeRielColumn),Double)
Catch e As Global.System.InvalidCastException
Throw New Global.System.Data.StrongTypingException("The value for column 'GlassFeeRiel' in table 'tblPatientReceipt' is DBNull.", e)
End Try
End Get
Set
Me(Me.tabletblPatientReceipt.GlassFeeRielColumn) = value
End Set
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property ArtificialEyeFeeUSD() As Double
Get
Try
Return CType(Me(Me.tabletblPatientReceipt.ArtificialEyeFeeUSDColumn),Double)
Catch e As Global.System.InvalidCastException
Throw New Global.System.Data.StrongTypingException("The value for column 'ArtificialEyeFeeUSD' in table 'tblPatientReceipt' is DBNull"& _
".", e)
End Try
End Get
Set
Me(Me.tabletblPatientReceipt.ArtificialEyeFeeUSDColumn) = value
End Set
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property ArtificialEyeFeeRiel() As Double
Get
Try
Return CType(Me(Me.tabletblPatientReceipt.ArtificialEyeFeeRielColumn),Double)
Catch e As Global.System.InvalidCastException
Throw New Global.System.Data.StrongTypingException("The value for column 'ArtificialEyeFeeRiel' in table 'tblPatientReceipt' is DBNul"& _
"l.", e)
End Try
End Get
Set
Me(Me.tabletblPatientReceipt.ArtificialEyeFeeRielColumn) = value
End Set
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property OtherFeeUSD() As Double
Get
Try
Return CType(Me(Me.tabletblPatientReceipt.OtherFeeUSDColumn),Double)
Catch e As Global.System.InvalidCastException
Throw New Global.System.Data.StrongTypingException("The value for column 'OtherFeeUSD' in table 'tblPatientReceipt' is DBNull.", e)
End Try
End Get
Set
Me(Me.tabletblPatientReceipt.OtherFeeUSDColumn) = value
End Set
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property OtherFeeRiel() As Double
Get
Try
Return CType(Me(Me.tabletblPatientReceipt.OtherFeeRielColumn),Double)
Catch e As Global.System.InvalidCastException
Throw New Global.System.Data.StrongTypingException("The value for column 'OtherFeeRiel' in table 'tblPatientReceipt' is DBNull.", e)
End Try
End Get
Set
Me(Me.tabletblPatientReceipt.OtherFeeRielColumn) = value
End Set
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property HN() As Long
Get
Return CType(Me(Me.tabletblPatientReceipt.HNColumn),Long)
End Get
Set
Me(Me.tabletblPatientReceipt.HNColumn) = value
End Set
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property ID() As Long
Get
Return CType(Me(Me.tabletblPatientReceipt.IDColumn),Long)
End Get
Set
Me(Me.tabletblPatientReceipt.IDColumn) = value
End Set
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property IDCashReceipt() As String
Get
Return CType(Me(Me.tabletblPatientReceipt.IDCashReceiptColumn),String)
End Get
Set
Me(Me.tabletblPatientReceipt.IDCashReceiptColumn) = value
End Set
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property ReceiptNo() As Long
Get
Return CType(Me(Me.tabletblPatientReceipt.ReceiptNoColumn),Long)
End Get
Set
Me(Me.tabletblPatientReceipt.ReceiptNoColumn) = value
End Set
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property HN1() As Decimal
Get
Return CType(Me(Me.tabletblPatientReceipt.HN1Column),Decimal)
End Get
Set
Me(Me.tabletblPatientReceipt.HN1Column) = value
End Set
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Function IsDateInNull() As Boolean
Return Me.IsNull(Me.tabletblPatientReceipt.DateInColumn)
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Sub SetDateInNull()
Me(Me.tabletblPatientReceipt.DateInColumn) = Global.System.Convert.DBNull
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Function IsCashUSDNull() As Boolean
Return Me.IsNull(Me.tabletblPatientReceipt.CashUSDColumn)
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Sub SetCashUSDNull()
Me(Me.tabletblPatientReceipt.CashUSDColumn) = Global.System.Convert.DBNull
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Function IsCashRielNull() As Boolean
Return Me.IsNull(Me.tabletblPatientReceipt.CashRielColumn)
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Sub SetCashRielNull()
Me(Me.tabletblPatientReceipt.CashRielColumn) = Global.System.Convert.DBNull
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Function IsOutPatientUSDNull() As Boolean
Return Me.IsNull(Me.tabletblPatientReceipt.OutPatientUSDColumn)
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Sub SetOutPatientUSDNull()
Me(Me.tabletblPatientReceipt.OutPatientUSDColumn) = Global.System.Convert.DBNull
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Function IsOutPatientRielNull() As Boolean
Return Me.IsNull(Me.tabletblPatientReceipt.OutPatientRielColumn)
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Sub SetOutPatientRielNull()
Me(Me.tabletblPatientReceipt.OutPatientRielColumn) = Global.System.Convert.DBNull
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Function IsInPatientUSDNull() As Boolean
Return Me.IsNull(Me.tabletblPatientReceipt.InPatientUSDColumn)
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Sub SetInPatientUSDNull()
Me(Me.tabletblPatientReceipt.InPatientUSDColumn) = Global.System.Convert.DBNull
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Function IsInPatientRielNull() As Boolean
Return Me.IsNull(Me.tabletblPatientReceipt.InPatientRielColumn)
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Sub SetInPatientRielNull()
Me(Me.tabletblPatientReceipt.InPatientRielColumn) = Global.System.Convert.DBNull
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Function IsGlassFeeUSDNull() As Boolean
Return Me.IsNull(Me.tabletblPatientReceipt.GlassFeeUSDColumn)
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Sub SetGlassFeeUSDNull()
Me(Me.tabletblPatientReceipt.GlassFeeUSDColumn) = Global.System.Convert.DBNull
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Function IsGlassFeeRielNull() As Boolean
Return Me.IsNull(Me.tabletblPatientReceipt.GlassFeeRielColumn)
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Sub SetGlassFeeRielNull()
Me(Me.tabletblPatientReceipt.GlassFeeRielColumn) = Global.System.Convert.DBNull
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Function IsArtificialEyeFeeUSDNull() As Boolean
Return Me.IsNull(Me.tabletblPatientReceipt.ArtificialEyeFeeUSDColumn)
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Sub SetArtificialEyeFeeUSDNull()
Me(Me.tabletblPatientReceipt.ArtificialEyeFeeUSDColumn) = Global.System.Convert.DBNull
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Function IsArtificialEyeFeeRielNull() As Boolean
Return Me.IsNull(Me.tabletblPatientReceipt.ArtificialEyeFeeRielColumn)
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Sub SetArtificialEyeFeeRielNull()
Me(Me.tabletblPatientReceipt.ArtificialEyeFeeRielColumn) = Global.System.Convert.DBNull
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Function IsOtherFeeUSDNull() As Boolean
Return Me.IsNull(Me.tabletblPatientReceipt.OtherFeeUSDColumn)
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Sub SetOtherFeeUSDNull()
Me(Me.tabletblPatientReceipt.OtherFeeUSDColumn) = Global.System.Convert.DBNull
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Function IsOtherFeeRielNull() As Boolean
Return Me.IsNull(Me.tabletblPatientReceipt.OtherFeeRielColumn)
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Sub SetOtherFeeRielNull()
Me(Me.tabletblPatientReceipt.OtherFeeRielColumn) = Global.System.Convert.DBNull
End Sub
End Class
'''<summary>
'''Row event argument class
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")> _
Public Class tblPatientReceiptRowChangeEvent
Inherits Global.System.EventArgs
Private eventRow As tblPatientReceiptRow
Private eventAction As Global.System.Data.DataRowAction
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Sub New(ByVal row As tblPatientReceiptRow, ByVal action As Global.System.Data.DataRowAction)
MyBase.New
Me.eventRow = row
Me.eventAction = action
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public ReadOnly Property Row() As tblPatientReceiptRow
Get
Return Me.eventRow
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public ReadOnly Property Action() As Global.System.Data.DataRowAction
Get
Return Me.eventAction
End Get
End Property
End Class
End Class
Namespace DataSetCashCountDailyTableAdapters
'''<summary>
'''Represents the connection and commands used to retrieve and save data.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0"), _
Global.System.ComponentModel.DesignerCategoryAttribute("code"), _
Global.System.ComponentModel.ToolboxItem(true), _
Global.System.ComponentModel.DataObjectAttribute(true), _
Global.System.ComponentModel.DesignerAttribute("Microsoft.VSDesigner.DataSource.Design.TableAdapterDesigner, Microsoft.VSDesigner"& _
", Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"), _
Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")> _
Partial Public Class tblPatientReceiptTableAdapter
Inherits Global.System.ComponentModel.Component
Private WithEvents _adapter As Global.System.Data.SqlClient.SqlDataAdapter
Private _connection As Global.System.Data.SqlClient.SqlConnection
Private _commandCollection() As Global.System.Data.SqlClient.SqlCommand
Private _clearBeforeFill As Boolean
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Sub New()
MyBase.New
Me.ClearBeforeFill = true
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Private ReadOnly Property Adapter() As Global.System.Data.SqlClient.SqlDataAdapter
Get
If (Me._adapter Is Nothing) Then
Me.InitAdapter
End If
Return Me._adapter
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Friend Property Connection() As Global.System.Data.SqlClient.SqlConnection
Get
If (Me._connection Is Nothing) Then
Me.InitConnection
End If
Return Me._connection
End Get
Set
Me._connection = value
If (Not (Me.Adapter.InsertCommand) Is Nothing) Then
Me.Adapter.InsertCommand.Connection = value
End If
If (Not (Me.Adapter.DeleteCommand) Is Nothing) Then
Me.Adapter.DeleteCommand.Connection = value
End If
If (Not (Me.Adapter.UpdateCommand) Is Nothing) Then
Me.Adapter.UpdateCommand.Connection = value
End If
Dim i As Integer = 0
Do While (i < Me.CommandCollection.Length)
If (Not (Me.CommandCollection(i)) Is Nothing) Then
CType(Me.CommandCollection(i),Global.System.Data.SqlClient.SqlCommand).Connection = value
End If
i = (i + 1)
Loop
End Set
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Protected ReadOnly Property CommandCollection() As Global.System.Data.SqlClient.SqlCommand()
Get
If (Me._commandCollection Is Nothing) Then
Me.InitCommandCollection
End If
Return Me._commandCollection
End Get
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Public Property ClearBeforeFill() As Boolean
Get
Return Me._clearBeforeFill
End Get
Set
Me._clearBeforeFill = value
End Set
End Property
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Private Sub InitAdapter()
Me._adapter = New Global.System.Data.SqlClient.SqlDataAdapter
Dim tableMapping As Global.System.Data.Common.DataTableMapping = New Global.System.Data.Common.DataTableMapping
tableMapping.SourceTable = "Table"
tableMapping.DataSetTable = "tblPatientReceipt"
tableMapping.ColumnMappings.Add("DateIn", "DateIn")
tableMapping.ColumnMappings.Add("CashUSD", "CashUSD")
tableMapping.ColumnMappings.Add("CashRiel", "CashRiel")
tableMapping.ColumnMappings.Add("OutPatientUSD", "OutPatientUSD")
tableMapping.ColumnMappings.Add("OutPatientRiel", "OutPatientRiel")
tableMapping.ColumnMappings.Add("InPatientUSD", "InPatientUSD")
tableMapping.ColumnMappings.Add("InPatientRiel", "InPatientRiel")
tableMapping.ColumnMappings.Add("GlassFeeUSD", "GlassFeeUSD")
tableMapping.ColumnMappings.Add("GlassFeeRiel", "GlassFeeRiel")
tableMapping.ColumnMappings.Add("ArtificialEyeFeeUSD", "ArtificialEyeFeeUSD")
tableMapping.ColumnMappings.Add("ArtificialEyeFeeRiel", "ArtificialEyeFeeRiel")
tableMapping.ColumnMappings.Add("OtherFeeUSD", "OtherFeeUSD")
tableMapping.ColumnMappings.Add("OtherFeeRiel", "OtherFeeRiel")
tableMapping.ColumnMappings.Add("ID", "ID")
tableMapping.ColumnMappings.Add("IDCashReceipt", "IDCashReceipt")
tableMapping.ColumnMappings.Add("ReceiptNo", "ReceiptNo")
tableMapping.ColumnMappings.Add("HN", "HN1")
Me._adapter.TableMappings.Add(tableMapping)
Me._adapter.DeleteCommand = New Global.System.Data.SqlClient.SqlCommand
Me._adapter.DeleteCommand.Connection = Me.Connection
Me._adapter.DeleteCommand.CommandText = "DELETE FROM [tblPatientReceipt] WHERE (((@IsNull_CashUSD = 1 AND [CashUSD] IS NUL"& _
"L) OR ([CashUSD] = @Original_CashUSD)) AND ((@IsNull_CashRiel = 1 AND [CashRiel]"& _
" IS NULL) OR ([CashRiel] = @Original_CashRiel)) AND ((@IsNull_InPatientRiel = 1 "& _
"AND [OperationFeeRiel] IS NULL) OR ([OperationFeeRiel] = @Original_InPatientRiel"& _
")) AND ((@IsNull_GlassFeeUSD = 1 AND [GlassFeeUSD] IS NULL) OR ([GlassFeeUSD] = "& _
"@Original_GlassFeeUSD)) AND ((@IsNull_GlassFeeRiel = 1 AND [GlassFeeRiel] IS NUL"& _
"L) OR ([GlassFeeRiel] = @Original_GlassFeeRiel)) AND ((@IsNull_ArtificialEyeFeeU"& _
"SD = 1 AND [ArtificialEyeFeeUSD] IS NULL) OR ([ArtificialEyeFeeUSD] = @Original_"& _
"ArtificialEyeFeeUSD)) AND ((@IsNull_ArtificialEyeFeeRiel = 1 AND [ArtificialEyeF"& _
"eeRiel] IS NULL) OR ([ArtificialEyeFeeRiel] = @Original_ArtificialEyeFeeRiel)) A"& _
"ND ((@IsNull_OtherFeeUSD = 1 AND [OtherFeeUSD] IS NULL) OR ([OtherFeeUSD] = @Ori"& _
"ginal_OtherFeeUSD)) AND ((@IsNull_OtherFeeRiel = 1 AND [OtherFeeRiel] IS NULL) O"& _
"R ([OtherFeeRiel] = @Original_OtherFeeRiel)) AND ([HN] = @Original_HN) AND ([ID]"& _
" = @Original_ID) AND ([IDCashReceipt] = @Original_IDCashReceipt) AND ([ReceiptNo"& _
"] = @Original_ReceiptNo))"
Me._adapter.DeleteCommand.CommandType = Global.System.Data.CommandType.Text
Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_CashUSD", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CashUSD", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_CashUSD", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CashUSD", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_CashRiel", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CashRiel", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_CashRiel", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CashRiel", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_InPatientRiel", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "InPatientRiel", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_InPatientRiel", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "InPatientRiel", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_GlassFeeUSD", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GlassFeeUSD", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_GlassFeeUSD", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GlassFeeUSD", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_GlassFeeRiel", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GlassFeeRiel", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_GlassFeeRiel", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GlassFeeRiel", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_ArtificialEyeFeeUSD", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "ArtificialEyeFeeUSD", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_ArtificialEyeFeeUSD", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "ArtificialEyeFeeUSD", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_ArtificialEyeFeeRiel", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "ArtificialEyeFeeRiel", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_ArtificialEyeFeeRiel", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "ArtificialEyeFeeRiel", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_OtherFeeUSD", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "OtherFeeUSD", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_OtherFeeUSD", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "OtherFeeUSD", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_OtherFeeRiel", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "OtherFeeRiel", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_OtherFeeRiel", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "OtherFeeRiel", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_HN", Global.System.Data.SqlDbType.[Decimal], 0, Global.System.Data.ParameterDirection.Input, 18, 0, "HN", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_ID", Global.System.Data.SqlDbType.BigInt, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "ID", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_IDCashReceipt", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "IDCashReceipt", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.DeleteCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_ReceiptNo", Global.System.Data.SqlDbType.BigInt, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "ReceiptNo", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.InsertCommand = New Global.System.Data.SqlClient.SqlCommand
Me._adapter.InsertCommand.Connection = Me.Connection
Me._adapter.InsertCommand.CommandText = "INSERT INTO [tblPatientReceipt] ([CashUSD], [CashRiel], [OperationFeeRiel], [Glas"& _
"sFeeUSD], [GlassFeeRiel], [ArtificialEyeFeeUSD], [ArtificialEyeFeeRiel], [OtherF"& _
"eeUSD], [OtherFeeRiel], [HN], [IDCashReceipt], [ReceiptNo]) VALUES (@CashUSD, @C"& _
"ashRiel, @InPatientRiel, @GlassFeeUSD, @GlassFeeRiel, @ArtificialEyeFeeUSD, @Art"& _
"ificialEyeFeeRiel, @OtherFeeUSD, @OtherFeeRiel, @HN, @IDCashReceipt, @ReceiptNo)"& _
";"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"SELECT CONVERT (VARCHAR(11), DateIn, 106) AS DateIn, CashUSD, CashRiel, Consu"& _
"ltationFeeUSD + FollowUpFeeUSD AS OutPatientUSD, ConsultationFeeRiel + FollowUpF"& _
"eeRiel AS OutPatientRiel, OperationFeeUSD + MedicineFeeUSD AS InPatientUSD, Oper"& _
"ationFeeRiel AS InPatientRiel, GlassFeeUSD, GlassFeeRiel, ArtificialEyeFeeUSD, A"& _
"rtificialEyeFeeRiel, OtherFeeUSD, OtherFeeRiel, HN, ID, IDCashReceipt, ReceiptNo"& _
" FROM tblPatientReceipt WHERE (ID = SCOPE_IDENTITY()) AND (ReceiptNo = @ReceiptN"& _
"o)"
Me._adapter.InsertCommand.CommandType = Global.System.Data.CommandType.Text
Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@CashUSD", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CashUSD", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@CashRiel", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CashRiel", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@InPatientRiel", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "InPatientRiel", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@GlassFeeUSD", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GlassFeeUSD", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@GlassFeeRiel", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GlassFeeRiel", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@ArtificialEyeFeeUSD", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "ArtificialEyeFeeUSD", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@ArtificialEyeFeeRiel", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "ArtificialEyeFeeRiel", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@OtherFeeUSD", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "OtherFeeUSD", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@OtherFeeRiel", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "OtherFeeRiel", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@HN", Global.System.Data.SqlDbType.[Decimal], 0, Global.System.Data.ParameterDirection.Input, 18, 0, "HN", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IDCashReceipt", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "IDCashReceipt", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me._adapter.InsertCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@ReceiptNo", Global.System.Data.SqlDbType.BigInt, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "ReceiptNo", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand = New Global.System.Data.SqlClient.SqlCommand
Me._adapter.UpdateCommand.Connection = Me.Connection
Me._adapter.UpdateCommand.CommandText = "UPDATE [tblPatientReceipt] SET [CashUSD] = @CashUSD, [CashRiel] = @CashRiel, [Ope"& _
"rationFeeRiel] = @InPatientRiel, [GlassFeeUSD] = @GlassFeeUSD, [GlassFeeRiel] = "& _
"@GlassFeeRiel, [ArtificialEyeFeeUSD] = @ArtificialEyeFeeUSD, [ArtificialEyeFeeRi"& _
"el] = @ArtificialEyeFeeRiel, [OtherFeeUSD] = @OtherFeeUSD, [OtherFeeRiel] = @Oth"& _
"erFeeRiel, [HN] = @HN, [IDCashReceipt] = @IDCashReceipt, [ReceiptNo] = @ReceiptN"& _
"o WHERE (((@IsNull_CashUSD = 1 AND [CashUSD] IS NULL) OR ([CashUSD] = @Original_"& _
"CashUSD)) AND ((@IsNull_CashRiel = 1 AND [CashRiel] IS NULL) OR ([CashRiel] = @O"& _
"riginal_CashRiel)) AND ((@IsNull_InPatientRiel = 1 AND [OperationFeeRiel] IS NUL"& _
"L) OR ([OperationFeeRiel] = @Original_InPatientRiel)) AND ((@IsNull_GlassFeeUSD "& _
"= 1 AND [GlassFeeUSD] IS NULL) OR ([GlassFeeUSD] = @Original_GlassFeeUSD)) AND ("& _
"(@IsNull_GlassFeeRiel = 1 AND [GlassFeeRiel] IS NULL) OR ([GlassFeeRiel] = @Orig"& _
"inal_GlassFeeRiel)) AND ((@IsNull_ArtificialEyeFeeUSD = 1 AND [ArtificialEyeFeeU"& _
"SD] IS NULL) OR ([ArtificialEyeFeeUSD] = @Original_ArtificialEyeFeeUSD)) AND ((@"& _
"IsNull_ArtificialEyeFeeRiel = 1 AND [ArtificialEyeFeeRiel] IS NULL) OR ([Artific"& _
"ialEyeFeeRiel] = @Original_ArtificialEyeFeeRiel)) AND ((@IsNull_OtherFeeUSD = 1 "& _
"AND [OtherFeeUSD] IS NULL) OR ([OtherFeeUSD] = @Original_OtherFeeUSD)) AND ((@Is"& _
"Null_OtherFeeRiel = 1 AND [OtherFeeRiel] IS NULL) OR ([OtherFeeRiel] = @Original"& _
"_OtherFeeRiel)) AND ([HN] = @Original_HN) AND ([ID] = @Original_ID) AND ([IDCash"& _
"Receipt] = @Original_IDCashReceipt) AND ([ReceiptNo] = @Original_ReceiptNo));"&Global.Microsoft.VisualBasic.ChrW(13)&Global.Microsoft.VisualBasic.ChrW(10)&"S"& _
"ELECT CONVERT (VARCHAR(11), DateIn, 106) AS DateIn, CashUSD, CashRiel, Consultat"& _
"ionFeeUSD + FollowUpFeeUSD AS OutPatientUSD, ConsultationFeeRiel + FollowUpFeeRi"& _
"el AS OutPatientRiel, OperationFeeUSD + MedicineFeeUSD AS InPatientUSD, Operatio"& _
"nFeeRiel AS InPatientRiel, GlassFeeUSD, GlassFeeRiel, ArtificialEyeFeeUSD, Artif"& _
"icialEyeFeeRiel, OtherFeeUSD, OtherFeeRiel, HN, ID, IDCashReceipt, ReceiptNo FRO"& _
"M tblPatientReceipt WHERE (ID = @ID) AND (ReceiptNo = @ReceiptNo)"
Me._adapter.UpdateCommand.CommandType = Global.System.Data.CommandType.Text
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@CashUSD", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CashUSD", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@CashRiel", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CashRiel", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@InPatientRiel", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "InPatientRiel", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@GlassFeeUSD", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GlassFeeUSD", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@GlassFeeRiel", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GlassFeeRiel", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@ArtificialEyeFeeUSD", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "ArtificialEyeFeeUSD", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@ArtificialEyeFeeRiel", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "ArtificialEyeFeeRiel", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@OtherFeeUSD", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "OtherFeeUSD", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@OtherFeeRiel", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "OtherFeeRiel", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@HN", Global.System.Data.SqlDbType.[Decimal], 0, Global.System.Data.ParameterDirection.Input, 18, 0, "HN", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IDCashReceipt", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "IDCashReceipt", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@ReceiptNo", Global.System.Data.SqlDbType.BigInt, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "ReceiptNo", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_CashUSD", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CashUSD", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_CashUSD", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CashUSD", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_CashRiel", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CashRiel", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_CashRiel", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "CashRiel", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_InPatientRiel", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "InPatientRiel", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_InPatientRiel", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "InPatientRiel", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_GlassFeeUSD", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GlassFeeUSD", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_GlassFeeUSD", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GlassFeeUSD", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_GlassFeeRiel", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GlassFeeRiel", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_GlassFeeRiel", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "GlassFeeRiel", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_ArtificialEyeFeeUSD", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "ArtificialEyeFeeUSD", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_ArtificialEyeFeeUSD", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "ArtificialEyeFeeUSD", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_ArtificialEyeFeeRiel", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "ArtificialEyeFeeRiel", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_ArtificialEyeFeeRiel", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "ArtificialEyeFeeRiel", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_OtherFeeUSD", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "OtherFeeUSD", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_OtherFeeUSD", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "OtherFeeUSD", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@IsNull_OtherFeeRiel", Global.System.Data.SqlDbType.Int, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "OtherFeeRiel", Global.System.Data.DataRowVersion.Original, true, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_OtherFeeRiel", Global.System.Data.SqlDbType.Float, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "OtherFeeRiel", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_HN", Global.System.Data.SqlDbType.[Decimal], 0, Global.System.Data.ParameterDirection.Input, 18, 0, "HN", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_ID", Global.System.Data.SqlDbType.BigInt, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "ID", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_IDCashReceipt", Global.System.Data.SqlDbType.VarChar, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "IDCashReceipt", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@Original_ReceiptNo", Global.System.Data.SqlDbType.BigInt, 0, Global.System.Data.ParameterDirection.Input, 0, 0, "ReceiptNo", Global.System.Data.DataRowVersion.Original, false, Nothing, "", "", ""))
Me._adapter.UpdateCommand.Parameters.Add(New Global.System.Data.SqlClient.SqlParameter("@ID", Global.System.Data.SqlDbType.BigInt, 8, Global.System.Data.ParameterDirection.Input, 0, 0, "ID", Global.System.Data.DataRowVersion.Current, false, Nothing, "", "", ""))
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Private Sub InitConnection()
Me._connection = New Global.System.Data.SqlClient.SqlConnection
Me._connection.ConnectionString = Global.TakeoHospitalInventory.My.MySettings.Default.TakeoDBConnectionString
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute()> _
Private Sub InitCommandCollection()
Me._commandCollection = New Global.System.Data.SqlClient.SqlCommand(0) {}
Me._commandCollection(0) = New Global.System.Data.SqlClient.SqlCommand
Me._commandCollection(0).Connection = Me.Connection
Me._commandCollection(0).CommandText = "SELECT CONVERT (VARCHAR(11), DateIn, 106) AS DateIn, CashUSD, CashRiel, Consultat"& _
"ionFeeUSD + FollowUpFeeUSD AS OutPatientUSD, ConsultationFeeRiel + FollowUpFeeRi"& _
"el AS OutPatientRiel, OperationFeeUSD + MedicineFeeUSD AS InPatientUSD, Operatio"& _
"nFeeRiel AS InPatientRiel, GlassFeeUSD, GlassFeeRiel, ArtificialEyeFeeUSD, Artif"& _
"icialEyeFeeRiel, OtherFeeUSD, OtherFeeRiel, HN, ID, IDCashReceipt, ReceiptNo FRO"& _
"M tblPatientReceipt"
Me._commandCollection(0).CommandType = Global.System.Data.CommandType.Text
End Sub
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"), _
Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.Fill, true)> _
Public Overloads Overridable Function Fill(ByVal dataTable As DataSetCashCountDaily.tblPatientReceiptDataTable) As Integer
Me.Adapter.SelectCommand = Me.CommandCollection(0)
If (Me.ClearBeforeFill = true) Then
dataTable.Clear
End If
Dim returnValue As Integer = Me.Adapter.Fill(dataTable)
Return returnValue
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter"), _
Global.System.ComponentModel.DataObjectMethodAttribute(Global.System.ComponentModel.DataObjectMethodType.[Select], true)> _
Public Overloads Overridable Function GetData() As DataSetCashCountDaily.tblPatientReceiptDataTable
Me.Adapter.SelectCommand = Me.CommandCollection(0)
Dim dataTable As DataSetCashCountDaily.tblPatientReceiptDataTable = New DataSetCashCountDaily.tblPatientReceiptDataTable
Me.Adapter.Fill(dataTable)
Return dataTable
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")> _
Public Overloads Overridable Function Update(ByVal dataTable As DataSetCashCountDaily.tblPatientReceiptDataTable) As Integer
Return Me.Adapter.Update(dataTable)
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")> _
Public Overloads Overridable Function Update(ByVal dataSet As DataSetCashCountDaily) As Integer
Return Me.Adapter.Update(dataSet, "tblPatientReceipt")
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")> _
Public Overloads Overridable Function Update(ByVal dataRow As Global.System.Data.DataRow) As Integer
Return Me.Adapter.Update(New Global.System.Data.DataRow() {dataRow})
End Function
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.ComponentModel.Design.HelpKeywordAttribute("vs.data.TableAdapter")> _
Public Overloads Overridable Function Update(ByVal dataRows() As Global.System.Data.DataRow) As Integer
Return Me.Adapter.Update(dataRows)
End Function
End Class
End Namespace
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> Partial Class frmItemItem
#Region "Windows Form Designer generated code "
<System.Diagnostics.DebuggerNonUserCode()> Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
End Sub
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()> Protected Overloads Overrides Sub Dispose(ByVal Disposing As Boolean)
If Disposing Then
If Not components Is Nothing Then
components.Dispose()
End If
End If
MyBase.Dispose(Disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
Public ToolTip1 As System.Windows.Forms.ToolTip
Public WithEvents _cmdClear_10 As System.Windows.Forms.Button
Public WithEvents _cmdStockItem_10 As System.Windows.Forms.Button
Public WithEvents _cmdClear_9 As System.Windows.Forms.Button
Public WithEvents _cmdStockItem_9 As System.Windows.Forms.Button
Public WithEvents _cmdClear_8 As System.Windows.Forms.Button
Public WithEvents _cmdStockItem_8 As System.Windows.Forms.Button
Public WithEvents _cmdClear_7 As System.Windows.Forms.Button
Public WithEvents _cmdStockItem_7 As System.Windows.Forms.Button
Public WithEvents _cmdClear_6 As System.Windows.Forms.Button
Public WithEvents _cmdStockItem_6 As System.Windows.Forms.Button
Public WithEvents _cmdClear_5 As System.Windows.Forms.Button
Public WithEvents _cmdStockItem_5 As System.Windows.Forms.Button
Public WithEvents _cmdClear_4 As System.Windows.Forms.Button
Public WithEvents _cmdStockItem_4 As System.Windows.Forms.Button
Public WithEvents _cmdClear_3 As System.Windows.Forms.Button
Public WithEvents _cmdStockItem_3 As System.Windows.Forms.Button
Public WithEvents _cmdClear_2 As System.Windows.Forms.Button
Public WithEvents _cmdStockItem_2 As System.Windows.Forms.Button
Public WithEvents _cmdClear_1 As System.Windows.Forms.Button
Public WithEvents _cmdStockItem_1 As System.Windows.Forms.Button
Public WithEvents cmdExit As System.Windows.Forms.Button
Public WithEvents cmdLoad As System.Windows.Forms.Button
Public WithEvents _optDataType_1 As System.Windows.Forms.RadioButton
Public WithEvents _optDataType_0 As System.Windows.Forms.RadioButton
Public WithEvents _lbl_11 As System.Windows.Forms.Label
Public WithEvents _lbl_10 As System.Windows.Forms.Label
Public WithEvents _lbl_9 As System.Windows.Forms.Label
Public WithEvents _lbl_8 As System.Windows.Forms.Label
Public WithEvents _lbl_7 As System.Windows.Forms.Label
Public WithEvents _lbl_6 As System.Windows.Forms.Label
Public WithEvents _lbl_5 As System.Windows.Forms.Label
Public WithEvents _lbl_4 As System.Windows.Forms.Label
Public WithEvents _lbl_3 As System.Windows.Forms.Label
Public WithEvents _lbl_2 As System.Windows.Forms.Label
Public WithEvents _lblItem_10 As System.Windows.Forms.Label
Public WithEvents _lblItem_9 As System.Windows.Forms.Label
Public WithEvents _lblItem_8 As System.Windows.Forms.Label
Public WithEvents _lblItem_7 As System.Windows.Forms.Label
Public WithEvents _lblItem_6 As System.Windows.Forms.Label
Public WithEvents _lblItem_5 As System.Windows.Forms.Label
Public WithEvents _lblItem_4 As System.Windows.Forms.Label
Public WithEvents _lblItem_3 As System.Windows.Forms.Label
Public WithEvents _lblItem_2 As System.Windows.Forms.Label
Public WithEvents _lblItem_1 As System.Windows.Forms.Label
Public WithEvents _lbl_0 As System.Windows.Forms.Label
Public WithEvents _Shape1_1 As Microsoft.VisualBasic.PowerPacks.RectangleShape
'Public WithEvents cmdClear As Microsoft.VisualBasic.Compatibility.VB6.ButtonArray
'Public WithEvents cmdStockItem As Microsoft.VisualBasic.Compatibility.VB6.ButtonArray
'Public WithEvents lbl As Microsoft.VisualBasic.Compatibility.VB6.LabelArray
'Public WithEvents lblItem As Microsoft.VisualBasic.Compatibility.VB6.LabelArray
'Public WithEvents optDataType As Microsoft.VisualBasic.Compatibility.VB6.RadioButtonArray
Public WithEvents Shape1 As RectangleShapeArray
Public WithEvents ShapeContainer1 As Microsoft.VisualBasic.PowerPacks.ShapeContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(frmItemItem))
Me.components = New System.ComponentModel.Container()
Me.ToolTip1 = New System.Windows.Forms.ToolTip(components)
Me.ShapeContainer1 = New Microsoft.VisualBasic.PowerPacks.ShapeContainer
Me._cmdClear_10 = New System.Windows.Forms.Button
Me._cmdStockItem_10 = New System.Windows.Forms.Button
Me._cmdClear_9 = New System.Windows.Forms.Button
Me._cmdStockItem_9 = New System.Windows.Forms.Button
Me._cmdClear_8 = New System.Windows.Forms.Button
Me._cmdStockItem_8 = New System.Windows.Forms.Button
Me._cmdClear_7 = New System.Windows.Forms.Button
Me._cmdStockItem_7 = New System.Windows.Forms.Button
Me._cmdClear_6 = New System.Windows.Forms.Button
Me._cmdStockItem_6 = New System.Windows.Forms.Button
Me._cmdClear_5 = New System.Windows.Forms.Button
Me._cmdStockItem_5 = New System.Windows.Forms.Button
Me._cmdClear_4 = New System.Windows.Forms.Button
Me._cmdStockItem_4 = New System.Windows.Forms.Button
Me._cmdClear_3 = New System.Windows.Forms.Button
Me._cmdStockItem_3 = New System.Windows.Forms.Button
Me._cmdClear_2 = New System.Windows.Forms.Button
Me._cmdStockItem_2 = New System.Windows.Forms.Button
Me._cmdClear_1 = New System.Windows.Forms.Button
Me._cmdStockItem_1 = New System.Windows.Forms.Button
Me.cmdExit = New System.Windows.Forms.Button
Me.cmdLoad = New System.Windows.Forms.Button
Me._optDataType_1 = New System.Windows.Forms.RadioButton
Me._optDataType_0 = New System.Windows.Forms.RadioButton
Me._lbl_11 = New System.Windows.Forms.Label
Me._lbl_10 = New System.Windows.Forms.Label
Me._lbl_9 = New System.Windows.Forms.Label
Me._lbl_8 = New System.Windows.Forms.Label
Me._lbl_7 = New System.Windows.Forms.Label
Me._lbl_6 = New System.Windows.Forms.Label
Me._lbl_5 = New System.Windows.Forms.Label
Me._lbl_4 = New System.Windows.Forms.Label
Me._lbl_3 = New System.Windows.Forms.Label
Me._lbl_2 = New System.Windows.Forms.Label
Me._lblItem_10 = New System.Windows.Forms.Label
Me._lblItem_9 = New System.Windows.Forms.Label
Me._lblItem_8 = New System.Windows.Forms.Label
Me._lblItem_7 = New System.Windows.Forms.Label
Me._lblItem_6 = New System.Windows.Forms.Label
Me._lblItem_5 = New System.Windows.Forms.Label
Me._lblItem_4 = New System.Windows.Forms.Label
Me._lblItem_3 = New System.Windows.Forms.Label
Me._lblItem_2 = New System.Windows.Forms.Label
Me._lblItem_1 = New System.Windows.Forms.Label
Me._lbl_0 = New System.Windows.Forms.Label
Me._Shape1_1 = New Microsoft.VisualBasic.PowerPacks.RectangleShape
'Me.cmdClear = New Microsoft.VisualBasic.Compatibility.VB6.ButtonArray(components)
'Me.cmdStockItem = New Microsoft.VisualBasic.Compatibility.VB6.ButtonArray(components)
'Me.lbl = New Microsoft.VisualBasic.Compatibility.VB6.LabelArray(components)
'Me.lblItem = New Microsoft.VisualBasic.Compatibility.VB6.LabelArray(components)
'Me.optDataType = New Microsoft.VisualBasic.Compatibility.VB6.RadioButtonArray(components)
Me.Shape1 = New RectangleShapeArray(components)
Me.SuspendLayout()
Me.ToolTip1.Active = True
'CType(Me.cmdClear, System.ComponentModel.ISupportInitialize).BeginInit()
'CType(Me.cmdStockItem, System.ComponentModel.ISupportInitialize).BeginInit()
'CType(Me.lbl, System.ComponentModel.ISupportInitialize).BeginInit()
'CType(Me.lblItem, System.ComponentModel.ISupportInitialize).BeginInit()
'CType(Me.optDataType, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.Shape1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog
Me.Text = "Compare Stock Item to Stock Item"
Me.ClientSize = New System.Drawing.Size(506, 369)
Me.Location = New System.Drawing.Point(3, 22)
Me.ControlBox = False
Me.KeyPreview = True
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.ShowInTaskbar = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.BackColor = System.Drawing.SystemColors.Control
Me.Enabled = True
Me.Cursor = System.Windows.Forms.Cursors.Default
Me.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.HelpButton = False
Me.WindowState = System.Windows.Forms.FormWindowState.Normal
Me.Name = "frmItemItem"
Me._cmdClear_10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me._cmdClear_10.Text = "&Clear"
Me._cmdClear_10.Size = New System.Drawing.Size(34, 19)
Me._cmdClear_10.Location = New System.Drawing.Point(453, 282)
Me._cmdClear_10.TabIndex = 34
Me._cmdClear_10.TabStop = False
Me._cmdClear_10.BackColor = System.Drawing.SystemColors.Control
Me._cmdClear_10.CausesValidation = True
Me._cmdClear_10.Enabled = True
Me._cmdClear_10.ForeColor = System.Drawing.SystemColors.ControlText
Me._cmdClear_10.Cursor = System.Windows.Forms.Cursors.Default
Me._cmdClear_10.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._cmdClear_10.Name = "_cmdClear_10"
Me._cmdStockItem_10.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me._cmdStockItem_10.Text = "..."
Me._cmdStockItem_10.Size = New System.Drawing.Size(34, 19)
Me._cmdStockItem_10.Location = New System.Drawing.Point(414, 282)
Me._cmdStockItem_10.TabIndex = 32
Me._cmdStockItem_10.BackColor = System.Drawing.SystemColors.Control
Me._cmdStockItem_10.CausesValidation = True
Me._cmdStockItem_10.Enabled = True
Me._cmdStockItem_10.ForeColor = System.Drawing.SystemColors.ControlText
Me._cmdStockItem_10.Cursor = System.Windows.Forms.Cursors.Default
Me._cmdStockItem_10.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._cmdStockItem_10.TabStop = True
Me._cmdStockItem_10.Name = "_cmdStockItem_10"
Me._cmdClear_9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me._cmdClear_9.Text = "&Clear"
Me._cmdClear_9.Size = New System.Drawing.Size(34, 19)
Me._cmdClear_9.Location = New System.Drawing.Point(453, 255)
Me._cmdClear_9.TabIndex = 31
Me._cmdClear_9.TabStop = False
Me._cmdClear_9.BackColor = System.Drawing.SystemColors.Control
Me._cmdClear_9.CausesValidation = True
Me._cmdClear_9.Enabled = True
Me._cmdClear_9.ForeColor = System.Drawing.SystemColors.ControlText
Me._cmdClear_9.Cursor = System.Windows.Forms.Cursors.Default
Me._cmdClear_9.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._cmdClear_9.Name = "_cmdClear_9"
Me._cmdStockItem_9.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me._cmdStockItem_9.Text = "..."
Me._cmdStockItem_9.Size = New System.Drawing.Size(34, 19)
Me._cmdStockItem_9.Location = New System.Drawing.Point(414, 255)
Me._cmdStockItem_9.TabIndex = 29
Me._cmdStockItem_9.BackColor = System.Drawing.SystemColors.Control
Me._cmdStockItem_9.CausesValidation = True
Me._cmdStockItem_9.Enabled = True
Me._cmdStockItem_9.ForeColor = System.Drawing.SystemColors.ControlText
Me._cmdStockItem_9.Cursor = System.Windows.Forms.Cursors.Default
Me._cmdStockItem_9.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._cmdStockItem_9.TabStop = True
Me._cmdStockItem_9.Name = "_cmdStockItem_9"
Me._cmdClear_8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me._cmdClear_8.Text = "&Clear"
Me._cmdClear_8.Size = New System.Drawing.Size(34, 19)
Me._cmdClear_8.Location = New System.Drawing.Point(453, 228)
Me._cmdClear_8.TabIndex = 28
Me._cmdClear_8.TabStop = False
Me._cmdClear_8.BackColor = System.Drawing.SystemColors.Control
Me._cmdClear_8.CausesValidation = True
Me._cmdClear_8.Enabled = True
Me._cmdClear_8.ForeColor = System.Drawing.SystemColors.ControlText
Me._cmdClear_8.Cursor = System.Windows.Forms.Cursors.Default
Me._cmdClear_8.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._cmdClear_8.Name = "_cmdClear_8"
Me._cmdStockItem_8.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me._cmdStockItem_8.Text = "..."
Me._cmdStockItem_8.Size = New System.Drawing.Size(34, 19)
Me._cmdStockItem_8.Location = New System.Drawing.Point(414, 228)
Me._cmdStockItem_8.TabIndex = 26
Me._cmdStockItem_8.BackColor = System.Drawing.SystemColors.Control
Me._cmdStockItem_8.CausesValidation = True
Me._cmdStockItem_8.Enabled = True
Me._cmdStockItem_8.ForeColor = System.Drawing.SystemColors.ControlText
Me._cmdStockItem_8.Cursor = System.Windows.Forms.Cursors.Default
Me._cmdStockItem_8.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._cmdStockItem_8.TabStop = True
Me._cmdStockItem_8.Name = "_cmdStockItem_8"
Me._cmdClear_7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me._cmdClear_7.Text = "&Clear"
Me._cmdClear_7.Size = New System.Drawing.Size(34, 19)
Me._cmdClear_7.Location = New System.Drawing.Point(453, 201)
Me._cmdClear_7.TabIndex = 25
Me._cmdClear_7.TabStop = False
Me._cmdClear_7.BackColor = System.Drawing.SystemColors.Control
Me._cmdClear_7.CausesValidation = True
Me._cmdClear_7.Enabled = True
Me._cmdClear_7.ForeColor = System.Drawing.SystemColors.ControlText
Me._cmdClear_7.Cursor = System.Windows.Forms.Cursors.Default
Me._cmdClear_7.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._cmdClear_7.Name = "_cmdClear_7"
Me._cmdStockItem_7.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me._cmdStockItem_7.Text = "..."
Me._cmdStockItem_7.Size = New System.Drawing.Size(34, 19)
Me._cmdStockItem_7.Location = New System.Drawing.Point(414, 201)
Me._cmdStockItem_7.TabIndex = 23
Me._cmdStockItem_7.BackColor = System.Drawing.SystemColors.Control
Me._cmdStockItem_7.CausesValidation = True
Me._cmdStockItem_7.Enabled = True
Me._cmdStockItem_7.ForeColor = System.Drawing.SystemColors.ControlText
Me._cmdStockItem_7.Cursor = System.Windows.Forms.Cursors.Default
Me._cmdStockItem_7.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._cmdStockItem_7.TabStop = True
Me._cmdStockItem_7.Name = "_cmdStockItem_7"
Me._cmdClear_6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me._cmdClear_6.Text = "&Clear"
Me._cmdClear_6.Size = New System.Drawing.Size(34, 19)
Me._cmdClear_6.Location = New System.Drawing.Point(453, 174)
Me._cmdClear_6.TabIndex = 22
Me._cmdClear_6.TabStop = False
Me._cmdClear_6.BackColor = System.Drawing.SystemColors.Control
Me._cmdClear_6.CausesValidation = True
Me._cmdClear_6.Enabled = True
Me._cmdClear_6.ForeColor = System.Drawing.SystemColors.ControlText
Me._cmdClear_6.Cursor = System.Windows.Forms.Cursors.Default
Me._cmdClear_6.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._cmdClear_6.Name = "_cmdClear_6"
Me._cmdStockItem_6.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me._cmdStockItem_6.Text = "..."
Me._cmdStockItem_6.Size = New System.Drawing.Size(34, 19)
Me._cmdStockItem_6.Location = New System.Drawing.Point(414, 174)
Me._cmdStockItem_6.TabIndex = 20
Me._cmdStockItem_6.BackColor = System.Drawing.SystemColors.Control
Me._cmdStockItem_6.CausesValidation = True
Me._cmdStockItem_6.Enabled = True
Me._cmdStockItem_6.ForeColor = System.Drawing.SystemColors.ControlText
Me._cmdStockItem_6.Cursor = System.Windows.Forms.Cursors.Default
Me._cmdStockItem_6.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._cmdStockItem_6.TabStop = True
Me._cmdStockItem_6.Name = "_cmdStockItem_6"
Me._cmdClear_5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me._cmdClear_5.Text = "&Clear"
Me._cmdClear_5.Size = New System.Drawing.Size(34, 19)
Me._cmdClear_5.Location = New System.Drawing.Point(453, 147)
Me._cmdClear_5.TabIndex = 19
Me._cmdClear_5.TabStop = False
Me._cmdClear_5.BackColor = System.Drawing.SystemColors.Control
Me._cmdClear_5.CausesValidation = True
Me._cmdClear_5.Enabled = True
Me._cmdClear_5.ForeColor = System.Drawing.SystemColors.ControlText
Me._cmdClear_5.Cursor = System.Windows.Forms.Cursors.Default
Me._cmdClear_5.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._cmdClear_5.Name = "_cmdClear_5"
Me._cmdStockItem_5.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me._cmdStockItem_5.Text = "..."
Me._cmdStockItem_5.Size = New System.Drawing.Size(34, 19)
Me._cmdStockItem_5.Location = New System.Drawing.Point(414, 147)
Me._cmdStockItem_5.TabIndex = 17
Me._cmdStockItem_5.BackColor = System.Drawing.SystemColors.Control
Me._cmdStockItem_5.CausesValidation = True
Me._cmdStockItem_5.Enabled = True
Me._cmdStockItem_5.ForeColor = System.Drawing.SystemColors.ControlText
Me._cmdStockItem_5.Cursor = System.Windows.Forms.Cursors.Default
Me._cmdStockItem_5.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._cmdStockItem_5.TabStop = True
Me._cmdStockItem_5.Name = "_cmdStockItem_5"
Me._cmdClear_4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me._cmdClear_4.Text = "&Clear"
Me._cmdClear_4.Size = New System.Drawing.Size(34, 19)
Me._cmdClear_4.Location = New System.Drawing.Point(453, 120)
Me._cmdClear_4.TabIndex = 16
Me._cmdClear_4.TabStop = False
Me._cmdClear_4.BackColor = System.Drawing.SystemColors.Control
Me._cmdClear_4.CausesValidation = True
Me._cmdClear_4.Enabled = True
Me._cmdClear_4.ForeColor = System.Drawing.SystemColors.ControlText
Me._cmdClear_4.Cursor = System.Windows.Forms.Cursors.Default
Me._cmdClear_4.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._cmdClear_4.Name = "_cmdClear_4"
Me._cmdStockItem_4.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me._cmdStockItem_4.Text = "..."
Me._cmdStockItem_4.Size = New System.Drawing.Size(34, 19)
Me._cmdStockItem_4.Location = New System.Drawing.Point(414, 120)
Me._cmdStockItem_4.TabIndex = 14
Me._cmdStockItem_4.BackColor = System.Drawing.SystemColors.Control
Me._cmdStockItem_4.CausesValidation = True
Me._cmdStockItem_4.Enabled = True
Me._cmdStockItem_4.ForeColor = System.Drawing.SystemColors.ControlText
Me._cmdStockItem_4.Cursor = System.Windows.Forms.Cursors.Default
Me._cmdStockItem_4.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._cmdStockItem_4.TabStop = True
Me._cmdStockItem_4.Name = "_cmdStockItem_4"
Me._cmdClear_3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me._cmdClear_3.Text = "&Clear"
Me._cmdClear_3.Size = New System.Drawing.Size(34, 19)
Me._cmdClear_3.Location = New System.Drawing.Point(453, 93)
Me._cmdClear_3.TabIndex = 13
Me._cmdClear_3.TabStop = False
Me._cmdClear_3.BackColor = System.Drawing.SystemColors.Control
Me._cmdClear_3.CausesValidation = True
Me._cmdClear_3.Enabled = True
Me._cmdClear_3.ForeColor = System.Drawing.SystemColors.ControlText
Me._cmdClear_3.Cursor = System.Windows.Forms.Cursors.Default
Me._cmdClear_3.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._cmdClear_3.Name = "_cmdClear_3"
Me._cmdStockItem_3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me._cmdStockItem_3.Text = "..."
Me._cmdStockItem_3.Size = New System.Drawing.Size(34, 19)
Me._cmdStockItem_3.Location = New System.Drawing.Point(414, 93)
Me._cmdStockItem_3.TabIndex = 11
Me._cmdStockItem_3.BackColor = System.Drawing.SystemColors.Control
Me._cmdStockItem_3.CausesValidation = True
Me._cmdStockItem_3.Enabled = True
Me._cmdStockItem_3.ForeColor = System.Drawing.SystemColors.ControlText
Me._cmdStockItem_3.Cursor = System.Windows.Forms.Cursors.Default
Me._cmdStockItem_3.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._cmdStockItem_3.TabStop = True
Me._cmdStockItem_3.Name = "_cmdStockItem_3"
Me._cmdClear_2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me._cmdClear_2.Text = "&Clear"
Me._cmdClear_2.Size = New System.Drawing.Size(34, 19)
Me._cmdClear_2.Location = New System.Drawing.Point(453, 66)
Me._cmdClear_2.TabIndex = 10
Me._cmdClear_2.TabStop = False
Me._cmdClear_2.BackColor = System.Drawing.SystemColors.Control
Me._cmdClear_2.CausesValidation = True
Me._cmdClear_2.Enabled = True
Me._cmdClear_2.ForeColor = System.Drawing.SystemColors.ControlText
Me._cmdClear_2.Cursor = System.Windows.Forms.Cursors.Default
Me._cmdClear_2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._cmdClear_2.Name = "_cmdClear_2"
Me._cmdStockItem_2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me._cmdStockItem_2.Text = "..."
Me._cmdStockItem_2.Size = New System.Drawing.Size(34, 19)
Me._cmdStockItem_2.Location = New System.Drawing.Point(414, 66)
Me._cmdStockItem_2.TabIndex = 8
Me._cmdStockItem_2.BackColor = System.Drawing.SystemColors.Control
Me._cmdStockItem_2.CausesValidation = True
Me._cmdStockItem_2.Enabled = True
Me._cmdStockItem_2.ForeColor = System.Drawing.SystemColors.ControlText
Me._cmdStockItem_2.Cursor = System.Windows.Forms.Cursors.Default
Me._cmdStockItem_2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._cmdStockItem_2.TabStop = True
Me._cmdStockItem_2.Name = "_cmdStockItem_2"
Me._cmdClear_1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me._cmdClear_1.Text = "&Clear"
Me._cmdClear_1.Size = New System.Drawing.Size(34, 19)
Me._cmdClear_1.Location = New System.Drawing.Point(453, 39)
Me._cmdClear_1.TabIndex = 7
Me._cmdClear_1.TabStop = False
Me._cmdClear_1.BackColor = System.Drawing.SystemColors.Control
Me._cmdClear_1.CausesValidation = True
Me._cmdClear_1.Enabled = True
Me._cmdClear_1.ForeColor = System.Drawing.SystemColors.ControlText
Me._cmdClear_1.Cursor = System.Windows.Forms.Cursors.Default
Me._cmdClear_1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._cmdClear_1.Name = "_cmdClear_1"
Me._cmdStockItem_1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me._cmdStockItem_1.Text = "..."
Me._cmdStockItem_1.Size = New System.Drawing.Size(34, 19)
Me._cmdStockItem_1.Location = New System.Drawing.Point(414, 39)
Me._cmdStockItem_1.TabIndex = 5
Me._cmdStockItem_1.BackColor = System.Drawing.SystemColors.Control
Me._cmdStockItem_1.CausesValidation = True
Me._cmdStockItem_1.Enabled = True
Me._cmdStockItem_1.ForeColor = System.Drawing.SystemColors.ControlText
Me._cmdStockItem_1.Cursor = System.Windows.Forms.Cursors.Default
Me._cmdStockItem_1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._cmdStockItem_1.TabStop = True
Me._cmdStockItem_1.Name = "_cmdStockItem_1"
Me.cmdExit.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me.cmdExit.Text = "E&xit"
Me.cmdExit.Size = New System.Drawing.Size(79, 31)
Me.cmdExit.Location = New System.Drawing.Point(12, 321)
Me.cmdExit.TabIndex = 4
Me.cmdExit.BackColor = System.Drawing.SystemColors.Control
Me.cmdExit.CausesValidation = True
Me.cmdExit.Enabled = True
Me.cmdExit.ForeColor = System.Drawing.SystemColors.ControlText
Me.cmdExit.Cursor = System.Windows.Forms.Cursors.Default
Me.cmdExit.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.cmdExit.TabStop = True
Me.cmdExit.Name = "cmdExit"
Me.cmdLoad.TextAlign = System.Drawing.ContentAlignment.MiddleCenter
Me.cmdLoad.Text = "&Load report >>"
Me.cmdLoad.Size = New System.Drawing.Size(79, 31)
Me.cmdLoad.Location = New System.Drawing.Point(417, 321)
Me.cmdLoad.TabIndex = 3
Me.cmdLoad.BackColor = System.Drawing.SystemColors.Control
Me.cmdLoad.CausesValidation = True
Me.cmdLoad.Enabled = True
Me.cmdLoad.ForeColor = System.Drawing.SystemColors.ControlText
Me.cmdLoad.Cursor = System.Windows.Forms.Cursors.Default
Me.cmdLoad.RightToLeft = System.Windows.Forms.RightToLeft.No
Me.cmdLoad.TabStop = True
Me.cmdLoad.Name = "cmdLoad"
Me._optDataType_1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
Me._optDataType_1.Text = "Sales &Value"
Me._optDataType_1.Size = New System.Drawing.Size(145, 13)
Me._optDataType_1.Location = New System.Drawing.Point(267, 339)
Me._optDataType_1.TabIndex = 2
Me._optDataType_1.CheckAlign = System.Drawing.ContentAlignment.MiddleLeft
Me._optDataType_1.BackColor = System.Drawing.SystemColors.Control
Me._optDataType_1.CausesValidation = True
Me._optDataType_1.Enabled = True
Me._optDataType_1.ForeColor = System.Drawing.SystemColors.ControlText
Me._optDataType_1.Cursor = System.Windows.Forms.Cursors.Default
Me._optDataType_1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._optDataType_1.Appearance = System.Windows.Forms.Appearance.Normal
Me._optDataType_1.TabStop = True
Me._optDataType_1.Checked = False
Me._optDataType_1.Visible = True
Me._optDataType_1.Name = "_optDataType_1"
Me._optDataType_0.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
Me._optDataType_0.Text = "Sales &Quantity"
Me._optDataType_0.Size = New System.Drawing.Size(145, 13)
Me._optDataType_0.Location = New System.Drawing.Point(267, 321)
Me._optDataType_0.TabIndex = 1
Me._optDataType_0.Checked = True
Me._optDataType_0.CheckAlign = System.Drawing.ContentAlignment.MiddleLeft
Me._optDataType_0.BackColor = System.Drawing.SystemColors.Control
Me._optDataType_0.CausesValidation = True
Me._optDataType_0.Enabled = True
Me._optDataType_0.ForeColor = System.Drawing.SystemColors.ControlText
Me._optDataType_0.Cursor = System.Windows.Forms.Cursors.Default
Me._optDataType_0.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._optDataType_0.Appearance = System.Windows.Forms.Appearance.Normal
Me._optDataType_0.TabStop = True
Me._optDataType_0.Visible = True
Me._optDataType_0.Name = "_optDataType_0"
Me._lbl_11.TextAlign = System.Drawing.ContentAlignment.TopRight
Me._lbl_11.Text = "1&0"
Me._lbl_11.Size = New System.Drawing.Size(17, 13)
Me._lbl_11.Location = New System.Drawing.Point(9, 285)
Me._lbl_11.TabIndex = 44
Me._lbl_11.BackColor = System.Drawing.Color.Transparent
Me._lbl_11.Enabled = True
Me._lbl_11.ForeColor = System.Drawing.SystemColors.ControlText
Me._lbl_11.Cursor = System.Windows.Forms.Cursors.Default
Me._lbl_11.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lbl_11.UseMnemonic = True
Me._lbl_11.Visible = True
Me._lbl_11.AutoSize = False
Me._lbl_11.BorderStyle = System.Windows.Forms.BorderStyle.None
Me._lbl_11.Name = "_lbl_11"
Me._lbl_10.TextAlign = System.Drawing.ContentAlignment.TopRight
Me._lbl_10.Text = "&9"
Me._lbl_10.Size = New System.Drawing.Size(17, 13)
Me._lbl_10.Location = New System.Drawing.Point(9, 258)
Me._lbl_10.TabIndex = 43
Me._lbl_10.BackColor = System.Drawing.Color.Transparent
Me._lbl_10.Enabled = True
Me._lbl_10.ForeColor = System.Drawing.SystemColors.ControlText
Me._lbl_10.Cursor = System.Windows.Forms.Cursors.Default
Me._lbl_10.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lbl_10.UseMnemonic = True
Me._lbl_10.Visible = True
Me._lbl_10.AutoSize = False
Me._lbl_10.BorderStyle = System.Windows.Forms.BorderStyle.None
Me._lbl_10.Name = "_lbl_10"
Me._lbl_9.TextAlign = System.Drawing.ContentAlignment.TopRight
Me._lbl_9.Text = "&8"
Me._lbl_9.Size = New System.Drawing.Size(17, 13)
Me._lbl_9.Location = New System.Drawing.Point(9, 231)
Me._lbl_9.TabIndex = 42
Me._lbl_9.BackColor = System.Drawing.Color.Transparent
Me._lbl_9.Enabled = True
Me._lbl_9.ForeColor = System.Drawing.SystemColors.ControlText
Me._lbl_9.Cursor = System.Windows.Forms.Cursors.Default
Me._lbl_9.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lbl_9.UseMnemonic = True
Me._lbl_9.Visible = True
Me._lbl_9.AutoSize = False
Me._lbl_9.BorderStyle = System.Windows.Forms.BorderStyle.None
Me._lbl_9.Name = "_lbl_9"
Me._lbl_8.TextAlign = System.Drawing.ContentAlignment.TopRight
Me._lbl_8.Text = "&7"
Me._lbl_8.Size = New System.Drawing.Size(17, 13)
Me._lbl_8.Location = New System.Drawing.Point(9, 204)
Me._lbl_8.TabIndex = 41
Me._lbl_8.BackColor = System.Drawing.Color.Transparent
Me._lbl_8.Enabled = True
Me._lbl_8.ForeColor = System.Drawing.SystemColors.ControlText
Me._lbl_8.Cursor = System.Windows.Forms.Cursors.Default
Me._lbl_8.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lbl_8.UseMnemonic = True
Me._lbl_8.Visible = True
Me._lbl_8.AutoSize = False
Me._lbl_8.BorderStyle = System.Windows.Forms.BorderStyle.None
Me._lbl_8.Name = "_lbl_8"
Me._lbl_7.TextAlign = System.Drawing.ContentAlignment.TopRight
Me._lbl_7.Text = "&6"
Me._lbl_7.Size = New System.Drawing.Size(17, 13)
Me._lbl_7.Location = New System.Drawing.Point(9, 177)
Me._lbl_7.TabIndex = 40
Me._lbl_7.BackColor = System.Drawing.Color.Transparent
Me._lbl_7.Enabled = True
Me._lbl_7.ForeColor = System.Drawing.SystemColors.ControlText
Me._lbl_7.Cursor = System.Windows.Forms.Cursors.Default
Me._lbl_7.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lbl_7.UseMnemonic = True
Me._lbl_7.Visible = True
Me._lbl_7.AutoSize = False
Me._lbl_7.BorderStyle = System.Windows.Forms.BorderStyle.None
Me._lbl_7.Name = "_lbl_7"
Me._lbl_6.TextAlign = System.Drawing.ContentAlignment.TopRight
Me._lbl_6.Text = "&5"
Me._lbl_6.Size = New System.Drawing.Size(17, 13)
Me._lbl_6.Location = New System.Drawing.Point(9, 150)
Me._lbl_6.TabIndex = 39
Me._lbl_6.BackColor = System.Drawing.Color.Transparent
Me._lbl_6.Enabled = True
Me._lbl_6.ForeColor = System.Drawing.SystemColors.ControlText
Me._lbl_6.Cursor = System.Windows.Forms.Cursors.Default
Me._lbl_6.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lbl_6.UseMnemonic = True
Me._lbl_6.Visible = True
Me._lbl_6.AutoSize = False
Me._lbl_6.BorderStyle = System.Windows.Forms.BorderStyle.None
Me._lbl_6.Name = "_lbl_6"
Me._lbl_5.TextAlign = System.Drawing.ContentAlignment.TopRight
Me._lbl_5.Text = "&4"
Me._lbl_5.Size = New System.Drawing.Size(17, 13)
Me._lbl_5.Location = New System.Drawing.Point(9, 123)
Me._lbl_5.TabIndex = 38
Me._lbl_5.BackColor = System.Drawing.Color.Transparent
Me._lbl_5.Enabled = True
Me._lbl_5.ForeColor = System.Drawing.SystemColors.ControlText
Me._lbl_5.Cursor = System.Windows.Forms.Cursors.Default
Me._lbl_5.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lbl_5.UseMnemonic = True
Me._lbl_5.Visible = True
Me._lbl_5.AutoSize = False
Me._lbl_5.BorderStyle = System.Windows.Forms.BorderStyle.None
Me._lbl_5.Name = "_lbl_5"
Me._lbl_4.TextAlign = System.Drawing.ContentAlignment.TopRight
Me._lbl_4.Text = "&3"
Me._lbl_4.Size = New System.Drawing.Size(17, 13)
Me._lbl_4.Location = New System.Drawing.Point(9, 96)
Me._lbl_4.TabIndex = 37
Me._lbl_4.BackColor = System.Drawing.Color.Transparent
Me._lbl_4.Enabled = True
Me._lbl_4.ForeColor = System.Drawing.SystemColors.ControlText
Me._lbl_4.Cursor = System.Windows.Forms.Cursors.Default
Me._lbl_4.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lbl_4.UseMnemonic = True
Me._lbl_4.Visible = True
Me._lbl_4.AutoSize = False
Me._lbl_4.BorderStyle = System.Windows.Forms.BorderStyle.None
Me._lbl_4.Name = "_lbl_4"
Me._lbl_3.TextAlign = System.Drawing.ContentAlignment.TopRight
Me._lbl_3.Text = "&2"
Me._lbl_3.Size = New System.Drawing.Size(17, 13)
Me._lbl_3.Location = New System.Drawing.Point(9, 69)
Me._lbl_3.TabIndex = 36
Me._lbl_3.BackColor = System.Drawing.Color.Transparent
Me._lbl_3.Enabled = True
Me._lbl_3.ForeColor = System.Drawing.SystemColors.ControlText
Me._lbl_3.Cursor = System.Windows.Forms.Cursors.Default
Me._lbl_3.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lbl_3.UseMnemonic = True
Me._lbl_3.Visible = True
Me._lbl_3.AutoSize = False
Me._lbl_3.BorderStyle = System.Windows.Forms.BorderStyle.None
Me._lbl_3.Name = "_lbl_3"
Me._lbl_2.TextAlign = System.Drawing.ContentAlignment.TopRight
Me._lbl_2.Text = "&1"
Me._lbl_2.Size = New System.Drawing.Size(17, 13)
Me._lbl_2.Location = New System.Drawing.Point(9, 42)
Me._lbl_2.TabIndex = 35
Me._lbl_2.BackColor = System.Drawing.Color.Transparent
Me._lbl_2.Enabled = True
Me._lbl_2.ForeColor = System.Drawing.SystemColors.ControlText
Me._lbl_2.Cursor = System.Windows.Forms.Cursors.Default
Me._lbl_2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lbl_2.UseMnemonic = True
Me._lbl_2.Visible = True
Me._lbl_2.AutoSize = False
Me._lbl_2.BorderStyle = System.Windows.Forms.BorderStyle.None
Me._lbl_2.Name = "_lbl_2"
Me._lblItem_10.Size = New System.Drawing.Size(382, 19)
Me._lblItem_10.Location = New System.Drawing.Point(30, 282)
Me._lblItem_10.TabIndex = 33
Me._lblItem_10.TextAlign = System.Drawing.ContentAlignment.TopLeft
Me._lblItem_10.BackColor = System.Drawing.SystemColors.Control
Me._lblItem_10.Enabled = True
Me._lblItem_10.ForeColor = System.Drawing.SystemColors.ControlText
Me._lblItem_10.Cursor = System.Windows.Forms.Cursors.Default
Me._lblItem_10.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lblItem_10.UseMnemonic = True
Me._lblItem_10.Visible = True
Me._lblItem_10.AutoSize = False
Me._lblItem_10.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me._lblItem_10.Name = "_lblItem_10"
Me._lblItem_9.Size = New System.Drawing.Size(382, 19)
Me._lblItem_9.Location = New System.Drawing.Point(30, 255)
Me._lblItem_9.TabIndex = 30
Me._lblItem_9.TextAlign = System.Drawing.ContentAlignment.TopLeft
Me._lblItem_9.BackColor = System.Drawing.SystemColors.Control
Me._lblItem_9.Enabled = True
Me._lblItem_9.ForeColor = System.Drawing.SystemColors.ControlText
Me._lblItem_9.Cursor = System.Windows.Forms.Cursors.Default
Me._lblItem_9.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lblItem_9.UseMnemonic = True
Me._lblItem_9.Visible = True
Me._lblItem_9.AutoSize = False
Me._lblItem_9.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me._lblItem_9.Name = "_lblItem_9"
Me._lblItem_8.Size = New System.Drawing.Size(382, 19)
Me._lblItem_8.Location = New System.Drawing.Point(30, 228)
Me._lblItem_8.TabIndex = 27
Me._lblItem_8.TextAlign = System.Drawing.ContentAlignment.TopLeft
Me._lblItem_8.BackColor = System.Drawing.SystemColors.Control
Me._lblItem_8.Enabled = True
Me._lblItem_8.ForeColor = System.Drawing.SystemColors.ControlText
Me._lblItem_8.Cursor = System.Windows.Forms.Cursors.Default
Me._lblItem_8.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lblItem_8.UseMnemonic = True
Me._lblItem_8.Visible = True
Me._lblItem_8.AutoSize = False
Me._lblItem_8.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me._lblItem_8.Name = "_lblItem_8"
Me._lblItem_7.Size = New System.Drawing.Size(382, 19)
Me._lblItem_7.Location = New System.Drawing.Point(30, 201)
Me._lblItem_7.TabIndex = 24
Me._lblItem_7.TextAlign = System.Drawing.ContentAlignment.TopLeft
Me._lblItem_7.BackColor = System.Drawing.SystemColors.Control
Me._lblItem_7.Enabled = True
Me._lblItem_7.ForeColor = System.Drawing.SystemColors.ControlText
Me._lblItem_7.Cursor = System.Windows.Forms.Cursors.Default
Me._lblItem_7.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lblItem_7.UseMnemonic = True
Me._lblItem_7.Visible = True
Me._lblItem_7.AutoSize = False
Me._lblItem_7.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me._lblItem_7.Name = "_lblItem_7"
Me._lblItem_6.Size = New System.Drawing.Size(382, 19)
Me._lblItem_6.Location = New System.Drawing.Point(30, 174)
Me._lblItem_6.TabIndex = 21
Me._lblItem_6.TextAlign = System.Drawing.ContentAlignment.TopLeft
Me._lblItem_6.BackColor = System.Drawing.SystemColors.Control
Me._lblItem_6.Enabled = True
Me._lblItem_6.ForeColor = System.Drawing.SystemColors.ControlText
Me._lblItem_6.Cursor = System.Windows.Forms.Cursors.Default
Me._lblItem_6.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lblItem_6.UseMnemonic = True
Me._lblItem_6.Visible = True
Me._lblItem_6.AutoSize = False
Me._lblItem_6.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me._lblItem_6.Name = "_lblItem_6"
Me._lblItem_5.Size = New System.Drawing.Size(382, 19)
Me._lblItem_5.Location = New System.Drawing.Point(30, 147)
Me._lblItem_5.TabIndex = 18
Me._lblItem_5.TextAlign = System.Drawing.ContentAlignment.TopLeft
Me._lblItem_5.BackColor = System.Drawing.SystemColors.Control
Me._lblItem_5.Enabled = True
Me._lblItem_5.ForeColor = System.Drawing.SystemColors.ControlText
Me._lblItem_5.Cursor = System.Windows.Forms.Cursors.Default
Me._lblItem_5.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lblItem_5.UseMnemonic = True
Me._lblItem_5.Visible = True
Me._lblItem_5.AutoSize = False
Me._lblItem_5.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me._lblItem_5.Name = "_lblItem_5"
Me._lblItem_4.Size = New System.Drawing.Size(382, 19)
Me._lblItem_4.Location = New System.Drawing.Point(30, 120)
Me._lblItem_4.TabIndex = 15
Me._lblItem_4.TextAlign = System.Drawing.ContentAlignment.TopLeft
Me._lblItem_4.BackColor = System.Drawing.SystemColors.Control
Me._lblItem_4.Enabled = True
Me._lblItem_4.ForeColor = System.Drawing.SystemColors.ControlText
Me._lblItem_4.Cursor = System.Windows.Forms.Cursors.Default
Me._lblItem_4.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lblItem_4.UseMnemonic = True
Me._lblItem_4.Visible = True
Me._lblItem_4.AutoSize = False
Me._lblItem_4.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me._lblItem_4.Name = "_lblItem_4"
Me._lblItem_3.Size = New System.Drawing.Size(382, 19)
Me._lblItem_3.Location = New System.Drawing.Point(30, 93)
Me._lblItem_3.TabIndex = 12
Me._lblItem_3.TextAlign = System.Drawing.ContentAlignment.TopLeft
Me._lblItem_3.BackColor = System.Drawing.SystemColors.Control
Me._lblItem_3.Enabled = True
Me._lblItem_3.ForeColor = System.Drawing.SystemColors.ControlText
Me._lblItem_3.Cursor = System.Windows.Forms.Cursors.Default
Me._lblItem_3.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lblItem_3.UseMnemonic = True
Me._lblItem_3.Visible = True
Me._lblItem_3.AutoSize = False
Me._lblItem_3.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me._lblItem_3.Name = "_lblItem_3"
Me._lblItem_2.Size = New System.Drawing.Size(382, 19)
Me._lblItem_2.Location = New System.Drawing.Point(30, 66)
Me._lblItem_2.TabIndex = 9
Me._lblItem_2.TextAlign = System.Drawing.ContentAlignment.TopLeft
Me._lblItem_2.BackColor = System.Drawing.SystemColors.Control
Me._lblItem_2.Enabled = True
Me._lblItem_2.ForeColor = System.Drawing.SystemColors.ControlText
Me._lblItem_2.Cursor = System.Windows.Forms.Cursors.Default
Me._lblItem_2.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lblItem_2.UseMnemonic = True
Me._lblItem_2.Visible = True
Me._lblItem_2.AutoSize = False
Me._lblItem_2.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me._lblItem_2.Name = "_lblItem_2"
Me._lblItem_1.Size = New System.Drawing.Size(382, 19)
Me._lblItem_1.Location = New System.Drawing.Point(30, 39)
Me._lblItem_1.TabIndex = 6
Me._lblItem_1.TextAlign = System.Drawing.ContentAlignment.TopLeft
Me._lblItem_1.BackColor = System.Drawing.SystemColors.Control
Me._lblItem_1.Enabled = True
Me._lblItem_1.ForeColor = System.Drawing.SystemColors.ControlText
Me._lblItem_1.Cursor = System.Windows.Forms.Cursors.Default
Me._lblItem_1.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lblItem_1.UseMnemonic = True
Me._lblItem_1.Visible = True
Me._lblItem_1.AutoSize = False
Me._lblItem_1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
Me._lblItem_1.Name = "_lblItem_1"
Me._lbl_0.Text = "&1. Select Stock Items"
Me._lbl_0.Size = New System.Drawing.Size(123, 13)
Me._lbl_0.Location = New System.Drawing.Point(9, 9)
Me._lbl_0.TabIndex = 0
Me._lbl_0.TextAlign = System.Drawing.ContentAlignment.TopLeft
Me._lbl_0.BackColor = System.Drawing.Color.Transparent
Me._lbl_0.Enabled = True
Me._lbl_0.ForeColor = System.Drawing.SystemColors.ControlText
Me._lbl_0.Cursor = System.Windows.Forms.Cursors.Default
Me._lbl_0.RightToLeft = System.Windows.Forms.RightToLeft.No
Me._lbl_0.UseMnemonic = True
Me._lbl_0.Visible = True
Me._lbl_0.AutoSize = True
Me._lbl_0.BorderStyle = System.Windows.Forms.BorderStyle.None
Me._lbl_0.Name = "_lbl_0"
Me._Shape1_1.BackColor = System.Drawing.Color.FromARGB(192, 192, 255)
Me._Shape1_1.BackStyle = Microsoft.VisualBasic.PowerPacks.BackStyle.Opaque
Me._Shape1_1.Size = New System.Drawing.Size(487, 283)
Me._Shape1_1.Location = New System.Drawing.Point(9, 30)
Me._Shape1_1.BorderColor = System.Drawing.SystemColors.WindowText
Me._Shape1_1.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid
Me._Shape1_1.BorderWidth = 1
Me._Shape1_1.FillColor = System.Drawing.Color.Black
Me._Shape1_1.FillStyle = Microsoft.VisualBasic.PowerPacks.FillStyle.Transparent
Me._Shape1_1.Visible = True
Me._Shape1_1.Name = "_Shape1_1"
Me.Controls.Add(_cmdClear_10)
Me.Controls.Add(_cmdStockItem_10)
Me.Controls.Add(_cmdClear_9)
Me.Controls.Add(_cmdStockItem_9)
Me.Controls.Add(_cmdClear_8)
Me.Controls.Add(_cmdStockItem_8)
Me.Controls.Add(_cmdClear_7)
Me.Controls.Add(_cmdStockItem_7)
Me.Controls.Add(_cmdClear_6)
Me.Controls.Add(_cmdStockItem_6)
Me.Controls.Add(_cmdClear_5)
Me.Controls.Add(_cmdStockItem_5)
Me.Controls.Add(_cmdClear_4)
Me.Controls.Add(_cmdStockItem_4)
Me.Controls.Add(_cmdClear_3)
Me.Controls.Add(_cmdStockItem_3)
Me.Controls.Add(_cmdClear_2)
Me.Controls.Add(_cmdStockItem_2)
Me.Controls.Add(_cmdClear_1)
Me.Controls.Add(_cmdStockItem_1)
Me.Controls.Add(cmdExit)
Me.Controls.Add(cmdLoad)
Me.Controls.Add(_optDataType_1)
Me.Controls.Add(_optDataType_0)
Me.Controls.Add(_lbl_11)
Me.Controls.Add(_lbl_10)
Me.Controls.Add(_lbl_9)
Me.Controls.Add(_lbl_8)
Me.Controls.Add(_lbl_7)
Me.Controls.Add(_lbl_6)
Me.Controls.Add(_lbl_5)
Me.Controls.Add(_lbl_4)
Me.Controls.Add(_lbl_3)
Me.Controls.Add(_lbl_2)
Me.Controls.Add(_lblItem_10)
Me.Controls.Add(_lblItem_9)
Me.Controls.Add(_lblItem_8)
Me.Controls.Add(_lblItem_7)
Me.Controls.Add(_lblItem_6)
Me.Controls.Add(_lblItem_5)
Me.Controls.Add(_lblItem_4)
Me.Controls.Add(_lblItem_3)
Me.Controls.Add(_lblItem_2)
Me.Controls.Add(_lblItem_1)
Me.Controls.Add(_lbl_0)
Me.ShapeContainer1.Shapes.Add(_Shape1_1)
Me.Controls.Add(ShapeContainer1)
'Me.cmdClear.SetIndex(_cmdClear_10, CType(10, Short))
'Me.cmdClear.SetIndex(_cmdClear_9, CType(9, Short))
'Me.cmdClear.SetIndex(_cmdClear_8, CType(8, Short))
'Me.cmdClear.SetIndex(_cmdClear_7, CType(7, Short))
'Me.cmdClear.SetIndex(_cmdClear_6, CType(6, Short))
'Me.cmdClear.SetIndex(_cmdClear_5, CType(5, Short))
'Me.cmdClear.SetIndex(_cmdClear_4, CType(4, Short))
'Me.cmdClear.SetIndex(_cmdClear_3, CType(3, Short))
'Me.cmdClear.SetIndex(_cmdClear_2, CType(2, Short))
'Me.cmdClear.SetIndex(_cmdClear_1, CType(1, Short))
'Me.cmdStockItem.SetIndex(_cmdStockItem_10, CType(10, Short))
'Me.cmdStockItem.SetIndex(_cmdStockItem_9, CType(9, Short))
'Me.cmdStockItem.SetIndex(_cmdStockItem_8, CType(8, Short))
'Me.cmdStockItem.SetIndex(_cmdStockItem_7, CType(7, Short))
'Me.cmdStockItem.SetIndex(_cmdStockItem_6, CType(6, Short))
'Me.cmdStockItem.SetIndex(_cmdStockItem_5, CType(5, Short))
'Me.cmdStockItem.SetIndex(_cmdStockItem_4, CType(4, Short))
'Me.cmdStockItem.SetIndex(_cmdStockItem_3, CType(3, Short))
'Me.cmdStockItem.SetIndex(_cmdStockItem_2, CType(2, Short))
'Me.cmdStockItem.SetIndex(_cmdStockItem_1, CType(1, Short))
'Me.lbl.SetIndex(_lbl_11, CType(11, Short))
'Me.lbl.SetIndex(_lbl_10, CType(10, Short))
'Me.lbl.SetIndex(_lbl_9, CType(9, Short))
'Me.lbl.SetIndex(_lbl_8, CType(8, Short))
'Me.lbl.SetIndex(_lbl_7, CType(7, Short))
'Me.lbl.SetIndex(_lbl_6, CType(6, Short))
'Me.lbl.SetIndex(_lbl_5, CType(5, Short))
'Me.lbl.SetIndex(_lbl_4, CType(4, Short))
'Me.lbl.SetIndex(_lbl_3, CType(3, Short))
'Me.lbl.SetIndex(_lbl_2, CType(2, Short))
'Me.lbl.SetIndex(_lbl_0, CType(0, Short))
'Me.lblItem.SetIndex(_lblItem_10, CType(10, Short))
'Me.lblItem.SetIndex(_lblItem_9, CType(9, Short))
'Me.lblItem.SetIndex(_lblItem_8, CType(8, Short))
'Me.lblItem.SetIndex(_lblItem_7, CType(7, Short))
'Me.lblItem.SetIndex(_lblItem_6, CType(6, Short))
'Me.lblItem.SetIndex(_lblItem_5, CType(5, Short))
'Me.lblItem.SetIndex(_lblItem_4, CType(4, Short))
'Me.lblItem.SetIndex(_lblItem_3, CType(3, Short))
'Me.lblItem.SetIndex(_lblItem_2, CType(2, Short))
'Me.lblItem.SetIndex(_lblItem_1, CType(1, Short))
'Me.optDataType.SetIndex(_optDataType_1, CType(1, Short))
'Me.optDataType.SetIndex(_optDataType_0, CType(0, Short))
Me.Shape1.SetIndex(_Shape1_1, CType(1, Short))
CType(Me.Shape1, System.ComponentModel.ISupportInitialize).EndInit()
'CType(Me.optDataType, System.ComponentModel.ISupportInitialize).EndInit()
'CType(Me.lblItem, System.ComponentModel.ISupportInitialize).EndInit()
'CType(Me.lbl, System.ComponentModel.ISupportInitialize).EndInit()
'CType(Me.cmdStockItem, System.ComponentModel.ISupportInitialize).EndInit()
'CType(Me.cmdClear, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()
End Sub
#End Region
End Class |
' Copyright (c) Microsoft Corporation. All rights reserved.
Imports System.ServiceModel
Imports System.ServiceModel.Channels
Namespace Microsoft.ServiceModel.Samples
Public Class TransactionFlowProperty
Public Const PropertyName = "TransactionFlowProperty"
Private propToken() As Byte
Private Sub New()
End Sub
Public Shared Function [Get](ByVal message As Message) As Byte()
If message Is Nothing Then
Return Nothing
End If
If message.Properties.ContainsKey(PropertyName) Then
Dim tfp As TransactionFlowProperty = CType(message.Properties(PropertyName), TransactionFlowProperty)
Return tfp.propToken
End If
Return Nothing
End Function
Public Shared Sub [Set](ByVal propToken() As Byte, ByVal message As Message)
If message.Properties.ContainsKey(PropertyName) Then
Throw New CommunicationException("A transaction flow property is already set on the message.")
End If
Dim [property] As New TransactionFlowProperty()
[property].propToken = propToken
message.Properties.Add(PropertyName, [property])
End Sub
End Class
End Namespace
|
Imports System
Namespace Waf.DotNetPad.Samples
Module AutoPropertyInitializers
Sub Main()
Dim customer = New Customer(3)
Console.WriteLine("Customer {0}: {1}, {2}", customer.Id, customer.First, customer.Last)
End Sub
End Module
Class Customer
Sub New(id As Integer)
Me.Id = id
End Sub
Public ReadOnly Property Id As Integer
Public Property First As String = "Luke"
Public Property Last As String = "Skywalker"
End Class
End Namespace |
Imports ProdCon
Public Class MathWorkItem
Inherits WorkItem(Of IEnumerable(Of Integer), MathResult)
Public Sub New(ByVal Data As IEnumerable(Of Integer))
MyBase.New(Data)
_work = getWork()
End Sub
Private Function getWork() As Func(Of IEnumerable(Of Integer), MathResult)
Static rand As New Random
Dim index As Integer = rand.Next(0, 2)
Dim res As Func(Of IEnumerable(Of Integer), MathResult) = Nothing
Select Case index
Case 0
res = Function(d)
Dim sw As New Stopwatch
sw.Start()
Dim value As Decimal = d.Select(Function(n) CDec(n)).Sum
Threading.Thread.Sleep(rand.Next(500, 1301)) 'artificially make work take time
sw.Stop()
Return New MathResult(value, Data, sw.Elapsed, Threading.Thread.CurrentThread.ManagedThreadId)
End Function
Case 1
res = Function(d)
Dim sw As New Stopwatch
sw.Start()
Dim value As Decimal = d.Aggregate(1D, Function(c, n) c * n)
Threading.Thread.Sleep(rand.Next(500, 1301)) 'artificially make work take time
sw.Stop()
Return New MathResult(value, Data, sw.Elapsed, Threading.Thread.CurrentThread.ManagedThreadId)
End Function
End Select
Return res
End Function
Private _work As Func(Of IEnumerable(Of Integer), MathResult)
Public Overrides Property Work As Func(Of IEnumerable(Of Integer), MathResult)
Get
Return _work
End Get
Set(value As Func(Of IEnumerable(Of Integer), MathResult))
_work = value
End Set
End Property
End Class
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
Imports System.Collections.Immutable
Imports Microsoft.CodeAnalysis.VisualBasic.Symbols
Imports Microsoft.CodeAnalysis.Test.Utilities
Imports Roslyn.Test.Utilities
Imports System.Xml.Linq
Imports Xunit
Namespace Microsoft.CodeAnalysis.VisualBasic.UnitTests.Symbols.Retargeting
Public Class NoPia
Inherits BasicTestBase
''' <summary>
''' Roslyn\Main\Open\Compilers\Test\Resources\Core\SymbolsTests\NoPia\Pia1.vb
''' </summary>
Private Shared ReadOnly s_sourcePia1 As XElement = <compilation name="Pia1"><file name="a.vb"><![CDATA[
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
<Assembly: Guid("f9c2d51d-4f44-45f0-9eda-c9d599b58257")>
<Assembly: ImportedFromTypeLib("Pia1.dll")>
<ComImport, Guid("27e3e649-994b-4f58-b3c6-f8089a5f2c01"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
Public Interface I1
Sub Sub1(ByVal x As Integer)
End Interface
Public Structure S1
Public F1 As Integer
End Structure
Namespace NS1
<ComImport, Guid("27e3e649-994b-4f58-b3c6-f8089a5f2c02"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
Public Interface I2
Sub Sub1(ByVal x As Integer)
End Interface
Public Structure S2
Public F1 As Integer
End Structure
End Namespace
]]></file></compilation>
''' <summary>
''' Disassembly of Roslyn\Main\Open\Compilers\Test\Resources\Core\SymbolsTests\NoPia\LocalTypes1.dll
''' </summary>
Private Shared ReadOnly s_sourceLocalTypes1_IL As XElement = <compilation name="LocalTypes1"><file name="a.vb"><![CDATA[
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
<ComImport, CompilerGenerated, Guid("27e3e649-994b-4f58-b3c6-f8089a5f2c01"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), TypeIdentifier>
Public Interface I1
End Interface
Namespace NS1
<ComImport, CompilerGenerated, Guid("27e3e649-994b-4f58-b3c6-f8089a5f2c02"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), TypeIdentifier>
Public Interface I2
End Interface
End Namespace
Public Class LocalTypes1
Public Sub Test1(x As I1, y As NS1.I2)
End Sub
End Class
]]></file></compilation>
''' <summary>
''' Roslyn\Main\Open\Compilers\Test\Resources\Core\SymbolsTests\NoPia\LocalTypes1.vb
''' </summary>
Private Shared ReadOnly s_sourceLocalTypes1 As XElement = <compilation name="LocalTypes1"><file name="a.vb"><![CDATA[
Public Class LocalTypes1
Public Sub Test1(x As I1, y As NS1.I2)
End Sub
End Class
]]></file></compilation>
''' <summary>
''' Disassembly of Roslyn\Main\Open\Compilers\Test\Resources\Core\SymbolsTests\NoPia\LocalTypes2.dll
''' </summary>
Private Shared ReadOnly s_sourceLocalTypes2_IL As XElement = <compilation name="LocalTypes2"><file name="a.vb"><![CDATA[
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
<CompilerGenerated(), TypeIdentifier("f9c2d51d-4f44-45f0-9eda-c9d599b58257", "S1")>
Public Structure S1
Public F1 As Integer
End Structure
Namespace NS1
<CompilerGenerated(), TypeIdentifier("f9c2d51d-4f44-45f0-9eda-c9d599b58257", "NS1.S2")>
Public Structure S2
Public F1 As Integer
End Structure
End Namespace
Public Class LocalTypes2
Public Sub Test2(x As S1, y As NS1.S2)
End Sub
End Class
]]></file></compilation>
''' <summary>
''' Roslyn\Main\Open\Compilers\Test\Resources\Core\SymbolsTests\NoPia\LocalTypes2.vb
''' </summary>
Private Shared ReadOnly s_sourceLocalTypes2 As XElement = <compilation name="LocalTypes2"><file name="a.vb"><![CDATA[
Public Class LocalTypes2
Public Sub Test2(ByVal x As S1, ByVal y As NS1.S2)
End Sub
End Class
]]></file></compilation>
''' <summary>
''' Disassembly of Roslyn\Main\Open\Compilers\Test\Resources\Core\SymbolsTests\NoPia\LocalTypes3.dll
''' </summary>
Private Shared ReadOnly s_sourceLocalTypes3_IL As XElement = <compilation name="LocalTypes3"><file name="a.vb"><![CDATA[
Imports System.Collections.Generic
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
Public Class C31(Of T)
Public Interface I31(Of S)
End Interface
End Class
Public Class C32(Of T)
End Class
Public Class C33
End Class
<ComImport, CompilerGenerated, Guid("27e3e649-994b-4f58-b3c6-f8089a5f2c01"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown), TypeIdentifier>
Public Interface I1
End Interface
Public Interface I32(Of S)
End Interface
Public Class LocalTypes3
Public Function Test1() As C31(Of C33).I31(Of C33)
Return Nothing
End Function
Public Function Test2() As C31(Of C33).I31(Of I1)
Return Nothing
End Function
Public Function Test3() As C31(Of I1).I31(Of C33)
Return Nothing
End Function
Public Function Test4() As C31(Of C33).I31(Of I32(Of I1))
Return Nothing
End Function
Public Function Test5() As C31(Of I32(Of I1)).I31(Of C33)
Return Nothing
End Function
Public Function Test6() As List(Of I1)
Return Nothing
End Function
End Class
]]></file></compilation>
''' <summary>
''' Roslyn\Main\Open\Compilers\Test\Resources\Core\SymbolsTests\NoPia\LocalTypes3.vb
''' </summary>
Private Shared ReadOnly s_sourceLocalTypes3 As XElement = <compilation name="LocalTypes3"><file name="a.vb"><![CDATA[
Imports System.Collections.Generic
Public Class LocalTypes3
Public Function Test1() As C31(Of C33).I31(Of C33)
Return Nothing
End Function
Public Function Test2() As C31(Of C33).I31(Of I1)
Return Nothing
End Function
Public Function Test3() As C31(Of I1).I31(Of C33)
Return Nothing
End Function
Public Function Test4() As C31(Of C33).I31(Of I32(Of I1))
Return Nothing
End Function
Public Function Test5() As C31(Of I32(Of I1)).I31(Of C33)
Return Nothing
End Function
Public Function Test6() As List(Of I1)
Return Nothing
End Function
End Class
Public Class C31(Of T)
Public Interface I31(Of S)
End Interface
End Class
Public Class C32(Of T)
End Class
Public Interface I32(Of S)
End Interface
Public Class C33
End Class
]]></file></compilation>
<Fact()>
Public Sub HideLocalTypeDefinitions()
Dim compilation1 = CreateCompilationWithMscorlib(s_sourceLocalTypes1_IL)
CompileAndVerify(compilation1)
Dim compilation2 = CreateCompilationWithMscorlib(s_sourceLocalTypes2_IL)
CompileAndVerify(compilation2)
Dim assemblies = MetadataTestHelpers.GetSymbolsForReferences(New Object() {
compilation1,
compilation2,
MscorlibRef
})
Dim localTypes1 = assemblies(0).Modules(0)
Dim localTypes2 = assemblies(1).Modules(0)
Assert.Same(assemblies(2), compilation1.Assembly.CorLibrary)
Assert.Same(assemblies(2), compilation2.Assembly.CorLibrary)
Assert.Equal(2, localTypes1.GlobalNamespace.GetMembers().Length)
Assert.Equal(2, localTypes1.GlobalNamespace.GetMembersUnordered().Length)
Assert.Equal(0, localTypes1.GlobalNamespace.GetMembers("I1").Length)
Assert.Equal(0, localTypes1.GlobalNamespace.GetMembers("S1").Length)
Assert.Equal(1, localTypes1.GlobalNamespace.GetTypeMembers().Length)
Assert.Equal(0, localTypes1.GlobalNamespace.GetTypeMembers("I1").Length)
Assert.Equal(0, localTypes1.GlobalNamespace.GetTypeMembers("S1").Length)
Assert.Equal(0, localTypes1.GlobalNamespace.GetTypeMembers("I1", 0).Length)
Assert.Equal(0, localTypes1.GlobalNamespace.GetTypeMembers("S1", 0).Length)
Assert.Equal(0, localTypes1.GlobalNamespace.GetMember(Of NamespaceSymbol)("NS1").GetTypeMembers().Length())
Assert.Equal(2, localTypes2.GlobalNamespace.GetMembers().Length)
Assert.Equal(2, localTypes2.GlobalNamespace.GetMembersUnordered().Length)
Assert.Equal(0, localTypes2.GlobalNamespace.GetMembers("I1").Length)
Assert.Equal(0, localTypes2.GlobalNamespace.GetMembers("S1").Length)
Assert.Equal(1, localTypes2.GlobalNamespace.GetTypeMembers().Length)
Assert.Equal(0, localTypes2.GlobalNamespace.GetTypeMembers("I1").Length)
Assert.Equal(0, localTypes2.GlobalNamespace.GetTypeMembers("S1").Length)
Assert.Equal(0, localTypes2.GlobalNamespace.GetTypeMembers("I1", 0).Length)
Assert.Equal(0, localTypes2.GlobalNamespace.GetTypeMembers("S1", 0).Length)
Assert.Equal(0, localTypes2.GlobalNamespace.GetMember(Of NamespaceSymbol)("NS1").GetTypeMembers().Length())
Dim fullName_I1 = MetadataTypeName.FromFullName("I1")
Dim fullName_I2 = MetadataTypeName.FromFullName("NS1.I2")
Dim fullName_S1 = MetadataTypeName.FromFullName("S1")
Dim fullName_S2 = MetadataTypeName.FromFullName("NS1.S2")
Assert.IsType(Of MissingMetadataTypeSymbol.TopLevel)(localTypes1.LookupTopLevelMetadataType(fullName_I1))
Assert.IsType(Of MissingMetadataTypeSymbol.TopLevel)(localTypes1.LookupTopLevelMetadataType(fullName_I2))
Assert.IsType(Of MissingMetadataTypeSymbol.TopLevel)(localTypes1.LookupTopLevelMetadataType(fullName_S1))
Assert.IsType(Of MissingMetadataTypeSymbol.TopLevel)(localTypes1.LookupTopLevelMetadataType(fullName_S2))
Assert.Null(assemblies(0).GetTypeByMetadataName(fullName_I1.FullName))
Assert.Null(assemblies(0).GetTypeByMetadataName(fullName_I2.FullName))
Assert.Null(assemblies(0).GetTypeByMetadataName(fullName_S1.FullName))
Assert.Null(assemblies(0).GetTypeByMetadataName(fullName_S2.FullName))
Assert.IsType(Of MissingMetadataTypeSymbol.TopLevel)(localTypes2.LookupTopLevelMetadataType(fullName_I1))
Assert.IsType(Of MissingMetadataTypeSymbol.TopLevel)(localTypes2.LookupTopLevelMetadataType(fullName_I2))
Assert.IsType(Of MissingMetadataTypeSymbol.TopLevel)(localTypes2.LookupTopLevelMetadataType(fullName_S1))
Assert.IsType(Of MissingMetadataTypeSymbol.TopLevel)(localTypes2.LookupTopLevelMetadataType(fullName_S2))
Assert.Null(assemblies(1).GetTypeByMetadataName(fullName_I1.FullName))
Assert.Null(assemblies(1).GetTypeByMetadataName(fullName_I2.FullName))
Assert.Null(assemblies(1).GetTypeByMetadataName(fullName_S1.FullName))
Assert.Null(assemblies(1).GetTypeByMetadataName(fullName_S2.FullName))
End Sub
<Fact()>
Public Sub LocalTypeSubstitution1_1()
Dim compilation1 = CreateCompilationWithMscorlib(s_sourceLocalTypes1_IL)
CompileAndVerify(compilation1)
Dim compilation2 = CreateCompilationWithMscorlib(s_sourceLocalTypes2_IL)
CompileAndVerify(compilation2)
LocalTypeSubstitution1(compilation1, compilation2)
End Sub
<Fact()>
Public Sub LocalTypeSubstitution1_2()
Dim compilation1 = CreateCompilationWithMscorlib(
s_sourceLocalTypes1,
references:={TestReferences.SymbolsTests.NoPia.Pia1.WithEmbedInteropTypes(True)})
CompileAndVerify(compilation1)
Dim compilation2 = CreateCompilationWithMscorlib(
s_sourceLocalTypes2,
references:={TestReferences.SymbolsTests.NoPia.Pia1.WithEmbedInteropTypes(True)})
CompileAndVerify(compilation2)
LocalTypeSubstitution1(compilation1, compilation2)
End Sub
<Fact()>
Public Sub LocalTypeSubstitution1_3()
Dim compilation0 = CreateCompilationWithMscorlib(s_sourcePia1)
CompileAndVerify(compilation0)
Dim compilation1 = CreateCompilationWithMscorlib(
s_sourceLocalTypes1,
references:={New VisualBasicCompilationReference(compilation0, embedInteropTypes:=True)})
CompileAndVerify(compilation1)
Dim compilation2 = CreateCompilationWithMscorlib(
s_sourceLocalTypes2,
references:={New VisualBasicCompilationReference(compilation0, embedInteropTypes:=True)})
CompileAndVerify(compilation2)
LocalTypeSubstitution1(compilation1, compilation2)
End Sub
Private Sub LocalTypeSubstitution1(compilation1 As VisualBasicCompilation, compilation2 As VisualBasicCompilation)
Dim assemblies1 = MetadataTestHelpers.GetSymbolsForReferences(New Object() {
compilation1,
compilation2,
TestReferences.SymbolsTests.NoPia.Pia1,
MscorlibRef,
TestReferences.SymbolsTests.MDTestLib1
})
Dim localTypes1_1 = assemblies1(0)
Dim localTypes2_1 = assemblies1(1)
Dim pia1_1 = assemblies1(2)
Dim varI1 = pia1_1.GlobalNamespace.GetTypeMembers("I1").Single()
Dim varS1 = pia1_1.GlobalNamespace.GetTypeMembers("S1").Single()
Dim varNS1 = pia1_1.GlobalNamespace.GetMember(Of NamespaceSymbol)("NS1")
Dim varI2 = varNS1.GetTypeMembers("I2").Single()
Dim varS2 = varNS1.GetTypeMembers("S2").Single()
Dim classLocalTypes1 As NamedTypeSymbol
Dim classLocalTypes2 As NamedTypeSymbol
classLocalTypes1 = localTypes1_1.GlobalNamespace.GetTypeMembers("LocalTypes1").Single()
classLocalTypes2 = localTypes2_1.GlobalNamespace.GetTypeMembers("LocalTypes2").Single()
Dim test1 As MethodSymbol
Dim test2 As MethodSymbol
test1 = classLocalTypes1.GetMember(Of MethodSymbol)("Test1")
test2 = classLocalTypes2.GetMember(Of MethodSymbol)("Test2")
Dim param As ImmutableArray(Of ParameterSymbol)
param = test1.Parameters
Assert.Same(varI1, param(0).[Type])
Assert.Same(varI2, param(1).[Type])
param = test2.Parameters
Assert.Same(varS1, param(0).[Type])
Assert.Same(varS2, param(1).[Type])
Dim assemblies2 = MetadataTestHelpers.GetSymbolsForReferences(New Object() {
compilation1,
compilation2,
TestReferences.SymbolsTests.NoPia.Pia1,
MscorlibRef
})
Dim localTypes1_2 = assemblies2(0)
Dim localTypes2_2 = assemblies2(1)
Assert.NotSame(localTypes1_1, localTypes1_2)
Assert.NotSame(localTypes2_1, localTypes2_2)
Assert.Same(pia1_1, assemblies2(2))
classLocalTypes1 = localTypes1_2.GlobalNamespace.GetTypeMembers("LocalTypes1").Single()
classLocalTypes2 = localTypes2_2.GlobalNamespace.GetTypeMembers("LocalTypes2").Single()
test1 = classLocalTypes1.GetMember(Of MethodSymbol)("Test1")
test2 = classLocalTypes2.GetMember(Of MethodSymbol)("Test2")
param = test1.Parameters
Assert.Same(varI1, param(0).[Type])
Assert.Same(varI2, param(1).[Type])
param = test2.Parameters
Assert.Same(varS1, param(0).[Type])
Assert.Same(varS2, param(1).[Type])
Dim assemblies3 = MetadataTestHelpers.GetSymbolsForReferences(New Object() {
compilation1,
compilation2,
TestReferences.SymbolsTests.NoPia.Pia1
})
Dim localTypes1_3 = assemblies3(0)
Dim localTypes2_3 = assemblies3(1)
Dim pia1_3 = assemblies3(2)
Assert.NotSame(localTypes1_1, localTypes1_3)
Assert.NotSame(localTypes2_1, localTypes2_3)
Assert.NotSame(localTypes1_2, localTypes1_3)
Assert.NotSame(localTypes2_2, localTypes2_3)
Assert.NotSame(pia1_1, pia1_3)
classLocalTypes1 = localTypes1_3.GlobalNamespace.GetTypeMembers("LocalTypes1").Single()
classLocalTypes2 = localTypes2_3.GlobalNamespace.GetTypeMembers("LocalTypes2").Single()
test1 = classLocalTypes1.GetMember(Of MethodSymbol)("Test1")
test2 = classLocalTypes2.GetMember(Of MethodSymbol)("Test2")
param = test1.Parameters
Assert.Same(pia1_3.GlobalNamespace.GetTypeMembers("I1").Single(), param(0).[Type])
Assert.Same(pia1_3.GlobalNamespace.GetMember(Of NamespaceSymbol)("NS1").GetTypeMembers("I2").[Single](), param(1).[Type])
param = test2.Parameters
Dim missing As NoPiaMissingCanonicalTypeSymbol
Assert.Equal(SymbolKind.ErrorType, param(0).[Type].Kind)
missing = DirectCast(param(0).[Type], NoPiaMissingCanonicalTypeSymbol)
Assert.Same(localTypes2_3, missing.EmbeddingAssembly)
Assert.Null(missing.Guid)
Assert.Equal(varS1.ToTestDisplayString(), missing.FullTypeName)
Assert.Equal("f9c2d51d-4f44-45f0-9eda-c9d599b58257", missing.Scope)
Assert.Equal(varS1.ToTestDisplayString(), missing.Identifier)
Assert.Equal(SymbolKind.ErrorType, param(1).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(1).[Type])
Dim assemblies4 = MetadataTestHelpers.GetSymbolsForReferences(New Object() {
compilation1,
compilation2,
TestReferences.SymbolsTests.NoPia.Pia1,
MscorlibRef,
TestReferences.SymbolsTests.MDTestLib1
})
For i As Integer = 0 To assemblies1.Length - 1 Step 1
Assert.Same(assemblies1(i), assemblies4(i))
Next
Dim assemblies5 = MetadataTestHelpers.GetSymbolsForReferences(New Object() {
compilation1,
compilation2,
TestReferences.SymbolsTests.NoPia.Pia2,
MscorlibRef
})
Dim localTypes1_5 = assemblies5(0)
Dim localTypes2_5 = assemblies5(1)
classLocalTypes1 = localTypes1_5.GlobalNamespace.GetTypeMembers("LocalTypes1").Single()
classLocalTypes2 = localTypes2_5.GlobalNamespace.GetTypeMembers("LocalTypes2").Single()
test1 = classLocalTypes1.GetMember(Of MethodSymbol)("Test1")
test2 = classLocalTypes2.GetMember(Of MethodSymbol)("Test2")
param = test1.Parameters
Assert.Equal(SymbolKind.ErrorType, param(0).[Type].Kind)
missing = DirectCast(param(0).[Type], NoPiaMissingCanonicalTypeSymbol)
Assert.Same(localTypes1_5, missing.EmbeddingAssembly)
Assert.Equal("27e3e649-994b-4f58-b3c6-f8089a5f2c01", missing.Guid)
Assert.Equal(varI1.ToTestDisplayString(), missing.FullTypeName)
Assert.Null(missing.Scope)
Assert.Null(missing.Identifier)
Assert.Equal(SymbolKind.ErrorType, param(1).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(1).[Type])
param = test2.Parameters
Assert.Equal(SymbolKind.ErrorType, param(0).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(0).[Type])
Assert.Equal(SymbolKind.ErrorType, param(1).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(1).[Type])
Dim assemblies6 = MetadataTestHelpers.GetSymbolsForReferences(New Object() {
compilation1,
compilation2,
TestReferences.SymbolsTests.NoPia.Pia3,
MscorlibRef
})
Dim localTypes1_6 = assemblies6(0)
Dim localTypes2_6 = assemblies6(1)
classLocalTypes1 = localTypes1_6.GlobalNamespace.GetTypeMembers("LocalTypes1").Single()
classLocalTypes2 = localTypes2_6.GlobalNamespace.GetTypeMembers("LocalTypes2").Single()
test1 = classLocalTypes1.GetMember(Of MethodSymbol)("Test1")
test2 = classLocalTypes2.GetMember(Of MethodSymbol)("Test2")
param = test1.Parameters
Assert.Equal(SymbolKind.ErrorType, param(0).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(0).[Type])
Assert.Equal(SymbolKind.ErrorType, param(1).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(1).[Type])
param = test2.Parameters
Assert.Equal(SymbolKind.ErrorType, param(0).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(0).[Type])
Assert.Equal(SymbolKind.ErrorType, param(1).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(1).[Type])
Dim assemblies7 = MetadataTestHelpers.GetSymbolsForReferences(New Object() {
compilation1,
compilation2,
TestReferences.SymbolsTests.NoPia.Pia4,
MscorlibRef
})
Dim localTypes1_7 = assemblies7(0)
Dim localTypes2_7 = assemblies7(1)
classLocalTypes1 = localTypes1_7.GlobalNamespace.GetTypeMembers("LocalTypes1").Single()
classLocalTypes2 = localTypes2_7.GlobalNamespace.GetTypeMembers("LocalTypes2").Single()
test1 = classLocalTypes1.GetMember(Of MethodSymbol)("Test1")
test2 = classLocalTypes2.GetMember(Of MethodSymbol)("Test2")
param = test1.Parameters
Assert.Equal(TypeKind.[Interface], param(0).[Type].TypeKind)
Assert.Equal(TypeKind.[Interface], param(1).[Type].TypeKind)
Assert.NotEqual(SymbolKind.ErrorType, param(0).[Type].Kind)
Assert.NotEqual(SymbolKind.ErrorType, param(1).[Type].Kind)
param = test2.Parameters
Assert.Equal(SymbolKind.ErrorType, param(0).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(0).[Type])
Assert.Equal(SymbolKind.ErrorType, param(1).[Type].Kind)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(param(1).[Type])
Dim assemblies8 = MetadataTestHelpers.GetSymbolsForReferences(New Object() {
compilation1,
compilation2,
TestReferences.SymbolsTests.NoPia.Pia4,
TestReferences.SymbolsTests.NoPia.Pia1,
MscorlibRef
})
Dim localTypes1_8 = assemblies8(0)
Dim localTypes2_8 = assemblies8(1)
Dim pia4_8 = assemblies8(2)
Dim pia1_8 = assemblies8(3)
classLocalTypes1 = localTypes1_8.GlobalNamespace.GetTypeMembers("LocalTypes1").Single()
classLocalTypes2 = localTypes2_8.GlobalNamespace.GetTypeMembers("LocalTypes2").Single()
test1 = classLocalTypes1.GetMember(Of MethodSymbol)("Test1")
test2 = classLocalTypes2.GetMember(Of MethodSymbol)("Test2")
param = test1.Parameters
Dim ambiguous As NoPiaAmbiguousCanonicalTypeSymbol
Assert.Equal(SymbolKind.ErrorType, param(0).[Type].Kind)
ambiguous = DirectCast(param(0).[Type], NoPiaAmbiguousCanonicalTypeSymbol)
Assert.Same(localTypes1_8, ambiguous.EmbeddingAssembly)
Assert.Same(pia4_8.GlobalNamespace.GetTypeMembers("I1").Single(), ambiguous.FirstCandidate)
Assert.Same(pia1_8.GlobalNamespace.GetTypeMembers("I1").Single(), ambiguous.SecondCandidate)
Assert.Equal(SymbolKind.ErrorType, param(1).[Type].Kind)
Assert.IsType(Of NoPiaAmbiguousCanonicalTypeSymbol)(param(1).[Type])
Dim assemblies9 = MetadataTestHelpers.GetSymbolsForReferences(New Object() {
compilation1,
compilation2,
TestReferences.SymbolsTests.NoPia.Pia4,
MscorlibRef
})
Dim localTypes1_9 = assemblies9(0)
Dim localTypes2_9 = assemblies9(1)
Dim assemblies10 = MetadataTestHelpers.GetSymbolsForReferences(New Object() {
compilation1,
compilation2,
TestReferences.SymbolsTests.NoPia.Pia4,
MscorlibRef,
TestReferences.SymbolsTests.MDTestLib1
})
Dim localTypes1_10 = assemblies10(0)
Dim localTypes2_10 = assemblies10(1)
Assert.NotSame(localTypes1_9, localTypes1_10)
Assert.NotSame(localTypes2_9, localTypes2_10)
GC.KeepAlive(localTypes1_1)
GC.KeepAlive(localTypes2_1)
GC.KeepAlive(pia1_1)
GC.KeepAlive(localTypes2_9)
GC.KeepAlive(localTypes1_9)
End Sub
<Fact()>
Public Sub CyclicReference_1()
Dim piaRef = TestReferences.SymbolsTests.NoPia.Pia1
Dim compilation1 = CreateCompilationWithMscorlib(s_sourceLocalTypes1_IL)
CompileAndVerify(compilation1)
Dim localTypes1Ref = New VisualBasicCompilationReference(compilation1)
CyclicReference(piaRef, localTypes1Ref)
End Sub
<Fact()>
Public Sub CyclicReference_2()
Dim piaRef = TestReferences.SymbolsTests.NoPia.Pia1
Dim compilation1 = CreateCompilationWithMscorlib(
s_sourceLocalTypes1,
references:={TestReferences.SymbolsTests.NoPia.Pia1.WithEmbedInteropTypes(True)})
CompileAndVerify(compilation1)
Dim localTypes1Ref = New VisualBasicCompilationReference(compilation1)
CyclicReference(piaRef, localTypes1Ref)
End Sub
<Fact()>
Public Sub CyclicReference_3()
Dim pia1 = CreateCompilationWithMscorlib(s_sourcePia1)
CompileAndVerify(pia1)
Dim piaRef = New VisualBasicCompilationReference(pia1)
Dim compilation1 = CreateCompilationWithMscorlib(
s_sourceLocalTypes1,
references:={New VisualBasicCompilationReference(pia1, embedInteropTypes:=True)})
CompileAndVerify(compilation1)
Dim localTypes1Ref = New VisualBasicCompilationReference(compilation1)
CyclicReference(piaRef, localTypes1Ref)
End Sub
Private Sub CyclicReference(piaRef As MetadataReference, localTypes1Ref As CompilationReference)
Dim mscorlibRef = TestReferences.SymbolsTests.MDTestLib1
Dim cyclic2Ref = TestReferences.SymbolsTests.Cyclic.Cyclic2.dll
Dim tc1 = VisualBasicCompilation.Create("Cyclic1", references:={mscorlibRef, cyclic2Ref, piaRef, localTypes1Ref})
Assert.NotNull(tc1.Assembly)
Dim tc2 = VisualBasicCompilation.Create("Cyclic1", references:={mscorlibRef, cyclic2Ref, piaRef, localTypes1Ref})
Assert.NotNull(tc2.Assembly)
Assert.NotSame(tc1.GetReferencedAssemblySymbol(localTypes1Ref), tc2.GetReferencedAssemblySymbol(localTypes1Ref))
GC.KeepAlive(tc1)
GC.KeepAlive(tc2)
End Sub
<Fact()>
Public Sub GenericsClosedOverLocalTypes1_1()
Dim compilation3 = CreateCompilationWithMscorlib(s_sourceLocalTypes3_IL)
CompileAndVerify(compilation3)
GenericsClosedOverLocalTypes1(compilation3)
End Sub
<ClrOnlyFact>
Public Sub ValueTupleWithMissingCanonicalType()
Dim source = "
Imports System
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
Namespace System
Public Structure ValueTuple(Of T1, T2)
Public Sub New(item1 As T1, item2 As T2)
End Sub
End Structure
End Namespace
<CompilerGenerated>
<TypeIdentifier(""f9c2d51d-4f44-45f0-9eda-c9d599b58257"", ""S1"")>
Public Structure S1
End Structure
Public Class C
Public Function Test1() As ValueTuple(Of S1, S1)
Throw New Exception()
End Function
End Class
"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.ReleaseDll, assemblyName:="comp")
comp.VerifyDiagnostics()
CompileAndVerify(comp)
Dim assemblies1 = MetadataTestHelpers.GetSymbolsForReferences({comp})
Assert.Equal(SymbolKind.ErrorType, assemblies1(0).GlobalNamespace.GetMember(Of MethodSymbol)("C.Test1").ReturnType.Kind)
Dim assemblies2 = MetadataTestHelpers.GetSymbolsForReferences({comp.ToMetadataReference()})
Assert.Equal(SymbolKind.ErrorType, assemblies2(0).GlobalNamespace.GetMember(Of MethodSymbol)("C.Test1").ReturnType.Kind)
End Sub
<ClrOnlyFact>
Public Sub EmbeddedValueTuple()
Dim source = "
Imports System
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
Namespace System
<CompilerGenerated>
<TypeIdentifier(""f9c2d51d-4f44-45f0-9eda-c9d599b58257"", ""ValueTuple"")>
Public Structure ValueTuple(Of T1, T2)
Public Sub New(item1 As T1, item2 As T2)
End Sub
End Structure
End Namespace
Public Class C
Public Function Test1() As ValueTuple(Of Integer, Integer)
Throw New Exception()
End Function
End Class
"
Dim comp = CreateCompilationWithMscorlib({source}, options:=TestOptions.ReleaseDll, assemblyName:="comp")
comp.VerifyDiagnostics()
Dim assemblies1 = MetadataTestHelpers.GetSymbolsForReferences({comp})
Assert.Equal(SymbolKind.ErrorType, assemblies1(0).GlobalNamespace.GetMember(Of MethodSymbol)("C.Test1").ReturnType.Kind)
Dim assemblies2 = MetadataTestHelpers.GetSymbolsForReferences({comp.ToMetadataReference()})
Assert.Equal(SymbolKind.ErrorType, assemblies2(0).GlobalNamespace.GetMember(Of MethodSymbol)("C.Test1").ReturnType.Kind)
End Sub
<ClrOnlyFact>
Public Sub CannotEmbedValueTuple()
Dim piaSource = "
Imports System.Runtime.InteropServices
<assembly: Guid(""f9c2d51d-4f44-45f0-9eda-c9d599b58257"")>
<assembly: ImportedFromTypeLib(""Pia1.dll"")>
Namespace System
Public Structure ValueTuple(Of T1, T2)
Public Sub New(item1 As T1, item2 As T2)
End Sub
End Structure
End Namespace
"
Dim pia = CreateCompilationWithMscorlib({piaSource}, options:=TestOptions.ReleaseDll, assemblyName:="comp")
pia.VerifyDiagnostics()
Dim source = "
Imports System.Runtime.InteropServices
Public Class C
Public Function TestValueTuple() As System.ValueTuple(Of String, String)
Throw New System.Exception()
End Function
Public Function TestTuple() As (Integer, Integer)
Throw New System.Exception()
End Function
Public Function TestTupleLiteral() As Object
Return (1, 2)
End Function
'Public Sub TestDeconstruction()
' Dim x, y As Integer
' (x, y) = New C()
'End Sub
public Sub Deconstruct(<Out> a As Integer, <Out> b As Integer)
a = 1
b = 1
End Sub
End Class
"
Dim expected = <errors>
BC36923: Type 'ValueTuple(Of T1, T2)' cannot be embedded because it has generic argument. Consider disabling the embedding of interop types.
Public Function TestValueTuple() As System.ValueTuple(Of String, String)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
BC36923: Type 'ValueTuple(Of T1, T2)' cannot be embedded because it has generic argument. Consider disabling the embedding of interop types.
Public Function TestTuple() As (Integer, Integer)
~~~~~~~~~~~~~~~~~~
BC36923: Type 'ValueTuple(Of T1, T2)' cannot be embedded because it has generic argument. Consider disabling the embedding of interop types.
Public Function TestTuple() As (Integer, Integer)
~~~~~~~~~~~~~~~~~~
BC36923: Type 'ValueTuple(Of T1, T2)' cannot be embedded because it has generic argument. Consider disabling the embedding of interop types.
Return (1, 2)
~~~~~~
</errors>
Dim comp1 = CreateCompilationWithMscorlib({source}, options:=TestOptions.ReleaseDll,
references:={pia.ToMetadataReference(embedInteropTypes:=True)})
comp1.AssertTheseDiagnostics(expected)
Dim comp2 = CreateCompilationWithMscorlib({source}, options:=TestOptions.ReleaseDll,
references:={pia.EmitToImageReference(embedInteropTypes:=True)})
comp2.AssertTheseDiagnostics(expected)
End Sub
<ClrOnlyFact(Skip:="https://github.com/dotnet/roslyn/issues/13200")>
Public Sub CannotEmbedValueTupleImplicitlyReferenced()
Dim piaSource = "
Imports System.Runtime.InteropServices
<assembly: Guid(""f9c2d51d-4f44-45f0-9eda-c9d599b58257"")>
<assembly: ImportedFromTypeLib(""Pia1.dll"")>
Namespace System
Public Structure ValueTuple(Of T1, T2)
Public Sub New(item1 As T1, item2 As T2)
End Sub
End Structure
End Namespace
Public Structure S(Of T)
End Structure
<ComImport>
<Guid(""f9c2d51d-4f44-45f0-9eda-c9d599b58280"")>
Public Interface ITest1
Function M() As (Integer, Integer)
Function M2() As S(Of Integer)
End Interface
"
Dim pia = CreateCompilationWithMscorlib({piaSource}, options:=TestOptions.ReleaseDll, assemblyName:="comp")
pia.VerifyDiagnostics()
Dim source = "
Public Interface ITest2
Inherits ITest1
End Interface
"
' We should expect errors as generic types cannot be embedded
' Issue https://github.com/dotnet/roslyn/issues/13200 tracks this
Dim expected = <errors>
</errors>
Dim comp1 = CreateCompilationWithMscorlib({source}, options:=TestOptions.ReleaseDll,
references:={pia.ToMetadataReference(embedInteropTypes:=True)})
comp1.AssertTheseDiagnostics(expected)
Dim comp2 = CreateCompilationWithMscorlib({source}, options:=TestOptions.ReleaseDll,
references:={pia.EmitToImageReference(embedInteropTypes:=True)})
comp2.AssertTheseDiagnostics(expected)
End Sub
<ClrOnlyFact(Skip:="https://github.com/dotnet/roslyn/issues/13200")>
Public Sub CannotEmbedValueTupleImplicitlyReferredFromMetadata()
Dim piaSource = "
Imports System.Runtime.InteropServices
<assembly: Guid(""f9c2d51d-4f44-45f0-9eda-c9d599b58257"")>
<assembly: ImportedFromTypeLib(""Pia1.dll"")>
Public Structure S(Of T)
End Structure
Namespace System
Public Structure ValueTuple(Of T1, T2)
Public Sub New(item1 As T1, item2 As T2)
End Sub
End Structure
End Namespace
"
Dim libSource = "
Public Class D
Function M() As (Integer, Integer)
Throw New System.Exception()
End Function
Function M2() As S(Of Integer)
Throw New System.Exception()
End Function
End Class
"
Dim pia = CreateCompilationWithMscorlib({piaSource}, options:=TestOptions.ReleaseDll, assemblyName:="pia")
pia.VerifyDiagnostics()
Dim [lib] = CreateCompilationWithMscorlib({libSource}, options:=TestOptions.ReleaseDll, references:={pia.ToMetadataReference()})
[lib].VerifyDiagnostics()
Dim source = "
Public Class C
Public Sub TestTupleFromMetadata()
D.M()
D.M2()
End Sub
Public Sub TestTupleAssignmentFromMetadata()
Dim t = D.M()
t.ToString()
Dim t2 = D.M2()
t2.ToString()
End Sub
End Class
"
' We should expect errors as generic types cannot be embedded
' Issue https://github.com/dotnet/roslyn/issues/13200 tracks this
Dim expectedDiagnostics = <errors>
</errors>
Dim comp1 = CreateCompilationWithMscorlib({source}, options:=TestOptions.ReleaseDll,
references:={pia.ToMetadataReference(embedInteropTypes:=True)})
comp1.AssertTheseDiagnostics(expectedDiagnostics)
Dim comp2 = CreateCompilationWithMscorlib({source}, options:=TestOptions.ReleaseDll,
references:={pia.EmitToImageReference(embedInteropTypes:=True)})
comp2.AssertTheseDiagnostics(expectedDiagnostics)
End Sub
<ClrOnlyFact>
Public Sub CheckForUnembeddableTypesInTuples()
Dim piaSource = "
Imports System.Runtime.InteropServices
<assembly: Guid(""f9c2d51d-4f44-45f0-9eda-c9d599b58257"")>
<assembly: ImportedFromTypeLib(""Pia1.dll"")>
Public Structure Generic(Of T1)
End Structure
"
Dim pia = CreateCompilationWithMscorlib({piaSource}, options:=TestOptions.ReleaseDll, assemblyName:="pia")
pia.VerifyDiagnostics()
Dim source = "
Public Class C
Function Test1() As System.ValueTuple(Of Generic(Of String), Generic(Of String))
Throw New System.Exception()
End Function
Function Test2() As (Generic(Of String), Generic(Of String))
Throw New System.Exception()
End Function
End Class
Namespace System
Public Structure ValueTuple(Of T1, T2)
Public Sub New(item1 As T1, item2 As T2)
End Sub
End Structure
End Namespace
"
Dim expectedDiagnostics = <errors>
BC36923: Type 'Generic(Of T1)' cannot be embedded because it has generic argument. Consider disabling the embedding of interop types.
Function Test1() As System.ValueTuple(Of Generic(Of String), Generic(Of String))
~~~~~~~~~~~~~~~~~~
BC36923: Type 'Generic(Of T1)' cannot be embedded because it has generic argument. Consider disabling the embedding of interop types.
Function Test1() As System.ValueTuple(Of Generic(Of String), Generic(Of String))
~~~~~~~~~~~~~~~~~~
BC36923: Type 'Generic(Of T1)' cannot be embedded because it has generic argument. Consider disabling the embedding of interop types.
Function Test2() As (Generic(Of String), Generic(Of String))
~~~~~~~~~~~~~~~~~~
BC36923: Type 'Generic(Of T1)' cannot be embedded because it has generic argument. Consider disabling the embedding of interop types.
Function Test2() As (Generic(Of String), Generic(Of String))
~~~~~~~~~~~~~~~~~~
</errors>
Dim comp1 = CreateCompilationWithMscorlib({source}, options:=TestOptions.ReleaseDll,
references:={pia.ToMetadataReference(embedInteropTypes:=True)})
comp1.AssertTheseDiagnostics(expectedDiagnostics)
Dim comp2 = CreateCompilationWithMscorlib({source}, options:=TestOptions.ReleaseDll,
references:={pia.EmitToImageReference(embedInteropTypes:=True)})
comp2.AssertTheseDiagnostics(expectedDiagnostics)
End Sub
<Fact()>
Public Sub GenericsClosedOverLocalTypes1_2()
Dim compilation3 = CreateCompilationWithMscorlib(
s_sourceLocalTypes3,
references:={TestReferences.SymbolsTests.NoPia.Pia1.WithEmbedInteropTypes(True)})
CompileAndVerify(compilation3)
GenericsClosedOverLocalTypes1(compilation3)
End Sub
<Fact()>
Public Sub GenericsClosedOverLocalTypes1_3()
Dim pia1 = CreateCompilationWithMscorlib(s_sourcePia1)
CompileAndVerify(pia1)
Dim compilation3 = CreateCompilationWithMscorlib(
s_sourceLocalTypes3,
references:={New VisualBasicCompilationReference(pia1, embedInteropTypes:=True)})
CompileAndVerify(compilation3)
GenericsClosedOverLocalTypes1(compilation3)
End Sub
Private Sub GenericsClosedOverLocalTypes1(compilation3 As VisualBasicCompilation)
Dim assemblies = MetadataTestHelpers.GetSymbolsForReferences({
compilation3,
TestReferences.SymbolsTests.NoPia.Pia1
})
Dim asmLocalTypes3 = assemblies(0)
Dim localTypes3 = asmLocalTypes3.GlobalNamespace.GetTypeMembers("LocalTypes3").Single()
Assert.NotEqual(SymbolKind.ErrorType, localTypes3.GetMember(Of MethodSymbol)("Test1").ReturnType.Kind)
Assert.NotEqual(SymbolKind.ErrorType, localTypes3.GetMember(Of MethodSymbol)("Test2").ReturnType.Kind)
Assert.Equal(SymbolKind.ErrorType, localTypes3.GetMember(Of MethodSymbol)("Test3").ReturnType.Kind)
Dim illegal As NoPiaIllegalGenericInstantiationSymbol = DirectCast(localTypes3.GetMember(Of MethodSymbol)("Test3").ReturnType, NoPiaIllegalGenericInstantiationSymbol)
Assert.Equal("C31(Of I1).I31(Of C33)", illegal.UnderlyingSymbol.ToTestDisplayString())
Assert.NotEqual(SymbolKind.ErrorType, localTypes3.GetMember(Of MethodSymbol)("Test4").ReturnType.Kind)
Assert.IsType(Of NoPiaIllegalGenericInstantiationSymbol)(localTypes3.GetMember(Of MethodSymbol)("Test5").ReturnType)
assemblies = MetadataTestHelpers.GetSymbolsForReferences({
compilation3,
TestReferences.SymbolsTests.NoPia.Pia1,
MscorlibRef
})
localTypes3 = assemblies(0).GlobalNamespace.GetTypeMembers("LocalTypes3").Single()
Assert.NotEqual(SymbolKind.ErrorType, localTypes3.GetMember(Of MethodSymbol)("Test1").ReturnType.Kind)
Assert.NotEqual(SymbolKind.ErrorType, localTypes3.GetMember(Of MethodSymbol)("Test2").ReturnType.Kind)
Assert.IsType(Of NoPiaIllegalGenericInstantiationSymbol)(localTypes3.GetMember(Of MethodSymbol)("Test3").ReturnType)
Assert.NotEqual(SymbolKind.ErrorType, localTypes3.GetMember(Of MethodSymbol)("Test4").ReturnType.Kind)
Assert.IsType(Of NoPiaIllegalGenericInstantiationSymbol)(localTypes3.GetMember(Of MethodSymbol)("Test5").ReturnType)
Assert.IsType(Of NoPiaIllegalGenericInstantiationSymbol)(localTypes3.GetMember(Of MethodSymbol)("Test6").ReturnType)
End Sub
<Fact()>
Public Sub NestedType1()
Dim piaSource = <compilation name="Pia"><file name="a.vb"><![CDATA[
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
<Assembly: Guid("f9c2d51d-4f44-45f0-9eda-c9d599b58257")>
<Assembly: ImportedFromTypeLib("Pia1.dll")>
Public Structure S1
Public F1 As Integer
Public Structure S2
Public F1 As Integer
End Structure
End Structure
]]></file></compilation>
Dim pia = CreateCompilationWithMscorlib(piaSource)
CompileAndVerify(pia)
Dim piaImage = MetadataReference.CreateFromImage(pia.EmitToArray())
Dim source = <compilation name="LocalTypes2"><file name="a.vb"><![CDATA[
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
Public Class LocalTypes2
Public Sub Test2(x As S1, y As S1.S2)
End Sub
End Class
<CompilerGenerated(), TypeIdentifier("f9c2d51d-4f44-45f0-9eda-c9d599b58257", "S1")>
Public Structure S1
Public F1 As Integer
<CompilerGenerated(), TypeIdentifier("f9c2d51d-4f44-45f0-9eda-c9d599b58257", "S1.S2")>
Public Structure S2
Public F1 As Integer
End Structure
End Structure
<ComEventInterface(GetType(S1), GetType(S1.S2))>
Interface AttrTest1
End Interface
]]></file></compilation>
Dim localTypes2 = CreateCompilationWithMscorlib(source)
CompileAndVerify(localTypes2)
Dim localTypes2Image = MetadataReference.CreateFromImage(localTypes2.EmitToArray())
Dim compilation = CreateCompilationWithMscorlib(<compilation/>,
references:=New MetadataReference() {New VisualBasicCompilationReference(localTypes2), New VisualBasicCompilationReference(pia)})
Dim lt = compilation.GetTypeByMetadataName("LocalTypes2")
Dim test2 = lt.GetMember(Of MethodSymbol)("Test2")
Assert.Equal("Pia", test2.Parameters(0).Type.ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(test2.Parameters(1).Type)
Dim attrTest1 = compilation.GetTypeByMetadataName("AttrTest1")
Dim args = attrTest1.GetAttributes()(0).CommonConstructorArguments
Assert.Equal("Pia", DirectCast(args(0).Value, TypeSymbol).ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(args(1).Value)
compilation = CreateCompilationWithMscorlib(<compilation/>,
references:=New MetadataReference() {localTypes2Image, New VisualBasicCompilationReference(pia)})
lt = compilation.GetTypeByMetadataName("LocalTypes2")
test2 = lt.GetMember(Of MethodSymbol)("Test2")
Assert.Equal("Pia", test2.Parameters(0).Type.ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(test2.Parameters(1).Type)
attrTest1 = compilation.GetTypeByMetadataName("AttrTest1")
args = attrTest1.GetAttributes()(0).CommonConstructorArguments
Assert.Equal("Pia", DirectCast(args(0).Value, TypeSymbol).ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(args(1).Value)
compilation = CreateCompilationWithMscorlib(<compilation/>,
references:=New MetadataReference() {New VisualBasicCompilationReference(localTypes2), piaImage})
lt = compilation.GetTypeByMetadataName("LocalTypes2")
test2 = lt.GetMember(Of MethodSymbol)("Test2")
Assert.Equal("Pia", test2.Parameters(0).Type.ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(test2.Parameters(1).Type)
attrTest1 = compilation.GetTypeByMetadataName("AttrTest1")
args = attrTest1.GetAttributes()(0).CommonConstructorArguments
Assert.Equal("Pia", DirectCast(args(0).Value, TypeSymbol).ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(args(1).Value)
compilation = CreateCompilationWithMscorlib(<compilation/>,
references:=New MetadataReference() {localTypes2Image, piaImage})
lt = compilation.GetTypeByMetadataName("LocalTypes2")
test2 = lt.GetMember(Of MethodSymbol)("Test2")
Assert.Equal("Pia", test2.Parameters(0).Type.ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(test2.Parameters(1).Type)
attrTest1 = compilation.GetTypeByMetadataName("AttrTest1")
args = attrTest1.GetAttributes()(0).CommonConstructorArguments
Assert.Equal("Pia", DirectCast(args(0).Value, TypeSymbol).ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(args(1).Value)
End Sub
<Fact()>
Public Sub NestedType2()
Dim piaSource = <compilation name="Pia"><file name="a.vb"><![CDATA[
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
<Assembly: Guid("f9c2d51d-4f44-45f0-9eda-c9d599b58257")>
<Assembly: ImportedFromTypeLib("Pia1.dll")>
Public Structure S1
Public F1 As Integer
Public Structure S2
Public F1 As Integer
End Structure
End Structure
]]></file></compilation>
Dim pia = CreateCompilationWithMscorlib(piaSource)
CompileAndVerify(pia)
Dim piaImage = MetadataReference.CreateFromImage(pia.EmitToArray())
Dim source = <compilation name="LocalTypes2"><file name="a.vb"><![CDATA[
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
Public Class LocalTypes2
Public Sub Test2(x As S1, y As S1.S2)
End Sub
End Class
<CompilerGenerated(), TypeIdentifier("f9c2d51d-4f44-45f0-9eda-c9d599b58257", "S1")>
Public Structure S1
Public F1 As Integer
Public Structure S2
Public F1 As Integer
End Structure
End Structure
<ComEventInterface(GetType(S1), GetType(S1.S2))>
Interface AttrTest1
End Interface
]]></file></compilation>
Dim localTypes2 = CreateCompilationWithMscorlib(source)
CompileAndVerify(localTypes2)
Dim localTypes2Image = MetadataReference.CreateFromImage(localTypes2.EmitToArray())
Dim compilation = CreateCompilationWithMscorlib(<compilation/>,
references:=New MetadataReference() {New VisualBasicCompilationReference(localTypes2), New VisualBasicCompilationReference(pia)})
Dim lt = compilation.GetTypeByMetadataName("LocalTypes2")
Dim test2 = lt.GetMember(Of MethodSymbol)("Test2")
Assert.Equal("Pia", test2.Parameters(0).Type.ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(test2.Parameters(1).Type)
Dim attrTest1 = compilation.GetTypeByMetadataName("AttrTest1")
Dim args = attrTest1.GetAttributes()(0).CommonConstructorArguments
Assert.Equal("Pia", DirectCast(args(0).Value, TypeSymbol).ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(args(1).Value)
compilation = CreateCompilationWithMscorlib(<compilation/>,
references:=New MetadataReference() {localTypes2Image, New VisualBasicCompilationReference(pia)})
lt = compilation.GetTypeByMetadataName("LocalTypes2")
test2 = lt.GetMember(Of MethodSymbol)("Test2")
Assert.Equal("Pia", test2.Parameters(0).Type.ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(test2.Parameters(1).Type)
attrTest1 = compilation.GetTypeByMetadataName("AttrTest1")
args = attrTest1.GetAttributes()(0).CommonConstructorArguments
Assert.Equal("Pia", DirectCast(args(0).Value, TypeSymbol).ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(args(1).Value)
compilation = CreateCompilationWithMscorlib(<compilation/>,
references:=New MetadataReference() {New VisualBasicCompilationReference(localTypes2), piaImage})
lt = compilation.GetTypeByMetadataName("LocalTypes2")
test2 = lt.GetMember(Of MethodSymbol)("Test2")
Assert.Equal("Pia", test2.Parameters(0).Type.ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(test2.Parameters(1).Type)
attrTest1 = compilation.GetTypeByMetadataName("AttrTest1")
args = attrTest1.GetAttributes()(0).CommonConstructorArguments
Assert.Equal("Pia", DirectCast(args(0).Value, TypeSymbol).ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(args(1).Value)
compilation = CreateCompilationWithMscorlib(<compilation/>,
references:=New MetadataReference() {localTypes2Image, piaImage})
lt = compilation.GetTypeByMetadataName("LocalTypes2")
test2 = lt.GetMember(Of MethodSymbol)("Test2")
Assert.Equal("Pia", test2.Parameters(0).Type.ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(test2.Parameters(1).Type)
attrTest1 = compilation.GetTypeByMetadataName("AttrTest1")
args = attrTest1.GetAttributes()(0).CommonConstructorArguments
Assert.Equal("Pia", DirectCast(args(0).Value, TypeSymbol).ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(args(1).Value)
End Sub
<Fact()>
Public Sub NestedType3()
Dim piaSource = <compilation name="Pia"><file name="a.vb"><![CDATA[
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
<Assembly: Guid("f9c2d51d-4f44-45f0-9eda-c9d599b58257")>
<Assembly: ImportedFromTypeLib("Pia1.dll")>
Public Structure S1
Public F1 As Integer
Public Structure S2
Public F1 As Integer
End Structure
End Structure
]]></file></compilation>
Dim pia = CreateCompilationWithMscorlib(piaSource)
CompileAndVerify(pia)
Dim piaImage = MetadataReference.CreateFromImage(pia.EmitToArray())
Dim source = <compilation name="LocalTypes2"><file name="a.vb"><![CDATA[
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
Public Class LocalTypes2
Public Sub Test2(x As S1, y As S1.S2)
End Sub
End Class
Public Structure S1
Public F1 As Integer
<CompilerGenerated(), TypeIdentifier("f9c2d51d-4f44-45f0-9eda-c9d599b58257", "S1.S2")>
Public Structure S2
Public F1 As Integer
End Structure
End Structure
<ComEventInterface(GetType(S1), GetType(S1.S2))>
Interface AttrTest1
End Interface
]]></file></compilation>
Dim localTypes2 = CreateCompilationWithMscorlib(source)
'CompileAndVerify(localTypes2)
Dim localTypes2Image = MetadataReference.CreateFromImage(localTypes2.EmitToArray())
Dim compilation = CreateCompilationWithMscorlib(<compilation/>,
references:=New MetadataReference() {New VisualBasicCompilationReference(localTypes2), New VisualBasicCompilationReference(pia)})
Dim lt = compilation.GetTypeByMetadataName("LocalTypes2")
Dim test2 = lt.GetMember(Of MethodSymbol)("Test2")
Assert.Equal("LocalTypes2", test2.Parameters(0).Type.ContainingAssembly.Name)
Assert.Equal("LocalTypes2", test2.Parameters(1).Type.ContainingAssembly.Name)
Dim attrTest1 = compilation.GetTypeByMetadataName("AttrTest1")
Dim args = attrTest1.GetAttributes()(0).CommonConstructorArguments
Assert.Equal("LocalTypes2", DirectCast(args(0).Value, TypeSymbol).ContainingAssembly.Name)
Assert.Equal("LocalTypes2", DirectCast(args(1).Value, TypeSymbol).ContainingAssembly.Name)
compilation = CreateCompilationWithMscorlib(<compilation/>,
references:=New MetadataReference() {localTypes2Image, New VisualBasicCompilationReference(pia)})
lt = compilation.GetTypeByMetadataName("LocalTypes2")
test2 = lt.GetMember(Of MethodSymbol)("Test2")
Assert.Equal("LocalTypes2", test2.Parameters(0).Type.ContainingAssembly.Name)
Assert.Equal("LocalTypes2", test2.Parameters(1).Type.ContainingAssembly.Name)
attrTest1 = compilation.GetTypeByMetadataName("AttrTest1")
args = attrTest1.GetAttributes()(0).CommonConstructorArguments
Assert.Equal("LocalTypes2", DirectCast(args(0).Value, TypeSymbol).ContainingAssembly.Name)
Assert.Equal("LocalTypes2", DirectCast(args(1).Value, TypeSymbol).ContainingAssembly.Name)
compilation = CreateCompilationWithMscorlib(<compilation/>,
references:=New MetadataReference() {New VisualBasicCompilationReference(localTypes2), piaImage})
lt = compilation.GetTypeByMetadataName("LocalTypes2")
test2 = lt.GetMember(Of MethodSymbol)("Test2")
Assert.Equal("LocalTypes2", test2.Parameters(0).Type.ContainingAssembly.Name)
Assert.Equal("LocalTypes2", test2.Parameters(1).Type.ContainingAssembly.Name)
attrTest1 = compilation.GetTypeByMetadataName("AttrTest1")
args = attrTest1.GetAttributes()(0).CommonConstructorArguments
Assert.Equal("LocalTypes2", DirectCast(args(0).Value, TypeSymbol).ContainingAssembly.Name)
Assert.Equal("LocalTypes2", DirectCast(args(1).Value, TypeSymbol).ContainingAssembly.Name)
compilation = CreateCompilationWithMscorlib(<compilation/>,
references:=New MetadataReference() {localTypes2Image, piaImage})
lt = compilation.GetTypeByMetadataName("LocalTypes2")
test2 = lt.GetMember(Of MethodSymbol)("Test2")
Assert.Equal("LocalTypes2", test2.Parameters(0).Type.ContainingAssembly.Name)
Assert.Equal("LocalTypes2", test2.Parameters(1).Type.ContainingAssembly.Name)
attrTest1 = compilation.GetTypeByMetadataName("AttrTest1")
args = attrTest1.GetAttributes()(0).CommonConstructorArguments
Assert.Equal("LocalTypes2", DirectCast(args(0).Value, TypeSymbol).ContainingAssembly.Name)
Assert.Equal("LocalTypes2", DirectCast(args(1).Value, TypeSymbol).ContainingAssembly.Name)
End Sub
<Fact()>
Public Sub NestedType4()
Dim piaSource = <compilation name="Pia"><file name="a.vb"><![CDATA[
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
<Assembly: Guid("f9c2d51d-4f44-45f0-9eda-c9d599b58257")>
<Assembly: ImportedFromTypeLib("Pia1.dll")>
Public Structure S1
Public F1 As Integer
Public Structure S2
Public F1 As Integer
End Structure
End Structure
]]></file></compilation>
Dim pia = CreateCompilationWithMscorlib(piaSource)
CompileAndVerify(pia)
Dim piaImage = MetadataReference.CreateFromImage(pia.EmitToArray())
Dim source = <compilation name="LocalTypes2"><file name="a.vb"><![CDATA[
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
Public Class LocalTypes2
Public Sub Test2(x As S1, y As S1.S2)
End Sub
End Class
<ComEventInterface(GetType(S1), GetType(S1.S2))>
Interface AttrTest1
End Interface
]]></file></compilation>
Dim localTypes2 = CreateCompilationWithMscorlib(source,
references:=New MetadataReference() {New VisualBasicCompilationReference(pia, embedInteropTypes:=True)})
'CompileAndVerify(localTypes2)
Dim compilation = CreateCompilationWithMscorlib(<compilation/>,
references:=New MetadataReference() {New VisualBasicCompilationReference(localTypes2), New VisualBasicCompilationReference(pia)})
Dim lt = compilation.GetTypeByMetadataName("LocalTypes2")
Dim test2 = lt.GetMember(Of MethodSymbol)("Test2")
Assert.Equal("Pia", test2.Parameters(0).Type.ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(test2.Parameters(1).Type)
Dim attrTest1 = compilation.GetTypeByMetadataName("AttrTest1")
Dim args = attrTest1.GetAttributes()(0).CommonConstructorArguments
Assert.Equal("Pia", DirectCast(args(0).Value, TypeSymbol).ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(args(1).Value)
compilation = CreateCompilationWithMscorlib(<compilation/>,
references:=New MetadataReference() {New VisualBasicCompilationReference(localTypes2), piaImage})
lt = compilation.GetTypeByMetadataName("LocalTypes2")
test2 = lt.GetMember(Of MethodSymbol)("Test2")
Assert.Equal("Pia", test2.Parameters(0).Type.ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(test2.Parameters(1).Type)
attrTest1 = compilation.GetTypeByMetadataName("AttrTest1")
args = attrTest1.GetAttributes()(0).CommonConstructorArguments
Assert.Equal("Pia", DirectCast(args(0).Value, TypeSymbol).ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(args(1).Value)
End Sub
<Fact()>
Public Sub GenericType1()
Dim piaSource = <compilation name="Pia"><file name="a.vb"><![CDATA[
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
<Assembly: Guid("f9c2d51d-4f44-45f0-9eda-c9d599b58257")>
<Assembly: ImportedFromTypeLib("Pia1.dll")>
Public Structure S1
Public F1 As Integer
End Structure
Public Structure S2(Of T)
Public F1 As Integer
End Structure
]]></file></compilation>
Dim pia = CreateCompilationWithMscorlib(piaSource)
CompileAndVerify(pia)
Dim piaImage = MetadataReference.CreateFromImage(pia.EmitToArray())
Dim source = <compilation name="LocalTypes2"><file name="a.vb"><![CDATA[
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
Public Class LocalTypes2
Public Sub Test2(x As S1, y As S2(Of Integer))
End Sub
End Class
<CompilerGenerated(), TypeIdentifier("f9c2d51d-4f44-45f0-9eda-c9d599b58257", "S1")>
Public Structure S1
Public F1 As Integer
End Structure
<CompilerGenerated(), TypeIdentifier("f9c2d51d-4f44-45f0-9eda-c9d599b58257", "S2`1")>
Public Structure S2(Of T)
Public F1 As Integer
End Structure
<ComEventInterface(GetType(S1), GetType(S2(Of)))>
Interface AttrTest1
End Interface
]]></file></compilation>
Dim localTypes2 = CreateCompilationWithMscorlib(source)
'CompileAndVerify(localTypes2)
Dim localTypes2Image = MetadataReference.CreateFromImage(localTypes2.EmitToArray())
Dim compilation = CreateCompilationWithMscorlib(<compilation/>,
references:=New MetadataReference() {New VisualBasicCompilationReference(localTypes2), New VisualBasicCompilationReference(pia)})
Dim lt = compilation.GetTypeByMetadataName("LocalTypes2")
Dim test2 = lt.GetMember(Of MethodSymbol)("Test2")
Assert.Equal("Pia", test2.Parameters(0).Type.ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(test2.Parameters(1).Type)
Dim attrTest1 = compilation.GetTypeByMetadataName("AttrTest1")
Dim args = attrTest1.GetAttributes()(0).CommonConstructorArguments
Assert.Equal("Pia", DirectCast(args(0).Value, TypeSymbol).ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(args(1).Value)
compilation = CreateCompilationWithMscorlib(<compilation/>,
references:=New MetadataReference() {localTypes2Image, New VisualBasicCompilationReference(pia)})
lt = compilation.GetTypeByMetadataName("LocalTypes2")
test2 = lt.GetMember(Of MethodSymbol)("Test2")
Assert.Equal("Pia", test2.Parameters(0).Type.ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(test2.Parameters(1).Type)
attrTest1 = compilation.GetTypeByMetadataName("AttrTest1")
args = attrTest1.GetAttributes()(0).CommonConstructorArguments
Assert.Equal("Pia", DirectCast(args(0).Value, TypeSymbol).ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(args(1).Value)
compilation = CreateCompilationWithMscorlib(<compilation/>,
references:=New MetadataReference() {New VisualBasicCompilationReference(localTypes2), piaImage})
lt = compilation.GetTypeByMetadataName("LocalTypes2")
test2 = lt.GetMember(Of MethodSymbol)("Test2")
Assert.Equal("Pia", test2.Parameters(0).Type.ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(test2.Parameters(1).Type)
attrTest1 = compilation.GetTypeByMetadataName("AttrTest1")
args = attrTest1.GetAttributes()(0).CommonConstructorArguments
Assert.Equal("Pia", DirectCast(args(0).Value, TypeSymbol).ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(args(1).Value)
compilation = CreateCompilationWithMscorlib(<compilation/>,
references:=New MetadataReference() {localTypes2Image, piaImage})
lt = compilation.GetTypeByMetadataName("LocalTypes2")
test2 = lt.GetMember(Of MethodSymbol)("Test2")
Assert.Equal("Pia", test2.Parameters(0).Type.ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(test2.Parameters(1).Type)
attrTest1 = compilation.GetTypeByMetadataName("AttrTest1")
args = attrTest1.GetAttributes()(0).CommonConstructorArguments
Assert.Equal("Pia", DirectCast(args(0).Value, TypeSymbol).ContainingAssembly.Name)
Assert.IsType(Of UnsupportedMetadataTypeSymbol)(args(1).Value)
End Sub
<Fact()>
Public Sub FullyQualifiedCaseSensitiveNames()
Dim pia1 = CreateCSharpCompilation(<![CDATA[
using System.Runtime.InteropServices;
[assembly: ImportedFromTypeLib("Pia.dll")]
[assembly: Guid("f9c2d51d-4f44-45f0-9eda-c9d599b58257")]
[ComImport, Guid("27e3e649-994b-4f58-b3c6-f8089a5f2c01")]
public interface I {}
namespace N1.N2
{
[ComImport, Guid("27e3e649-994b-4f58-b3c6-f8089a5f2c01")]
public interface I {}
}
namespace n1.n2
{
[ComImport, Guid("27e3e649-994b-4f58-b3c6-f8089a5f2c01")]
public interface i {}
}
]]>.Value,
assemblyName:="Pia1",
referencedAssemblies:=New MetadataReference() {MscorlibRef})
Dim pia1Image = pia1.EmitToImageReference(embedInteropTypes:=True)
Dim pia2 = CreateCSharpCompilation(<![CDATA[
using System.Runtime.InteropServices;
[assembly: ImportedFromTypeLib("Pia.dll")]
[assembly: Guid("f9c2d51d-4f44-45f0-9eda-c9d599b58257")]
namespace N1.N2
{
[ComImport, Guid("27e3e649-994b-4f58-b3c6-f8089a5f2c01")]
public interface I {}
}
]]>.Value,
assemblyName:="Pia2",
referencedAssemblies:=New MetadataReference() {MscorlibRef})
Dim pia2Image = pia2.EmitToImageReference(embedInteropTypes:=True)
Dim compilation1 = CreateCSharpCompilation(<![CDATA[
using System;
class A : Attribute
{
public A(object o) {}
}
[A(typeof(I))]
class C1 {}
[A(typeof(N1.N2.I))]
class C2 {}
[A(typeof(n1.n2.i))]
class C3 {}
]]>.Value,
assemblyName:="1",
referencedAssemblies:=New MetadataReference() {MscorlibRef, pia1Image})
compilation1.VerifyDiagnostics()
Dim compilation1Image = MetadataReference.CreateFromImage(compilation1.EmitToArray())
Dim compilation2 = CreateCompilationWithMscorlib(<compilation name="2"/>,
references:=New MetadataReference() {compilation1Image, pia1Image})
Dim type = compilation2.GetTypeByMetadataName("C1")
Dim argType = DirectCast(type.GetAttributes()(0).CommonConstructorArguments(0).Value, TypeSymbol)
Assert.Equal("Pia1", argType.ContainingAssembly.Name)
Assert.Equal("I", argType.ToString())
type = compilation2.GetTypeByMetadataName("C2")
argType = DirectCast(type.GetAttributes()(0).CommonConstructorArguments(0).Value, TypeSymbol)
Assert.Equal("Pia1", argType.ContainingAssembly.Name)
Assert.Equal("N1.N2.I", argType.ToString())
type = compilation2.GetTypeByMetadataName("C3")
argType = DirectCast(type.GetAttributes()(0).CommonConstructorArguments(0).Value, TypeSymbol)
Assert.Equal("Pia1", argType.ContainingAssembly.Name)
Assert.Equal("n1.n2.i", argType.ToString())
compilation2 = CreateCompilationWithMscorlib(<compilation name="2"/>,
references:=New MetadataReference() {compilation1Image, pia2Image})
type = compilation2.GetTypeByMetadataName("C1")
argType = DirectCast(type.GetAttributes()(0).CommonConstructorArguments(0).Value, TypeSymbol)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(argType)
type = compilation2.GetTypeByMetadataName("C2")
argType = DirectCast(type.GetAttributes()(0).CommonConstructorArguments(0).Value, TypeSymbol)
Assert.Equal("Pia2", argType.ContainingAssembly.Name)
Assert.Equal("N1.N2.I", argType.ToString())
type = compilation2.GetTypeByMetadataName("C3")
argType = DirectCast(type.GetAttributes()(0).CommonConstructorArguments(0).Value, TypeSymbol)
Assert.IsType(Of NoPiaMissingCanonicalTypeSymbol)(argType)
End Sub
<Fact, WorkItem(685240, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/685240")>
Public Sub Bug685240()
Dim piaSource =
<compilation name="Pia1">
<file name="a.vb"><![CDATA[
Imports System.Runtime.CompilerServices
Imports System.Runtime.InteropServices
<Assembly: Guid("f9c2d51d-4f44-45f0-9eda-c9d599b58257")>
<Assembly: ImportedFromTypeLib("Pia1.dll")>
<ComImport, Guid("27e3e649-994b-4f58-b3c6-f8089a5f2c01"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)>
Public Interface I1
Sub Sub1(ByVal x As Integer)
End Interface
]]></file>
</compilation>
Dim pia1 = CreateCompilationWithMscorlib(piaSource, options:=TestOptions.ReleaseDll)
CompileAndVerify(pia1)
Dim moduleSource =
<compilation name="Module1">
<file name="a.vb"><![CDATA[
Public Class Test
Public Shared Function M1() As I1
return Nothing
End Function
End Class
]]></file>
</compilation>
Dim module1 = CreateCompilationWithMscorlib(moduleSource, options:=TestOptions.ReleaseModule,
references:={New VisualBasicCompilationReference(pia1, embedInteropTypes:=True)})
Dim emptySource =
<compilation>
<file name="a.vb"><![CDATA[
]]></file>
</compilation>
Dim multiModule = CreateCompilationWithMscorlib(emptySource, options:=TestOptions.ReleaseDll,
references:={module1.EmitToImageReference()})
CompileAndVerify(multiModule)
Dim consumerSource =
<compilation>
<file name="a.vb"><![CDATA[
Public Class Consumer
public shared sub M2()
Dim x = Test.M1()
End Sub
End Class
]]></file>
</compilation>
Dim consumer = CreateCompilationWithMscorlib(consumerSource, options:=TestOptions.ReleaseDll,
references:={New VisualBasicCompilationReference(multiModule),
New VisualBasicCompilationReference(pia1)})
CompileAndVerify(consumer)
End Sub
<Fact, WorkItem(528047, "http://vstfdevdiv:8080/DevDiv2/DevDiv/_workitems/edit/528047")>
Public Sub OverloadResolutionWithEmbeddedInteropType()
Dim source1 =
<compilation>
<file name="a.vb"><![CDATA[
imports System
imports System.Collections.Generic
imports stdole
public class A
public shared Sub Foo(func As Func(Of X))
System.Console.WriteLine("X")
end Sub
public shared Sub Foo(func As Func(Of Y))
System.Console.WriteLine("Y")
end Sub
End Class
public delegate Sub X(addin As List(Of IDispatch))
public delegate Sub Y(addin As List(Of string))
]]></file>
</compilation>
Dim comp1 = CreateCompilationWithMscorlib(source1, options:=TestOptions.ReleaseDll,
references:={TestReferences.SymbolsTests.NoPia.StdOle.WithEmbedInteropTypes(True)})
Dim source2 =
<compilation>
<file name="a.vb"><![CDATA[
public module Program
public Sub Main()
A.Foo(Function() Sub(x) x.ToString())
End Sub
End Module
]]></file>
</compilation>
Dim comp2 = CreateCompilationWithMscorlibAndVBRuntimeAndReferences(source2,
{comp1.EmitToImageReference(),
TestReferences.SymbolsTests.NoPia.StdOle.WithEmbedInteropTypes(True)},
TestOptions.ReleaseExe)
CompileAndVerify(comp2, expectedOutput:="Y").Diagnostics.Verify()
Dim comp3 = CreateCompilationWithMscorlibAndVBRuntimeAndReferences(source2,
{New VisualBasicCompilationReference(comp1),
TestReferences.SymbolsTests.NoPia.StdOle.WithEmbedInteropTypes(True)},
TestOptions.ReleaseExe)
CompileAndVerify(comp3, expectedOutput:="Y").Diagnostics.Verify()
End Sub
End Class
End Namespace
|
Imports Windows10Design
Public Class Program
Inherits Win32Application
<STAThread>
Public Shared Sub Main(args As String())
Dim app As New Program(args)
Dim window As New Form1()
app.Run(New Form1())
End Sub
Public Sub New(args As String())
MyBase.New(args)
End Sub
Public Overrides Function CreateUWPApplication() As IDisposable
Return New UI.App(Me)
End Function
Public Overrides Function GetXamlContent() As Object
Return New UI.MainPage()
End Function
End Class
|
Public Class EarthDistanceCounter
Private ReadOnly _gameConfig As GameConfig
Private ReadOnly _playArea As Form2
Private ReadOnly _screenSize As ScreenSize
Private _counter As Integer
Public Sub New(ByVal frames As Frames, ByVal playArea As Form2, ByVal gameConfig As GameConfig, ByVal game As LaserDefender, ByVal screen As ScreenSize)
_gameConfig = gameConfig
_playArea = playArea
_screenSize = screen
AddHandler frames.Update, AddressOf Add
AddHandler game.GameStart, AddressOf InitializeCounter
End Sub
Private Sub InitializeCounter()
_counter = 0
_playArea.EarthImage.Top = _screenSize.yMax - 60
_playArea.DistanceEarthCounter.Text = _counter
End Sub
Public Sub Add()
_counter += _gameConfig.EarthDistanceCounterSpeed
If Math.Floor(_counter / 5) = _counter / 5 Then
_playArea.EarthImage.Top += _gameConfig.EarthDistanceCounterEarthSpeed
End If
_playArea.DistanceEarthCounter.Text = _counter
End Sub
End Class
|
Namespace XeoraCube.VSAddIn.Forms
Public Class TranslationSearch
Inherits ISFormBase
Public Sub New(ByVal Selection As EnvDTE.TextSelection, ByVal BeginningOffset As Integer)
MyBase.New(Selection, BeginningOffset)
Me.InitializeComponent()
MyBase.lwControls.SmallImageList = ilTranslations
End Sub
Private _TranslationsPath As String = String.Empty
Private _TranslationID As String = String.Empty
Public WriteOnly Property TranslationsPath() As String
Set(ByVal value As String)
Me._TranslationsPath = value
End Set
End Property
Public ReadOnly Property TranslationID() As String
Get
Return Me._TranslationID
End Get
End Property
Public Overrides Sub FillList()
Me._FillList(Me._TranslationsPath)
Dim ParentDI As IO.DirectoryInfo = _
IO.Directory.GetParent(Me._TranslationsPath)
If ParentDI.GetDirectories("Addons").Length = 0 Then _
Me._FillList(IO.Path.GetFullPath(IO.Path.Combine(Me._TranslationsPath, "../../../../Translations")))
MyBase.Sort()
End Sub
Private Sub _FillList(ByVal TranslationsPath As String)
Dim cFStream As IO.FileStream = Nothing
Try
Dim TranslationFileNames As String() = _
IO.Directory.GetFiles(TranslationsPath, "*.xml")
Dim TranslationCompile As New Generic.Dictionary(Of String, Integer)
For Each TranslationFileName As String In TranslationFileNames
Try
cFStream = New IO.FileStream( _
TranslationFileName, IO.FileMode.Open, _
IO.FileAccess.Read, IO.FileShare.ReadWrite)
Dim xPathDocument As New Xml.XPath.XPathDocument(cFStream)
Dim xPathNavigator As Xml.XPath.XPathNavigator = _
xPathDocument.CreateNavigator()
Dim xPathIter As Xml.XPath.XPathNodeIterator
xPathIter = xPathNavigator.Select("/translations/translation")
Do While xPathIter.MoveNext()
Dim TransID As String = _
xPathIter.Current.GetAttribute("id", xPathIter.Current.NamespaceURI)
If TranslationCompile.ContainsKey(TransID) Then _
TranslationCompile.Item(TransID) += 1 Else TranslationCompile.Add(TransID, 1)
Loop
Catch ex As Exception
' Just Handle Exceptions
Finally
If Not cFStream Is Nothing Then cFStream.Close()
End Try
Next
Dim ImageIndex As Integer = 0
For Each TransIDKey As String In TranslationCompile.Keys
If TranslationCompile.Item(TransIDKey) = TranslationFileNames.Length AndAlso _
Not MyBase.lwControls.Items.ContainsKey(TransIDKey) Then
MyBase.lwControls.Items.Add(TransIDKey, String.Empty, ImageIndex)
MyBase.lwControls.Items(MyBase.lwControls.Items.Count - 1).SubItems.Add(TransIDKey)
End If
Next
Catch ex As Exception
' Just Handle Exceptions
End Try
End Sub
Public Overrides Sub AcceptSelection()
If MyBase.lwControls.SelectedItems.Count > 0 Then
Me._TranslationID = MyBase.lwControls.SelectedItems.Item(0).SubItems.Item(1).Text
Else
Me.CancelSelection()
End If
End Sub
Public Overrides Sub CancelSelection()
Me._TranslationID = String.Empty
End Sub
Public Overrides Sub HandleResult()
MyBase.HandleResultDelegate.BeginInvoke(MyBase.WindowHandler, Me.DialogResult = System.Windows.Forms.DialogResult.OK, Me.BeginningOffset, Me.CurrentSelection, Globals.ISTypes.TranslationSearch, Me.AcceptChar, Me.UseCloseChar, New Object() {Me.TranslationID}, New AsyncCallback(Sub(aR As IAsyncResult)
Try
CType(aR.AsyncState, AddInControl.HandleResultDelegate).EndInvoke(Nothing, aR)
Catch ex As Exception
' Just handle to prevent crash
End Try
End Sub), MyBase.HandleResultDelegate)
End Sub
#Region " Form Designer Generated Codes "
Friend WithEvents ilTranslations As System.Windows.Forms.ImageList
Private components As System.ComponentModel.IContainer
Private Sub InitializeComponent()
Me.components = New System.ComponentModel.Container
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(TranslationSearch))
Me.ilTranslations = New System.Windows.Forms.ImageList(Me.components)
Me.SuspendLayout()
'
'ilTranslations
'
Me.ilTranslations.ImageStream = CType(resources.GetObject("ilTranslations.ImageStream"), System.Windows.Forms.ImageListStreamer)
Me.ilTranslations.TransparentColor = System.Drawing.Color.Transparent
Me.ilTranslations.Images.SetKeyName(0, "0translation.png")
'
'TranslationSearch
'
Me.ClientSize = New System.Drawing.Size(184, 184)
Me.Name = "TranslationSearch"
Me.ResumeLayout(False)
End Sub
#End Region
End Class
End Namespace |
Imports System.Drawing.Drawing2D
Imports System.IO
Public Class frmImageEditor
Dim fileAddress As String
Dim Job As Integer = 0 ' 1:crop 2:contrast
Dim timerTik As Boolean = False
Dim img As New ImageProcessor.ImageFactory
Dim tempCnt As Boolean 'check weather the roller is used or not
Dim bm_dest As Bitmap
Dim bm_source As Bitmap
Dim i As Int16 = 0.5
Dim cropX As Integer
Dim cropY As Integer
Dim cropWidth As Integer
Dim cropHeight As Integer
Dim oCropX As Integer
Dim oCropY As Integer
Dim cropBitmap As Bitmap
Public cropPen As Pen
Public cropPenSize As Integer = 1 '2
Public cropDashStyle As Drawing2D.DashStyle = DashStyle.Solid
Public cropPenColor As Color = Color.Yellow
Dim tmppoint As Point
Dim isStart As Boolean = False
Sub New()
InitializeComponent()
End Sub
Sub New(FileAddress As String)
InitializeComponent()
' Add any initialization after the InitializeComponent() call.
Me.fileAddress = FileAddress
Try
Dim xx As Image
Using str As Stream = File.OpenRead(FileAddress)
xx = Image.FromStream(str)
End Using
pic.Image = xx
resizer()
lblTaqir.Text = ""
Catch ex As Exception
MessageBox.Show(ex.Message)
Me.Close()
End Try
End Sub
Private Sub frmImageEditor_Load(sender As Object, e As EventArgs) Handles MyBase.Load
btnOK.BackgroundImage = IMGcache.img($"{Application.StartupPath}\data\app\icon\tick11.png")
btnCancel.BackgroundImage = IMGcache.img($"{Application.StartupPath}\data\app\icon\cross106.png")
End Sub
Private Sub resizer()
If pic.Image Is Nothing Then Exit Sub
Dim ix, iy, iw, ih As Double
If pic.Image.Width / pic.Image.Height > picPanel.Width / picPanel.Height Then
iw = picPanel.Width
ih = picPanel.Width / pic.Image.Width * pic.Image.Height
ix = 0
iy = (picPanel.Height - ih) / 2
ElseIf pic.Image.Width / pic.Image.Height < picPanel.Width / picPanel.Height Then
iw = picPanel.Height / pic.Image.Height * pic.Image.Width
ih = picPanel.Height
ix = (picPanel.Width - iw) / 2
iy = 0
Else
iw = picPanel.Width
ih = picPanel.Height
ix = 0
iy = 0
End If
pic.Dock = DockStyle.None
pic.Size = New Size(iw, ih)
pic.Location = New Point(ix, iy)
End Sub
Private Sub btnEnseraf_Click(sender As Object, e As EventArgs) Handles btnEnseraf.Click
Me.Close()
End Sub
Private Sub btnCrop_Click(sender As Object, e As EventArgs) Handles btnCrop.Click
Job = 1
lblTaqir.Text = "برش"
Abzar.Enabled = False
btnOK.Visible = True
btnCancel.Visible = True
btnTaeed.Enabled = False
End Sub
Private Sub pic_MouseDown(sender As Object, e As MouseEventArgs) Handles pic.MouseDown
Try
If Job = 1 Then
If e.Button = Windows.Forms.MouseButtons.Left Then
cropX = e.X
cropY = e.Y
cropPen = New Pen(cropPenColor, cropPenSize)
cropPen.DashStyle = DashStyle.DashDotDot
Cursor = Cursors.Cross
End If
pic.Refresh()
End If
Catch exc As Exception
End Try
End Sub
Private Sub pic_MouseMove(sender As Object, e As MouseEventArgs) Handles pic.MouseMove
Try
If Job = 1 Then
If pic.Image Is Nothing Then Exit Sub
If e.Button = Windows.Forms.MouseButtons.Left Then
isStart = True
If Not MouseIsOverControl(pic) Then Exit Sub
pic.Refresh()
cropWidth = Math.Max(e.X, cropX) - Math.Min(e.X, cropX)
cropHeight = Math.Max(e.Y, cropY) - Math.Min(e.Y, cropY)
pic.CreateGraphics.DrawRectangle(cropPen, Math.Min(cropX, e.X), Math.Min(cropY, e.Y), cropWidth, cropHeight)
End If
End If
Catch exc As Exception
If Err.Number = 5 Then Exit Sub
End Try
End Sub
Public Function MouseIsOverControl(ByVal c As Control) As Boolean
Return c.ClientRectangle.Contains(c.PointToClient(Control.MousePosition))
End Function
Private Sub pic_MouseUp(sender As Object, e As MouseEventArgs) Handles pic.MouseUp
Try
If Job = 1 Then
Cursor = Cursors.Default
Try
If cropWidth < 10 Or cropHeight < 10 Or Not isStart Then
pic.Refresh()
Exit Sub
End If
isStart = False
Dim rect As Rectangle = New Rectangle(Math.Min(cropX, e.X), Math.Min(cropY, e.Y), cropWidth, cropHeight)
Dim bit As Bitmap = New Bitmap(pic.Image, pic.Width, pic.Height)
'cropBitmap = New Bitmap(cropWidth, cropHeight)
'Dim g As Graphics = Graphics.FromImage(cropBitmap)
'g.InterpolationMode = InterpolationMode.HighQualityBicubic
'g.PixelOffsetMode = PixelOffsetMode.HighQuality
'g.CompositingQuality = CompositingQuality.HighQuality
'g.DrawImage(bit, 0, 0, rect, GraphicsUnit.Pixel)
'preview.Image = cropBitmap
img = New ImageProcessor.ImageFactory
img.Quality(100)
img.Load(bit)
preview.Image = img.Crop(rect).Image
Catch exc As Exception
End Try
End If
Catch exc As Exception
End Try
End Sub
Private Sub frmImageEditor_Resize(sender As Object, e As EventArgs) Handles Me.Resize
resizer()
End Sub
Private Sub btnOK_Click(sender As Object, e As EventArgs) Handles btnOK.Click
If preview.Image IsNot Nothing Then
pic.Image = preview.Image
resizer()
btnOK.Visible = False
btnCancel.Visible = False
Abzar.Enabled = True
btnTaeed.Enabled = True
Job = 0
lblTaqir.Text = ""
trackContrast.Visible = False
resizer()
pic.Refresh()
preview.Image = Nothing
End If
End Sub
Private Sub btnCancel_Click(sender As Object, e As EventArgs) Handles btnCancel.Click
Job = 0
lblTaqir.Text = ""
trackContrast.Visible = False
resizer()
pic.Refresh()
preview.Image = Nothing
btnOK.Visible = False
btnCancel.Visible = False
Abzar.Enabled = True
btnTaeed.Enabled = True
End Sub
Private Sub btnTaeed_Click(sender As Object, e As EventArgs) Handles btnTaeed.Click
Try
pic.Image.Save(fileAddress)
IMGcache.Remove(fileAddress)
MessageBox.Show("تصویر با موفقیت ویرایش و ذخیره شد")
Me.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub
Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
If timerTik Then
' btnOK.BackColor = Color.FromArgb(100, Color.Green)
' btnCancel.BackColor = Color.FromArgb(255, Color.Orange)
GroupBox1.ForeColor = Color.White
Else
' btnOK.BackColor = Color.FromArgb(255, Color.Orange)
' btnCancel.BackColor = Color.FromArgb(100, Color.Red)
GroupBox1.ForeColor = Color.Black
End If
If Job > 0 Then
timerTik = Not timerTik
GroupBox1.Visible = True
Else
'GroupBox1.ForeColor = Color.Black
GroupBox1.Visible = False
End If
End Sub
Private Sub btnRotateC_Click(sender As Object, e As EventArgs) Handles btnRotateC.Click
img = New ImageProcessor.ImageFactory
img.Load(New Bitmap(pic.Image))
pic.Image = img.Rotate(90).Image
resizer()
btnTaeed.Enabled = True
End Sub
Private Sub btnRotateAC_Click(sender As Object, e As EventArgs) Handles btnRotateAC.Click
img = New ImageProcessor.ImageFactory
img.Load(New Bitmap(pic.Image))
pic.Image = img.Rotate(-90).Image
resizer()
btnTaeed.Enabled = True
End Sub
Private Sub btnFilipV_Click(sender As Object, e As EventArgs) Handles btnFilipV.Click
img = New ImageProcessor.ImageFactory
img.Load(New Bitmap(pic.Image))
pic.Image = img.Flip(True, False).Image
resizer()
btnTaeed.Enabled = True
End Sub
Private Sub btnFilipH_Click(sender As Object, e As EventArgs) Handles btnFilipH.Click
img = New ImageProcessor.ImageFactory
img.Load(New Bitmap(pic.Image))
pic.Image = img.Flip(False, False).Image
resizer()
btnTaeed.Enabled = True
End Sub
Private Sub btnContrast_Click(sender As Object, e As EventArgs) Handles btnContrast.Click
Job = 2
lblTaqir.Tag = 0
lblTaqir.Text = $"میزان روشنایی : {lblTaqir.Tag}%"
preview.Image = pic.Image
img = New ImageProcessor.ImageFactory
img.Load(pic.Image)
trackContrast.Value = 0
trackContrast.Visible = True
Abzar.Enabled = False
btnOK.Visible = True
btnCancel.Visible = True
btnTaeed.Enabled = False
End Sub
Private Sub trackContrast_Scroll(sender As Object, e As EventArgs) Handles trackContrast.Scroll
img.Reset()
preview.Image = img.Contrast(trackContrast.Value).Image
lblTaqir.Tag = trackContrast.Value
lblTaqir.Text = $"میزان روشنایی : {lblTaqir.Tag}%"
End Sub
End Class |
Imports System.Text
Namespace BomCompare
Public Class BomCompareRow
Implements IComparable
Public Enum ChangeTypeEnum
Unchanged
Added
Removed
Updated
Replaced
End Enum
Public Sub New(ByVal index As String, ByVal changeType As ChangeTypeEnum, ByVal changeDescription As List(Of String), compareItem As BomCompareItem, baseItem As BomCompareItem)
Me.Index = index
Me.ChangeType = changeType
Me.ChangeDescription = changeDescription
Me.CompareItem = compareItem
Me.BaseItem = baseItem
End Sub
Public Property Index As String
Property ChangeType As ChangeTypeEnum
Property ChangeDescription As List(Of String)
Property CompareItem As BomCompareItem
Property BaseItem As BomCompareItem
Public Overrides Function ToString() As String
Dim sb As New StringBuilder
sb.AppendLine("Index: " & Index)
sb.AppendLine("ChangeType: " & ChangeType.ToString)
sb.AppendLine("Change description:")
For Each changeDesc In ChangeDescription
sb.AppendLine(changeDesc)
Next
If CompareItem Is Nothing Then
sb.AppendLine("No compare item")
Else
sb.AppendLine("Compare Item:")
sb.Append(BomCompareItemToString(CompareItem))
End If
If BaseItem Is Nothing Then
sb.AppendLine("No base item")
Else
sb.AppendLine("BaseItem Item:")
sb.Append(BomCompareItemToString(BaseItem))
End If
Return sb.ToString()
End Function
Private Function BomCompareItemToString(ByVal item As BomCompareItem) As String
Dim sb As New StringBuilder
For Each prop As IBomCompareItemProperty In item.BomCompareItemProperties
sb.Append(prop.PropertyName)
sb.Append("=")
sb.Append(prop.Value)
sb.Append(" Changed?=" & prop.Changed)
sb.AppendLine()
Next
Return sb.ToString()
End Function
Public Function CompareTo(obj As Object) As Integer Implements IComparable.CompareTo
Dim otherBomCompareRow As BomCompareRow = TryCast(obj, BomCompareRow)
If otherBomCompareRow Is Nothing Then
Return 0
End If
' Try to sort by integer if possible
Dim otherIndex As Integer
Dim thisIndex As Integer
If Integer.TryParse(otherBomCompareRow.Index, otherIndex) AndAlso Integer.TryParse(Me.Index, thisIndex) Then
If thisIndex > otherIndex Then
Return 1
ElseIf thisIndex < otherIndex Then
Return -1
End If
Return 0
Else
If Me.Index > otherBomCompareRow.Index Then
Return 1
ElseIf Me.Index < otherBomCompareRow.Index Then
Return -1
End If
Return 0
End If
End Function
End Class
End Namespace |
Imports System.Reflection
Imports System.Runtime.InteropServices
Imports System.Windows
<Assembly: AssemblyTitle("HVIFViewer")>
<Assembly: AssemblyDescription("")>
<Assembly: AssemblyCompany("")>
<Assembly: AssemblyProduct("HVIFViewer")>
<Assembly: AssemblyCopyright("Copyright © 2022")>
<Assembly: AssemblyTrademark("")>
<Assembly: ComVisible(false)>
'<Assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)>
<Assembly: ThemeInfo(ResourceDictionaryLocation.None, ResourceDictionaryLocation.SourceAssembly)>
<Assembly: Guid("d22f4d27-a8f8-4161-8ad3-d3c9dab907eb")>
<Assembly: AssemblyVersion("1.0.0.0")>
<Assembly: AssemblyFileVersion("1.0.0.0")>
|
Imports System.Data.SqlClient
Public Class OtobuslerFormu
Private SQLBaglanti As New SqlConnection(SqlBaglantiCumlesi)
Private OtobusTablosuSDA As SqlDataAdapter
Private Sub OtobuslerFormu_Load(sender As Object, e As EventArgs) Handles MyBase.Load
OtobusBilgileriniGetir()
MarkaModelBilgileriniGetir()
OtobusTablosuBindingSource.CancelEdit()
End Sub
Private Sub OtobusBilgileriniGetir()
Dim Sorgu As String = "SELECT * FROM OtobusTablosu"
OtobusTablosuSDA = New SqlDataAdapter(Sorgu, SQLBaglanti)
OtobusTablosuSDA.Fill(BipBusDataSet, "OtobusTablosu")
'Insert, Update ve Delete Komutlarını Ekle
Dim SQLKomutOlusturucu As New SqlCommandBuilder(OtobusTablosuSDA)
OtobusTablosuSDA.InsertCommand = SQLKomutOlusturucu.GetInsertCommand
OtobusTablosuSDA.UpdateCommand = SQLKomutOlusturucu.GetUpdateCommand
OtobusTablosuSDA.DeleteCommand = SQLKomutOlusturucu.GetDeleteCommand
'**********************************
OtobusTablosuBindingSource.DataSource = BipBusDataSet
OtobusTablosuBindingSource.DataMember = "OtobusTablosu"
OtobusTablosuBindingNavigator.BindingSource = OtobusTablosuBindingSource
OtobuslerDataGridView.DataSource = OtobusTablosuBindingSource
FormNesneleriniBagla()
End Sub
Private Sub FormNesneleriniBagla()
PlakaTextBox.DataBindings.Add("Text", OtobusTablosuBindingSource, "Plaka")
MarkaNoComboBox.DataBindings.Add("SelectedValue", OtobusTablosuBindingSource, "MarkaNo")
ModelNoComboBox.DataBindings.Add("SelectedValue", OtobusTablosuBindingSource, "ModelNo")
KoltukSayisiNUD.DataBindings.Add("Value", OtobusTablosuBindingSource, "KoltukSayisi", True)
TelefonTextBox.DataBindings.Add("Text", OtobusTablosuBindingSource, "Telefon")
KoltukDizilisiComboBox.DataBindings.Add("Text", OtobusTablosuBindingSource, "KoltukDizilisi")
KatNUD.DataBindings.Add("Value", OtobusTablosuBindingSource, "Kat", True)
End Sub
Private Sub MarkaModelBilgileriniGetir()
Try
SQLBaglanti.Open()
'Marka Bilgilerini Getir
Dim Sorgu As String = "SELECT * FROM MarkaTablosu"
Dim SQLKomut As New SqlCommand(Sorgu, SQLBaglanti)
BipBusDataSet.Tables.Add("MarkaTablosu").Load(SQLKomut.ExecuteReader)
'Model Bilgilerini Getir
Sorgu = "SELECT * FROM ModelTablosu"
SQLKomut.CommandText = Sorgu
BipBusDataSet.Tables.Add("ModelTablosu").Load(SQLKomut.ExecuteReader)
'Marka ve Model Tabloları Arasında DataSet Üzerinde İlişki Kurma************
'MarkaNo Alanlarını Değişkenlere Ata
Dim Marka_MarkaNo As DataColumn = BipBusDataSet.Tables("MarkaTablosu").Columns("MarkaNo")
Dim Model_MarkaNo As DataColumn = BipBusDataSet.Tables("ModelTablosu").Columns("MarkaNo")
'İlişki Değişkenini Oluştur New DataRelation("İlişki Adı", PK Olan Alan, FK Olan Alan)
Dim MarkaModelRelation As New DataRelation("MarkaModel", Marka_MarkaNo, Model_MarkaNo)
'İlişkiyi DataSet'e Ekle
BipBusDataSet.Relations.Add(MarkaModelRelation)
'BindingSource'ler ile Bağlantı Kur
MarkaBindingSource.DataSource = BipBusDataSet
MarkaBindingSource.DataMember = "MarkaTablosu"
'Buraya Dikkat
ModelBindingSource.DataSource = MarkaBindingSource
ModelBindingSource.DataMember = "MarkaModel" 'İlişkiye Verdiğimiz İsmi Yazıyoruz
'***************************************************************
'ComboBox'lar ile Bağlantı Kur
MarkaNoComboBox.DataSource = MarkaBindingSource
MarkaNoComboBox.DisplayMember = "Marka"
MarkaNoComboBox.ValueMember = "MarkaNo"
ModelNoComboBox.DataSource = ModelBindingSource
ModelNoComboBox.DisplayMember = "ModelAdi"
ModelNoComboBox.ValueMember = "ModelNo"
'DataGridView İçerisindeki Tipi ComboBox Olan Alanlar İle Bağlantı Kur
Dim MarkaNoCB As DataGridViewComboBoxColumn = OtobuslerDataGridView.Columns("MarkaNo")
MarkaNoCB.DataSource = MarkaBindingSource
MarkaNoCB.DisplayMember = "Marka"
MarkaNoCB.ValueMember = "MarkaNo"
Dim ModelNoCB As DataGridViewComboBoxColumn = OtobuslerDataGridView.Columns("ModelNo")
ModelNoCB.DataSource = ModelBindingSource
ModelNoCB.DisplayMember = "ModelAdi"
ModelNoCB.ValueMember = "ModelNo"
Catch ex As Exception
Finally
SQLBaglanti.Close()
End Try
End Sub
Private Sub MarkaNoComboBox_SelectedValueChanged(sender As Object, e As EventArgs) Handles MarkaNoComboBox.SelectedValueChanged
' MarkaBindingSource.Position = MarkaNoComboBox.SelectedIndex
End Sub
Private Sub BindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles BindingNavigatorSaveItem.Click
Me.Validate()
OtobusTablosuBindingSource.EndEdit()
OtobusTablosuSDA.Update(BipBusDataSet, "OtobusTablosu")
MsgBox("Yapılan Değişiklikler (Ekle, Değiştir, Sil) Veri Tabanına Aktarıldı.")
End Sub
Private Sub AraButton_Click(sender As Object, e As EventArgs) Handles AraButton.Click
OtobusAramaFormu.ShowDialog(Me)
End Sub
Private Sub OtobuslerDataGridView_DataError(sender As Object, e As DataGridViewDataErrorEventArgs) Handles OtobuslerDataGridView.DataError
If e.Exception.Message = "DataGridViewComboBoxCell value is not valid." Then
Dim value As Object = OtobuslerDataGridView.Rows(e.RowIndex).Cells(e.ColumnIndex).Value
If Not (CType(OtobuslerDataGridView.Columns(e.ColumnIndex), DataGridViewComboBoxColumn)).Items.Contains(value) Then
CType(OtobuslerDataGridView.Columns(e.ColumnIndex), DataGridViewComboBoxColumn).Items.Add(value)
e.ThrowException = False
End If
End If
End Sub
End Class |
Public Class FrmFindVA
Private Sub BtnCancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnCancel.Click
Me.Close()
Me.Dispose()
End Sub
Private Sub BtnOk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnOk.Click
Me.DialogResult = Windows.Forms.DialogResult.OK
End Sub
Private Sub TxtValue_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TxtValue.KeyPress
SetDisableKeyString(e)
End Sub
End Class |
'------------------------------------------------------------------------------
' <auto-generated>
' 此代码由工具生成。
' 运行时版本:4.0.30319.42000
'
' 对此文件的更改可能会导致不正确的行为,并且如果
' 重新生成代码,这些更改将会丢失。
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My
<Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0"), _
Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
Private Shared defaultInstance As MySettings = CType(Global.System.Configuration.ApplicationSettingsBase.Synchronized(New MySettings()),MySettings)
#Region "My.Settings 自动保存功能"
#If _MyType = "WindowsForms" Then
Private Shared addedHandler As Boolean
Private Shared addedHandlerLockObject As New Object
<Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
End Sub
#End If
#End Region
Public Shared ReadOnly Property [Default]() As MySettings
Get
#If _MyType = "WindowsForms" Then
If Not addedHandler Then
SyncLock addedHandlerLockObject
If Not addedHandler Then
AddHandler My.Application.Shutdown, AddressOf AutoSaveSettings
addedHandler = True
End If
End SyncLock
End If
#End If
Return defaultInstance
End Get
End Property
End Class
End Namespace
Namespace My
<Global.Microsoft.VisualBasic.HideModuleNameAttribute(), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute()> _
Friend Module MySettingsProperty
<Global.System.ComponentModel.Design.HelpKeywordAttribute("My.Settings")> _
Friend ReadOnly Property Settings() As Global.舰娘大战塞壬启动器.My.MySettings
Get
Return Global.舰娘大战塞壬启动器.My.MySettings.Default
End Get
End Property
End Module
End Namespace
|
Public Class PalindromeForm
Private Sub btnAnalyze_Click(sender As Object, e As EventArgs) Handles btnAnalyze.Click
Dim word as String = txtWord.Text
Dim wordNoPunctuation as String = ""
For i as Integer = 0 To word.Length - 1
Dim character as Char = Cchar(word.Substring(i,1).ToUpper())
If Asc(character) >= 65 And Asc(character) <= 90 Then
wordNoPunctuation += character
End If
Next
If IsPalindrome(wordNoPunctuation) Then
txtOutput.Text = "YES"
Else
txtOutput.Text = "NO"
End If
End Sub
Private Function IsPalindrome(word As String) As Boolean
Dim reversedWord as String = ""
For i as Integer = word.Length To 1 Step -1
reversedWord += word.Substring(i - 1, 1)
Next
If reversedWord = word Then
Return True
Else
Return False
End If
End Function
End Class
|
'------------------------------------------------------------------------------
' <auto-generated>
' This code was generated by a tool.
' Runtime Version:4.0.30319.42000
'
' Changes to this file may cause incorrect behavior and will be lost if
' the code is regenerated.
' </auto-generated>
'------------------------------------------------------------------------------
Option Strict On
Option Explicit On
Namespace My.Resources
'This class was auto-generated by the StronglyTypedResourceBuilder
'class via a tool like ResGen or Visual Studio.
'To add or remove a member, edit your .ResX file then rerun ResGen
'with the /str option, or rebuild your VS project.
'''<summary>
''' A strongly-typed resource class, for looking up localized strings, etc.
'''</summary>
<Global.System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0"), _
Global.System.Diagnostics.DebuggerNonUserCodeAttribute(), _
Global.System.Runtime.CompilerServices.CompilerGeneratedAttribute(), _
Global.Microsoft.VisualBasic.HideModuleNameAttribute()> _
Friend Module Resources
Private resourceMan As Global.System.Resources.ResourceManager
Private resourceCulture As Global.System.Globalization.CultureInfo
'''<summary>
''' Returns the cached ResourceManager instance used by this class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend ReadOnly Property ResourceManager() As Global.System.Resources.ResourceManager
Get
If Object.ReferenceEquals(resourceMan, Nothing) Then
Dim temp As Global.System.Resources.ResourceManager = New Global.System.Resources.ResourceManager("SaberLibreriasWindows.Resources", GetType(Resources).Assembly)
resourceMan = temp
End If
Return resourceMan
End Get
End Property
'''<summary>
''' Overrides the current thread's CurrentUICulture property for all
''' resource lookups using this strongly typed resource class.
'''</summary>
<Global.System.ComponentModel.EditorBrowsableAttribute(Global.System.ComponentModel.EditorBrowsableState.Advanced)> _
Friend Property Culture() As Global.System.Globalization.CultureInfo
Get
Return resourceCulture
End Get
Set(ByVal value As Global.System.Globalization.CultureInfo)
resourceCulture = value
End Set
End Property
End Module
End Namespace
|
' Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
'-----------------------------------------------------------------------------------------------------------
' This is the code that actually outputs the VB code that defines the tree. It is passed a read and validated
' ParseTree, and outputs the code to defined the node classes for that tree, and also additional data
' structures like the kinds, visitor, etc.
'-----------------------------------------------------------------------------------------------------------
Imports System.IO
' Class to write out the code for the code tree.
Friend Class GreenNodeWriter
Inherits WriteUtils
Private _writer As TextWriter 'output is sent here.
Private ReadOnly _nonterminalsWithOneChild As List(Of String) = New List(Of String)
Private ReadOnly _nonterminalsWithTwoChildren As List(Of String) = New List(Of String)
' Initialize the class with the parse tree to write.
Public Sub New(parseTree As ParseTree)
MyBase.New(parseTree)
End Sub
' Write out the code defining the tree to the give file.
Public Sub WriteTreeAsCode(writer As TextWriter)
_writer = writer
GenerateFile()
End Sub
Private Sub GenerateFile()
GenerateNamespace()
End Sub
Private Sub GenerateNamespace()
_writer.WriteLine()
If Not String.IsNullOrEmpty(_parseTree.NamespaceName) Then
_writer.WriteLine("Namespace {0}", Ident(_parseTree.NamespaceName) + ".Syntax.InternalSyntax")
_writer.WriteLine()
End If
GenerateNodeStructures()
If Not String.IsNullOrEmpty(_parseTree.VisitorName) Then
GenerateVisitorClass()
End If
If Not String.IsNullOrEmpty(_parseTree.RewriteVisitorName) Then
GenerateRewriteVisitorClass()
End If
If Not String.IsNullOrEmpty(_parseTree.NamespaceName) Then
_writer.WriteLine("End Namespace")
End If
'DumpNames("Nodes with One Child", _nonterminalsWithOneChild)
'DumpNames("Nodes with Two Children", _nonterminalsWithTwoChildren)
End Sub
Private Sub DumpNames(title As String, names As List(Of String))
Console.WriteLine(title)
Console.WriteLine("=======================================")
Dim sortedNames = From n In names Order By n
For Each name In sortedNames
Console.WriteLine(name)
Next
Console.WriteLine()
End Sub
Private Sub GenerateNodeStructures()
For Each nodeStructure In _parseTree.NodeStructures.Values
If Not nodeStructure.NoFactory Then
GenerateNodeStructureClass(nodeStructure)
End If
Next
End Sub
' Generate an constant value
Private Function GetConstantValue(val As Long) As String
Return val.ToString()
End Function
' Generate a class declaration for a node structure.
Private Sub GenerateNodeStructureClass(nodeStructure As ParseNodeStructure)
' XML comment
GenerateXmlComment(_writer, nodeStructure, 4)
' Class name
_writer.Write(" ")
If (nodeStructure.PartialClass) Then
_writer.Write("Partial ")
End If
Dim visibility As String = "Friend"
If _parseTree.IsAbstract(nodeStructure) Then
_writer.WriteLine("{0} MustInherit Class {1}", visibility, StructureTypeName(nodeStructure))
ElseIf Not nodeStructure.HasDerivedStructure Then
_writer.WriteLine("{0} NotInheritable Class {1}", visibility, StructureTypeName(nodeStructure))
Else
_writer.WriteLine("{0} Class {1}", visibility, StructureTypeName(nodeStructure))
End If
' Base class
If Not IsRoot(nodeStructure) Then
_writer.WriteLine(" Inherits {0}", StructureTypeName(nodeStructure.ParentStructure))
End If
_writer.WriteLine()
'Create members
GenerateNodeStructureMembers(nodeStructure)
' Create the constructor.
GenerateNodeStructureConstructor(nodeStructure, False, noExtra:=True)
GenerateNodeStructureConstructor(nodeStructure, False, noExtra:=True, contextual:=True)
GenerateNodeStructureConstructor(nodeStructure, False)
' Serialization
GenerateNodeStructureSerialization(nodeStructure)
GenerateCreateRed(nodeStructure)
' Create the property accessor for each of the fields
Dim fields = nodeStructure.Fields
For i = 0 To fields.Count - 1
GenerateNodeFieldProperty(fields(i), i, fields(i).ContainingStructure IsNot nodeStructure)
Next
' Create the property accessor for each of the children
Dim children = nodeStructure.Children
For i = 0 To children.Count - 1
GenerateNodeChildProperty(nodeStructure, children(i), i)
GenerateNodeWithChildProperty(children(i), i, nodeStructure)
Next
If Not (_parseTree.IsAbstract(nodeStructure) OrElse nodeStructure.IsToken) Then
If children.Count = 1 Then
If Not children(0).IsList AndAlso Not KindTypeStructure(children(0).ChildKind).Name = "ExpressionSyntax" Then
_nonterminalsWithOneChild.Add(nodeStructure.Name)
End If
ElseIf children.Count = 2 Then
If Not children(0).IsList AndAlso Not KindTypeStructure(children(0).ChildKind).Name = "ExpressionSyntax" AndAlso Not children(1).IsList AndAlso Not KindTypeStructure(children(1).ChildKind).Name = "ExpressionSyntax" Then
_nonterminalsWithTwoChildren.Add(nodeStructure.Name)
End If
End If
End If
'Create GetChild
GenerateGetChild(nodeStructure)
GenerateWithTrivia(nodeStructure)
GenerateSetDiagnostics(nodeStructure)
GenerateSetAnnotations(nodeStructure)
' Visitor accept method
If Not String.IsNullOrEmpty(_parseTree.VisitorName) Then
GenerateAccept(nodeStructure)
End If
'GenerateUpdate(nodeStructure)
' Special methods for the root node.
If IsRoot(nodeStructure) Then
GenerateRootNodeSpecialMethods(nodeStructure)
End If
' End the class
_writer.WriteLine(" End Class")
_writer.WriteLine()
End Sub
' Generate CreateRed method
Private Sub GenerateCreateRed(nodeStructure As ParseNodeStructure)
If _parseTree.IsAbstract(nodeStructure) OrElse nodeStructure.IsToken OrElse nodeStructure.IsTrivia Then
Return
End If
_writer.WriteLine(" Friend Overrides Function CreateRed(ByVal parent As SyntaxNode, ByVal startLocation As Integer) As SyntaxNode")
_writer.WriteLine(" Return new {0}.Syntax.{1}(Me, parent, startLocation)", _parseTree.NamespaceName, StructureTypeName(nodeStructure))
_writer.WriteLine(" End Function")
_writer.WriteLine()
End Sub
' Generate SetDiagnostics method
Private Sub GenerateSetDiagnostics(nodeStructure As ParseNodeStructure)
If _parseTree.IsAbstract(nodeStructure) Then
Return
End If
_writer.WriteLine(" Friend Overrides Function SetDiagnostics(ByVal newErrors As DiagnosticInfo()) As GreenNode")
_writer.Write(" Return new {0}", StructureTypeName(nodeStructure))
GenerateNodeStructureConstructorParameters(nodeStructure, "newErrors", "GetAnnotations", "GetLeadingTrivia", "GetTrailingTrivia")
_writer.WriteLine(" End Function")
_writer.WriteLine()
End Sub
' Generate SetAnnotations method
Private Sub GenerateSetAnnotations(nodeStructure As ParseNodeStructure)
If _parseTree.IsAbstract(nodeStructure) Then
Return
End If
_writer.WriteLine(" Friend Overrides Function SetAnnotations(ByVal annotations As SyntaxAnnotation()) As GreenNode")
_writer.Write(" Return new {0}", StructureTypeName(nodeStructure))
GenerateNodeStructureConstructorParameters(nodeStructure, "GetDiagnostics", "annotations", "GetLeadingTrivia", "GetTrailingTrivia")
_writer.WriteLine(" End Function")
_writer.WriteLine()
End Sub
' Generate Update method . But only for non terminals
Private Sub GenerateUpdate(nodeStructure As ParseNodeStructure)
If _parseTree.IsAbstract(nodeStructure) OrElse nodeStructure.IsToken OrElse nodeStructure.IsTrivia Then
Return
End If
Dim structureName = StructureTypeName(nodeStructure)
Dim factory = FactoryName(nodeStructure)
Dim needComma = False
_writer.Write(" Friend ")
If nodeStructure.ParentStructure IsNot Nothing AndAlso Not nodeStructure.ParentStructure.Abstract Then
_writer.Write("Shadows ")
End If
_writer.Write("Function Update(")
For Each child In GetAllChildrenOfStructure(nodeStructure)
If needComma Then
_writer.Write(", ")
End If
GenerateFactoryChildParameter(nodeStructure, child, Nothing, False)
needComma = True
Next
_writer.WriteLine(") As {0}", structureName)
needComma = False
_writer.Write(" If ")
For Each child In GetAllChildrenOfStructure(nodeStructure)
If needComma Then
_writer.Write(" OrElse ")
End If
If child.IsList OrElse KindTypeStructure(child.ChildKind).IsToken Then
_writer.Write("{0}.Node IsNot Me.{1}", ChildParamName(child), ChildVarName(child))
Else
_writer.Write("{0} IsNot Me.{1}", ChildParamName(child), ChildVarName(child))
End If
needComma = True
Next
_writer.WriteLine(" Then")
needComma = False
_writer.Write(" Return SyntaxFactory.{0}(", factory)
If nodeStructure.NodeKinds.Count >= 2 And Not _parseTree.NodeKinds.ContainsKey(FactoryName(nodeStructure)) Then
_writer.Write("Me.Kind, ")
End If
For Each child In GetAllChildrenOfStructure(nodeStructure)
If needComma Then
_writer.Write(", ")
End If
_writer.Write("{0}", ChildParamName(child))
needComma = True
Next
_writer.WriteLine(")")
_writer.WriteLine(" End If")
_writer.WriteLine(" Return Me")
_writer.WriteLine(" End Function")
_writer.WriteLine()
End Sub
' Generate WithTrivia method s
Private Sub GenerateWithTrivia(nodeStructure As ParseNodeStructure)
If _parseTree.IsAbstract(nodeStructure) OrElse Not nodeStructure.IsToken Then
Return
End If
_writer.WriteLine(" Public Overrides Function WithLeadingTrivia(ByVal trivia As GreenNode) As GreenNode")
_writer.Write(" Return new {0}", StructureTypeName(nodeStructure))
GenerateNodeStructureConstructorParameters(nodeStructure, "GetDiagnostics", "GetAnnotations", "trivia", "GetTrailingTrivia")
_writer.WriteLine(" End Function")
_writer.WriteLine()
_writer.WriteLine(" Public Overrides Function WithTrailingTrivia(ByVal trivia As GreenNode) As GreenNode")
_writer.Write(" Return new {0}", StructureTypeName(nodeStructure))
GenerateNodeStructureConstructorParameters(nodeStructure, "GetDiagnostics", "GetAnnotations", "GetLeadingTrivia", "trivia")
_writer.WriteLine(" End Function")
_writer.WriteLine()
End Sub
' Generate GetChild, GetChildrenCount so members can be accessed by index
Private Sub GenerateGetChild(nodeStructure As ParseNodeStructure)
If _parseTree.IsAbstract(nodeStructure) OrElse nodeStructure.IsToken Then
Return
End If
Dim allChildren = GetAllChildrenOfStructure(nodeStructure)
Dim childrenCount = allChildren.Count
If childrenCount = 0 Then
Return
End If
_writer.WriteLine(" Friend Overrides Function GetSlot(i as Integer) as GreenNode")
' Create the property accessor for each of the children
Dim children = allChildren
If childrenCount <> 1 Then
_writer.WriteLine(" Select case i")
For i = 0 To childrenCount - 1
_writer.WriteLine(" Case {0}", i)
_writer.WriteLine(" Return Me.{0}", ChildVarName(children(i)))
Next
_writer.WriteLine(" Case Else")
_writer.WriteLine(" Debug.Assert(false, ""child index out of range"")")
_writer.WriteLine(" Return Nothing")
_writer.WriteLine(" End Select")
Else
_writer.WriteLine(" If i = 0 Then")
_writer.WriteLine(" Return Me.{0}", ChildVarName(children(0)))
_writer.WriteLine(" Else")
_writer.WriteLine(" Debug.Assert(false, ""child index out of range"")")
_writer.WriteLine(" Return Nothing")
_writer.WriteLine(" End If")
End If
_writer.WriteLine(" End Function")
_writer.WriteLine()
'_writer.WriteLine(" Friend Overrides ReadOnly Property SlotCount() As Integer")
'_writer.WriteLine(" Get")
'_writer.WriteLine(" Return {0}", childrenCount)
'_writer.WriteLine(" End Get")
'_writer.WriteLine(" End Property")
_writer.WriteLine()
End Sub
' Generate IsTerminal property.
Private Sub GenerateIsTerminal(nodeStructure As ParseNodeStructure)
_writer.WriteLine(" Friend Overrides ReadOnly Property IsTerminal As Boolean")
_writer.WriteLine(" Get")
_writer.WriteLine(" Return {0}", If(nodeStructure.IsTerminal, "True", "False"))
_writer.WriteLine(" End Get")
_writer.WriteLine(" End Property")
_writer.WriteLine()
End Sub
Private Sub GenerateNodeStructureMembers(nodeStructure As ParseNodeStructure)
Dim fields = nodeStructure.Fields
For Each field In fields
_writer.WriteLine(" Friend ReadOnly {0} as {1}", FieldVarName(field), FieldTypeRef(field))
Next
Dim children = nodeStructure.Children
For Each child In children
_writer.WriteLine(" Friend ReadOnly {0} as {1}", ChildVarName(child), ChildFieldTypeRef(child, True))
Next
_writer.WriteLine()
End Sub
Private Sub GenerateNodeStructureSerialization(nodeStructure As ParseNodeStructure)
If nodeStructure.IsTokenRoot OrElse nodeStructure.IsTriviaRoot OrElse nodeStructure.IsPredefined OrElse nodeStructure.Name = "StructuredTriviaSyntax" Then
Return
End If
_writer.WriteLine(" Friend Sub New(reader as ObjectReader)")
_writer.WriteLine(" MyBase.New(reader)")
If Not nodeStructure.Abstract Then
Dim allChildren = GetAllChildrenOfStructure(nodeStructure)
Dim childrenCount = allChildren.Count
If childrenCount <> 0 Then
_writer.WriteLine(" MyBase._slotCount = {0}", childrenCount)
End If
End If
For Each child In nodeStructure.Children
_writer.WriteLine(" Dim {0} = DirectCast(reader.ReadValue(), {1})", ChildVarName(child), ChildFieldTypeRef(child, isGreen:=True))
_writer.WriteLine(" If {0} isnot Nothing ", ChildVarName(child))
_writer.WriteLine(" AdjustFlagsAndWidth({0})", ChildVarName(child))
_writer.WriteLine(" Me.{0} = {0}", ChildVarName(child))
_writer.WriteLine(" End If")
Next
For Each field In nodeStructure.Fields
_writer.WriteLine(" Me.{0} = CType(reader.{1}(), {2})", FieldVarName(field), ReaderMethod(FieldTypeRef(field)), FieldTypeRef(field))
Next
'TODO: BLUE
If StructureTypeName(nodeStructure) = "DirectiveTriviaSyntax" Then
_writer.WriteLine(" SetFlags(NodeFlags.ContainsDirectives)")
End If
_writer.WriteLine(" End Sub")
If Not nodeStructure.Abstract Then
' Friend Shared CreateInstance As Func(Of ObjectReader, Object) = Function(o) New BinaryExpressionSyntax(o)
_writer.WriteLine(" Friend Shared CreateInstance As Func(Of ObjectReader, Object) = Function(o) New {0}(o)", StructureTypeName(nodeStructure))
_writer.WriteLine()
End If
If nodeStructure.Children.Count > 0 OrElse nodeStructure.Fields.Count > 0 Then
_writer.WriteLine()
_writer.WriteLine(" Friend Overrides Sub WriteTo(writer as ObjectWriter)")
_writer.WriteLine(" MyBase.WriteTo(writer)")
For Each child In nodeStructure.Children
_writer.WriteLine(" writer.WriteValue(Me.{0})", ChildVarName(child))
Next
For Each field In nodeStructure.Fields
_writer.WriteLine(" writer.{0}(Me.{1})", WriterMethod(FieldTypeRef(field)), FieldVarName(field))
Next
_writer.WriteLine(" End Sub")
End If
If Not _parseTree.IsAbstract(nodeStructure) Then
_writer.WriteLine()
_writer.WriteLine(" Shared Sub New()")
_writer.WriteLine(" ObjectBinder.RegisterTypeReader(GetType({0}), Function(r) New {0}(r))", StructureTypeName(nodeStructure))
_writer.WriteLine(" End Sub")
End If
_writer.WriteLine()
End Sub
Private Function ReaderMethod(type As String) As String
Select Case type
Case "Integer", "SyntaxKind", "TypeCharacter"
Return "ReadInt32"
Case "Boolean"
Return "ReadBoolean"
Case Else
Return "ReadValue"
End Select
End Function
Private Function WriterMethod(type As String) As String
Select Case type
Case "Integer", "SyntaxKind", "TypeCharacter"
Return "WriteInt32"
Case "Boolean"
Return "WriteBoolean"
Case Else
Return "WriteValue"
End Select
End Function
' Generate constructor for a node structure
Private Sub GenerateNodeStructureConstructor(nodeStructure As ParseNodeStructure,
isRaw As Boolean,
Optional noExtra As Boolean = False,
Optional contextual As Boolean = False)
' these constructors are hardcoded
If nodeStructure.IsTokenRoot OrElse nodeStructure.IsTriviaRoot OrElse nodeStructure.Name = "StructuredTriviaSyntax" Then
Return
End If
If nodeStructure.ParentStructure Is Nothing Then
Return
End If
Dim allFields = GetAllFieldsOfStructure(nodeStructure)
_writer.Write(" Friend Sub New(")
' Generate each of the field parameters
_writer.Write("ByVal kind As {0}", NodeKindType())
If Not noExtra Then
_writer.Write(", ByVal errors as DiagnosticInfo(), ByVal annotations as SyntaxAnnotation()", NodeKindType())
End If
If nodeStructure.IsTerminal Then
' terminals have a text
_writer.Write(", text as String")
End If
If nodeStructure.IsToken Then
' tokens have trivia
_writer.Write(", leadingTrivia As GreenNode, trailingTrivia As GreenNode", StructureTypeName(_parseTree.RootStructure))
End If
For Each field In allFields
_writer.Write(", ")
GenerateNodeStructureFieldParameter(field)
Next
For Each child In GetAllChildrenOfStructure(nodeStructure)
_writer.Write(", ")
GenerateNodeStructureChildParameter(child, Nothing, True)
Next
If contextual Then
_writer.Write(", context As ISyntaxFactoryContext")
End If
_writer.WriteLine(")")
' Generate each of the field parameters
_writer.Write(" MyBase.New(kind", NodeKindType())
If Not noExtra Then
_writer.Write(", errors, annotations")
End If
If nodeStructure.IsToken AndAlso Not nodeStructure.IsTokenRoot Then
' nonterminals have text.
_writer.Write(", text")
If Not nodeStructure.IsTrivia Then
' tokens have trivia, but only if they are not trivia.
_writer.Write(", leadingTrivia, trailingTrivia")
End If
End If
Dim baseClass = nodeStructure.ParentStructure
If baseClass IsNot Nothing Then
For Each child In GetAllChildrenOfStructure(baseClass)
_writer.Write(", {0}", ChildParamName(child))
Next
End If
_writer.WriteLine(")")
If Not nodeStructure.Abstract Then
Dim allChildren = GetAllChildrenOfStructure(nodeStructure)
Dim childrenCount = allChildren.Count
If childrenCount <> 0 Then
_writer.WriteLine(" MyBase._slotCount = {0}", childrenCount)
End If
End If
' Generate code to initialize this class
If contextual Then
_writer.WriteLine(" Me.SetFactoryContext(context)")
End If
If allFields.Count > 0 Then
For i = 0 To allFields.Count - 1
_writer.WriteLine(" Me.{0} = {1}", FieldVarName(allFields(i)), FieldParamName(allFields(i)))
Next
End If
If nodeStructure.Children.Count > 0 Then
'_writer.WriteLine(" Dim fullWidth as integer")
_writer.WriteLine()
For Each child In nodeStructure.Children
Dim indent = ""
If child.IsOptional OrElse child.IsList Then
'If endKeyword IsNot Nothing Then
_writer.WriteLine(" If {0} IsNot Nothing Then", ChildParamName(child))
indent = " "
End If
'_writer.WriteLine("{0} fullWidth += {1}.FullWidth", indent, ChildParamName(child))
_writer.WriteLine("{0} AdjustFlagsAndWidth({1})", indent, ChildParamName(child))
_writer.WriteLine("{0} Me.{1} = {2}", indent, ChildVarName(child), ChildParamName(child))
If child.IsOptional OrElse child.IsList Then
'If endKeyword IsNot Nothing Then
_writer.WriteLine(" End If", ChildParamName(child))
End If
Next
'_writer.WriteLine(" Me._fullWidth += fullWidth")
_writer.WriteLine()
End If
'TODO: BLUE
If StructureTypeName(nodeStructure) = "DirectiveTriviaSyntax" Then
_writer.WriteLine(" SetFlags(NodeFlags.ContainsDirectives)")
End If
' Generate End Sub
_writer.WriteLine(" End Sub")
_writer.WriteLine()
End Sub
Private Sub GenerateNodeStructureConstructorParameters(nodeStructure As ParseNodeStructure, errorParam As String, annotationParam As String, precedingTriviaParam As String, followingTriviaParam As String)
' Generate each of the field parameters
_writer.Write("(Me.Kind")
_writer.Write(", {0}", errorParam)
_writer.Write(", {0}", annotationParam)
If nodeStructure.IsToken Then
' nonterminals have text.
_writer.Write(", text")
If Not nodeStructure.IsTrivia Then
' tokens have trivia, but only if they are not trivia.
_writer.Write(", {0}, {1}", precedingTriviaParam, followingTriviaParam)
End If
ElseIf nodeStructure.IsTrivia AndAlso nodeStructure.IsTriviaRoot Then
_writer.Write(", Me.Text")
End If
For Each field In GetAllFieldsOfStructure(nodeStructure)
_writer.Write(", {0}", FieldVarName(field))
Next
For Each child In GetAllChildrenOfStructure(nodeStructure)
_writer.Write(", {0}", ChildVarName(child))
Next
_writer.WriteLine(")")
End Sub
' Generate a parameter corresponding to a node structure field
Private Sub GenerateNodeStructureFieldParameter(field As ParseNodeField, Optional conflictName As String = Nothing)
_writer.Write("{0} As {1}", FieldParamName(field, conflictName), FieldTypeRef(field))
End Sub
' Generate a parameter corresponding to a node structure child
Private Sub GenerateNodeStructureChildParameter(child As ParseNodeChild, Optional conflictName As String = Nothing, Optional isGreen As Boolean = False)
_writer.Write("{0} As {1}", ChildParamName(child, conflictName), ChildConstructorTypeRef(child, isGreen))
End Sub
' Generate a parameter corresponding to a node structure child
Private Sub GenerateFactoryChildParameter(node As ParseNodeStructure, child As ParseNodeChild, Optional conflictName As String = Nothing, Optional internalForm As Boolean = False)
_writer.Write("{0} As {1}", ChildParamName(child, conflictName), ChildFactoryTypeRef(node, child, True, internalForm))
End Sub
' Get modifiers
Private Function GetModifiers(containingStructure As ParseNodeStructure, isOverride As Boolean, name As String) As String
' Is this overridable or an override?
Dim modifiers = ""
'If isOverride Then
' modifiers = "Overrides"
'ElseIf containingStructure.HasDerivedStructure Then
' modifiers = "Overridable"
'End If
' Put Shadows modifier on if useful.
' Object has Equals and GetType
' root name has members for every kind and structure (factory methods)
If (name = "Equals" OrElse name = "GetType") Then 'OrElse _parseTree.NodeKinds.ContainsKey(name) OrElse _parseTree.NodeStructures.ContainsKey(name)) Then
modifiers = "Shadows " + modifiers
End If
Return modifiers
End Function
' Generate a public property for a node field
Private Sub GenerateNodeFieldProperty(field As ParseNodeField, fieldIndex As Integer, isOverride As Boolean)
' XML comment
GenerateXmlComment(_writer, field, 8)
_writer.WriteLine(" Friend {2} ReadOnly Property {0} As {1}", FieldPropertyName(field), FieldTypeRef(field), GetModifiers(field.ContainingStructure, isOverride, field.Name))
_writer.WriteLine(" Get")
_writer.WriteLine(" Return Me.{0}", FieldVarName(field))
_writer.WriteLine(" End Get")
_writer.WriteLine(" End Property")
_writer.WriteLine("")
End Sub
' Generate a public property for a child
Private Sub GenerateNodeChildProperty(node As ParseNodeStructure, child As ParseNodeChild, childIndex As Integer)
' XML comment
GenerateXmlComment(_writer, child, 8)
Dim isToken = KindTypeStructure(child.ChildKind).IsToken
_writer.WriteLine(" Friend {2} ReadOnly Property {0} As {1}", ChildPropertyName(child), ChildPropertyTypeRef(node, child, True), GetModifiers(child.ContainingStructure, False, child.Name))
_writer.WriteLine(" Get")
If Not child.IsList Then
_writer.WriteLine(" Return Me.{0}", ChildVarName(child))
ElseIf child.IsSeparated Then
_writer.WriteLine(" Return new {0}(New Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(of {1})(Me.{2}))", ChildPropertyTypeRef(node, child, True), BaseTypeReference(child), ChildVarName(child))
ElseIf KindTypeStructure(child.ChildKind).IsToken Then
_writer.WriteLine(" Return New Microsoft.CodeAnalysis.Syntax.InternalSyntax.SyntaxList(of GreenNode)(Me.{1})", BaseTypeReference(child), ChildVarName(child))
Else
_writer.WriteLine(" Return new {0}(Me.{1})", ChildPropertyTypeRef(node, child, True), ChildVarName(child))
End If
_writer.WriteLine(" End Get")
_writer.WriteLine(" End Property")
_writer.WriteLine("")
End Sub
' Generate a public property for a child
Private Sub GenerateNodeWithChildProperty(withChild As ParseNodeChild, childIndex As Integer, nodeStructure As ParseNodeStructure)
Dim isOverride As Boolean = withChild.ContainingStructure IsNot nodeStructure
If withChild.GenerateWith Then
Dim isAbstract As Boolean = _parseTree.IsAbstract(nodeStructure)
If Not isAbstract Then
' XML comment
GenerateWithXmlComment(_writer, withChild, 8)
_writer.WriteLine(" Friend {2} Function {0}({3} as {4}) As {1}", ChildWithFunctionName(withChild), StructureTypeName(withChild.ContainingStructure), GetModifiers(withChild.ContainingStructure, isOverride, withChild.Name), Ident(UpperFirstCharacter(withChild.Name)), ChildConstructorTypeRef(withChild))
_writer.WriteLine(" Ensures(Result(Of {0}) IsNot Nothing)", StructureTypeName(withChild.ContainingStructure))
_writer.Write(" return New {0}(", StructureTypeName(nodeStructure))
_writer.Write("Kind, Green.Errors")
Dim allFields = GetAllFieldsOfStructure(nodeStructure)
If allFields.Count > 0 Then
For i = 0 To allFields.Count - 1
_writer.Write(", {0}", FieldParamName(allFields(i)))
Next
End If
For Each child In nodeStructure.Children
If child IsNot withChild Then
_writer.Write(", {0}", ChildParamName(child))
Else
_writer.Write(", {0}", Ident(UpperFirstCharacter(child.Name)))
End If
Next
_writer.WriteLine(")")
_writer.WriteLine(" End Function")
ElseIf nodeStructure.Children.Contains(withChild) Then
' XML comment
GenerateWithXmlComment(_writer, withChild, 8)
_writer.WriteLine(" Friend {2} Function {0}({3} as {4}) As {1}", ChildWithFunctionName(withChild), StructureTypeName(withChild.ContainingStructure), "MustOverride", Ident(UpperFirstCharacter(withChild.Name)), ChildConstructorTypeRef(withChild))
End If
_writer.WriteLine("")
End If
End Sub
' Generate public properties for a child that is a separated list
Private Sub GenerateAccept(nodeStructure As ParseNodeStructure)
If nodeStructure.ParentStructure IsNot Nothing AndAlso (_parseTree.IsAbstract(nodeStructure) OrElse nodeStructure.IsToken OrElse nodeStructure.IsTrivia) Then
Return
End If
_writer.WriteLine(" Public {0} Function Accept(ByVal visitor As {1}) As VisualBasicSyntaxNode", If(IsRoot(nodeStructure), "Overridable", "Overrides"), _parseTree.VisitorName)
_writer.WriteLine(" Return visitor.{0}(Me)", VisitorMethodName(nodeStructure))
_writer.WriteLine(" End Function")
_writer.WriteLine()
End Sub
' Generate special methods and properties for the root node. These only appear in the root node.
Private Sub GenerateRootNodeSpecialMethods(nodeStructure As ParseNodeStructure)
_writer.WriteLine()
End Sub
' Generate the Visitor class definition
Private Sub GenerateVisitorClass()
_writer.WriteLine(" Friend MustInherit Class {0}", Ident(_parseTree.VisitorName))
' Basic Visit method that dispatches.
_writer.WriteLine(" Public Overridable Function Visit(ByVal node As {0}) As VisualBasicSyntaxNode", StructureTypeName(_parseTree.RootStructure))
_writer.WriteLine(" If node IsNot Nothing")
_writer.WriteLine(" Return node.Accept(Me)")
_writer.WriteLine(" Else")
_writer.WriteLine(" Return Nothing")
_writer.WriteLine(" End If")
_writer.WriteLine(" End Function")
For Each nodeStructure In _parseTree.NodeStructures.Values
GenerateVisitorMethod(nodeStructure)
Next
_writer.WriteLine(" End Class")
_writer.WriteLine()
End Sub
' Generate a method in the Visitor class
Private Sub GenerateVisitorMethod(nodeStructure As ParseNodeStructure)
If nodeStructure.IsToken OrElse nodeStructure.IsTrivia Then
Return
End If
Dim methodName = VisitorMethodName(nodeStructure)
Dim structureName = StructureTypeName(nodeStructure)
_writer.WriteLine(" Public Overridable Function {0}(ByVal node As {1}) As VisualBasicSyntaxNode",
methodName,
structureName)
_writer.WriteLine(" Debug.Assert(node IsNot Nothing)")
If Not IsRoot(nodeStructure) Then
_writer.WriteLine(" Return {0}(node)", VisitorMethodName(nodeStructure.ParentStructure))
Else
_writer.WriteLine(" Return node")
End If
_writer.WriteLine(" End Function")
End Sub
' Generate the RewriteVisitor class definition
Private Sub GenerateRewriteVisitorClass()
_writer.WriteLine(" Friend MustInherit Class {0}", Ident(_parseTree.RewriteVisitorName))
_writer.WriteLine(" Inherits {0}", Ident(_parseTree.VisitorName), StructureTypeName(_parseTree.RootStructure))
_writer.WriteLine()
For Each nodeStructure In _parseTree.NodeStructures.Values
GenerateRewriteVisitorMethod(nodeStructure)
Next
_writer.WriteLine(" End Class")
_writer.WriteLine()
End Sub
' Generate a method in the RewriteVisitor class
Private Sub GenerateRewriteVisitorMethod(nodeStructure As ParseNodeStructure)
If nodeStructure.IsToken OrElse nodeStructure.IsTrivia Then
Return
End If
If nodeStructure.Abstract Then
' do nothing for abstract nodes
Return
End If
Dim methodName = VisitorMethodName(nodeStructure)
Dim structureName = StructureTypeName(nodeStructure)
_writer.WriteLine(" Public Overrides Function {0}(ByVal node As {1}) As {2}",
methodName,
structureName,
StructureTypeName(_parseTree.RootStructure))
' non-abstract non-terminals need to rewrite their children and recreate as needed.
Dim allFields = GetAllFieldsOfStructure(nodeStructure)
Dim allChildren = GetAllChildrenOfStructure(nodeStructure)
' create anyChanges variable
_writer.WriteLine(" Dim anyChanges As Boolean = False")
_writer.WriteLine()
' visit all children
For i = 0 To allChildren.Count - 1
If allChildren(i).IsList Then
_writer.WriteLine(" Dim {0} = VisitList(node.{1})" + vbCrLf +
" If node.{2} IsNot {0}.Node Then anyChanges = True",
ChildNewVarName(allChildren(i)), ChildPropertyName(allChildren(i)), ChildVarName(allChildren(i)))
ElseIf KindTypeStructure(allChildren(i).ChildKind).IsToken Then
_writer.WriteLine(" Dim {0} = DirectCast(Visit(node.{2}), {1})" + vbCrLf +
" If node.{3} IsNot {0} Then anyChanges = True",
ChildNewVarName(allChildren(i)), BaseTypeReference(allChildren(i)), ChildPropertyName(allChildren(i)), ChildVarName(allChildren(i)))
Else
_writer.WriteLine(" Dim {0} = DirectCast(Visit(node.{2}), {1})" + vbCrLf +
" If node.{2} IsNot {0} Then anyChanges = True",
ChildNewVarName(allChildren(i)), ChildPropertyTypeRef(nodeStructure, allChildren(i)), ChildVarName(allChildren(i)))
End If
Next
_writer.WriteLine()
' check if any changes.
_writer.WriteLine(" If anyChanges Then")
_writer.Write(" Return New {0}(node.Kind", StructureTypeName(nodeStructure))
_writer.Write(", node.GetDiagnostics, node.GetAnnotations")
For Each field In allFields
_writer.Write(", node.{0}", FieldPropertyName(field))
Next
For Each child In allChildren
If child.IsList Then
_writer.Write(", {0}.Node", ChildNewVarName(child))
ElseIf KindTypeStructure(child.ChildKind).IsToken Then
_writer.Write(", {0}", ChildNewVarName(child))
Else
_writer.Write(", {0}", ChildNewVarName(child))
End If
Next
_writer.WriteLine(")")
_writer.WriteLine(" Else")
_writer.WriteLine(" Return node")
_writer.WriteLine(" End If")
_writer.WriteLine(" End Function")
_writer.WriteLine()
End Sub
End Class
|
#Region "Microsoft.VisualBasic::d65445f67976c5d9470b8a3ab0b384b8, mzkit\src\metadb\Massbank\Public\TMIC\HMDB\Tables\ChemicalDescriptor.vb"
' Author:
'
' xieguigang ([email protected], BioNovoGene Co., LTD.)
'
' Copyright (c) 2018 [email protected], BioNovoGene Co., LTD.
'
'
' MIT License
'
'
' 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.
' /********************************************************************************/
' Summaries:
' Code Statistics:
' Total Lines: 151
' Code Lines: 126
' Comment Lines: 12
' Blank Lines: 13
' File Size: 6.82 KB
' Class ChemicalDescriptor
'
' Properties: acceptor_count, accession, bioavailability, descriptors, donor_count
' formal_charge, ghose_filter, kegg_id, logp, mddr_like_rule
' melting_point, name, number_of_rings, physiological_charge, pka_strongest_acidic
' pka_strongest_basic, polar_surface_area, polarizability, refractivity, rotatable_bond_count
' rule_of_five, state, veber_rule
'
' Constructor: (+1 Overloads) Sub New
'
' Function: FromMetabolite, ToDescriptor
'
' Sub: WriteTable
'
'
' /********************************************************************************/
#End Region
Imports System.IO
Imports System.Reflection
Imports Microsoft.VisualBasic.ComponentModel.Collection
Imports Microsoft.VisualBasic.ComponentModel.DataSourceModel
Imports Microsoft.VisualBasic.Data.csv.IO.Linq
Namespace TMIC.HMDB
Public Class ChemicalDescriptor
''' <summary>
''' HMDB main accession
''' </summary>
''' <returns></returns>
Public Property accession As String
Public Property name As String
Public Property kegg_id As String
Public Property state As String
Public Property melting_point As Double
Public Property logp As Double
Public Property pka_strongest_acidic As Double
Public Property pka_strongest_basic As Double
Public Property polar_surface_area As Double
Public Property refractivity As Double
Public Property polarizability As Double
Public Property rotatable_bond_count As Double
Public Property acceptor_count As Double
Public Property donor_count As Double
Public Property physiological_charge As Double
Public Property formal_charge As Double
Public Property number_of_rings As Double
Public Property bioavailability As Double
Public Property rule_of_five As String
Public Property ghose_filter As String
Public Property veber_rule As String
Public Property mddr_like_rule As String
''' <summary>
''' The chemical descriptor names
''' </summary>
''' <returns></returns>
Public Shared ReadOnly Property descriptors As Index(Of String)
Shared ReadOnly readers As PropertyInfo()
Shared Sub New()
readers = DataFramework _
.Schema(GetType(ChemicalDescriptor), PropertyAccess.Readable, nonIndex:=True) _
.Values _
.ToArray
descriptors = readers _
.Where(Function(p)
Return p.PropertyType Is GetType(Double)
End Function) _
.Select(Function(p) p.Name) _
.AsList + {
NameOf(state),
NameOf(rule_of_five),
NameOf(ghose_filter),
NameOf(veber_rule),
NameOf(mddr_like_rule)
}
readers = readers _
.Where(Function(p) p.Name Like descriptors) _
.ToArray
End Sub
''' <summary>
''' Create descriptor data set for machine learning
''' </summary>
''' <returns></returns>
Public Function ToDescriptor() As Dictionary(Of String, Double)
Return readers _
.ToDictionary(Function(p) p.Name,
Function(p)
Dim value As Object = p.GetValue(Me)
If p.PropertyType Is GetType(Double) Then
Return CDbl(value)
ElseIf p.Name = NameOf(state) Then
If CStr(value).TextEquals("Solid") Then
Return 1
Else
Return 0
End If
Else
If CStr(value).ParseBoolean = False Then
Return 0
Else
Return 1
End If
End If
End Function)
End Function
Public Shared Function FromMetabolite(metabolite As metabolite) As ChemicalDescriptor
Dim properties = metabolite.experimental_properties.PropertyList.AsList +
metabolite.predicted_properties.PropertyList
Dim propertyTable As Dictionary(Of String, String) = properties _
.GroupBy(Function(p) p.kind) _
.ToDictionary(Function(p) p.Key,
Function(g)
If g.Any(Function(f) IsBooleanFactor(f.value)) Then
Return g.Select(Function(x) x.value).TopMostFrequent
Else
Return g.Select(Function(x) Val(x.value)) _
.Average _
.ToString
End If
End Function)
Dim read = Function(key As String, default$) As String
Return propertyTable.TryGetValue(key, [default]:=[default])
End Function
Return New ChemicalDescriptor With {
.accession = metabolite.accession,
.name = metabolite.name,
.kegg_id = metabolite.kegg_id,
.state = metabolite.state,
.acceptor_count = read(NameOf(.acceptor_count), 0),
.bioavailability = read(NameOf(.bioavailability), 0),
.donor_count = read(NameOf(.donor_count), 0),
.formal_charge = read(NameOf(.formal_charge), 0),
.ghose_filter = read(NameOf(.ghose_filter), "no"),
.logp = read(NameOf(.logp), 0),
.mddr_like_rule = read(NameOf(.mddr_like_rule), "no"),
.melting_point = read(NameOf(melting_point), 0),
.number_of_rings = read(NameOf(.number_of_rings), 0),
.physiological_charge = read(NameOf(.physiological_charge), 0),
.pka_strongest_acidic = read(NameOf(.pka_strongest_acidic), 0),
.pka_strongest_basic = read(NameOf(.pka_strongest_basic), 0),
.polarizability = read(NameOf(.polarizability), 0),
.polar_surface_area = read(NameOf(.polar_surface_area), 0),
.refractivity = read(NameOf(.refractivity), 0),
.rotatable_bond_count = read(NameOf(.rotatable_bond_count), 0),
.rule_of_five = read(NameOf(.rule_of_five), "no"),
.veber_rule = read(NameOf(.veber_rule), "no")
}
End Function
Public Shared Sub WriteTable(metabolites As IEnumerable(Of metabolite), out As Stream)
Using table As New WriteStream(Of ChemicalDescriptor)(New StreamWriter(out))
For Each metabolite As metabolite In metabolites
Call table.Flush(FromMetabolite(metabolite))
Next
End Using
End Sub
End Class
End Namespace
|
Public Class UserControl1
End Class
|
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class SplashScreen1
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
Friend WithEvents ApplicationTitle As System.Windows.Forms.Label
Friend WithEvents Version As System.Windows.Forms.Label
Friend WithEvents Copyright As System.Windows.Forms.Label
Friend WithEvents MainLayoutPanel As System.Windows.Forms.TableLayoutPanel
Friend WithEvents DetailsLayoutPanel As System.Windows.Forms.TableLayoutPanel
Friend WithEvents UserName As System.Windows.Forms.Label
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Dim resources As System.ComponentModel.ComponentResourceManager = New System.ComponentModel.ComponentResourceManager(GetType(SplashScreen1))
Me.MainLayoutPanel = New System.Windows.Forms.TableLayoutPanel()
Me.DetailsLayoutPanel = New System.Windows.Forms.TableLayoutPanel()
Me.ApplicationTitle = New System.Windows.Forms.Label()
Me.Copyright = New System.Windows.Forms.Label()
Me.UserName = New System.Windows.Forms.Label()
Me.Version = New System.Windows.Forms.Label()
Me.MainLayoutPanel.SuspendLayout()
Me.DetailsLayoutPanel.SuspendLayout()
Me.SuspendLayout()
'
'MainLayoutPanel
'
Me.MainLayoutPanel.BackgroundImage = CType(resources.GetObject("MainLayoutPanel.BackgroundImage"), System.Drawing.Image)
Me.MainLayoutPanel.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch
Me.MainLayoutPanel.ColumnCount = 2
Me.MainLayoutPanel.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 314.0!))
Me.MainLayoutPanel.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 265.0!))
Me.MainLayoutPanel.Controls.Add(Me.DetailsLayoutPanel, 0, 1)
Me.MainLayoutPanel.Controls.Add(Me.ApplicationTitle, 1, 1)
Me.MainLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill
Me.MainLayoutPanel.Location = New System.Drawing.Point(0, 0)
Me.MainLayoutPanel.Name = "MainLayoutPanel"
Me.MainLayoutPanel.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 285.0!))
Me.MainLayoutPanel.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 22.0!))
Me.MainLayoutPanel.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20.0!))
Me.MainLayoutPanel.Size = New System.Drawing.Size(579, 350)
Me.MainLayoutPanel.TabIndex = 0
'
'DetailsLayoutPanel
'
Me.DetailsLayoutPanel.Anchor = System.Windows.Forms.AnchorStyles.None
Me.DetailsLayoutPanel.BackColor = System.Drawing.Color.White
Me.DetailsLayoutPanel.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 308.0!))
Me.DetailsLayoutPanel.ColumnStyles.Add(New System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20.0!))
Me.DetailsLayoutPanel.Controls.Add(Me.Version, 0, 0)
Me.DetailsLayoutPanel.Controls.Add(Me.UserName, 0, 1)
Me.DetailsLayoutPanel.Controls.Add(Me.Copyright, 0, 2)
Me.DetailsLayoutPanel.Location = New System.Drawing.Point(3, 288)
Me.DetailsLayoutPanel.Name = "DetailsLayoutPanel"
Me.DetailsLayoutPanel.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.0!))
Me.DetailsLayoutPanel.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.0!))
Me.DetailsLayoutPanel.RowStyles.Add(New System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 34.0!))
Me.DetailsLayoutPanel.Size = New System.Drawing.Size(308, 58)
Me.DetailsLayoutPanel.TabIndex = 1
'
'Version
'
Me.Version.Anchor = System.Windows.Forms.AnchorStyles.Left
Me.Version.AutoSize = True
Me.Version.BackColor = System.Drawing.Color.White
Me.Version.Font = New System.Drawing.Font("Segoe UI", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point)
Me.Version.Location = New System.Drawing.Point(3, 2)
Me.Version.Name = "Version"
Me.Version.Size = New System.Drawing.Size(140, 15)
Me.Version.TabIndex = 1
Me.Version.Text = "Version: {0}.{1:00}.{2}.{3}"
Me.Version.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
'
'UserName
'
Me.UserName.Anchor = System.Windows.Forms.AnchorStyles.Left
Me.UserName.AutoSize = True
Me.UserName.BackColor = System.Drawing.Color.White
Me.UserName.Font = New System.Drawing.Font("Segoe UI", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point)
Me.UserName.Location = New System.Drawing.Point(3, 21)
Me.UserName.Name = "UserName"
Me.UserName.Size = New System.Drawing.Size(69, 15)
Me.UserName.TabIndex = 2
Me.UserName.Text = "User Name"
Me.UserName.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
'
'Copyright
'
Me.Copyright.Anchor = System.Windows.Forms.AnchorStyles.Left
Me.Copyright.AutoSize = True
Me.Copyright.BackColor = System.Drawing.Color.White
Me.Copyright.Font = New System.Drawing.Font("Segoe UI", 9.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point)
Me.Copyright.Location = New System.Drawing.Point(3, 40)
Me.Copyright.Name = "Copyright"
Me.Copyright.Size = New System.Drawing.Size(61, 15)
Me.Copyright.TabIndex = 2
Me.Copyright.Text = "Copyright"
Me.Copyright.TextAlign = System.Drawing.ContentAlignment.MiddleLeft
'
'ApplicationTitle
'
Me.ApplicationTitle.AutoSize = True
Me.ApplicationTitle.BackColor = System.Drawing.Color.Transparent
Me.ApplicationTitle.Dock = System.Windows.Forms.DockStyle.Bottom
Me.ApplicationTitle.Font = New System.Drawing.Font("Segoe UI", 15.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point)
Me.ApplicationTitle.ForeColor = System.Drawing.SystemColors.MenuHighlight
Me.ApplicationTitle.Location = New System.Drawing.Point(317, 320)
Me.ApplicationTitle.Name = "ApplicationTitle"
Me.ApplicationTitle.Size = New System.Drawing.Size(259, 30)
Me.ApplicationTitle.TabIndex = 0
Me.ApplicationTitle.Text = "Application Title"
Me.ApplicationTitle.TextAlign = System.Drawing.ContentAlignment.MiddleRight
'
'SplashScreen1
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(7.0!, 15.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(579, 350)
Me.ControlBox = False
Me.Controls.Add(Me.MainLayoutPanel)
Me.Font = New System.Drawing.Font("Segoe UI", 9.0!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.MinimizeBox = False
Me.Name = "SplashScreen1"
Me.ShowInTaskbar = False
Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen
Me.MainLayoutPanel.ResumeLayout(False)
Me.MainLayoutPanel.PerformLayout()
Me.DetailsLayoutPanel.ResumeLayout(False)
Me.DetailsLayoutPanel.PerformLayout()
Me.ResumeLayout(False)
End Sub
End Class
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.