2016-07-05 8 views
5

मैं अपने आवेदन के लिए फ़ाइल-एसोसिएशन बनाने के लिए BrendanGrant.Helpers.FileAssociation; (एक NuGet पैकेज) का उपयोग कर रहा हूं। यह अब तक ठीक काम करता है। हालांकि, मैं ProgramVerb के साथ एक समस्या है:मेरे contextmenu प्रविष्टियों को कम मामले क्यों हैं?

जब मैं एक ProgramAssociation बना सकते हैं और इस तरह से यह करने के लिए क्रियाओं जोड़ें:

var pai = new ProgramAssociationInfo(fai.ProgID); 

    pai.Create(
    "App name", 
    new[] 
    { 
     new ProgramVerb("Öffnen", Assembly.GetEntryAssembly().Location + " \"%1\""), 
     new ProgramVerb("Bearbeiten", Assembly.GetEntryAssembly().Location + " \"%1\"") 
    }); 
} 

Bearbeiten और Öffnen (संपादित करें और खुले) कीवर्ड ContextMenu में लोअरकेस कर रहे हैं Windows explorer के:

enter image description here

मैं अगर इसके कुछ ही पहले चरित्र को बदलने का परीक्षण करने के 2 प्रविष्टि WAAAA नाम है, लेकिन जाहिरा तौर पर इसकी नहीं।

मुझे क्या बदलना है, ताकि मेरा Bearbeiten और Öffnen संदर्भ मेनू में अपरकेस हो?

उत्तर

4

मैंने इस पुस्तकालय की जांच की और ऐसा लगता है कि इस व्यवहार पर आपका कोई प्रभाव नहीं है।

यह पंक्ति है कि छोटे अक्षरों पर बदल जाता है:

RegistryKey subKey2 = subKey1.CreateSubKey(verb.Name.ToLower()); 

_

protected void SetVerbs(ProgramVerb[] verbs) 
{ 
    if (!this.Exists) 
    throw new Exception("Extension does not exist"); 
    RegistryKey registryKey = RegistryHelper.AssociationsRoot.OpenSubKey(this.progId, true); 
    if (registryKey.OpenSubKey("shell", true) != null) 
    registryKey.DeleteSubKeyTree("shell"); 
    RegistryKey subKey1 = registryKey.CreateSubKey("shell"); 
    foreach (ProgramVerb verb in verbs) 
    { 
    RegistryKey subKey2 = subKey1.CreateSubKey(verb.Name.ToLower()); 
    RegistryKey subKey3 = subKey2.CreateSubKey("command"); 
    subKey3.SetValue(string.Empty, (object) verb.Command, RegistryValueKind.ExpandString); 
    subKey3.Close(); 
    subKey2.Close(); 
    } 
    ShellNotification.NotifyOfChange(); 
} 
संग्रह असाइनमेंट आप AddVerb (ProgramVerb क्रिया) विधि और फिर अपरकेस रखा जाना चाहिए का उपयोग करना चाहिए के बजाय

:

pai.Create("App name", new ProgramVerb[0]); 
pai.AddVerb(new ProgramVerb("Öffnen", Assembly.GetEntryAssembly().Location + " \"%1\"")); 
pai.AddVerb(new ProgramVerb("Bearbeiten", Assembly.GetEntryAssembly().Location + " \"%1\"")); 
+2

*** एक तस्वीर?! *** आपने * ap पोस्ट किया कोड की एक पंक्ति की नकल * कोड की रेखा की प्रतिलिपि बनाने और चिपकाने के बजाय? –

+0

@PawelMaga क्या मैं पुस्तकालय के बजाय नीचे पोस्ट किए गए कोड का उपयोग कर सकता हूं? या आप किसी अन्य पुस्तकालय को जानते हैं? – Mafii

+0

@ माफी दुर्भाग्य से आप नहीं कर सकते, मेरे संपादित उत्तर को देखें। –

संबंधित मुद्दे