2013-05-15 28 views
2

我有一個用C#WPF編寫的應用程序,並保存生成的Word文檔。通過RemoteApp設置,我已設置顯示本地用戶的邏輯驅動器,但它們旁邊沒有字母。它們顯示爲C on myHostnameD on myHostname您是否可以通過RemoteApp將文件保存在本地驅動器上,而不是保存到服務器驅動器上?

當我打開了一個SaveFileDialog對象,它顯示Local Disk (C:)C on myHostname,並在左側窗格中D on myHostname

如何設置文件名,如果沒有相應的字母?

string filename = @"C:\myDirectory\myFile.docx"; 
using(WordprocessingDocument myDoc = 
    WordprocessingDocument.Create(filename, 
     WordprocessingDocumentType.Document)) {} 

回答

2

我發現,如果我使用終端服務客戶端,我可以使用關鍵字tsclient告訴它使用本地用戶的驅動器。

// Check if remote session, and get the local drive location 
if(System.Windows.Forms.SystemInformation.TerminalServerSession) { 
    filename = @"\\tsclient\C\myDirectory\myFile.docx"; 
} 
相關問題