public ExprDisplayer(Expr expr) { this.expr = expr; this.ContextMenu = ExprDisplayerRightClickMenuFactory.getInstance(); this.Click += ExprDisplayer_Click; }
public static string getRemoteExprFile(Expr expr) { bool duty; lock (lock1) { if (!DownloadingExprs.Contains(expr.md5)) { if (File.Exists(FileUtility.FullPath(expr))) { return FileUtility.FullPath(expr); } else { DownloadingExprs.Add(expr.md5); duty = true; } } else { duty = false; } } if (duty) { WebClient client = new WebClient(); client.DownloadFile(NetworkUtility.FullUrl(expr), FileUtility.FullPath(expr)); DownloadingExprs.Remove(expr.md5); return FileUtility.FullPath(expr); } else { while (DownloadingExprs.Contains(expr.md5)); return FileUtility.FullPath(expr); } }
public static void copyToClipBoard(Expr expr, Image image) { string[] s = new string[1]; s[0] = FileUtility.FullPath(expr); DataObject dataObject = new DataObject(); dataObject.SetData(DataFormats.FileDrop, s); dataObject.SetImage(image); Clipboard.SetDataObject(dataObject); }
public static void sendTo(Expr expr, Image image, WindowType windowType) { copyToClipBoard(expr, image); if (windowType == WindowType.WindowTypeQQ) { Process qqProcess = Process.GetProcessesByName("QQ").FirstOrDefault(); if (qqProcess != null) { IntPtr qqHandle = qqProcess.MainWindowHandle; Console.Out.WriteLine(qqProcess.ProcessName); SetForegroundWindow(qqHandle); SendKeys.SendWait("^V"); } else { MessageBox.Show("找不到QQ窗口", "发送失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else if (windowType == WindowType.WindowTypeWeChat) { Process weChatProcess = Process.GetProcessesByName("WeChat").FirstOrDefault(); if (weChatProcess != null) { IntPtr weChatHandle = weChatProcess.MainWindowHandle; Console.Out.WriteLine(weChatProcess.ProcessName); SetForegroundWindow(weChatHandle); SendKeys.SendWait("^V"); } else { MessageBox.Show("找不到微信窗口", "发送失败", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } // Update recently used exprs List<Expr> recentlyUsedExprs = SettingUtility.getRecentlyUsedExprs(); for (int i = 0; i < recentlyUsedExprs.Count; i++) { if (recentlyUsedExprs[i].id == expr.id) { recentlyUsedExprs.Remove(recentlyUsedExprs[i]); } } recentlyUsedExprs.Insert(0, expr); SettingUtility.setRecentlyUsedExprs(recentlyUsedExprs); if (SettingUtility.exprsDisplayer != null) { SettingUtility.exprsDisplayer.loadRecentlyUsedExprs(); } }
public ExprDisplayer() { this.expr = null; this.Click += ExprDisplayer_Click; }
public static String FullUrl(Expr expr) { return Properties.Settings.Default["ExprUrl"] + "/" + expr.filename(); }
public static string FullPath(Expr expr) { return CachePath + "\\" + expr.filename(); }
private void ExprsDisplayer_MouseOnExpr(object sender, Expr expr) { exprPreviewer.Expr = expr; }