本文整理汇总了C#中TvControl.User类的典型用法代码示例。如果您正苦于以下问题:C# User类的具体用法?C# User怎么用?C# User使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
User类属于TvControl命名空间,在下文中一共展示了User类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TvNotifyManager
public TvNotifyManager()
{
using (Settings xmlreader = new MPSettings())
{
_enableRecNotification = xmlreader.GetValueAsBool("mytv", "enableRecNotifier", false);
_preNotifyConfig = xmlreader.GetValueAsInt("mytv", "notifyTVBefore", 300);
}
_busy = false;
_timer = new Timer();
_timer.Stop();
// check every 15 seconds for notifies
_dummyuser = new User();
_dummyuser.IsAdmin = false;
_dummyuser.Name = "Free channel checker";
_timer.Interval = 15000;
_timer.Enabled = true;
// Execute TvNotifyManager in a separate thread, so that it doesn't block the Main UI Render thread when Tvservice connection died
new Thread(() =>
{
_timer.Tick += new EventHandler(_timer_Tick);
}
) {Name = "TvNotifyManager"}.Start();
_notifiedRecordings = new ArrayList();
}
示例2: Connect
public bool Connect(string hostname)
{
try
{
string connStr;
string provider;
if (!GetDatabaseConnectionString(out connStr, out provider))
return false;
RemoteControl.HostName = hostname;
Gentle.Framework.ProviderFactory.SetDefaultProviderConnectionString(connStr);
me = new User();
me.IsAdmin = true;
groups = ChannelGroup.ListAll();
radioGroups = RadioChannelGroup.ListAll();
channels = Channel.ListAll();
mappings = GroupMap.ListAll();
cards = Card.ListAll();
}
catch (Exception ex)
{
lastException = ex;
RemoteControl.Clear();
return false;
}
return true;
}
示例3: VirtualCard
/// <summary>
/// Initializes a new instance of the <see cref="VirtualCard"/> class.
/// </summary>
/// <param name="user">The user.</param>
/// <param name="server">The server.</param>
/// <param name="recordingFormat">The recording format.</param>
public VirtualCard(User user, string server, int recordingFormat)
{
_user = user;
_server = server;
_recordingFolder = String.Format(@"{0}\Team MediaPortal\MediaPortal TV Server\recordings",
Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData));
_recordingFormat = recordingFormat;
}
示例4: AddUserOwnerTest
public void AddUserOwnerTest()
{
ITvCardContext ctx = new TvCardContext();
IUser u1 = new User("u1", false, 1);
ctx.Add(u1);
Assert.IsTrue(ctx.IsOwner(u1), "user is not owner");
}
示例5: AddNewUserTest
public void AddNewUserTest()
{
ITvCardContext ctx = new TvCardContext();
IUser u1 = new User("u1", false, 1);
ctx.Add(u1);
Assert.IsTrue(UserExists(ctx, u1), "user is not found");
}
示例6: RemoveUserTest
public void RemoveUserTest()
{
ITvCardContext ctx = new TvCardContext();
IUser u1 = new User("u1", false, 1);
ctx.Add(u1);
ctx.Remove(u1);
Assert.AreEqual(0, ctx.Users.Length, "user count wrong");
Assert.IsFalse(UserExists(ctx, u1), "user is found");
Assert.IsTrue(((TvCardContext)ctx).UsersOld.Contains(u1), "user not found in history");
}
示例7: AddAlreadyExistingUserTest
public void AddAlreadyExistingUserTest()
{
ITvCardContext ctx = new TvCardContext();
IUser u1 = new User("u1", false, 1);
ctx.Add(u1);
User u2 = new User("u1", false, 2);
ctx.Add(u2);
Assert.AreEqual(1, ctx.Users.Length, "user count wrong");
Assert.IsTrue(UserExists(ctx, u2), "user is not found");
}
示例8: AddAnotherUserNotOwnerTest
public void AddAnotherUserNotOwnerTest()
{
ITvCardContext ctx = new TvCardContext();
IUser u1 = new User("u1", false, 1);
ctx.Add(u1);
User u2 = new User("u2", false, 2);
ctx.Add(u2);
Assert.IsTrue(ctx.IsOwner(u1), "user is owner");
Assert.IsFalse(ctx.IsOwner(u2), "user is not owner");
}
示例9: ShowDialog
public new DialogResult ShowDialog(IWin32Window owner)
{
Text = "Preview " + _channel.DisplayName;
TvServer server = new TvServer();
IUser user = new User("setuptv", false);
TvResult result = server.StartTimeShifting(ref user, _channel.IdChannel, out _card);
if (result != TvResult.Succeeded)
{
MessageBox.Show("Preview failed:" + result);
Close();
return DialogResult.None;
}
Log.Info("preview {0} user:{1} {2} {3} {4}", _channel.DisplayName, user.CardId, user.SubChannel, user.Name,
_card.TimeShiftFileName);
_player = new Player();
_player.Play(_card.TimeShiftFileName, this);
return base.ShowDialog(owner);
}
示例10: RecordingDetail
/// <summary>
/// constructor
/// </summary>
/// <param name="schedule">Schedule of this recording</param>
/// <param name="channel">Channel on which the recording is done</param>
/// <param name="endTime">Date/Time the recording should start without pre-record interval</param>
/// <param name="endTime">Date/Time the recording should stop with post record interval</param>
/// <param name="isSerie">Is serie recording</param>
///
///
public RecordingDetail(Schedule schedule, Channel channel, DateTime endTime, bool isSerie)
{
_user = new User();
User.Name = string.Format("scheduler{0}", schedule.IdSchedule);
User.CardId = -1;
User.SubChannel = -1;
User.IsAdmin = true;
_schedule = schedule;
_channel = channel;
_endTime = endTime;
_program = null;
_isSerie = isSerie;
DateTime startTime = DateTime.MinValue;
if (isSerie)
{
DateTime now = DateTime.Now.AddMinutes(schedule.PreRecordInterval);
startTime = new DateTime(now.Year, now.Month, now.Day, schedule.StartTime.Hour, schedule.StartTime.Minute, 0);
}
else
{
startTime = schedule.StartTime;
}
_program = schedule.ReferencedChannel().GetProgramAt(startTime);
//no program? then treat this as a manual recording
if (_program == null)
{
_program = new TvDatabase.Program(0, DateTime.Now, endTime, "manual", "", "",
TvDatabase.Program.ProgramState.None,
System.Data.SqlTypes.SqlDateTime.MinValue.Value, string.Empty, string.Empty,
string.Empty, string.Empty, -1, string.Empty, 0);
}
}
示例11: SwitchTVServerToChannel
private VirtualCard SwitchTVServerToChannel(string userName, int channelId)
{
// validate arguments
if (String.IsNullOrEmpty(userName))
{
Log.Error("Called SwitchTVServerToChannel with empty userName");
return null;
}
// create the user
Log.Debug("Starting timeshifting with username {0} on channel id {1}", userName, channelId);
IUser currentUser = new User();
currentUser.Name = userName;
currentUser.IsAdmin = true;
// actually start timeshifting
VirtualCard tvCard;
Log.Debug("Starting timeshifting");
TvResult result = _tvControl.StartTimeShifting(ref currentUser, channelId, out tvCard);
Log.Trace("Tried to start timeshifting, result {0}", result);
// make sure result is correct and return
if (result != TvResult.Succeeded)
{
Log.Error("Starting timeshifting failed with result {0}", result);
return null;
}
Log.Debug("Timeshifting succeeded");
if (tvCard == null)
{
Log.Error("Couldn't get virtual card");
return null;
}
return tvCard;
}
示例12: GetChannelState
public WebChannelState GetChannelState(int channelId, string userName)
{
IUser user = new User();
user.Name = userName;
TvControl.ChannelState state = _tvControl.GetChannelState(channelId, user);
Log.Trace("ChannelId: " + channelId + ", State: " + state.ToString());
return state.ToWebChannelState(channelId);
}
示例13: StopTimeShifting
public bool StopTimeShifting(int idChannel,int idCard,string userName)
{
if (!ConnectToDatabase())
return false;
User user = new User(userName, false, idCard);
user.IdChannel = idChannel;
return RemoteControl.Instance.StopTimeShifting(ref user);
}
示例14: StartTimeShifting
public WebTvResult StartTimeShifting(int idChannel)
{
if (!ConnectToDatabase())
return new WebTvResult();
VirtualCard vcard;
TvResult result;
string rtspURL="";
string timeshiftFilename="";
User me = new User(System.Guid.NewGuid().ToString("B"),false);
try
{
result = RemoteControl.Instance.StartTimeShifting(ref me, idChannel, out vcard);
}
catch (Exception)
{
return new WebTvResult();
}
if (result == TvResult.Succeeded)
{
me.IdChannel = idChannel;
me.CardId = vcard.Id;
rtspURL = vcard.RTSPUrl;
timeshiftFilename=vcard.TimeShiftFileName;
}
return new WebTvResult((int)result,rtspURL,timeshiftFilename,me);
}
示例15: SendHeartBeat
public void SendHeartBeat(int idChannel,int idCard,string userName)
{
if (!ConnectToDatabase())
return;
User user = new User(userName, false, idCard);
user.IdChannel = idChannel;
try
{
RemoteControl.Instance.HeartBeat(user);
}
catch (Exception)
{
}
}