示例#1
0
 public void RemoveElement(WfcElement element)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     Wfc.RemoveElement(_Device.Handle, element.Handle);
 }
示例#2
0
 public void InsertElement(WfcElement element, WfcElement position)
 {
     if (element == null)
     {
         throw new ArgumentNullException("element");
     }
     Wfc.InsertElement(_Device.Handle, element.Handle, position != null ? position.Handle : Wfc.INVALID_HANDLE);
 }
示例#3
0
        /// <summary>
        /// Open the OpenWF device.
        /// </summary>
        /// <param name="deviceId">
        /// A <see cref="Int32"/> that specifies the identifier of the device.
        /// </param>
        public WfcDevice(int deviceId)
        {
            if ((_Handle = Wfc.CreateDevice(deviceId, null)) == Wfc.INVALID_HANDLE)
            {
                throw new InvalidOperationException(String.Format("unable to create OpenWF device {0}", deviceId));
            }

            // Query device attributes
            Class = (WFCDeviceClass)Wfc.GetDeviceAttribi(_Handle, WFCDeviceAttrib.DeviceClass);
        }
示例#4
0
        /// <summary>
        /// Create an OpenWF Composition element.
        /// </summary>
        /// <param name="device">
        /// A <see cref="WfcDevice"/> which the source is created on.
        /// </param>
        /// <param name="ctx">
        /// A <see cref="WfcContext"/> which the source is created on.
        /// </param>
        internal WfcElement(WfcDevice device, WfcContext ctx)
        {
            if (device == null)
            {
                throw new ArgumentNullException("device");
            }

            if ((_Handle = Wfc.CreateElement(device.Handle, ctx.Handle, null)) == Wfc.INVALID_HANDLE)
            {
                throw new InvalidOperationException(String.Format("unable to create OpenWF element"));
            }

            _Device = device;
        }
示例#5
0
        /// <summary>
        /// Create an OpenWF Composition source.
        /// </summary>
        /// <param name="device">
        /// A <see cref="WfcDevice"/> which the source is created on.
        /// </param>
        /// <param name="ctx">
        /// A <see cref="WfcContext"/> which the source is created on.
        /// </param>
        /// <param name="stream">
        /// A <see cref="NativeStreamType"/> that specifies the native source stream.
        /// </param>
        internal WfcSource(WfcDevice device, WfcContext ctx, NativeStreamType stream)
        {
            if (device == null)
            {
                throw new ArgumentNullException("device");
            }

            if ((_Handle = Wfc.CreateSourceFromStream(device.Handle, ctx.Handle, stream, null)) == Wfc.INVALID_HANDLE)
            {
                throw new InvalidOperationException(String.Format("unable to create OpenWF source"));
            }

            _Device = device;
        }
示例#6
0
        /// <summary>
        /// Enumerate OpenWF Composition devices.
        /// </summary>
        /// <returns>
        /// It returns the <see cref="List{WfcDeviceId}"/> specifying the available device identifiers.
        /// </returns>
        public List <WfcDeviceId> Enumerate()
        {
            int[] devices     = new int[Wfc.EnumerateDevices(null, 0, null)];
            int   deviceCount = Wfc.EnumerateDevices(devices, devices.Length, null);

            List <WfcDeviceId> wfcDevices = new List <WfcDeviceId>();

            for (int i = 0; i < Math.Min(deviceCount, devices.Length); i++)
            {
                wfcDevices.Add(devices[i]);
            }

            return(wfcDevices);
        }
示例#7
0
        /// <summary>
        /// Releases all resource used by the <see cref="WfcElement"/> object.
        /// </summary>
        /// <param name="disposing">
        /// A <see cref="Boolean"/> indicating whether the disposition happens in a managed context.
        /// </param>
        private void Dispose(bool disposing)
        {
            if (_Disposed)
            {
                return;
            }

            if (_Handle != Wfc.INVALID_HANDLE)
            {
                Wfc.DestroyElement(_Device.Handle, _Handle);
                _Handle = Wfc.INVALID_HANDLE;
            }

            _Disposed = true;
        }
示例#8
0
        /// <summary>
        /// Create an OpenWF Composition (on-screen) context on the specified screen of a device.
        /// </summary>
        /// <param name="device">
        /// A <see cref="WfcDevice"/> which the context is created on.
        /// </param>
        /// <param name="screenNumber">
        /// A <see cref="Int32"/> that identifies the screen.
        /// </param>
        internal WfcContext(WfcDevice device, int screenNumber)
        {
            if (device == null)
            {
                throw new ArgumentNullException("device");
            }

            if ((_Handle = Wfc.Create(device.Handle, screenNumber, null)) == Wfc.INVALID_HANDLE)
            {
                throw new InvalidOperationException(String.Format("unable to create OpenWF context"));
            }

            _Device = device;

            ContextType = WFCContextType.ContextTypeOnScreen;
        }
示例#9
0
        /// <summary>
        /// Releases all resource used by the <see cref="WfcDevice"/> object.
        /// </summary>
        /// <param name="disposing">
        /// A <see cref="Boolean"/> indicating whether the disposition happens in a managed context.
        /// </param>
        private void Dispose(bool disposing)
        {
            if (_Disposed)
            {
                return;
            }

            if (_Handle != Wfc.INVALID_HANDLE)
            {
                WFCErrorCode err = Wfc.DestroyDevice(_Handle);
                _Handle = Wfc.INVALID_HANDLE;

                // Throw exception is disposition is managed
                if (disposing)
                {
                    Wfc.CheckErrors(err);
                }
            }

            _Disposed = true;
        }
示例#10
0
 public void Activate()
 {
     Wfc.Activate(_Device.Handle, _Handle);
 }
示例#11
0
 public void ComposeAsync()
 {
     Wfc.Compose(_Device.Handle, _Handle, false);
 }
示例#12
0
 public void Compose()
 {
     Wfc.Compose(_Device.Handle, _Handle, true);
 }
示例#13
0
 public void CommitAsync()
 {
     Wfc.Commit(_Device.Handle, _Handle, false);
 }
示例#14
0
 public void Commit()
 {
     Wfc.Commit(_Device.Handle, _Handle, true);
 }