예제 #1
0
        private static void GetMeaning(object arg)
        {
            if (arg is GetMeaningArgs)
            {
                GetMeaningArgs         arg2 = arg as GetMeaningArgs;
                GetMeaningCompleteArgs arg3 = new GetMeaningCompleteArgs();
                arg3.Meaning = string.Empty;

                if ((arg2.Word == null) || (arg2.AllDicts == null))
                {
                    arg3.GetMeaningArgs = arg2;
                    OnGetMeaningComplete(arg3);
                    return;
                }

                foreach (DictFileInfo dict in arg2.AllDicts)
                {
                    IndexEntry index;
                    if ((index = dict.IndexFile[arg2.Word]) != null)
                    {
                        int offset = GetDecValue(index.Offset);
                        int length = GetDecValue(index.Length);

                        string mean = GetWordMeaning(offset, length, dict.Path);

                        if (OnGetMeaningComplete != null)
                        {
                            arg3.Meaning        = arg3.Meaning + mean;
                            arg3.GetMeaningArgs = arg2;
                        }
                    }
                    else
                    {
                        arg3.GetMeaningArgs = arg2;
                    }
                    OnGetMeaningComplete(arg3);
                }
            }
        }
예제 #2
0
        void DictFileManager_OnGetMeaningComplete(GetMeaningCompleteArgs args)
        {
            RtfUtility rtfUtil = new RtfUtility();

            try
            {
                if (args.Meaning != "")
                {
                    string rtf = rtfUtil.GetRtfFromDictionaryString(args.Meaning);
                    this.rtbMeaning.Invoke(new UpdateRtfUI(UpdateRtf), rtf);
                    this.rtfQuickDic.Invoke(new UpdateRtfUI(UpdateRtf), rtf);
                    this.kanjiUserControl.RichTextQickDic.Invoke(new UpdateRtfUI(UpdateRtf), rtf);
                }
                else
                {
                    this.rtbMeaning.Rtf = rtfUtil.GetEmptyRtf();
                }
            }
            catch
            {
            }
        }