Jump to content

virtualTVExample "GetSavedChannelSchedule()" does not work


Recommended Posts

VicMoore
Posted

@LukeIn the VirtualTVExample code, saving the schedule with

private ChannelSchedule GetSavedChannelSchedule(TunerHostInfo tuner, string tunerChannelId)

within the C# PseudoTVTuner.cs code, returns both the schedule and a DirectoryNotFoundException.

exception which causes the function to always return a null;

 
private ChannelSchedule GetSavedChannelSchedule(TunerHostInfo tuner, string tunerChannelId)
        {
            var path = this.GetChannelDataPath(tuner.Id, tunerChannelId);
 
            try
            {
                return this.JsonSerializer.DeserializeFromFile<ChannelSchedule>(path);
            }
            catch (DirectoryNotFoundException)
            {
 
            }
            catch (FileNotFoundException)
            {
 
            }
            catch (Exception ex)
            {
                this.Logger.ErrorException("Error in GetSavedChannelSchedule for {0}", ex, path);
            }
 
            return null;
        }

 

I think the problem is that the code is asynchronous and does not wait for the promise.

Vic

 

 

 

VicMoore
Posted

This function is now working OK. I am sure it was something stupid that I was doing.

Vic

  • Thanks 1

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...