Bronco Solutions

Knowledge Management and Collaboration Platform
Welcome to Bronco Solutions Sign in | Join | Help
in Search

Andrew Renner

CodeRush: iEditable Smart Paste Template

This template is used to paste properties compatible with the iEditable interface.

  1. Create a new smart paste template
  2. Set the match with property to:

             [code language="VB.NET"]%ws1%%Accessibility%?%SharedModifier1%?%FieldVarPrefix1%%PartialIdentifier1%%mws%%As1%%Type1%(%ws2%?=%ws3%?%IdentifierStringOrNumber%)? %EndOfLineComment%?[/code]

  3. Set the replacement text to the following

    [code language="VB.NET"]

    Public Property %SharedModifier1% %PartialIdentifier1% %As1% %Type1%
      Get
        Return «Marker(60)»%FieldVarPrefix1%%PartialIdentifier1%
      End Get
      Set
        «Cursor»If Not %FieldVarPrefix1%%PartialIdentifier1%.Equals(Value) Then
    If Me.InEdit Then
                 SaveState("%PartialIdentifier1%", %FieldVarPrefix1%%PartialIdentifier1%, value)
    End If
            %FieldVarPrefix1%%PartialIdentifier1% = Value
            OnPropertyChanged("%PartialIdentifier1%")
         End If«BlockAnchor»
      End Set
    End Property [/code]

  4. Set the rest of the properties the same as Property(PrefixedField)

Example:

[code language="VB.NET"] 
   Private _id As String
   Private _name As String
   Private _salary As Decimal

   Public Property id() As String
      Get
         Return _id
      End Get
      Set(ByVal value As String)
         If Not _id.Equals(Value) Then
            If Me.InEdit Then
               SaveState("id", _id, value)
            End If
            _id = Value
            OnPropertyChanged("id")
         End If
      End Set
   End Property
   Public Property name() As String
      Get
         Return _name
      End Get
      Set(ByVal value As String)
         If Not _name.Equals(Value) Then
            If Me.InEdit Then
               SaveState("name", _name, value)
            End If
            _name = Value
            OnPropertyChanged("name")
         End If
      End Set
   End Property
   Public Property salary() As Decimal
      Get
         Return _salary
      End Get
      Set(ByVal value As Decimal)
         If Not _salary.Equals(Value) Then
            If Me.InEdit Then
               SaveState("salary", _salary, value)
            End If
            _salary = Value
            OnPropertyChanged("salary")
         End If
      End Set
   End Property

[/code]

Published Wednesday, May 10, 2006 3:50 PM by rennera

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Comments

No Comments

Leave a Comment

(required) 
(optional)
(required) 
Submit