Skip to content

Instantly share code, notes, and snippets.

@KatsuYuzu
Created December 7, 2013 05:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KatsuYuzu/7837680 to your computer and use it in GitHub Desktop.
Save KatsuYuzu/7837680 to your computer and use it in GitHub Desktop.
C#からの変換依頼
Imports System.Windows.Input
Imports System.ComponentModel
Namespace CounterApp_CS
Public NotInheritable Class CounterViewModel
Implements INotifyPropertyChanged
Public Sub New()
counter_ = New CounterComponent.Counter()
AddHandler counter_.PropertyChanged,
Sub(sender, e)
If e.PropertyName = "Count" Then
RaisePropertyChanged(e.PropertyName)
End If
End Sub
End Sub
Public Event PropertyChanged(sender As Object, e As PropertyChangedEventArgs) Implements INotifyPropertyChanged.PropertyChanged
Public ReadOnly Property Count As Integer
Get
Return counter_.Count
End Get
End Property
Public ReadOnly Property Increment As ICommand
Get
Return New Common.RelayCommand(
Sub()
counter_.Increment()
End Sub)
End Get
End Property
Public ReadOnly Property Decrement As ICommand
Get
Return New Common.RelayCommand(
Sub()
counter_.Decrement()
End Sub)
End Get
End Property
Private Sub RaisePropertyChanged(propertyName As String)
Dim handle = PropertyChangedEvent
If handle IsNot Nothing Then
handle(Me, New PropertyChangedEventArgs(propertyName))
End If
End Sub
Private counter_ As CounterComponent.Counter
End Class
End Namespace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment