ItemOperations.IsFileOpen Yöntem
Belirtilen dosyayı belirtilen görünümde açık olup olmadığını gösterir.
Ad alanı: EnvDTE
Derleme: EnvDTE (EnvDTE.dll içinde)
Sözdizimi
'Bildirim
Function IsFileOpen ( _
FileName As String, _
ViewKind As String _
) As Boolean
bool IsFileOpen(
string FileName,
string ViewKind
)
bool IsFileOpen(
[InAttribute] String^ FileName,
[InAttribute] String^ ViewKind
)
abstract IsFileOpen :
FileName:string *
ViewKind:string -> bool
function IsFileOpen(
FileName : String,
ViewKind : String
) : boolean
Parametreler
- FileName
Tür: System.String
Gerekli.Belirtilen dosyayı mutlak yolu.Dosyayı yalnızca oluşturduysanız ancak, henüz, sonra kaydedilen IsFileOpen verir false.
- ViewKind
Tür: System.String
İsteğe Bağlı.A Constants .vsViewKind* sabit gösteren Görünüm türü, kaydedilen dosyanın bulunduğu şu anda açık.
Dönüş Değeri
Tür: System.Boolean
Belirten bir Boole değeri true Dosya ise belirtilen görünümünde açık false IF not.
Örnekler
Sub IsFileOpenExample()
Dim soln As Solution = DTE.Solution
Dim prj As Project
Dim prjItem As ProjectItem
Dim ItemOp As ItemOperations
Dim savePath As String
' Create a new text document.
ItemOp = DTE.ItemOperations
ItemOp.NewFile("General\Text File", "Some name", _
Constants.vsViewKindTextView)
' Set variables for proj and proj item names.
prj = soln.Item(1)
prjItem = prj.ProjectItems.Item(1)
savePath = "C:\UserFiles\KempB\" & prjItem.Name
MsgBox(savePath)
If ItemOp.IsFileOpen(savePath) = True Then
MsgBox("The saved document is open.")
Else
MsgBox("The saved document is not open.")
End If
prjItem.Save(savePath)
If ItemOp.IsFileOpen(savePath) = True Then
MsgBox("The saved document is open.")
Else
MsgBox("The saved document is not open.")
End If
End Sub
.NET Framework Güvenliği
- Anında arayanlar için tam güven. Bu üye kısmen güvenilen kodla kullanılamaz. Daha fazla bilgi için bkz. kısmen güvenilir kod tarafından Kitaplıklar kullanma.