←Select platform

Password Property

Summary
Gets or sets the password used in the last successful lock operation of this AnnObject.
Syntax
C#
Objective-C
C++/CLI
Java
Python
public string Password { get; set; } 
@property (nonatomic, copy, nullable) NSString *password; 
public String getPassword() 
public void setPassword(String password) 
public:  
   property String^ Password 
   { 
      String^ get() 
      void set(String^ value) 
   } 
Password # get and set (AnnObject) 

Property Value

The password used in the last successful lock operation of this AnnObject. The default value is an empty string.

Remarks

If the object is locked, the password passed to the Lock is stored in this property.

When the object is unlocked successfully with Unlock, the password is cleared (the value will be an empty string).

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

For more information, refer to Implementing Annotation Security.

Example
C#
using Leadtools.Annotations.Automation; 
using Leadtools.Annotations.Engine; 
using Leadtools.WinForms; 
using Leadtools.Annotations.WinForms; 
 
public void AnnObject_Lock() 
{ 
   double inch = 720.0; 
 
   // Get the container 
   AnnContainer container = _automation.Container; 
 
   // Add the lock picture to the container resources 
 
   // Create a new instance of AnnResources if the container does not already have one 
   AnnResources resources = _automation.Manager.Resources; 
   if (resources == null) 
   { 
      resources = new AnnResources(); 
   } 
 
   // Get the images collection 
   IList<AnnPicture> imagesResources = resources.Images; 
 
   // Add our picture to it 
   imagesResources.Add(new AnnPicture(@"ms-appx:///Assets/Lock.png")); 
   int pictureIndex = imagesResources.Count - 1; 
 
   // Add a blue on yellow rectangle from 3in 3in to 4in 4in 
   AnnRectangleObject rectObj = new AnnRectangleObject(); 
   rectObj.Rect = LeadRectD.Create(3 * inch, 3 * inch, 1 * inch, 1 * inch); 
   rectObj.Stroke = AnnStroke.Create(AnnSolidColorBrush.Create("Blue"), LeadLengthD.Create(1)); 
   rectObj.Fill = AnnSolidColorBrush.Create("Yellow"); 
 
   // Set its lock picture 
   rectObj.LockPicture = pictureIndex; 
 
   // Add it to the container 
   container.Children.Add(rectObj); 
 
   // Show the object lock state (default) 
   Debug.WriteLine("1. Default lock state"); 
   ShowLockedState(rectObj); 
 
   // Lock it with a password 
   Debug.WriteLine("2. Locking now with a password"); 
   rectObj.Lock("secret"); 
 
   // Show the object lock state, it should say locked and the object should be painted with the lock picture 
   ShowLockedState(rectObj); 
 
   // Now try to unlock it with a wrong password 
   Debug.WriteLine("3. Unlocking with a wrong password"); 
   rectObj.Unlock("wrong password"); 
 
   // Check, it should be locked 
   ShowLockedState(rectObj); 
 
   // Unlock it with the correct password 
   Debug.WriteLine("4. Unlocking with a correct password"); 
   rectObj.Unlock("secret"); 
 
   // Check lock status 
   ShowLockedState(rectObj); 
 
   //Lock using a new password 
   Debug.WriteLine("5. Locking with a new password"); 
   rectObj.Lock("NewPassword"); 
   ShowLockedState(rectObj); 
 
   //Change the password used in the last lock operation 
   Debug.WriteLine("6. After being locked, change to new password"); 
   rectObj.Password = "secret-again"; 
    ShowLockedState(rectObj); 
} 
 
private void ShowLockedState(AnnObject annObj) 
{ 
   _automation.Invalidate(LeadRectD.Empty); 
 
   // Show the object lock state (default) 
   Debug.WriteLine($"\tLocked: {annObj.IsLocked} | Password: {annObj.Password}"); 
} 
Requirements

Target Platforms

See Also

Reference

AnnObject Class

AnnObject Members

Help Version 23.0.2024.2.29
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2024 LEAD Technologies, Inc. All Rights Reserved.

Leadtools.Annotations.Engine Assembly
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2023 LEAD Technologies, Inc. All Rights Reserved.