public static FrmClipboard GetForm(string Text) { if (inst == null || inst.IsDisposed) { inst = new FrmClipboard(); } inst.TextToShow = Text; return(inst); }
private void Clipboard_ClipboardChanged(object sender, SharpClipboard.ClipboardChangedEventArgs e) { if (e.ContentType == SharpClipboard.ContentTypes.Text && e.Content.ToString().Trim() != "") { FrmClipboard f = FrmClipboard.GetForm(e.Content.ToString()); f.Show(); } }
private void Clipboard_ClipboardChanged(object sender, SharpClipboard.ClipboardChangedEventArgs e) { try { if (e.ContentType == SharpClipboard.ContentTypes.Text && e.Content.ToString().Trim() != "") { //FrmClipboard f = FrmClipboard.GetForm(e.Content.ToString()).Show(); //f.Invoke(new MethodInvoker(delegate () //{ // f.ShowDialog(); //})); } } catch (Exception ex) { } }
private void Watcher_Created(object sender, FileSystemEventArgs e) { try { DateTime lastWriteTime = File.GetLastWriteTime(e.FullPath); if (lastWriteTime != lastRead) { Thread.Sleep(100); string Content = ""; using (StreamReader sr = new StreamReader(File.Open(e.FullPath, FileMode.Open, FileAccess.Read, FileShare.Read))) { string s = ""; while ((s = sr.ReadLine()) != null) { Content += s + Environment.NewLine; } } lastRead = lastWriteTime; FrmClipboard f = FrmClipboard.GetForm(Content); if (f.IsHandleCreated) { f.Invoke(new MethodInvoker(delegate() { f.ShowDialog(); })); } } } catch (Exception ex) { #if DEBUG using (EventLog eventLog = new EventLog("Application")) { eventLog.Source = "EFTServer"; eventLog.WriteEntry("Watcher_Created : " + ex.Message, EventLogEntryType.Error, 101, 1); } #endif } }