本文整理汇总了C#中TvDatabase.TvBusinessLayer.AddSchedule方法的典型用法代码示例。如果您正苦于以下问题:C# TvBusinessLayer.AddSchedule方法的具体用法?C# TvBusinessLayer.AddSchedule怎么用?C# TvBusinessLayer.AddSchedule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TvDatabase.TvBusinessLayer
的用法示例。
在下文中一共展示了TvBusinessLayer.AddSchedule方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: handleCommand
public override void handleCommand(string command, string[] arguments, ref TvControl.IUser me)
{
//TvEngine.PowerScheduler.WaitableTimer tveps;
TvBusinessLayer layer = new TvBusinessLayer();
int schedtype = (int) TvDatabase.ScheduleRecordingType.Once;
Schedule newSchedule;
DateTime startTime = new DateTime(2009, 11, 23, 10, 00, 00);
DateTime endTime = new DateTime(2009,11,23,11,15,00);
try
{
newSchedule = layer.AddSchedule(32, "Marcel test", startTime, endTime, schedtype);
newSchedule.Persist();
Console.WriteLine("Schedule added: " + newSchedule.IdChannel.ToString());
}
catch (Exception ex)
{
Console.WriteLine(ex.Message);
}
}
示例2: Importxmlfile
//.........这里部分代码省略.........
progressbar((int)PB_action.STOP, ref PB_Import, (int)PB_part.TV_Channels);
}
if (schedules == true)
{
// begin import schedule settings
progressbar((int)PB_action.START, ref PB_Import, (int)PB_part.TV_Schedules);
textoutput("Importing schedule settings");
XmlNodeList scheduleList = doc.SelectNodes("/tvserver/schedules/schedule");
scheduleCount = 0;
foreach (XmlNode nodeSchedule in scheduleList)
{
string programName = nodeSchedule.Attributes["ProgramName"].Value;
string displayname = nodeSchedule.Attributes["DisplayName"].Value;
int idSchedule = Int32.Parse(nodeSchedule.Attributes["IdSchedule"].Value);
try
{
scheduleCount++;
Channel tmpchannel = mygetChannelbyName(displayname);
if (tmpchannel == null)
{
textoutput("<RED>Channel " + displayname + " (Display: " + displayname + ") not found for schedule " + idSchedule);
}
int idChannel = tmpchannel.IdChannel;
DateTime startTime = DateTime.ParseExact(nodeSchedule.Attributes["StartTime"].Value, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
DateTime endTime = DateTime.ParseExact(nodeSchedule.Attributes["EndTime"].Value, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
int scheduletype = Int32.Parse(nodeSchedule.Attributes["ScheduleType"].Value);
Schedule schedule = layer.AddSchedule(idChannel, programName, startTime, endTime, scheduletype);
schedule.ScheduleType = scheduletype; //do not remove! AddSchedule(idChannel, programName, startTime,endTime,scheduletype); does not work!
schedule.KeepDate = DateTime.ParseExact(nodeSchedule.Attributes["KeepDate"].Value, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
schedule.PreRecordInterval = Int32.Parse(nodeSchedule.Attributes["PreRecordInterval"].Value);
schedule.PostRecordInterval = Int32.Parse(nodeSchedule.Attributes["PostRecordInterval"].Value);
schedule.Priority = Int32.Parse(nodeSchedule.Attributes["Priority"].Value);
schedule.Quality = Int32.Parse(nodeSchedule.Attributes["Quality"].Value);
schedule.Directory = nodeSchedule.Attributes["Directory"].Value;
schedule.KeepMethod = Int32.Parse(nodeSchedule.Attributes["KeepMethod"].Value);
schedule.MaxAirings = Int32.Parse(nodeSchedule.Attributes["MaxAirings"].Value);
schedule.RecommendedCard = 0;
try
{
int unmappedcard = Int32.Parse(nodeSchedule.Attributes["RecommendedCard"].Value);
if (xmlcardassigned[unmappedcard] == true) //cardmapping does exist
{
schedule.RecommendedCard = cardmaptranslator[unmappedcard];
}
}
catch// do nothing in case of error: recommended card = 0
{
}
schedule.Series = (GetNodeAttribute(nodeSchedule, "Series", "False") == "True");
schedule.BitRateMode = (VIDEOENCODER_BITRATE_MODE)Int32.Parse(GetNodeAttribute(nodeSchedule, "BitRateMode", "-1"));
schedule.QualityType = (QualityType)Int32.Parse(GetNodeAttribute(nodeSchedule, "QualityType", "1"));
try
{
schedule.Canceled = DateTime.ParseExact(nodeSchedule.Attributes["Canceled"].Value, "yyyy-MM-dd HH:mm:ss", CultureInfo.InvariantCulture);
}
catch
{
示例3: importButton_Click
//.........这里部分代码省略.........
Channel channel = channels[0];
if (!channel.GroupNames.Contains(group.GroupName))
{
RadioGroupMap map = new RadioGroupMap(group.IdGroup, channel.IdChannel, sortOrder);
map.Persist();
}
else
{
foreach (RadioGroupMap map in channel.ReferringRadioGroupMap())
{
if (map.IdGroup == group.IdGroup)
{
map.SortOrder = sortOrder;
map.Persist();
break;
}
}
}
}
}
}
catch (Exception exg)
{
Log.Error("Radio Channels: Failed to add group - {0}", exg.Message);
}
}
}
if (scheduleList != null && importschedules)
{
// Import schedules
foreach (XmlNode nodeSchedule in scheduleList)
{
try
{
int idChannel = -1;
string programName = nodeSchedule.Attributes["ProgramName"].Value;
string channel = nodeSchedule.Attributes["ChannelName"].Value;
if (!string.IsNullOrEmpty(channel))
{
IList<Channel> channels = layer.GetChannelsByName(channel);
if (channels != null && channels.Count > 0)
{
idChannel = channels[0].IdChannel;
}
}
DateTime startTime = DateTime.ParseExact(nodeSchedule.Attributes["StartTime"].Value, "yyyy-M-d H:m:s",
CultureInfo.InvariantCulture);
DateTime endTime = DateTime.ParseExact(nodeSchedule.Attributes["EndTime"].Value, "yyyy-M-d H:m:s",
CultureInfo.InvariantCulture);
int scheduleType = Int32.Parse(nodeSchedule.Attributes["ScheduleType"].Value);
Schedule schedule = layer.AddSchedule(idChannel, programName, startTime, endTime, scheduleType);
schedule.ScheduleType = scheduleType;
schedule.KeepDate = DateTime.ParseExact(nodeSchedule.Attributes["KeepDate"].Value, "yyyy-M-d H:m:s",
CultureInfo.InvariantCulture);
schedule.PreRecordInterval = Int32.Parse(nodeSchedule.Attributes["PreRecordInterval"].Value);
schedule.PostRecordInterval = Int32.Parse(nodeSchedule.Attributes["PostRecordInterval"].Value);
schedule.Priority = Int32.Parse(nodeSchedule.Attributes["Priority"].Value);
schedule.Quality = Int32.Parse(nodeSchedule.Attributes["Quality"].Value);
schedule.Directory = nodeSchedule.Attributes["Directory"].Value;
schedule.KeepMethod = Int32.Parse(nodeSchedule.Attributes["KeepMethod"].Value);
schedule.MaxAirings = Int32.Parse(nodeSchedule.Attributes["MaxAirings"].Value);
schedule.ScheduleType = Int32.Parse(nodeSchedule.Attributes["ScheduleType"].Value);
schedule.Series = (GetNodeAttribute(nodeSchedule, "Series", "False") == "True");
if (idChannel > -1)
{
schedule.Persist();
scheduleCount++;
Log.Info("TvChannels: Added schedule: {0} on channel: {1}", programName, channel);
}
else
Log.Info("TvChannels: Skipped schedule: {0} because the channel was unknown: {1}", programName, channel);
}
catch (Exception ex)
{
Log.Error("TvChannels: Failed to add schedule - {0}", ex.Message);
}
}
}
dlg.Close();
Log.Info(
"TvChannels: Imported {0} channels, {1} tv channel groups, {2} radio channel groups and {3} schedules",
channelCount, tvChannelGroupCount, radioChannelGroupCount, scheduleCount);
MessageBox.Show(
String.Format("Imported {0} channels, {1} tv channel groups, {2} radio channel groups and {3} schedules",
channelCount, tvChannelGroupCount, radioChannelGroupCount, scheduleCount));
}
catch (Exception ex)
{
MessageBox.Show(this, "Error while importing:\n\n" + ex + " " + ex.StackTrace);
}
finally
{
dlg.Close();
OnSectionActivated();
}
}