示例#1
0
        /// <summary>
        /// [Experimental] Sets the target camera for cap negotiation that can be set per camera.
        /// </summary>
        /// <param name="cameraName"></param>
        /// <returns></returns>
        public ReturnCode SetCamera(string cameraName)
        {
            TWFileSystem fs = new TWFileSystem();

            fs.InputName = cameraName;
            return(DGControl.FileSystem.ChangeDirectory(fs));
        }
示例#2
0
 public static extern ReturnCode DsmWinNew(
     [In, Out] TWIdentity origin,
     [In, Out] TWIdentity destination,
     DataGroups dg,
     DataArgumentType dat,
     Message msg,
     [In, Out] TWFileSystem data);
示例#3
0
        //#region INotifyPropertyChanged Members

        ///// <summary>
        ///// Occurs when a property value changes.
        ///// </summary>
        //public event PropertyChangedEventHandler PropertyChanged;

        ///// <summary>
        ///// Raises the <see cref="PropertyChanged"/> event.
        ///// </summary>
        ///// <param name="propertyName">Name of the property.</param>
        //protected void OnPropertyChanged(string propertyName)
        //{
        //    var syncer = Session.SynchronizationContext;
        //    if (syncer == null)
        //    {
        //        try
        //        {
        //            var hand = PropertyChanged;
        //            if (hand != null) { hand(this, new PropertyChangedEventArgs(propertyName)); }
        //        }
        //        catch { }
        //    }
        //    else
        //    {
        //        syncer.Post(o =>
        //        {
        //            try
        //            {
        //                var hand = PropertyChanged;
        //                if (hand != null) { hand(this, new PropertyChangedEventArgs(propertyName)); }
        //            }
        //            catch { }
        //        }, null);
        //    }
        //}

        //#endregion

        #region cameras

        /// <summary>
        /// [Experimental] Gets the cameras supported by the source.
        /// </summary>
        /// <returns></returns>
        public IList <string> GetCameras()
        {
            TWFileSystem  fs   = new TWFileSystem();
            List <string> cams = new List <string>();
            var           rc   = DGControl.FileSystem.GetFirstFile(fs);

            while (rc == ReturnCode.Success)
            {
                switch (fs.FileType)
                {
                case FileType.Camera:
                case FileType.CameraBottom:
                case FileType.CameraTop:
                case FileType.CameraPreview:
                    cams.Add(fs.OutputName);
                    break;
                }
                rc = DGControl.FileSystem.GetNextFile(fs);
            }
            return(cams);
        }
示例#4
0
文件: Dsm.cs 项目: lukaszmn/ntwain
 public static ReturnCode DsmEntry(
     TWIdentity origin,
     TWIdentity destination,
     Message msg,
     TWFileSystem data)
 {
     if (PlatformInfo.Current.IsWindows)
     {
         if (PlatformInfo.Current.UseNewWinDSM)
         {
             return(NativeMethods.DsmWinNew(origin, destination, DataGroups.Control, DataArgumentType.FileSystem, msg, data));
         }
         else
         {
             return(NativeMethods.DsmWinOld(origin, destination, DataGroups.Control, DataArgumentType.FileSystem, msg, data));
         }
     }
     else if (PlatformInfo.Current.IsLinux)
     {
         return(NativeMethods.DsmLinux(origin, destination, DataGroups.Control, DataArgumentType.FileSystem, msg, data));
     }
     throw new PlatformNotSupportedException();
 }
示例#5
0
 /// <summary>
 /// This operation formats the specified storage. This operation destroys all images and subdirectories
 /// under the selected device. Use with caution.
 /// </summary>
 /// <param name="fileSystem">The file system.</param>
 /// <returns></returns>
 public ReturnCode FormatMedia(TWFileSystem fileSystem)
 {
     Session.VerifyState(4, 4, DataGroups.Control, DataArgumentType.FileSystem, Message.FormatMedia);
     return(Dsm.DsmEntry(Session.AppId, Session.CurrentSource.Identity, Message.FormatMedia, fileSystem));
 }
示例#6
0
 /// <summary>
 /// This operation creates a new directory within the current directory. Pathnames are not allowed,
 /// only the name of the new directory can be specified.
 /// </summary>
 /// <param name="fileSystem">The file system.</param>
 /// <returns></returns>
 public ReturnCode CreateDirectory(TWFileSystem fileSystem)
 {
     Session.VerifyState(4, 4, DataGroups.Control, DataArgumentType.FileSystem, Message.CreateDirectory);
     return(Dsm.DsmEntry(Session.AppId, Session.CurrentSource.Identity, Message.CreateDirectory, fileSystem));
 }
示例#7
0
 /// <summary>
 /// This operation gets the next filename in a directory, and returns information about that file (the
 /// same information that can be retrieved with GetInfo).
 /// </summary>
 /// <param name="fileSystem">The file system.</param>
 /// <returns></returns>
 public ReturnCode GetNextFile(TWFileSystem fileSystem)
 {
     Session.VerifyState(4, 6, DataGroups.Control, DataArgumentType.FileSystem, Message.GetNextFile);
     return(Dsm.DsmEntry(Session.AppId, Session.CurrentSource.Identity, Message.GetNextFile, fileSystem));
 }