mirror of
				https://github.com/soukoku/ntwain.git
				synced 2025-10-31 16:46:51 +08:00 
			
		
		
		
	Moved identities to propevents file.
This commit is contained in:
		| @@ -8,6 +8,12 @@ namespace SampleConsole | ||||
|     static void Main(string[] args) | ||||
|     { | ||||
|       var twain = new TwainSession(Environment.ProcessPath ?? Assembly.GetExecutingAssembly().Location); | ||||
|       twain.StateChanged += Twain_StateChanged; | ||||
|     } | ||||
|  | ||||
|     private static void Twain_StateChanged(TwainSession session, TWAINWorkingGroup.STATE state) | ||||
|     { | ||||
|       Console.WriteLine($"State changed to {state}"); | ||||
|     } | ||||
|   } | ||||
| } | ||||
| @@ -3,7 +3,7 @@ | ||||
| 	<PropertyGroup> | ||||
| 		<PackageId>NTwain</PackageId> | ||||
| 		<Description>Library containing the TWAIN API for dotnet.</Description> | ||||
| 		<TargetFrameworks>net462;net6.0;net7.0;netstandard2.0</TargetFrameworks> | ||||
| 		<TargetFrameworks>net462;net6.0</TargetFrameworks> | ||||
|     <Nullable>enable</Nullable> | ||||
| 		<AllowUnsafeBlocks>true</AllowUnsafeBlocks> | ||||
|   </PropertyGroup> | ||||
|   | ||||
| @@ -13,6 +13,27 @@ namespace NTwain | ||||
|  | ||||
|   partial class TwainSession | ||||
|   { | ||||
|  | ||||
|     // really legacy version is the one to be used (except on mac) or | ||||
|     // until it doesn't work (special linux) | ||||
|  | ||||
|     /// <summary> | ||||
|     /// Gets the app identity. | ||||
|     /// </summary> | ||||
|     public TW_IDENTITY_LEGACY AppIdentity => _appIdentityLegacy; | ||||
|     internal TW_IDENTITY_LEGACY _appIdentityLegacy; | ||||
|     internal TW_IDENTITY _appIdentity; | ||||
|     internal TW_IDENTITY_MACOSX _appIdentityOSX; | ||||
|  | ||||
|     /// <summary> | ||||
|     /// Gets the current data source. | ||||
|     /// </summary> | ||||
|     public TW_IDENTITY_LEGACY DSIdentity => _dsIdentityLegacy; | ||||
|     internal TW_IDENTITY_LEGACY _dsIdentityLegacy; | ||||
|     internal TW_IDENTITY _dsIdentity; | ||||
|     internal TW_IDENTITY_MACOSX _dsIdentityOSX; | ||||
|  | ||||
|  | ||||
|     private STATE _state = STATE.S1; | ||||
|  | ||||
|     /// <summary> | ||||
| @@ -20,13 +41,13 @@ namespace NTwain | ||||
|     /// </summary> | ||||
|     public STATE State | ||||
|     { | ||||
|       get { return _state; } | ||||
|       get => _state; | ||||
|       private set | ||||
|       { | ||||
|         if (_state != value) | ||||
|         { | ||||
|           _state = value; | ||||
|           StateChanged?.Invoke(this, value); | ||||
|           StateChanged?.Invoke(this, value); // TODO: should care about thread | ||||
|         } | ||||
|       } | ||||
|     } | ||||
|   | ||||
| @@ -1,10 +1,6 @@ | ||||
| using System; | ||||
| using System.Collections.Generic; | ||||
| using System.Diagnostics; | ||||
| using System.Linq; | ||||
| using System.Reflection; | ||||
| using System.Text; | ||||
| using System.Threading.Tasks; | ||||
| using TWAINWorkingGroup; | ||||
|  | ||||
| namespace NTwain | ||||
| @@ -77,26 +73,7 @@ namespace NTwain | ||||
|         } | ||||
|       }; | ||||
|       if (TwainPlatform.IsLinux) _appIdentity = _appIdentityLegacy; | ||||
|       if (TwainPlatform.IsMacOSX) _appIdentityOSX = _appIdentityLegacy; | ||||
|       else if (TwainPlatform.IsMacOSX) _appIdentityOSX = _appIdentityLegacy; | ||||
|     } | ||||
|  | ||||
|     // really legacy version is the one to be used (except on mac) or | ||||
|     // until it doesn't work (special linux) | ||||
|  | ||||
|     /// <summary> | ||||
|     /// Gets the app identity. | ||||
|     /// </summary> | ||||
|     public TW_IDENTITY_LEGACY AppIdentity => _appIdentityLegacy; | ||||
|     internal TW_IDENTITY_LEGACY _appIdentityLegacy; | ||||
|     internal TW_IDENTITY _appIdentity; | ||||
|     internal TW_IDENTITY_MACOSX _appIdentityOSX; | ||||
|  | ||||
|     /// <summary> | ||||
|     /// Gets the current data source. | ||||
|     /// </summary> | ||||
|     public TW_IDENTITY_LEGACY DSIdentity => _dsIdentityLegacy; | ||||
|     internal TW_IDENTITY_LEGACY _dsIdentityLegacy; | ||||
|     internal TW_IDENTITY _dsIdentity; | ||||
|     internal TW_IDENTITY_MACOSX _dsIdentityOSX; | ||||
|   } | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Eugene Wang
					Eugene Wang