「Xamarin.Macでリムーバブルメディアの着脱を検知する」の版間の差分
imported>Administrator 編集の要約なし |
imported>Administrator 編集の要約なし |
||
| 11行目: | 11行目: | ||
<source lang="csharp"> | <source lang="csharp"> | ||
using System; | using System; | ||
using | using Foundation; | ||
using | using AppKit; | ||
public class RemovableMediaNotificationEventArgs : EventArgs | public class RemovableMediaNotificationEventArgs : EventArgs | ||
| 52行目: | 52行目: | ||
if (_mountObserver == null) | if (_mountObserver == null) | ||
{ | { | ||
_mountObserver = notification.AddObserver( | |||
_mountObserver = notification.AddObserver(NSWorkspace.DidMountNotification, DidMount); | |||
} | } | ||
| 58行目: | 59行目: | ||
if (_unmountObserver == null) | if (_unmountObserver == null) | ||
{ | { | ||
_unmountObserver = notification.AddObserver( | |||
_unmountObserver = notification.AddObserver(NSWorkspace.WillUnmountNotification, WiilUnmount); | |||
} | } | ||
} | } | ||
| 111行目: | 113行目: | ||
var workspace = NSWorkspace.SharedWorkspace; | var workspace = NSWorkspace.SharedWorkspace; | ||
workspace.GetFileSystemInfo(devicePath, out isRemovable, out isWritable,out isUnmountable, out description, | workspace.GetFileSystemInfo(devicePath, out isRemovable, out isWritable, out isUnmountable, out description, out fileSystemType); | ||
var args = new RemovableMediaNotificationEventArgs { | var args = new RemovableMediaNotificationEventArgs | ||
{ | |||
DevicePath = devicePath, | DevicePath = devicePath, | ||
IsRemovable = isRemovable, | IsRemovable = isRemovable, | ||
| 126行目: | 129行目: | ||
</source> | </source> | ||
==関連項目== | == 関連項目 == | ||
*[[Xamarin.Mac/CDやDVDなどの光学メディアを排出する]] | *[[Xamarin.Mac/CDやDVDなどの光学メディアを排出する]] | ||
[[category:MonoMac]] | [[category:MonoMac]] | ||
[[category:Xamarin.Mac]] | [[category:Xamarin.Mac]] | ||