簡體   English   中英

在Mac OSX上使用mono gtk#打開文件

[英]Open files with mono gtk# on Mac OSX

我使用mono和gtk#開發了適用於mac的應用程序。
問題是默認的文件處理程序。 我使用此Info.plist(片段)注冊我的應用程序

...
<array>
    <dict>
        <key>CFBundleTypeName</key>
        <string>My Filetype</string>
        <key>CFBundleTypeIconFile</key>
        <string>file.icns</string>
        <key>CFBundleTypeRole</key>
        <string>Editor</string>
        <key>CFBundleTypeExtensions</key>
        <array>
            <string>ext</string>
            <string>EXT</string>
        </array>
        <key>LSIsAppleDefaultForType</key>
        <true/>
    </dict>
</array>
....

它正確注冊(圖標匹配,打開我的應用程序),但是每當我打開文件時,都會出現以下消息:

The document "test.ext" could not be opened. mono cannot open files of this type.

那么我該如何運作呢?

我自己發現的:

  1. https://github.com/mono/monodevelop/tree/master/main/src/addins/MacPlatform/MacInterop包含到您的項目中。

  2. 使用此代碼

     ApplicationEvents.OpenDocuments+= delegate (object sender, ApplicationDocumentEventArgs e) { if (e.Documents != null && e.Documents.Count > 0) { // e.Documents holds the files } e.Handled = true; }; 

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM