Пример #1
0
        public static void Register()
        {
            var regservice = new RegistrationServices();

            regservice.RegisterAssembly(Assembly.LoadFrom("YIME.Core.dll"),
                                        AssemblyRegistrationFlags.SetCodeBase);
            var iconname = System.IO.Path.Combine(System.IO.Path.GetDirectoryName(Assembly.GetEntryAssembly().Location),
                                                  "YIME.Core.dll");

            Console.WriteLine(iconname);
            Console.WriteLine(CultureInfo.GetCultureInfo("zh-cn").LCID);
            //Insert code here.
            var p      = new ITfInputProcessorProfiles();
            var result = p.Register(CLSID_TEXTSERVICE);

            Console.WriteLine(result.ToString());
            result = p.AddLanguageProfile(CLSID_TEXTSERVICE, new LangID((ushort)CultureInfo.GetCultureInfo("zh-cn").LCID), GUID_PROFILE,
                                          name.ToCharArray(), (uint)name.ToCharArray().Length, iconname.ToCharArray(), (uint)iconname.Length, 0);

            Console.WriteLine(result.ToString());
            var c = new ITfCategoryMgr();

            foreach (var supportCategory in SupportCategories)
            {
                var r = c.RegisterCategory(CLSID_TEXTSERVICE, supportCategory, CLSID_TEXTSERVICE);
                Console.WriteLine(r.ToString());
            }
        }
Пример #2
0
        public static void UnregisterCategories()
        {
            var pCategoryMgr = new ITfCategoryMgr();

            foreach (Guid guid in SupportCategories)
            {
                pCategoryMgr.UnregisterCategory(Globals.SampleIMECLSID, guid, Globals.SampleIMECLSID);
            }
        }
Пример #3
0
        /// <summary>
        /// Because it's expensive to map our display attribute GUID to a TSF
        /// TfGuidAtom, we do it once when Activate is called.
        /// </summary>
        /// <returns></returns>
        private bool _InitDisplayAttributeGuidAtom()
        {
            var pCategoryMgr = new ITfCategoryMgr();

            if (!pCategoryMgr.RegisterGUID(Globals.SampleIMEGuidDisplayAttributeInput, out _gaDisplayAttributeInput).Succeeded)
            {
                return(false);
            }

            if (!pCategoryMgr.RegisterGUID(Globals.SampleIMEGuidDisplayAttributeConverted, out _gaDisplayAttributeConverted).Succeeded)
            {
                return(false);
            }

            return(true);
        }
Пример #4
0
        public static void Unregister()
        {
            ITfCategoryMgr c = new ITfCategoryMgr();

            foreach (var supportCategory in SupportCategories)
            {
                var r = c.UnregisterCategory(CLSID_TEXTSERVICE, supportCategory, CLSID_TEXTSERVICE);
                Console.WriteLine(r.ToString());
            }
            ITfInputProcessorProfiles p = new ITfInputProcessorProfiles();
            var result = p.Unregister(CLSID_TEXTSERVICE);

            Console.WriteLine(result.ToString());
            var regservice = new RegistrationServices();

            regservice.UnregisterAssembly(Assembly.LoadFrom("YIME.Core.dll"));
        }
 public static extern int TF_CreateCategoryMgr(out ITfCategoryMgr catmgr);