private void ButtonSearch_Click(object sender, RoutedEventArgs e) { if (null == GlobalTool.AllEmojis || new List <MyEmoji>() == GlobalTool.AllEmojis) { return; } if (string.IsNullOrWhiteSpace(TextBoxSearch.Text)) { GlobalTool.BarMsg("请输入关键字"); return; } ListShowEmoji = new List <MyEmoji>(); foreach (var emoji in GlobalTool.AllEmojis) { if (emoji.Note.Contains(TextBoxSearch.Text.Trim())) { ListShowEmoji.Add(emoji); } } if (0 == ListShowEmoji.Count) { GlobalTool.BarMsg("无结果"); return; } ComboBoxChoose.SelectedIndex = 0; ChangeListItemSource(); }
private void Button_Click(object sender, RoutedEventArgs e) { if (null == GlobalTool.SelectedEmoji || new MyEmoji() == GlobalTool.SelectedEmoji) { return; } string senderName = (sender as Button).Name; switch (senderName) { case "ButtonCopy": Clipboard.SetDataObject(GlobalTool.SelectedEmoji.Text); GlobalTool.BarMsg("已复制到剪贴板"); break; case "ButtonSave": GlobalTool.WinEmoji = new WindowEmoji(); GlobalTool.WinEmoji.Show(); break; } }
private void Button_Click(object sender, RoutedEventArgs e) { var senderName = (sender as Button).Name; switch (senderName) { case "ButtonOK": { string s_key = TextBoxYuan.Text.Trim(); string s_value = TextBoxNew.Text.Trim(); if (string.IsNullOrEmpty(s_key) || string.IsNullOrEmpty(s_value)) { GlobalTool.BarMsg("请输入内容"); return; } if (GlobalTool.AllDic.ContainsKey(s_key)) { GlobalTool.AllDic[s_key] = s_value; } else { GlobalTool.AllDic.Add(s_key, s_value); } JavaScriptSerializer serializer = new JavaScriptSerializer(); string json = serializer.Serialize(GlobalTool.AllDic); MyFiles.WriteLocalTrans(json); GlobalTool.CloseDialogLearn(); GlobalTool.BarMsg("添加成功"); GlobalTool.GetDic(); } break; case "ButtonCancel": GlobalTool.CloseDialogLearn(); break; } }
private void Button_Click(object sender, RoutedEventArgs e) { string senderName = (sender as Button).Name; switch (senderName) { case "ButtonLearn": GlobalTool.OpenDialogLearn(); break; case "ButtonTranslate": { string NewText = TextBoxDoc.Text.Trim(); if (CheckBoxWoYe.IsChecked.Value) { NewText = NewText.Replace("我", "👴"); } if (CheckBoxDaDai.IsChecked.Value) { NewText = NewText.Replace("大", "带"); } for (int i = 0; i < GlobalTool.AllKey.Count; i++) { NewText = NewText.Replace(GlobalTool.AllKey[i], GlobalTool.AllDic[GlobalTool.AllKey[i]]); } TextBlockShow.Text = NewText; GlobalTool.ShowText = NewText; } break; case "ButtonCopy": Clipboard.SetDataObject(GlobalTool.ShowText); GlobalTool.BarMsg("已复制到剪贴板"); break; } }
/// <summary> /// 菜单栏点击事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MenuItem_Click(object sender, RoutedEventArgs e) { var mySender = sender as MenuItem; switch (mySender.Name) { case "MenuItemAbout": GlobalTool.OpenDialogButton ( "Let's Emoji (" + Application.ResourceAssembly.GetName().Version.ToString() + ")\n\n作者 FunJoo\n官网 http://funjoo.fun/ \n开源 https://gitee.com/funjoo/Lets-Emoji/ " ); break; case "MenuItemExit": GlobalTool.CloseApp(); break; case "MenuItemUpdateData": { GlobalTool.OpenDialogProgress("更新中"); MyNet.ReadRemoteEmoji((result) => { var mr = MyNet.FuncGetResult.EndInvoke(result); Sync.Post((o) => { GlobalTool.FrameMain.Navigate(new PageEmoji()); GlobalTool.CloseDialogProgress(); GlobalTool.BarMsg("更新成功"); GC.Collect(); }, mr); }); } break; case "MenuItemTranslator": GlobalTool.FrameMain.Navigate(new PageTranslator()); break; case "MenuItemEmoji": GlobalTool.FrameMain.Navigate(new PageEmoji()); break; case "MenuItemTranslatorUpdate": { GlobalTool.OpenDialogProgress("更新中"); GlobalTool.GetDic(); MyNet.ReadRemoteTrans((result) => { var mr = MyNet.FuncGetTransResult.EndInvoke(result); GlobalTool.GetDic(); Sync.Post((o) => { GlobalTool.FrameMain.Navigate(new PageTranslator()); GlobalTool.CloseDialogProgress(); GlobalTool.BarMsg("更新成功"); GC.Collect(); }, mr); }); } break; } }