public RecodeStopEventArgs(RecordTimer e) { this.timer = e; }
void timer_Started(object sender, RecordTimer.RecodeStopEventArgs e) { buttonStop.Enabled = true; }
void timer_Stoped(object sender, RecordTimer.RecodeStopEventArgs e) { buttonStop.Enabled = false; lock (this.timers) { this.timers.Remove(e.timer); } this.Invoke(new MethodInvoker( delegate { this.treeViewFiles.Nodes.RemoveByKey(e.timer.Key); })); XmlDocument old = new XmlDocument(); old.Load(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"old.xml")); foreach (XmlNode node in old.DocumentElement.ChildNodes) { if (node.InnerXml == e.timer._node.InnerXml) { old.DocumentElement.RemoveChild(node); old.Save(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"old.xml")); break; } } checkPoint = DateTime.Now; }
public void AddNew(XmlDocument document,bool loadfromhistory) { if (document.DocumentElement.Name == "tv-program-info" && document.DocumentElement.Attributes["version"] != null && document.DocumentElement.Attributes["version"].Value == "1.0") { foreach (XmlNode programNode in document.DocumentElement.ChildNodes) { if (programNode.Name == "program") { RecordTimer timer = new RecordTimer(programNode); timer.Stoped += new EventHandler<RecordTimer.RecodeStopEventArgs>(timer_Stoped); timer.Started += new EventHandler<RecordTimer.RecodeStopEventArgs>(timer_Started); lock (this.timers) { this.timers.Add(timer); } timer.Start(); treeViewFiles.Invoke((MethodInvoker)delegate { treeViewFiles.Nodes.Add(timer.Key, timer.ToString()); }); if (!loadfromhistory) { XmlDocument old = new XmlDocument(); old.Load(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"old.xml")); XmlElement element = old.CreateElement("program"); element.InnerXml = programNode.InnerXml; old.DocumentElement.AppendChild(element); old.Save(Path.Combine(AppDomain.CurrentDomain.BaseDirectory,"old.xml")); } } } } }