10 |
[Serializable] |
[Serializable] |
11 |
internal class XMLTVRuntimeInstance : MarshalByRefObject, IXMLTVRuntimeInstance, ISerializer<XMLTVRuntimeInstance> |
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 |
} |
} |
35 |
|
|
36 |
public IXMLTVSerializer<XMLTVRuntimeInstance> Serializer |
public IXMLTVSerializer<XMLTVRuntimeInstance> Serializer |
37 |
{ |
{ |
38 |
get { return new XMLTVSerializer<XMLTVRuntimeInstance>(this); } |
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 |
//{ |
//{ |
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 |
} |
} |