Exemple #1
0
 /// <summary>
 /// 上传成功后,清理
 /// </summary>
 private void KeywordClear()
 {
     WordsManager.NewWords.Clear();
     WordsManager.ExistWords.Clear();
     WordsManager.ShowNewWordsForm();
     WordsManager.ShowExistWordsForm();
 }
Exemple #2
0
 public EditCheckedItem(WordsManager wordManager, EditFormType type, string strSource)
 {
     InitializeComponent();
     CurrentWordsManager = wordManager;
     SourceString        = strSource;
     FormType            = type;
 }
Exemple #3
0
        /// <summary>
        /// 更新词库
        /// </summary>
        public void UpdateWord()
        {
            ClientServer _client = new ClientServer();

            _client.StartConn();

            MessageHead head = new MessageHead((int)KeywordMessageType.Upload, 0, 1);

            byte[]     bodyBytes = Service.GetBodyBytes(Service.SessionId, Service.DictVersion, Service.ComputerMac);
            MessageBag bag       = new MessageBag(head, bodyBytes);

            _client.SendMessage(bag);

            MessageBag recBag = _client.ReceiveMessage();

            string returnVal = _client.AnalyzeResponeMessage(recBag);

            if (string.Compare(returnVal, "versionSameOfSuccess") == 0)
            {
                //验证成功,版本一样,可上传
                MessageHead head2     = new MessageHead((int)KeywordMessageType.Upload, 0, 2);
                string      updateCmd = WordsManager.GetUpdateCmd();
                byte[]      bytes     = Encoding.UTF8.GetBytes(updateCmd);
                MessageBag  bag2      = new MessageBag(head2, bytes);

                _client.SendMessage(bag2);

                MessageBag recBag2 = _client.ReceiveMessage();

                string recVal = _client.AnalyzeResponeMessage(recBag2);


                if (string.Compare(recVal, "true") != 0)
                {
                    Debug.Fail("更新失败!");
                }
                else
                {
                    MessageBox.Show("更新成功!");
                    KeywordClear();
                }
            }
            else if (string.Compare(returnVal, "versionDifferentOfSuccess") == 0)
            {
                //验证成功,版本不一样,不可上传  需更新本地词库并显示
                WordsManager man = new WordsManager(this);
                man.ShowNewWordsForm();
            }
            else
            {
                if (!string.IsNullOrEmpty(returnVal))
                {
                    MessageBox.Show(returnVal);
                }
            }

            _client.CloseConn();
        }
Exemple #4
0
 internal KeywordListView(WordsManager wordManager, KeywordFormType formType)
 {
     this.InitializeComponent();
     this.WordManager = wordManager;
     FormType         = formType;
     Init();
     if (FormType == KeywordFormType.ExistWord)
     {
         _KeyWordCheckedListBox.Items.Add("1");
         _KeyWordCheckedListBox.Items.Add("2");
         _KeyWordCheckedListBox.Items.Add("3");
     }
 }
Exemple #5
0
        /// <summary>
        /// 更新本地词库
        /// </summary>
        private void UpdateLocalWord()
        {
            ClientServer _client = new ClientServer();

            _client.StartConn();

            MessageHead head = new MessageHead((int)KeywordMessageType.Update, 0, 1);

            byte[]     bodyBytes = Service.GetBodyBytes(Service.SessionId, Service.DictVersion, Service.ComputerMac);
            MessageBag bag       = new MessageBag(head, bodyBytes);

            _client.SendMessage(bag);

            MessageBag recBag = _client.ReceiveMessage();

            string returnVal = _client.AnalyzeResponeMessage(recBag);

            _client.CloseConn();

            WordsManager.UpdateLocalWord();
        }
Exemple #6
0
        /// <summary>
        /// 构造函数
        /// </summary>
        private WorkbenchForm()
        {
            this.InitializeComponent();
            if (!this.DesignMode)//保证设计器可用
            {
                this.ImeMode                         = ImeMode.On;
                this.MainDockPanel.Dock              = DockStyle.Fill;
                this.MainDockPanel.DockTopPortion    = 100;
                this.MainDockPanel.DockBottomPortion = 200;
                this.MainDockPanel.DockLeftPortion   = 280;
                this.MainDockPanel.DockRightPortion  = 100;

                this.IsInitForApplication = false;
                this.IsSnatchAtKewword    = false;


                //下面的初始化为关键词管理服务
                _wordsManager = new WordsManager(this);
                _urlManager   = new UrlManager(this);
            }
        }
Exemple #7
0
 private void toolStripMenuItem1_Click(object sender, EventArgs e)
 {
     WordsManager.ShowExistWordsForm();
 }