Example #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="CyrusBuilt.MonoPi.Components.LcdDisplay.LcdComponent"/>
 /// class with the LCD transfer provider and the rows and columns of the display.
 /// </summary>
 /// <param name="provider">
 /// The LCD transfer provider.
 /// </param>
 /// <param name="rows">
 /// The number of rows in the display.
 /// </param>
 /// <param name="columns">
 /// The number of columns.
 /// </param>
 public LcdComponent(ILcdTransferProvider provider, Int32 rows, Int32 columns)
     : base()
 {
     if (provider == null)
     {
         throw new ArgumentNullException("provider");
     }
     this._module = new LcdModule(provider);
     this._module.Begin(columns, rows);
 }
Example #2
0
        /// <summary>
        /// Releases all resource used by the <see cref="CyrusBuilt.MonoPi.Components.LcdDisplay.LcdComponent"/> object.
        /// </summary>
        /// <remarks>Call <see cref="Dispose"/> when you are finished using the
        /// <see cref="CyrusBuilt.MonoPi.Components.LcdDisplay.LcdComponent"/>. The <see cref="Dispose"/> method leaves the
        /// <see cref="CyrusBuilt.MonoPi.Components.LcdDisplay.LcdComponent"/> in an unusable state. After calling
        /// <see cref="Dispose"/>, you must release all references to the
        /// <see cref="CyrusBuilt.MonoPi.Components.LcdDisplay.LcdComponent"/> so the garbage collector can reclaim the memory
        /// that the <see cref="CyrusBuilt.MonoPi.Components.LcdDisplay.LcdComponent"/> was occupying.</remarks>
        public override void Dispose()
        {
            if (base.IsDisposed)
            {
                return;
            }

            if (this._module != null)
            {
                this._module.Clear();
                this._module.Provider.Dispose();
                this._module = null;
            }
            base.Dispose();
        }