/[xmltv_parser]/trunk/libxmltv/Core/XMLTVRuntimeInstance.cs
ViewVC logotype

Diff of /trunk/libxmltv/Core/XMLTVRuntimeInstance.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 45 by william, Fri Mar 8 03:41:18 2013 UTC revision 52 by william, Fri Mar 8 07:01:37 2013 UTC
# Line 3  using System.Collections.Generic; Line 3  using System.Collections.Generic;
3  using System.Linq;  using System.Linq;
4  using System.Text;  using System.Text;
5  using libxmltv.Interfaces;  using libxmltv.Interfaces;
6    using System.ComponentModel;
7    
8  namespace libxmltv.Core  namespace libxmltv.Core
9  {  {
10      internal class XMLTVRuntimeInstance : MarshalByRefObject, IXMLTVRuntimeInstance      [Serializable]
11        internal class XMLTVRuntimeInstance : MarshalByRefObject, IXMLTVRuntimeInstance, ISerializer<XMLTVRuntimeInstance>
12      {      {
13          public XMLTVRuntimeInstance(string xmlfile) { CreateInstance(xmlfile); }          public XMLTVRuntimeInstance(string xmlfile) { CreateInstance(xmlfile); }
14          private void CreateInstance(string xmlfile)          //public XMLTVRuntimeInstance(string xmlfile) : this(xmlfile, null) { }
15            //public XMLTVRuntimeInstance(string xmlfile, EventHandler<CancelEventArgs> t) { CreateInstance(xmlfile,t); }
16            private void CreateInstance(string xmlfile)
17          {          {
18              using (Instance = new XMLTVInstance(xmlfile, this))              //CancelEvent = t;
19                using (XMLTVInstance instance = new XMLTVInstance(xmlfile, this))
20              {              {
21              }              }
22          }          }
23          internal XMLTVInstance Instance { get; private set; }  
24            //internal XMLTVInstance Instance { get; private set; }
25    
26          #region IXMLTV_LOADER members          #region IXMLTV_LOADER members
27          public System.IO.FileInfo XmlFile { get; set; }          public System.IO.FileInfo XmlFile { get; set; }
28          public System.Xml.Linq.XDocument XmlDoc { get; set; }          public string XmlDoc { get; set; }
29          #endregion          #endregion
30          #region IXMLTV_PARSER Members          #region IXMLTV_PARSER Members
31          public IXMLTVSource Source { get; set; }          public IXMLTVSource Source { get; set; }
# Line 27  namespace libxmltv.Core Line 33  namespace libxmltv.Core
33          public Dictionary<int, IXMLTVProgram> Programs { get; set; }          public Dictionary<int, IXMLTVProgram> Programs { get; set; }
34          #endregion            #endregion  
35            
36            public IXMLTVSerializer<XMLTVRuntimeInstance> Serializer
37            {
38                get
39                {
40                    ///* We have to set CancelEvent to null, before returning a new instance of the serializer otherwise all subscribers to the event will have to be marked as serializeable.
41                    //   Most subscribers will be of type: System.Windows.Forms which is not marked as serializable and will fail to serialize. */
42                    //if (CancelEvent != null) { CancelEvent = null; }
43                    return new XMLTVSerializer<XMLTVRuntimeInstance>(this);
44                }
45            }
46          //public void Dispose()          //public void Dispose()
47          //{          //{
48          //    IsDisposing = true;          //    IsDisposing = true;
49          //    //throw new NotImplementedException();          //    //throw new NotImplementedException();
50          //}          //}
51          public bool IsDisposing { get; private set; }          //public bool IsDisposing { get; private set; }
52    
53    
54            //private event EventHandler<CancelEventArgs> CancelEvent = null;
55    
56            public bool IsAborting
57            {
58                get
59                {
60                    //if (CancelEvent != null)
61                    //{
62                    //    CancelEventArgs e = new CancelEventArgs();
63                    //    CancelEvent.Invoke(this, e);
64                    //    if (e.Cancel)
65                    //    {
66                    //        xmltv_logger.Log.Verbose.Debug.WriteLine("Detected Instance abort event...");
67                    //    }
68                    //    return e.Cancel;
69                    //}
70                    //return false;
71                    return false;
72                }
73            }
74    
75    
76      }      }
77    
78      internal class XMLTVInstance : IDisposable      internal class XMLTVInstance : IDisposable

Legend:
Removed from v.45  
changed lines
  Added in v.52

  ViewVC Help
Powered by ViewVC 1.1.22