private void MegaLS_OutputDataReceived(object o, DataReceivedEventArgs e) { if (e.Data == null || !_megalsRegex.IsMatch(e.Data)) { return; } _eArgs = new MegaLSEventArgs(); GroupCollection captured = _megalsRegex.Match(e.Data).Groups; _eArgs.Type = (MegaLSFileType)Convert.ToInt32(captured["type"].Value); if (captured["size"].Value != "-") { _eArgs.Size = Convert.ToInt64(captured["size"].Value); } _eArgs.DateTime = new DateTime( Convert.ToInt32(captured["date"].Value.Substring(0, 4)), Convert.ToInt32(captured["date"].Value.Substring(5, 2)), Convert.ToInt32(captured["date"].Value.Substring(8)), Convert.ToInt32(captured["time"].Value.Substring(0, 2)), Convert.ToInt32(captured["time"].Value.Substring(3, 2)), Convert.ToInt32(captured["time"].Value.Substring(6)) ); _eArgs.Name = captured["name"].Value; OnFileInfoReady(this, _eArgs); }
void mega_OnFileInfoReady(object sender, MegaLSEventArgs e) { Dispatcher.BeginInvoke(new Action(delegate { TreeViewItem child = new TreeViewItem(); child.Header = e.Name; treeView.Items.Add(child); outputTextBox.Text += string.Format("\r\n-->{0}--{1}<--", e.Name, e.DateTime.ToString()); }), System.Windows.Threading.DispatcherPriority.ApplicationIdle, null); }