12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273 |
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using System.Windows;
- using System.Windows.Controls;
- using System.Windows.Data;
- using System.Windows.Documents;
- using System.Windows.Forms.VisualStyles;
- using System.Windows.Input;
- using System.Windows.Media;
- using System.Windows.Media.Imaging;
- using System.Windows.Navigation;
- using System.Windows.Shapes;
- using System.Windows.Threading;
- using DevExpress.Xpf.Editors.Helpers;
- namespace SAGA.MBI.WinView.TraceView
- {
- /// <summary>
- /// WinTraceView.xaml 的交互逻辑
- /// </summary>
- public partial class WinTraceView : INotifyPropertyChanged
- {
- public WinTraceView()
- {
- InitializeComponent();
- this.DataContext = this;
- }
- private string m_TraceText;
- public event PropertyChangedEventHandler PropertyChanged;
- public string TraceText
- {
- get { return m_TraceText; }
- set
- {
- m_TraceText = value;
- PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("TraceText"));
- }
- }
- public void Refrush(string txt)
- {
- TraceText = txt;
- DoEvents();
- }
- public void DoEvents()
- {
- var frame = new DispatcherFrame();
- Dispatcher.CurrentDispatcher.BeginInvoke(DispatcherPriority.Background,
- new DispatcherOperationCallback(ExitFrames), frame);
- try
- {
- Dispatcher.PushFrame(frame);
- }
- catch (InvalidOperationException)
- {
- }
- }
- private object ExitFrames(object frame)
- {
- ((DispatcherFrame)frame).Continue = false;
- return null;
- }
- }
- }
|