Skip to content

Commit

Permalink
Clean up issues in a few C# projects, remove Me, ByVal and other code… (
Browse files Browse the repository at this point in the history
#1391)

* Clean up issues in a few C# projects, remove Me, ByRef and other code cleanup.

* Fix Snippet while still adding ConfigureGeneratedCodeAnalysis and EnableConcurrentExecution.

* FIx Typo in project file

* Restore DataTime from DAte

* respond to PR feedback

* Fix Byval and spacing in some VB files

* Update Form1.vb

* Update quickcontacts.vb
  • Loading branch information
paul1956 authored and Ron Petrusha committed Sep 12, 2019
1 parent 5fc2989 commit e83a584
Show file tree
Hide file tree
Showing 31 changed files with 227 additions and 266 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard1.3</TargetFramework>
<TargetFramework>netstandard2.0</TargetFramework>
<IncludeBuildOutput>false</IncludeBuildOutput>
<GeneratePackageOnBuild>True</GeneratePackageOnBuild>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,10 @@ public class MakeConstAnalyzer : DiagnosticAnalyzer

public override void Initialize(AnalysisContext context)
{
// See https://github.com/dotnet/roslyn/blob/master/docs/analyzers/Analyzer%20Actions%20Semantics.md for more information
// <SnippetRegisterNodeAction>
// See https://github.com/dotnet/roslyn/blob/master/docs/analyzers/Analyzer%20Actions%20Semantics.md for more information
// <SnippetRegisterNodeAction>
context.ConfigureGeneratedCodeAnalysis(GeneratedCodeAnalysisFlags.Analyze | GeneratedCodeAnalysisFlags.None);
context.EnableConcurrentExecution();
context.RegisterSyntaxNodeAction(AnalyzeNode, SyntaxKind.LocalDeclarationStatement);
// </SnippetRegisterNodeAction>
}
Expand Down
22 changes: 11 additions & 11 deletions snippets/common/VS_Snippets_CFX/c_howtousechannelfactory/source.vb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
Imports System.ServiceModel

' This code generated by svcutil.exe.
<ServiceContract()> _
<ServiceContract()>
Interface IMath
<OperationContract()> _
Function Add(ByVal A As Double, ByVal B As Double) As Double
End Interface
<OperationContract()>
Function Add(A As Double, B As Double) As Double
End Interface

public class Math
Public Class Math
Implements IMath

Function Add(ByVal A As Double, ByVal B As Double) As Double Implements IMath.Add
Return A + B
Function Add(A As Double, B As Double) As Double Implements IMath.Add
Return A + B
End Function
End Class

Expand All @@ -24,10 +24,10 @@ Public Class Test
' This code is written by an application developer.
' Create a channel factory.
Dim myBinding As New BasicHttpBinding
Dim myEndpoint As New EndpointAddress("http://localhost/MathService/Ep1")
Dim myEndpoint As New EndpointAddress("http://localhost/MathService/Ep1")

Dim myChannelFactory As ChannelFactory(Of IMath) = _
New ChannelFactory(Of IMath) (myBinding, myEndpoint)
Dim myChannelFactory As ChannelFactory(Of IMath) =
New ChannelFactory(Of IMath)(myBinding, myEndpoint)

'Create a channel.
Dim proxy1 As IMath = myChannelFactory.CreateChannel()
Expand All @@ -40,4 +40,4 @@ Public Class Test
Console.WriteLine(s.ToString())
End Sub
End Class
' </snippet1>
' </snippet1>
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

Protected catalog As ListDictionary
Protected returnValue As String
Sub Page_Load(ByVal sender As Object, ByVal e As _
System.EventArgs) Handles Me.Load
Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim cbReference As String
cbReference = Page.ClientScript.GetCallbackEventReference(Me, _
cbReference = Page.ClientScript.GetCallbackEventReference(Me,
"arg", "ReceiveServerData", "context")
Dim callbackScript As String = ""
callbackScript &= "function CallServer(arg, context) { " & _
callbackScript &= "function CallServer(arg, context) { " &
cbReference & "} ;"
Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), _
Page.ClientScript.RegisterClientScriptBlock(Me.GetType(),
"CallServer", callbackScript, True)

' Populate List Dictionary with invented database data
Expand All @@ -27,7 +26,7 @@
ListBox1.DataBind()
End Sub

Public Sub RaiseCallbackEvent(ByVal eventArgument As String) _
Public Sub RaiseCallbackEvent(eventArgument As String) _
Implements System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent

If catalog(eventArgument) Is Nothing Then
Expand All @@ -46,4 +45,4 @@

End Function

End Class
End Class
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ Namespace Samples.AspNet.VB.Controls
End Property

' The contacts are rendered in an HTML table.
Protected Overrides Sub RenderContents( _
ByVal writer As HtmlTextWriter)
Protected Overrides Sub RenderContents(writer As HtmlTextWriter)
Dim t As Table = CreateContactsTable()
If t IsNot Nothing Then
t.RenderControl(writer)
Expand All @@ -55,12 +54,14 @@ Namespace Samples.AspNet.VB.Controls
Dim aContact As Contact = TryCast(item, Contact)
If aContact IsNot Nothing Then
Dim r As New TableRow
Dim c1 As New TableCell
c1.Text = aContact.Name
Dim c1 As New TableCell With {
.Text = aContact.Name
}
r.Controls.Add(c1)

Dim c2 As New TableCell
c2.Text = aContact.Email
Dim c2 As New TableCell With {
.Text = aContact.Email
}
r.Controls.Add(c2)

Dim c3 As New TableCell
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

Protected catalog As ListDictionary
Protected returnValue As String
Sub Page_Load(ByVal sender As Object, ByVal e As _
System.EventArgs) Handles Me.Load
Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim cbReference As String
cbReference = Page.ClientScript.GetCallbackEventReference(Me, _
cbReference = Page.ClientScript.GetCallbackEventReference(Me,
"arg", "ReceiveServerData", "context")
Dim callbackScript As String = ""
callbackScript &= "function CallServer(arg, context) { " & _
callbackScript &= "function CallServer(arg, context) { " &
cbReference & "} ;"
Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), _
Page.ClientScript.RegisterClientScriptBlock(Me.GetType(),
"CallServer", callbackScript, True)

' Populate List Dictionary with invented database data
Expand All @@ -27,7 +26,7 @@
ListBox1.DataBind()
End Sub

Public Sub RaiseCallbackEvent(ByVal eventArgument As String) _
Public Sub RaiseCallbackEvent(eventArgument As String) _
Implements System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent

If catalog(eventArgument) Is Nothing Then
Expand All @@ -46,4 +45,4 @@

End Function

End Class
End Class
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

Protected catalog As ListDictionary
Protected returnValue As String
Sub Page_Load(ByVal sender As Object, ByVal e As _
System.EventArgs) Handles Me.Load
Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim cbReference As String
cbReference = Page.ClientScript.GetCallbackEventReference(Me, _
cbReference = Page.ClientScript.GetCallbackEventReference(Me,
"arg", "ReceiveServerData", "context")
Dim callbackScript As String = ""
callbackScript &= "function CallServer(arg, context) { " & _
callbackScript &= "function CallServer(arg, context) { " &
cbReference & "} ;"
Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), _
Page.ClientScript.RegisterClientScriptBlock(Me.GetType(),
"CallServer", callbackScript, True)

' Populate List Dictionary with invented database data
Expand All @@ -27,7 +26,7 @@
ListBox1.DataBind()
End Sub

Public Sub RaiseCallbackEvent(ByVal eventArgument As String) _
Public Sub RaiseCallbackEvent(eventArgument As String) _
Implements System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent

If catalog(eventArgument) Is Nothing Then
Expand All @@ -46,4 +45,4 @@

End Function

End Class
End Class
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ Namespace Samples.AspNet.VB.Controls
End Property

' The contacts are rendered in an HTML table.
Protected Overrides Sub RenderContents( _
ByVal writer As HtmlTextWriter)
Protected Overrides Sub RenderContents(writer As HtmlTextWriter)
Dim t As Table = CreateContactsTable()
If t IsNot Nothing Then
t.RenderControl(writer)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@

Protected catalog As ListDictionary
Protected returnValue As String
Sub Page_Load(ByVal sender As Object, ByVal e As _
System.EventArgs) Handles Me.Load
Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim cbReference As String
cbReference = Page.ClientScript.GetCallbackEventReference(Me, _
cbReference = Page.ClientScript.GetCallbackEventReference(Me,
"arg", "ReceiveServerData", "context")
Dim callbackScript As String = ""
callbackScript &= "function CallServer(arg, context) { " & _
callbackScript &= "function CallServer(arg, context) { " &
cbReference & "} ;"
Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), _
Page.ClientScript.RegisterClientScriptBlock(Me.GetType(),
"CallServer", callbackScript, True)

' Populate List Dictionary with invented database data
Expand All @@ -27,7 +26,7 @@
ListBox1.DataBind()
End Sub

Public Sub RaiseCallbackEvent(ByVal eventArgument As String) _
Public Sub RaiseCallbackEvent(eventArgument As String) _
Implements System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent

If catalog(eventArgument) Is Nothing Then
Expand All @@ -46,4 +45,4 @@

End Function

End Class
End Class
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@ Partial Class ClientCallback

Protected catalog As ListDictionary
Protected returnValue As String
Sub Page_Load(ByVal sender As Object, ByVal e As _
System.EventArgs) Handles Me.Load
Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
Dim cbReference As String
cbReference = Page.ClientScript.GetCallbackEventReference(Me, _
cbReference = Page.ClientScript.GetCallbackEventReference(Me,
"arg", "ReceiveServerData", "context")
Dim callbackScript As String = ""
callbackScript &= "function CallServer(arg, context) { " & _
callbackScript &= "function CallServer(arg, context) { " &
cbReference & "} ;"
Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), _
Page.ClientScript.RegisterClientScriptBlock(Me.GetType(),
"CallServer", callbackScript, True)

' Populate List Dictionary with invented database data
Expand All @@ -28,7 +27,7 @@ Partial Class ClientCallback
ListBox1.DataBind()
End Sub

Public Sub RaiseCallbackEvent(ByVal eventArgument As String) _
Public Sub RaiseCallbackEvent(eventArgument As String) _
Implements System.Web.UI.ICallbackEventHandler.RaiseCallbackEvent

If catalog(eventArgument) Is Nothing Then
Expand All @@ -48,4 +47,4 @@ Partial Class ClientCallback
End Function

End Class
' </Snippet4>
' </Snippet4>
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,31 @@ Partial Class ClientCallback
Protected validationLookUpStock As String = "LookUpStock"
Protected validationLookUpSale As String = "LookUpSale"
'</Snippet3>
Sub Page_Load(ByVal sender As Object, ByVal e As _
System.EventArgs) Handles Me.Load
Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load

Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), _
validationLookUpStock, "function LookUpStock() { " & _
"var lb = document.forms[0].ListBox1; " & _
"if (lb.selectedIndex == -1) { alert ('Please make a selection.'); return; } " & _
"var product = lb.options[lb.selectedIndex].text; " & _
Page.ClientScript.RegisterClientScriptBlock(Me.GetType(),
validationLookUpStock, "function LookUpStock() { " &
"var lb = document.forms[0].ListBox1; " &
"if (lb.selectedIndex == -1) { alert ('Please make a selection.'); return; } " &
"var product = lb.options[lb.selectedIndex].text; " &
"CallServer(product, ""LookUpStock"");} ", True)
If (User.Identity.IsAuthenticated) Then
Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), _
validationLookUpSale, "function LookUpSale() { " & _
"var lb = document.forms[0].ListBox1; " & _
"if (lb.selectedIndex == -1) { alert ('Please make a selection.'); return; } " & _
"var product = lb.options[lb.selectedIndex].text; " & _
Page.ClientScript.RegisterClientScriptBlock(Me.GetType(),
validationLookUpSale, "function LookUpSale() { " &
"var lb = document.forms[0].ListBox1; " &
"if (lb.selectedIndex == -1) { alert ('Please make a selection.'); return; } " &
"var product = lb.options[lb.selectedIndex].text; " &
"CallServer(product, ""LookUpSale"");} ", True)
End If

Dim cbReference As String
cbReference = "var param = arg + '|' + context;" & _
Page.ClientScript.GetCallbackEventReference(Me, _
cbReference = "var param = arg + '|' + context;" &
Page.ClientScript.GetCallbackEventReference(Me,
"param", "ReceiveServerData", "context")
Dim callbackScript As String = ""
callbackScript &= "function CallServer(arg, context) { " & _
callbackScript &= "function CallServer(arg, context) { " &
cbReference & "} ;"
Page.ClientScript.RegisterClientScriptBlock(Me.GetType(), _
Page.ClientScript.RegisterClientScriptBlock(Me.GetType(),
"CallServer", callbackScript, True)

' Populate List Dictionary with invented database data
Expand Down Expand Up @@ -113,15 +112,15 @@ Partial Class ClientCallback
'</Snippet6>

'<Snippet7>
Protected Overrides Sub Render(ByVal writer As System.Web.UI.HtmlTextWriter)
Page.ClientScript.RegisterForEventValidation("LookUpStockButton", _
Protected Overrides Sub Render(writer As System.Web.UI.HtmlTextWriter)
Page.ClientScript.RegisterForEventValidation("LookUpStockButton",
validationLookUpStock)
If (User.Identity.IsAuthenticated) Then
Page.ClientScript.RegisterForEventValidation("LookUpSaleButton", _
Page.ClientScript.RegisterForEventValidation("LookUpSaleButton",
validationLookUpSale)
End If
MyBase.Render(writer)
End Sub
'</Snippet7>
End Class
' </Snippet2>
' </Snippet2>
Loading

0 comments on commit e83a584

Please sign in to comment.