void stree_TreeOrderByEvent(object sender, StringEventArgs e) { SequenceTree st = sender as SequenceTree; int index = sts.IndexOf(st); if (e.Message == "down") { if (index < sts.Count - 1) { SequenceTree temp = sts[index]; sts[index] = sts[index + 1]; sts[index + 1] = temp; } } else { if (index > 0) { SequenceTree temp = sts[index]; sts[index] = sts[index - 1]; sts[index - 1] = temp; } } tree.Children.Clear(); foreach (var item in sts) { tree.Children.Add(item); } }
void SequencesView_Loaded(object sender, RoutedEventArgs e) { outLog.Document = fd; string basePath = AppDomain.CurrentDomain.BaseDirectory; foreach (var file in files) { Sequence s = new Sequence(file.Value, basePath + @"data\Source.xml"); s.Name = file.Key; sequences.Add(s); } foreach (var sequence in sequences) { SequenceTree stree = new SequenceTree(); stree.Sequence = sequence; stree.TreeOrderByEvent += stree_TreeOrderByEvent; stree.WaitEventHandler += stree_WaitEventHandler; stree.CommandEventHandler += stree_CommandEventHandler; stree.CompleteEventHandler += stree_CompleteEventHandler; sts.Add(stree); tree.Children.Add(stree); stree.Render(); } //DrawChart(); DrawProtocol(); DrawRealData(); m_TcpMain = new TcpClientAppMain(); m_TcpMain.init(CurrentSequence); m_TcpMain.appdata.CmdIndexStatusEvent += appdata_CmdIndexStatusEvent; m_TcpMain.appdata.RecRt_DataEvent += appdata_RecRt_DataEvent; m_TcpMain.appdata.EquComm_StatusEnvent += appdata_EquComm_StatusEnvent; m_TcpMain.appdata.EquComm_MessageEnvent += appdata_EquComm_MessageEnvent; m_TcpMain.appdata.EquComm_RunStatusEnvent += appdata_EquComm_RunStatusEnvent; }