LEADTOOLS Annotations for WPF and Silverlight (Leadtools.Windows.Annotations assembly)

Lock Method (AnnObject)

Show in webframe
Example 





String containing the password used to lock the annotation object.
Locks this AnnObject with the specified password.
Syntax
public virtual void Lock( 
   string password
)
'Declaration
 
Public Overridable Sub Lock( _
   ByVal password As String _
) 
'Usage
 
Dim instance As AnnObject
Dim password As String
 
instance.Lock(password)

            

            
public:
virtual void Lock( 
   String^ password
) 

Parameters

password
String containing the password used to lock the annotation object.
Remarks

Only unlocked objects can be locked. If an object is already locked, it will stay locked with its original password. You must pass the same password to Unlock to unlock this AnnObject.

If this method succeeds, password will be stored inside the object and can be retrieved with the Password property.

An object must be unlocked in order to change that object in automated mode.

For more information, refer to Implementing WPF Annotation Security.

Example
Copy Code  
Imports Leadtools.Windows.Controls
Imports Leadtools.Windows.Annotations

Public Sub AnnObject_Lock(ByVal obj As AnnObject, ByVal password As String)
   If obj.IsLocked Then
      MessageBox.Show("Object is locked. It will be unlocked.")
      If String.Compare(password, obj.Password, False) <> 0 Then
         MessageBox.Show("Invalid password!!")
      Else
         obj.Unlock(password)
      End If
   Else
      MessageBox.Show("Object was not locked. It will be locked now.")
      obj.Lock(password)
   End If
End Sub
using Leadtools.Windows.Controls;
using Leadtools.Windows.Annotations;
using Leadtools.Demos;
using Leadtools.Help;

public void AnnObject_Lock(AnnObject obj, string password)
{
   if(obj.IsLocked)
   {
      MessageBox.Show("Object is locked. It will be unlocked.");
      if(string.Compare(password, obj.Password, false) != 0)
         MessageBox.Show("Invalid password!!");
      else
         obj.Unlock(password);
   }
   else
   {
      MessageBox.Show("Object was not locked. It will be locked now.");
      obj.Lock(password);
   }
}
using Leadtools.Windows.Controls;
using Leadtools.Windows.Annotations;
using Leadtools.Examples;

public void AnnObject_Lock(AnnObject obj, string password)
{
   if(obj.IsLocked)
   {
      MessageBox.Show("Object is locked. It will be unlocked.");
      if(string.Compare(password, obj.Password, StringComparison.Ordinal) != 0)
         MessageBox.Show("Invalid password!!");
      else
         obj.Unlock(password);
   }
   else
   {
      MessageBox.Show("Object was not locked. It will be locked now.");
      obj.Lock(password);
   }
}
Imports Leadtools.Windows.Controls
Imports Leadtools.Windows.Annotations

Public Sub AnnObject_Lock(ByVal obj As AnnObject, ByVal password As String)
   If obj.IsLocked Then
      MessageBox.Show("Object is locked. It will be unlocked.")
      If String.Compare(password, obj.Password, StringComparison.Ordinal) <> 0 Then
         MessageBox.Show("Invalid password!!")
      Else
         obj.Unlock(password)
      End If
   Else
      MessageBox.Show("Object was not locked. It will be locked now.")
      obj.Lock(password)
   End If
End Sub
Requirements

Target Platforms

See Also

Reference

AnnObject Class
AnnObject Members

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.