/[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 49 by william, Fri Mar 8 05:20:12 2013 UTC revision 52 by william, Fri Mar 8 07:01:37 2013 UTC
# Line 8  using System.ComponentModel; Line 8  using System.ComponentModel;
8  namespace libxmltv.Core  namespace libxmltv.Core
9  {  {
10      [Serializable]      [Serializable]
11      internal class XMLTVRuntimeInstance : MarshalByRefObject, IXMLTVRuntimeInstance      internal class XMLTVRuntimeInstance : MarshalByRefObject, IXMLTVRuntimeInstance, ISerializer<XMLTVRuntimeInstance>
12      {      {
13          public XMLTVRuntimeInstance(string xmlfile) : this(xmlfile, null) { }          public XMLTVRuntimeInstance(string xmlfile) { CreateInstance(xmlfile); }
14          public XMLTVRuntimeInstance(string xmlfile, EventHandler<CancelEventArgs> t) { CreateInstance(xmlfile,t); }          //public XMLTVRuntimeInstance(string xmlfile) : this(xmlfile, null) { }
15          private void CreateInstance(string xmlfile, EventHandler<CancelEventArgs> t)          //public XMLTVRuntimeInstance(string xmlfile, EventHandler<CancelEventArgs> t) { CreateInstance(xmlfile,t); }
16            private void CreateInstance(string xmlfile)
17          {          {
18              CancelEvent = t;              //CancelEvent = t;
19              using (XMLTVInstance instance = new XMLTVInstance(xmlfile, this))              using (XMLTVInstance instance = new XMLTVInstance(xmlfile, this))
20              {              {
21              }              }
# Line 32  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          internal IXMLTVSerializer<IXMLTVRuntimeInstance> Serializer          public IXMLTVSerializer<XMLTVRuntimeInstance> Serializer
37          {          {
38              get              get
39              {              {
40                  return new XMLTVSerializer<IXMLTVRuntimeInstance>(this);                  ///* 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()
# Line 47  namespace libxmltv.Core Line 51  namespace libxmltv.Core
51          //public bool IsDisposing { get; private set; }          //public bool IsDisposing { get; private set; }
52    
53    
54          private event EventHandler<CancelEventArgs> CancelEvent = null;          //private event EventHandler<CancelEventArgs> CancelEvent = null;
55    
56          public bool IsAborting          public bool IsAborting
57          {          {
58              get              get
59              {              {
60                  if (CancelEvent != null)                  //if (CancelEvent != null)
61                  {                  //{
62                      CancelEventArgs e = new CancelEventArgs();                  //    CancelEventArgs e = new CancelEventArgs();
63                      CancelEvent.Invoke(this, e);                  //    CancelEvent.Invoke(this, e);
64                      if (e.Cancel)                  //    if (e.Cancel)
65                      {                  //    {
66                          xmltv_logger.Log.Verbose.Debug.WriteLine("Detected Instance abort event...");                  //        xmltv_logger.Log.Verbose.Debug.WriteLine("Detected Instance abort event...");
67                      }                  //    }
68                      return e.Cancel;                  //    return e.Cancel;
69                  }                  //}
70                    //return false;
71                  return false;                  return false;
72              }              }
73          }          }

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

  ViewVC Help
Powered by ViewVC 1.1.22