Author: gibman_dk
Date: 2011-12-07 12:04:14 +0100 (Wed, 07 Dec 2011)
New Revision: 28334
Modified:
branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/CardManagement/CardAllocation/AdvancedCardAllocation.cs
branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/CardManagement/CardAllocation/AdvancedCardAllocationTicket.cs
branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/CardManagement/CardHandler/CardTuner.cs
branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/CardManagement/CardReservation/CardReservationHelper.cs
branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/CardManagement/CardReservation/Implementations/CardReservationBase.cs
branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/CardManagement/CardReservation/Implementations/CardReservationRec.cs
branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/Epg/EpgCard.cs
branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/Epg/EpgGrabber.cs
branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/Scheduler/Scheduler.cs
branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/Service1.cs
branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/Services/ServiceManager.cs
branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/TCPEventServer/TCPServer.cs
branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/TvCardContext.cs
Log:
servicemanager now impl. as a singleton with idisposable for closing wcf services.
Modified: branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/CardManagement/CardAllocation/AdvancedCardAllocation.cs
===================================================================
--- branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/CardManagement/CardAllocation/AdvancedCardAllocation.cs 2011-12-06 12:32:43 UTC (rev 28333)
+++ branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/CardManagement/CardAllocation/AdvancedCardAllocation.cs 2011-12-07 11:04:14 UTC (rev 28334)
@@ -59,7 +59,7 @@
bool isCardPresent = false;
try
{
- if (ServiceManager.InternalControllerService.CardPresent(cardId))
+ if (ServiceManager.Instance.InternalControllerService.CardPresent(cardId))
{
isCardPresent = true;
}
Modified: branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/CardManagement/CardAllocation/AdvancedCardAllocationTicket.cs
===================================================================
--- branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/CardManagement/CardAllocation/AdvancedCardAllocationTicket.cs 2011-12-06 12:32:43 UTC (rev 28333)
+++ branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/CardManagement/CardAllocation/AdvancedCardAllocationTicket.cs 2011-12-07 11:04:14 UTC (rev 28334)
@@ -50,9 +50,9 @@
{
if (LogEnabled && cardDetail.Card.idCard > 0)
{
- if (ServiceManager.InternalControllerService != null)
+ if (ServiceManager.Instance.InternalControllerService != null)
{
- var card = ServiceManager.InternalControllerService.CardCollection[cardDetail.Card.idCard];
+ var card = ServiceManager.Instance.InternalControllerService.CardCollection[cardDetail.Card.idCard];
Log.Info("Controller: card:{0} type:{1} users: {2}", cardDetail.Card.idCard, card.Type, cardDetail.NumberOfOtherUsers);
}
}
@@ -60,7 +60,7 @@
public ICollection<CardDetail> UpdateFreeCardsForChannelBasedOnTicket(ICollection<CardDetail> cardsAvailable, IUser user, out TvResult result)
{
- IDictionary<int, ITvCardHandler> cards = ServiceManager.InternalControllerService.CardCollection;
+ IDictionary<int, ITvCardHandler> cards = ServiceManager.Instance.InternalControllerService.CardCollection;
var cardetails = new List<CardDetail>();
foreach (CardDetail cardDetail in cardsAvailable)
Modified: branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/CardManagement/CardHandler/CardTuner.cs
===================================================================
--- branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/CardManagement/CardHandler/CardTuner.cs 2011-12-06 12:32:43 UTC (rev 28333)
+++ branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/CardManagement/CardHandler/CardTuner.cs 2011-12-07 11:04:14 UTC (rev 28334)
@@ -456,14 +456,14 @@
// if we are stopping an on-going recording/schedule (=admin), we have to make sure that we remove the schedule also.
{
Log.Debug("user is scheduler: {0}", users[i].Name);
- int recScheduleId = ServiceManager.InternalControllerService.GetRecordingSchedule(users[i].CardId,
+ int recScheduleId = ServiceManager.Instance.InternalControllerService.GetRecordingSchedule(users[i].CardId,
users[i].IdChannel);
if (recScheduleId > 0)
{
Schedule schedule = ScheduleManagement.GetSchedule(recScheduleId);
Log.Info("removing schedule with id: {0}", schedule.id_Schedule);
- ServiceManager.InternalControllerService.StopRecordingSchedule(schedule.id_Schedule);
+ ServiceManager.Instance.InternalControllerService.StopRecordingSchedule(schedule.id_Schedule);
ScheduleManagement.DeleteSchedule(schedule.id_Schedule);
}
}
Modified: branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/CardManagement/CardReservation/CardReservationHelper.cs
===================================================================
--- branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/CardManagement/CardReservation/CardReservationHelper.cs 2011-12-06 12:32:43 UTC (rev 28333)
+++ branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/CardManagement/CardReservation/CardReservationHelper.cs 2011-12-07 11:04:14 UTC (rev 28334)
@@ -389,7 +389,7 @@
public static ICollection<ICardTuneReservationTicket> RequestCardReservations(IUser user, IEnumerable<CardDetail> availCardsForReservation, ICardReservation cardResImpl, IEnumerable<int> ignoreCards)
{
ICollection<ICardTuneReservationTicket> tickets = new List<ICardTuneReservationTicket>();
- IDictionary<int, ITvCardHandler> cards = ServiceManager.InternalControllerService.CardCollection;
+ IDictionary<int, ITvCardHandler> cards = ServiceManager.Instance.InternalControllerService.CardCollection;
foreach (CardDetail cardDetail in availCardsForReservation)
{
Modified: branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/CardManagement/CardReservation/Implementations/CardReservationBase.cs
===================================================================
--- branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/CardManagement/CardReservation/Implementations/CardReservationBase.cs 2011-12-06 12:32:43 UTC (rev 28333)
+++ branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/CardManagement/CardReservation/Implementations/CardReservationBase.cs 2011-12-07 11:04:14 UTC (rev 28334)
@@ -141,7 +141,7 @@
{
if (OnStartCardTune != null)
{
- if (!ServiceManager.InternalControllerService.IsTimeShifting(ref user))
+ if (!ServiceManager.Instance.InternalControllerService.IsTimeShifting(ref user))
{
CleanTimeShiftFiles(tvcard.DataBaseCard.timeshiftingFolder,
String.Format("live{0}-{1}.ts", user.CardId, user.SubChannel));
Modified: branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/CardManagement/CardReservation/Implementations/CardReservationRec.cs
===================================================================
--- branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/CardManagement/CardReservation/Implementations/CardReservationRec.cs 2011-12-06 12:32:43 UTC (rev 28333)
+++ branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/CardManagement/CardReservation/Implementations/CardReservationRec.cs 2011-12-07 11:04:14 UTC (rev 28334)
@@ -56,12 +56,12 @@
protected override bool OnStartTune(IUser user)
{
bool startRecordingOnDisc = true;
- if (ServiceManager.InternalControllerService.SupportsSubChannels(_cardInfo.Card.idCard) == false)
+ if (ServiceManager.Instance.InternalControllerService.SupportsSubChannels(_cardInfo.Card.idCard) == false)
{
Log.Write("Scheduler : record, now start timeshift");
string timeshiftFileName = String.Format(@"{0}\live{1}-{2}.ts", _cardInfo.Card.timeshiftingFolder, _cardInfo.Id,
user.SubChannel);
- startRecordingOnDisc = (TvResult.Succeeded == ServiceManager.InternalControllerService.StartTimeShifting(ref user, ref timeshiftFileName));
+ startRecordingOnDisc = (TvResult.Succeeded == ServiceManager.Instance.InternalControllerService.StartTimeShifting(ref user, ref timeshiftFileName));
}
if (startRecordingOnDisc)
@@ -70,7 +70,7 @@
_recDetail.CardInfo = _cardInfo;
Log.Write("Scheduler : record to {0}", _recDetail.FileName);
string fileName = _recDetail.FileName;
- startRecordingOnDisc = (TvResult.Succeeded == ServiceManager.InternalControllerService.StartRecording(ref user, ref fileName));
+ startRecordingOnDisc = (TvResult.Succeeded == ServiceManager.Instance.InternalControllerService.StartRecording(ref user, ref fileName));
if (startRecordingOnDisc)
{
@@ -78,9 +78,9 @@
_recDetail.RecordingStartDateTime = DateTime.Now;
}
}
- if (!startRecordingOnDisc && ServiceManager.InternalControllerService.AllCardsIdle)
+ if (!startRecordingOnDisc && ServiceManager.Instance.InternalControllerService.AllCardsIdle)
{
- ServiceManager.InternalControllerService.EpgGrabberEnabled = true;
+ ServiceManager.Instance.InternalControllerService.EpgGrabberEnabled = true;
}
return startRecordingOnDisc;
Modified: branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/Epg/EpgCard.cs
===================================================================
--- branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/Epg/EpgCard.cs 2011-12-06 12:32:43 UTC (rev 28333)
+++ branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/Epg/EpgCard.cs 2011-12-07 11:04:14 UTC (rev 28334)
@@ -103,7 +103,7 @@
_epgTimer.Interval = 30000;
_epgTimer.Elapsed += _epgTimer_Elapsed;
_eventHandler = controller_OnTvServerEvent;
- _dbUpdater = new EpgDBUpdater(ServiceManager.InternalControllerService, "IdleEpgGrabber", true);
+ _dbUpdater = new EpgDBUpdater(ServiceManager.Instance.InternalControllerService, "IdleEpgGrabber", true);
}
#endregion
@@ -156,7 +156,7 @@
return;
}
_state = EpgState.Idle;
- ServiceManager.InternalControllerService.StopGrabbingEpg(_user);
+ ServiceManager.Instance.InternalControllerService.StopGrabbingEpg(_user);
_user.CardId = -1;
_currentTransponder.InUse = false;
return;
@@ -190,13 +190,13 @@
{
Log.Epg("Epg: card:{0} OnEpgReceived but card is not idle", _user.CardId);
_state = EpgState.Idle;
- ServiceManager.InternalControllerService.StopGrabbingEpg(_user);
+ ServiceManager.Instance.InternalControllerService.StopGrabbingEpg(_user);
_user.CardId = -1;
_currentTransponder.InUse = false;
return 0;
}
- List<EpgChannel> epg = ServiceManager.InternalControllerService.Epg(_user.CardId) ?? new List<EpgChannel>();
+ List<EpgChannel> epg = ServiceManager.Instance.InternalControllerService.Epg(_user.CardId) ?? new List<EpgChannel>();
//did we receive epg info?
if (epg.Count == 0)
{
@@ -206,8 +206,8 @@
_currentTransponder.OnTimeOut();
_state = EpgState.Idle;
- ServiceManager.InternalControllerService.StopGrabbingEpg(_user);
- ServiceManager.InternalControllerService.PauseCard(_user);
+ ServiceManager.Instance.InternalControllerService.StopGrabbingEpg(_user);
+ ServiceManager.Instance.InternalControllerService.PauseCard(_user);
_user.CardId = -1;
_currentTransponder.InUse = false;
return 0;
@@ -238,7 +238,7 @@
/// </summary>
public void GrabEpg()
{
- ServiceManager.InternalControllerService.OnTvServerEvent += _eventHandler;
+ ServiceManager.Instance.InternalControllerService.OnTvServerEvent += _eventHandler;
Setting s = SettingsManagement.GetSetting("timeoutEPG", "10");
if (Int32.TryParse(s.value, out _epgTimeOut) == false)
{
@@ -276,13 +276,13 @@
if (_user.CardId >= 0)
{
Log.Epg("EpgCard: card: {0} stop grabbing", _user.CardId);
- ServiceManager.InternalControllerService.StopGrabbingEpg(_user);
+ ServiceManager.Instance.InternalControllerService.StopGrabbingEpg(_user);
}
if (_currentTransponder != null)
{
_currentTransponder.InUse = false;
}
- ServiceManager.InternalControllerService.OnTvServerEvent -= _eventHandler;
+ ServiceManager.Instance.InternalControllerService.OnTvServerEvent -= _eventHandler;
_epgTimer.Enabled = false;
_isRunning = false;
}
@@ -325,7 +325,7 @@
{
Log.Epg("EpgCard: Canceled epg, card is not idle:{0}", _user.CardId);
}
- ServiceManager.InternalControllerService.AbortEPGGrabbing(_user.CardId);
+ ServiceManager.Instance.InternalControllerService.AbortEPGGrabbing(_user.CardId);
_state = EpgState.Idle;
_user.CardId = -1;
_currentTransponder.InUse = false;
@@ -339,7 +339,7 @@
{
//epg grabber timed out. Update database and go back to idle mode
Log.Epg("EpgCard: card: {0} timeout after {1} mins", _user.CardId, ts.TotalMinutes);
- ServiceManager.InternalControllerService.AbortEPGGrabbing(_user.CardId);
+ ServiceManager.Instance.InternalControllerService.AbortEPGGrabbing(_user.CardId);
Log.Epg("EpgCard: Aborted epg grab");
}
else
@@ -383,7 +383,7 @@
Log.Error("Epg: invalid card");
return false;
}
- if (ServiceManager.InternalControllerService == null)
+ if (ServiceManager.Instance.InternalControllerService == null)
{
Log.Error("Epg: invalid tvcontroller");
return false;
@@ -394,7 +394,7 @@
return false;
}
//remove following check to enable multi-card epg grabbing (still beta)
- if (ServiceManager.InternalControllerService.AllCardsIdle == false)
+ if (ServiceManager.Instance.InternalControllerService.AllCardsIdle == false)
{
Log.Epg("Epg: card:{0} cards are not idle", card.idCard);
return false;
@@ -405,7 +405,7 @@
ATSCChannel atscChannel = tuning as ATSCChannel;
if (atscChannel != null)
{
- if (ServiceManager.InternalControllerService.Type(card.idCard) == CardType.Atsc)
+ if (ServiceManager.Instance.InternalControllerService.Type(card.idCard) == CardType.Atsc)
{
if (IsCardIdle(card.idCard) == false)
{
@@ -422,7 +422,7 @@
DVBCChannel dvbcChannel = tuning as DVBCChannel;
if (dvbcChannel != null)
{
- if (ServiceManager.InternalControllerService.Type(card.idCard) == CardType.DvbC)
+ if (ServiceManager.Instance.InternalControllerService.Type(card.idCard) == CardType.DvbC)
{
if (IsCardIdle(card.idCard) == false)
{
@@ -439,7 +439,7 @@
DVBSChannel dvbsChannel = tuning as DVBSChannel;
if (dvbsChannel != null)
{
- if (ServiceManager.InternalControllerService.Type(card.idCard) == CardType.DvbS)
+ if (ServiceManager.Instance.InternalControllerService.Type(card.idCard) == CardType.DvbS)
{
if (IsCardIdle(card.idCard) == false)
{
@@ -456,7 +456,7 @@
DVBTChannel dvbtChannel = tuning as DVBTChannel;
if (dvbtChannel != null)
{
- if (ServiceManager.InternalControllerService.Type(card.idCard) == CardType.DvbT)
+ if (ServiceManager.Instance.InternalControllerService.Type(card.idCard) == CardType.DvbT)
{
if (IsCardIdle(card.idCard) == false)
{
@@ -474,7 +474,7 @@
DVBIPChannel dvbipChannel = tuning as DVBIPChannel;
if (dvbipChannel != null)
{
- if (ServiceManager.InternalControllerService.Type(card.idCard) == CardType.DvbIP)
+ if (ServiceManager.Instance.InternalControllerService.Type(card.idCard) == CardType.DvbIP)
{
if (IsCardIdle(card.idCard) == false)
{
@@ -499,7 +499,7 @@
{
_user.CardId = card.idCard;
ITvCardHandler cardHandler;
- if (ServiceManager.InternalControllerService.CardCollection.TryGetValue(card.idCard, out cardHandler))
+ if (ServiceManager.Instance.InternalControllerService.CardCollection.TryGetValue(card.idCard, out cardHandler))
{
ICardTuneReservationTicket ticket = null;
try
@@ -509,14 +509,14 @@
if (ticket != null)
{
- result = ServiceManager.InternalControllerService.Tune(ref _user, tuning, channel.idChannel, ticket);
+ result = ServiceManager.Instance.InternalControllerService.Tune(ref _user, tuning, channel.idChannel, ticket);
if (result == TvResult.Succeeded)
{
- if (!_isRunning || false == ServiceManager.InternalControllerService.GrabEpg(this, card.idCard))
+ if (!_isRunning || false == ServiceManager.Instance.InternalControllerService.GrabEpg(this, card.idCard))
{
if (!_isRunning)
Log.Epg("Tuning finished but EpgGrabber no longer enabled");
- ServiceManager.InternalControllerService.StopGrabbingEpg(_user);
+ ServiceManager.Instance.InternalControllerService.StopGrabbingEpg(_user);
_user.CardId = -1;
Log.Epg("Epg: card:{0} could not start dvbt grabbing", card.idCard);
return false;
@@ -596,13 +596,13 @@
}
if (_state != EpgState.Idle && _user.CardId >= 0)
{
- ServiceManager.InternalControllerService.StopGrabbingEpg(_user);
- ServiceManager.InternalControllerService.PauseCard(_user);
+ ServiceManager.Instance.InternalControllerService.StopGrabbingEpg(_user);
+ ServiceManager.Instance.InternalControllerService.PauseCard(_user);
}
_currentTransponder.InUse = false;
_state = EpgState.Idle;
_user.CardId = -1;
- ServiceManager.InternalControllerService.Fire(this, new TvServerEventArgs(TvServerEventType.ProgramUpdated));
+ ServiceManager.Instance.InternalControllerService.Fire(this, new TvServerEventArgs(TvServerEventType.ProgramUpdated));
}
}
@@ -623,16 +623,16 @@
return false;
IUser user = new User();
user.CardId = cardId;
- if (ServiceManager.InternalControllerService.IsRecording(ref user))
+ if (ServiceManager.Instance.InternalControllerService.IsRecording(ref user))
return false;
- if (ServiceManager.InternalControllerService.IsTimeShifting(ref user))
+ if (ServiceManager.Instance.InternalControllerService.IsTimeShifting(ref user))
return false;
- if (ServiceManager.InternalControllerService.IsScanning(user.CardId))
+ if (ServiceManager.Instance.InternalControllerService.IsScanning(user.CardId))
return false;
IUser cardUser;
- if (ServiceManager.InternalControllerService.IsCardInUse(cardId, out cardUser))
+ if (ServiceManager.Instance.InternalControllerService.IsCardInUse(cardId, out cardUser))
return false;
- if (ServiceManager.InternalControllerService.IsCardInUse(user.CardId, out cardUser))
+ if (ServiceManager.Instance.InternalControllerService.IsCardInUse(user.CardId, out cardUser))
{
if (cardUser != null)
{
@@ -654,14 +654,14 @@
return false;
if (user.CardId < 0)
return false;
- if (ServiceManager.InternalControllerService.IsRecording(ref _user))
+ if (ServiceManager.Instance.InternalControllerService.IsRecording(ref _user))
return false;
- if (ServiceManager.InternalControllerService.IsTimeShifting(ref _user))
+ if (ServiceManager.Instance.InternalControllerService.IsTimeShifting(ref _user))
return false;
- if (ServiceManager.InternalControllerService.IsScanning(user.CardId))
+ if (ServiceManager.Instance.InternalControllerService.IsScanning(user.CardId))
return false;
IUser cardUser;
- if (ServiceManager.InternalControllerService.IsCardInUse(user.CardId, out cardUser))
+ if (ServiceManager.Instance.InternalControllerService.IsCardInUse(user.CardId, out cardUser))
{
if (cardUser != null)
{
Modified: branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/Epg/EpgGrabber.cs
===================================================================
--- branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/Epg/EpgGrabber.cs 2011-12-06 12:32:43 UTC (rev 28333)
+++ branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/Epg/EpgGrabber.cs 2011-12-07 11:04:14 UTC (rev 28334)
@@ -141,7 +141,7 @@
try
{
RemoteControl.HostName = SettingsManagement.GetSetting("hostname").value;
- if (!ServiceManager.InternalControllerService.CardPresent(card.idCard))
+ if (!ServiceManager.Instance.InternalControllerService.CardPresent(card.idCard))
{
continue;
}
@@ -242,7 +242,7 @@
}
catch (InvalidOperationException) {}
- if (ServiceManager.InternalControllerService.AllCardsIdle == false)
+ if (ServiceManager.Instance.InternalControllerService.AllCardsIdle == false)
return;
foreach (EpgCard card in _epgCards)
{
@@ -251,7 +251,7 @@
return;
if (card.IsGrabbing)
continue;
- if (ServiceManager.InternalControllerService.AllCardsIdle == false)
+ if (ServiceManager.Instance.InternalControllerService.AllCardsIdle == false)
return;
GrabEpgOnCard(card);
}
@@ -272,7 +272,7 @@
/// <param name="epgCard">The epg card.</param>
private void GrabEpgOnCard(EpgCard epgCard)
{
- CardType type = ServiceManager.InternalControllerService.Type(epgCard.Card.idCard);
+ CardType type = ServiceManager.Instance.InternalControllerService.Type(epgCard.Card.idCard);
//skip analog and webstream cards
if (type == CardType.Analog || type == CardType.RadioWebStream)
return;
Modified: branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/Scheduler/Scheduler.cs
===================================================================
--- branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/Scheduler/Scheduler.cs 2011-12-06 12:32:43 UTC (rev 28333)
+++ branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/Scheduler/Scheduler.cs 2011-12-07 11:04:14 UTC (rev 28334)
@@ -414,7 +414,7 @@
private void CheckAndDeleteOrphanedRecordings()
{
- List<IVirtualCard> vCards = ServiceManager.InternalControllerService.GetAllRecordingCards();
+ List<IVirtualCard> vCards = ServiceManager.Instance.InternalControllerService.GetAllRecordingCards();
foreach (VirtualCard vCard in vCards)
{
@@ -575,7 +575,7 @@
IUser user = newRecording.User;
- ServiceManager.InternalControllerService.Fire(this,
+ ServiceManager.Instance.InternalControllerService.Fire(this,
new TvServerEventArgs(TvServerEventType.ScheduleDeleted,
new VirtualCard(user), (User)user,
newRecording.Schedule.Entity.id_Schedule,
@@ -984,13 +984,13 @@
user, out tvResult);
CardReservationHelper.CancelCardReservationsExceedingMaxConcurrentTickets(tickets, cards,
- ServiceManager.InternalControllerService.CardCollection);
+ ServiceManager.Instance.InternalControllerService.CardCollection);
CardReservationHelper.CancelCardReservationsNotFoundInFreeCards(cardsForReservation, tickets,
cards,
- ServiceManager.InternalControllerService.CardCollection);
+ ServiceManager.Instance.InternalControllerService.CardCollection);
int maxCards = GetMaxCards(cards);
CardReservationHelper.CancelCardReservationsBasedOnMaxCardsLimit(tickets, cards, maxCards,
- ServiceManager.InternalControllerService.CardCollection);
+ ServiceManager.Instance.InternalControllerService.CardCollection);
UpdateCardsIterated(cardsIterated, cards); //keep track of what cards have been iterated here.
if (cards != null && cards.Count > 0)
@@ -1008,7 +1008,7 @@
}
finally
{
- CardReservationHelper.CancelAllCardReservations(tickets, ServiceManager.InternalControllerService.CardCollection);
+ CardReservationHelper.CancelAllCardReservations(tickets, ServiceManager.Instance.InternalControllerService.CardCollection);
}
}
@@ -1049,7 +1049,7 @@
private void StartRecordOnFreeCard(RecordingDetail recDetail, ref IUser user)
{
var cardAllocationStatic = new AdvancedCardAllocationStatic();
- List<CardDetail> freeCardsForReservation = cardAllocationStatic.GetFreeCardsForChannel(ServiceManager.InternalControllerService.CardCollection, recDetail.Channel, ref user);
+ List<CardDetail> freeCardsForReservation = cardAllocationStatic.GetFreeCardsForChannel(ServiceManager.Instance.InternalControllerService.CardCollection, recDetail.Channel, ref user);
StartRecordOnCard(recDetail, ref user, freeCardsForReservation);
}
@@ -1074,7 +1074,7 @@
{
ITvCardHandler tvCardHandler;
CardDetail cardInfo = GetCardInfoForRecording(cards);
- if (ServiceManager.InternalControllerService.CardCollection.TryGetValue(cardInfo.Id, out tvCardHandler))
+ if (ServiceManager.Instance.InternalControllerService.CardCollection.TryGetValue(cardInfo.Id, out tvCardHandler))
{
ICardTuneReservationTicket ticket = GetTicketByCardId(tickets, cardInfo.Id);
@@ -1128,7 +1128,7 @@
try
{
cardInfo = GetCardInfoForRecording(cards);
- if (ServiceManager.InternalControllerService.CardCollection.TryGetValue(cardInfo.Id, out tvCardHandler))
+ if (ServiceManager.Instance.InternalControllerService.CardCollection.TryGetValue(cardInfo.Id, out tvCardHandler))
{
ICardTuneReservationTicket ticket = GetTicketByCardId(tickets, cardInfo.Id);
if (ticket != null)
@@ -1209,18 +1209,18 @@
{
IUser user = recording.User;
- if (recording.CardInfo != null && ServiceManager.InternalControllerService.SupportsSubChannels(recording.CardInfo.Id) == false)
+ if (recording.CardInfo != null && ServiceManager.Instance.InternalControllerService.SupportsSubChannels(recording.CardInfo.Id) == false)
{
- ServiceManager.InternalControllerService.StopTimeShifting(ref user);
+ ServiceManager.Instance.InternalControllerService.StopTimeShifting(ref user);
}
Log.Write("Scheduler: stop failed record {0} {1}-{2} {3}", recording.Channel.displayName,
recording.RecordingStartDateTime,
recording.EndTime, recording.Schedule.Entity.programName);
- if (ServiceManager.InternalControllerService.IsRecording(ref user))
+ if (ServiceManager.Instance.InternalControllerService.IsRecording(ref user))
{
- if (ServiceManager.InternalControllerService.StopRecording(ref user))
+ if (ServiceManager.Instance.InternalControllerService.StopRecording(ref user))
{
ResetRecordingStateOnProgram(recording);
if (recording.Recording != null)
@@ -1314,7 +1314,7 @@
Log.Write(
"Scheduler : kicking user:{0}",
timeshiftingUser.Name);
- ServiceManager.InternalControllerService.StopTimeShifting(ref timeshiftingUser, TvStoppedReason.RecordingStarted);
+ ServiceManager.Instance.InternalControllerService.StopTimeShifting(ref timeshiftingUser, TvStoppedReason.RecordingStarted);
Log.Write(
"Scheduler : card is tuned to the same transponder but not free. record on card:{0} priority:{1}, kicking user:{2}",
@@ -1355,7 +1355,7 @@
Log.Write(
"Scheduler : card is tuned to the same transponder but not free. record on card:{0} priority:{1}, kicking user:{2}",
cardDetail.Id, cardDetail.Card.priority, timeshiftingUser.Name);
- ServiceManager.InternalControllerService.StopTimeShifting(ref timeshiftingUser, TvStoppedReason.RecordingStarted);
+ ServiceManager.Instance.InternalControllerService.StopTimeShifting(ref timeshiftingUser, TvStoppedReason.RecordingStarted);
cardInfo = cardDetail;
break;
@@ -1366,7 +1366,7 @@
private void RecordingFailedNotification(RecordingDetail recDetail)
{
IUser user = recDetail.User;
- ServiceManager.InternalControllerService.Fire(this,
+ ServiceManager.Instance.InternalControllerService.Fire(this,
new TvServerEventArgs(TvServerEventType.RecordingFailed, new VirtualCard(user), (User)user));
}
@@ -1374,7 +1374,7 @@
private void RecordingStartedNotification(RecordingDetail recDetail)
{
IUser user = recDetail.User;
- ServiceManager.InternalControllerService.Fire(this,
+ ServiceManager.Instance.InternalControllerService.Fire(this,
new TvServerEventArgs(TvServerEventType.RecordingStarted, new VirtualCard(user), (User)user,
recDetail.Schedule.Entity.id_Schedule, recDetail.Recording.idRecording));
}
@@ -1382,7 +1382,7 @@
private void StartRecordingNotification(RecordingDetail recDetail)
{
IUser user = recDetail.User;
- ServiceManager.InternalControllerService.Fire(this,
+ ServiceManager.Instance.InternalControllerService.Fire(this,
new TvServerEventArgs(TvServerEventType.StartRecording, new VirtualCard(user), (User)user,
recDetail.Schedule.Entity.id_Schedule, -1));
}
@@ -1402,13 +1402,13 @@
private bool StartRecordingOnDisc(RecordingDetail recDetail, ref IUser user, CardDetail cardInfo, ICardTuneReservationTicket ticket, CardReservationRec cardResImpl)
{
bool startRecordingOnDisc = false;
- ServiceManager.InternalControllerService.EpgGrabberEnabled = false;
+ ServiceManager.Instance.InternalControllerService.EpgGrabberEnabled = false;
Log.Write("Scheduler : record, first tune to channel");
cardResImpl.CardInfo = cardInfo;
cardResImpl.RecDetail = recDetail;
- TvResult tuneResult = ServiceManager.InternalControllerService.Tune(ref user, cardInfo.TuningDetail, recDetail.Channel.idChannel, ticket, cardResImpl);
+ TvResult tuneResult = ServiceManager.Instance.InternalControllerService.Tune(ref user, cardInfo.TuningDetail, recDetail.Channel.idChannel, ticket, cardResImpl);
startRecordingOnDisc = (tuneResult == TvResult.Succeeded);
return startRecordingOnDisc;
@@ -1447,16 +1447,16 @@
{
IUser user = recDetail.User;
int cardId = user.CardId;
- if (ServiceManager.InternalControllerService.SupportsQualityControl(cardId))
+ if (ServiceManager.Instance.InternalControllerService.SupportsQualityControl(cardId))
{
- if (recDetail.Schedule.BitRateMode != VIDEOENCODER_BITRATE_MODE.NotSet && ServiceManager.InternalControllerService.SupportsBitRate(cardId))
+ if (recDetail.Schedule.BitRateMode != VIDEOENCODER_BITRATE_MODE.NotSet && ServiceManager.Instance.InternalControllerService.SupportsBitRate(cardId))
{
- ServiceManager.InternalControllerService.SetQualityType(cardId, recDetail.Schedule.QualityType);
+ ServiceManager.Instance.InternalControllerService.SetQualityType(cardId, recDetail.Schedule.QualityType);
}
- if (recDetail.Schedule.QualityType != QualityType.NotSet && ServiceManager.InternalControllerService.SupportsBitRateModes(cardId) &&
- ServiceManager.InternalControllerService.SupportsPeakBitRateMode(cardId))
+ if (recDetail.Schedule.QualityType != QualityType.NotSet && ServiceManager.Instance.InternalControllerService.SupportsBitRateModes(cardId) &&
+ ServiceManager.Instance.InternalControllerService.SupportsPeakBitRateMode(cardId))
{
- ServiceManager.InternalControllerService.SetBitRateMode(cardId, recDetail.Schedule.BitRateMode);
+ ServiceManager.Instance.InternalControllerService.SetBitRateMode(cardId, recDetail.Schedule.BitRateMode);
}
}
}
@@ -1503,16 +1503,16 @@
{
IUser user = recording.User;
- if (ServiceManager.InternalControllerService.SupportsSubChannels(recording.CardInfo.Id) == false)
+ if (ServiceManager.Instance.InternalControllerService.SupportsSubChannels(recording.CardInfo.Id) == false)
{
- ServiceManager.InternalControllerService.StopTimeShifting(ref user);
+ ServiceManager.Instance.InternalControllerService.StopTimeShifting(ref user);
}
Log.Write("Scheduler: stop record {0} {1}-{2} {3}", recording.Channel.displayName,
recording.RecordingStartDateTime,
recording.EndTime, recording.Schedule.Entity.programName);
- if (ServiceManager.InternalControllerService.StopRecording(ref user))
+ if (ServiceManager.Instance.InternalControllerService.StopRecording(ref user))
{
ResetRecordingState(recording);
ResetRecordingStateOnProgram(recording);
@@ -1553,7 +1553,7 @@
private void RecordingEndedNotification(RecordingDetail recording)
{
IUser user = recording.User;
- ServiceManager.InternalControllerService.Fire(this,
+ ServiceManager.Instance.InternalControllerService.Fire(this,
new TvServerEventArgs(TvServerEventType.RecordingEnded, new VirtualCard(user), (User)user,
recording.Schedule.Entity.id_Schedule, recording.Recording.idRecording));
}
@@ -1579,7 +1579,7 @@
{
_episodeManagement.OnScheduleEnded(recording.FileName, recording.Schedule.Entity, recording.Program.Entity);
}
- ServiceManager.InternalControllerService.Fire(this,
+ ServiceManager.Instance.InternalControllerService.Fire(this,
new TvServerEventArgs(TvServerEventType.ScheduleDeleted, new VirtualCard(user), (User)user,
recording.Schedule.Entity.id_Schedule, -1));
// now we can safely delete it
Modified: branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/Service1.cs
===================================================================
--- branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/Service1.cs 2011-12-06 12:32:43 UTC (rev 28333)
+++ branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/Service1.cs 2011-12-07 11:04:14 UTC (rev 28334)
@@ -173,7 +173,7 @@
{
if (_tvServiceThread == null)
{
- StarServiceManager();
+ //System.Diagnostics.Debugger.Launch();
if (!(args != null && args.Length > 0 && args[0] == "/DEBUG"))
{
@@ -206,15 +206,8 @@
Thread.Sleep(20);
}
}
- }
+ }
- private void StarServiceManager()
- {
- System.Diagnostics.Debugger.Launch();
- ServiceManager.Start();
- //ThreadPool.QueueUserWorkItem(delegate { debug(); });
- }
-
private void debug()
{
/*var rnd = new Random();
@@ -399,14 +392,8 @@
_tvServiceThread.Join();
Log.Write("tvService thread aborted.");
_tvServiceThread = null;
- }
- CloseWCFservice();
- }
-
- private void CloseWCFservice()
- {
- ServiceManager.Close();
- }
+ }
+ }
}
public class TvServiceThread : IPowerEventHandler
@@ -733,7 +720,7 @@
powerStatus == PowerEventType.ResumeSuspend
)
{
- ServiceManager.InternalControllerService.ExecutePendingDeletions();
+ ServiceManager.Instance.InternalControllerService.ExecutePendingDeletions();
// call Recording-folder cleanup, just in case we have empty folders.
}
@@ -749,13 +736,13 @@
{
case PowerEventType.StandBy:
case PowerEventType.Suspend:
- ServiceManager.InternalControllerService.OnSuspend();
+ ServiceManager.Instance.InternalControllerService.OnSuspend();
return true;
case PowerEventType.QuerySuspend:
case PowerEventType.QueryStandBy:
- if (ServiceManager.InternalControllerService != null)
+ if (ServiceManager.Instance.InternalControllerService != null)
{
- if (ServiceManager.InternalControllerService.CanSuspend)
+ if (ServiceManager.Instance.InternalControllerService.CanSuspend)
{
//OnStop();
return true;
@@ -765,13 +752,13 @@
return true;
case PowerEventType.QuerySuspendFailed:
case PowerEventType.QueryStandByFailed:
- if (!ServiceManager.InternalControllerService.EpgGrabberEnabled)
- ServiceManager.InternalControllerService.EpgGrabberEnabled = true;
+ if (!ServiceManager.Instance.InternalControllerService.EpgGrabberEnabled)
+ ServiceManager.Instance.InternalControllerService.EpgGrabberEnabled = true;
return true;
case PowerEventType.ResumeAutomatic:
case PowerEventType.ResumeCritical:
case PowerEventType.ResumeSuspend:
- ServiceManager.InternalControllerService.OnResume();
+ ServiceManager.Instance.InternalControllerService.OnResume();
return true;
}
return true;
@@ -800,13 +787,13 @@
Type interfaceType = tvServerPluginCommunciation.GetServiceInterfaceForContractType;
object instance = tvServerPluginCommunciation.GetServiceInstance;
- ServiceManager.AddService(interfaceType, instance);
+ ServiceManager.Instance.AddService(interfaceType, instance);
}
Log.Info("TV Service: Plugin: {0} started", plugin.Name);
try
{
- plugin.Start(ServiceManager.InternalControllerService);
+ plugin.Start(ServiceManager.Instance.InternalControllerService);
_pluginsStarted.Add(plugin);
}
catch (Exception ex)
@@ -874,9 +861,9 @@
{
_InitializedEvent.Reset();
}
- if (ServiceManager.InternalControllerService != null)
+ if (ServiceManager.Instance.InternalControllerService != null)
{
- ServiceManager.InternalControllerService.DeInit();
+ ServiceManager.Instance.InternalControllerService.DeInit();
}
StopPlugins();
@@ -915,7 +902,7 @@
_powerEventThread.Name = "PowerEventThread";
_powerEventThread.IsBackground = true;
_powerEventThread.Start();
- ServiceManager.InternalControllerService.Init();
+ ServiceManager.Instance.InternalControllerService.Init();
StartPlugins();
Modified: branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/Services/ServiceManager.cs
===================================================================
--- branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/Services/ServiceManager.cs 2011-12-06 12:32:43 UTC (rev 28333)
+++ branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/Services/ServiceManager.cs 2011-12-07 11:04:14 UTC (rev 28334)
@@ -11,57 +11,44 @@
namespace Mediaportal.TV.Server.TVService.Services
{
- public static class ServiceManager
+ public class ServiceManager : IDisposable
{
- private static readonly object _lock = new object();
- private static readonly IDictionary<Type, ServiceHost> _serviceHosts = new Dictionary<Type, ServiceHost>();
-
- /*private static readonly IDictionary<Type, Type> _staticMappings = new Dictionary<Type, Type>
+ private readonly object _lock = new object();
+ private readonly IDictionary<Type, ServiceHost> _serviceHosts = new Dictionary<Type, ServiceHost>();
+ private static ServiceManager _instance;
+ private static readonly object _instanceLock = new object();
+
+
+ public static ServiceManager Instance
+ {
+ get
+ {
+ lock (_instanceLock)
{
- {typeof (IProgramCategoryService), typeof (ProgramCategoryService)},
- {typeof (IConflictService), typeof (ConflictService)},
- {typeof (ICardService), typeof (CardService)},
- {typeof (ICanceledScheduleService), typeof (CanceledScheduleService)},
- {typeof (IChannelService), typeof (ChannelService)},
- {typeof (IProgramService), typeof(ProgramService)},
- {typeof (ISettingService), typeof(SettingService)},
- {typeof (IRecordingService), typeof(RecordingService)},
- {typeof (IScheduleService), typeof(ScheduleService)},
- {typeof (IChannelGroupService), typeof(ChannelGroupService)},
- {typeof (IControllerService), typeof(TvControllerService)}
- }; */
+ if (_instance == null)
+ {
+ _instance = new ServiceManager();
+ }
+ return _instance;
+ }
+ }
+ }
- static ServiceManager()
+ ~ServiceManager()
{
- /*GlobalServiceProvider.Add<IProgramCategoryService>(new ProgramCategoryService());
- GlobalServiceProvider.Add<IConflictService>(new ConflictService());
- GlobalServiceProvider.Add<ICardService>(new CardService());
- GlobalServiceProvider.Add<ICanceledScheduleService>(new CanceledScheduleService());
- GlobalServiceProvider.Add<IChannelService>(new ChannelService());
- GlobalServiceProvider.Add<IProgramService>(new ProgramService());
- GlobalServiceProvider.Add<ISettingService>(new SettingService());
- GlobalServiceProvider.Add<IRecordingService>(new RecordingService());
- GlobalServiceProvider.Add<IScheduleService>(new ScheduleService());
- GlobalServiceProvider.Add<IChannelGroupService>(new ChannelGroupService());
- GlobalServiceProvider.Add<IControllerService>(new TvControllerService());
- GlobalServiceProvider.Add<IInternalControllerService>(new TvController());
- */
+ lock (_instanceLock)
+ {
+ Dispose();
+ }
+ }
- /*
- AddService<IProgramCategoryService, ProgramCategoryService>(typeof(ProgramCategoryService));
- AddService<IConflictService, ConflictService>(typeof(ConflictService));
- AddService<ICardService, CardService>(typeof(CardService));
- AddService<ICanceledScheduleService, CanceledScheduleService>(typeof(CanceledScheduleService));
- AddService<IChannelService, ChannelService>(typeof(ChannelService));
- AddService<IProgramService, ProgramService>(typeof(ProgramService));
- AddService<ISettingService, SettingService>(typeof(SettingService));
- AddService<IRecordingService, RecordingService>(typeof(RecordingService));
- AddService<IScheduleService, ScheduleService>(typeof(ScheduleService));
- AddService<IChannelGroupService, ChannelGroupService>(typeof(ChannelGroupService));
- AddService<IControllerService, TvControllerService>(typeof(TvControllerService));
- AddService<IInternalControllerService, TvController>(typeof(TvController));
- */
+ private ServiceManager ()
+ {
+ Init();
+ }
+ private void Init()
+ {
AddService<IProgramCategoryService, ProgramCategoryService>();
AddService<IConflictService, ConflictService>();
AddService<ICardService, CardService>();
@@ -77,67 +64,67 @@
GlobalServiceProvider.Add<IInternalControllerService>(new TvController());
}
- public static ICardService CardService
+ public ICardService CardService
{
get { return GlobalServiceProvider.Get<ICardService>(); }
}
- public static IProgramService ProgramService
+ public IProgramService ProgramService
{
get { return GlobalServiceProvider.Get<IProgramService>(); }
}
- public static IRecordingService RecordingService
+ public IRecordingService RecordingService
{
get { return GlobalServiceProvider.Get<IRecordingService>(); }
}
- public static IChannelGroupService ChannelGroupService
+ public IChannelGroupService ChannelGroupService
{
get { return GlobalServiceProvider.Get<IChannelGroupService>(); }
}
- public static ISettingService SettingService
+ public ISettingService SettingService
{
get { return GlobalServiceProvider.Get<ISettingService>(); }
}
- public static IChannelService ChannelService
+ public IChannelService ChannelService
{
get { return GlobalServiceProvider.Get<IChannelService>(); }
}
- public static IScheduleService ScheduleService
+ public IScheduleService ScheduleService
{
get { return GlobalServiceProvider.Get<IScheduleService>(); }
}
- public static ICanceledScheduleService CanceledScheduleService
+ public ICanceledScheduleService CanceledScheduleService
{
get { return GlobalServiceProvider.Get<ICanceledScheduleService>(); }
}
- public static IConflictService ConflictService
+ public IConflictService ConflictService
{
get { return GlobalServiceProvider.Get<IConflictService>(); }
}
- public static IProgramCategoryService ProgramCategoryService
+ public IProgramCategoryService ProgramCategoryService
{
get { return GlobalServiceProvider.Get<IProgramCategoryService>(); }
}
- public static IInternalControllerService InternalControllerService
+ public IInternalControllerService InternalControllerService
{
get { return GlobalServiceProvider.Get<IInternalControllerService>(); }
}
- public static IControllerService ControllerService
+ public IControllerService ControllerService
{
get { return GlobalServiceProvider.Get<IControllerService>(); }
}
- public static void AddService(Type interfaceType, object instance)
+ public void AddService(Type interfaceType, object instance)
{
Type implType = instance.GetType();
ThrowExceptionIfServiceAlreadyAdded(implType);
@@ -149,7 +136,7 @@
}
}
- public static void AddService<I, T>() where T : class, I, new()
+ public void AddService<I, T>() where T : class, I, new()
{
Type implType = typeof (T);
Type interfaceType = typeof (I);
@@ -163,7 +150,7 @@
}
}
- private static ServiceHost GetServiceHost(Type interfaceType, Type implType)
+ private ServiceHost GetServiceHost(Type interfaceType, Type implType)
{
var serviceHost = new ServiceHost(implType);
BasicHttpBinding defaultBinding = ServiceHelper.GetBinding();
@@ -200,7 +187,7 @@
return serviceHost;
}
- private static void ThrowExceptionIfServiceAlreadyAdded(Type contractType)
+ private void ThrowExceptionIfServiceAlreadyAdded(Type contractType)
{
lock (_lock)
{
@@ -210,41 +197,16 @@
}
}
}
+
- public static void Start ()
- {
- //System.Diagnostics.Debugger.Launch();
- /*Log.Debug("starting WCF service.");
- try
- {
- if (_serviceHosts.Count > 0)
- {
- Close();
- }
+
+ #region Implementation of IDisposable
- foreach (var type in _staticMappings)
- {
- Type implementationType = type.Value;
- ThrowExceptionIfServiceAlreadyAdded(implementationType);
-
- var serviceHost = new ServiceHost(implementationType);
- serviceHost.Open();
-
- lock (_lock)
- {
- _serviceHosts.Add(implementationType, serviceHost);
- }
- }
- }
- catch (Exception ex)
- {
- Log.Error("could not start WCF service", ex);
- throw;
- }
- Log.Debug("WCF service(s) started."); */
- }
-
- public static void Close()
+ /// <summary>
+ /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
+ /// </summary>
+ /// <filterpriority>2</filterpriority>
+ public void Dispose()
{
Log.Debug("closing WCF service.");
try
@@ -266,6 +228,6 @@
}
}
-
+ #endregion
}
}
Modified: branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/TCPEventServer/TCPServer.cs
===================================================================
--- branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/TCPEventServer/TCPServer.cs 2011-12-06 12:32:43 UTC (rev 28333)
+++ branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/TCPEventServer/TCPServer.cs 2011-12-07 11:04:14 UTC (rev 28334)
@@ -85,8 +85,8 @@
public void Start()
{
- ServiceManager.InternalControllerService.OnTvServerEvent -= new TvServerEventHandler(_tvController_OnTvServerEvent);
- ServiceManager.InternalControllerService.OnTvServerEvent += new TvServerEventHandler(_tvController_OnTvServerEvent);
+ ServiceManager.Instance.InternalControllerService.OnTvServerEvent -= new TvServerEventHandler(_tvController_OnTvServerEvent);
+ ServiceManager.Instance.InternalControllerService.OnTvServerEvent += new TvServerEventHandler(_tvController_OnTvServerEvent);
_evtTCPCtrl.Reset();
_listenThread = new Thread(new ThreadStart(ListenForClients));
@@ -98,7 +98,7 @@
public void Stop()
{
- ServiceManager.InternalControllerService.OnTvServerEvent -= new TvServerEventHandler(_tvController_OnTvServerEvent);
+ ServiceManager.Instance.InternalControllerService.OnTvServerEvent -= new TvServerEventHandler(_tvController_OnTvServerEvent);
StopHeartbeatThread();
StopClientsNotificationsThread();
@@ -160,14 +160,14 @@
{
byte[] data;
IUser user = new User(tcpClientData.Name, false);
- bool isTimeShifting = ServiceManager.InternalControllerService.IsTimeShifting(ref user);
+ bool isTimeShifting = ServiceManager.Instance.InternalControllerService.IsTimeShifting(ref user);
if (isTimeShifting)
{
tvServerEventArgs.User.ChannelStates = user.ChannelStates;
}
else
{
- tvServerEventArgs.User.ChannelStates = ServiceManager.InternalControllerService.GetAllChannelStatesForIdleUserCached();
+ tvServerEventArgs.User.ChannelStates = ServiceManager.Instance.InternalControllerService.GetAllChannelStatesForIdleUserCached();
}
data = TvServerEventArgsTranslator.ToBinary(tvServerEventArgs);
return data;
Modified: branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/TvCardContext.cs
===================================================================
--- branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/TvCardContext.cs 2011-12-06 12:32:43 UTC (rev 28333)
+++ branches/TVEngine3-Experimental/Mediaportal/TV/Server/TvService/TvCardContext.cs 2011-12-07 11:04:14 UTC (rev 28334)
@@ -427,7 +427,7 @@
ChannelManagement.SaveChannelHistory(history);
}
existingUser.History = null;
- var channelBll = new ChannelBLL(ServiceManager.ProgramService, channel);
+ var channelBll = new ChannelBLL(ServiceManager.Instance.ProgramService, channel);
Program p = channelBll.CurrentProgram;
if (p != null)
{
@@ -462,7 +462,7 @@
Channel channel = ChannelManagement.GetChannel(existingUser.IdChannel);
if (channel != null)
{
- Program p = new ChannelBLL(ServiceManager.ProgramService, channel).CurrentProgram;
+ Program p = new ChannelBLL(ServiceManager.Instance.ProgramService, channel).CurrentProgram;
if (p != null && p.startTime != history.startTime)
{
ChannelManagement.SaveChannelHistory(history);
|