Пример #1
0
 public RecodeStopEventArgs(RecordTimer e)
 {
     this.timer = e;
 }
Пример #2
0
 void timer_Started(object sender, RecordTimer.RecodeStopEventArgs e)
 {
     buttonStop.Enabled = true;
    
 }
Пример #3
0
        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;
        }
Пример #4
0
 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"));
                 }
                 
             }
         }
     }
 }