コード例 #1
0
        /// <summary>Attempts to unmount the card.</summary>
        /// <returns>Whether or not the card was successfully unmounted.</returns>
        public bool Unmount()
        {
            if (!this.IsCardMounted)
            {
                throw new InvalidOperationException("The card is already unmounted.");
            }

            return(!Mainboard.UnmountStorageDevice("SD"));
        }
コード例 #2
0
ファイル: USBHost_43.cs プロジェクト: valoni/NETMF-Gadgeteer
        /// <summary>Attempts to unmount the mass storage device.</summary>
        /// <returns>Whether or not the mass storage device was successfully unmounted.</returns>
        public bool UnmountMassStorage()
        {
            if (!this.IsMassStorageMounted)
            {
                throw new InvalidOperationException("The mass storage is not mounted.");
            }

            return(Mainboard.UnmountStorageDevice("USB"));
        }
コード例 #3
0
 private void OnInsert(object sender, MediaEventArgs e)
 {
     if (string.Compare(e.Volume.Name, "SD") == 0)
     {
         if (e.Volume.FileSystem != null)
         {
             this.device        = new StorageDevice(e.Volume);
             this.IsCardMounted = true;
             this.OnMounted(this, this.device);
         }
         else
         {
             this.device        = null;
             this.IsCardMounted = false;
             Mainboard.UnmountStorageDevice("SD");
             this.ErrorPrint("The SD card does not have a valid filesystem.");
         }
     }
 }
コード例 #4
0
ファイル: SDCard_42.cs プロジェクト: valoni/NETMF-Gadgeteer
 /// <summary>
 /// Attempts to dismount the file system associated with a non-volatile memory card.
 /// </summary>
 /// <remarks>
 /// <para>
 ///  Use <see cref="MountSDCard"/> and <see cref="UnmountSDCard"/>
 ///  to manually mount and dismount the file system on the non-volatile memory card.
 /// </para>
 /// <para>
 ///  If you call this method when there is no memory card inserted into the
 ///  slot, or the card is already dismounted, this method has no effect.
 /// </para>
 /// <para>
 ///  For more information on when you need to use this method, see <see cref="SDCard"/>.
 /// </para>
 /// </remarks>
 public void UnmountSDCard()
 {
     if (IsCardMounted)
     {
         try
         {
             //_storage.Unmount();
             //_storage.Dispose();
             IsCardMounted = false;
             Mainboard.UnmountStorageDevice("SD");
             //IsCardMounted = false;
             Thread.Sleep(500);
             _device = null;
         }
         catch
         {
             _device = null;
             ErrorPrint("Unable to unmount SD card - no card detected.");
         }
     }
 }