private async void BeginGetPlayInfo() { if (_playInfo != null && _playInfo.ChannelDetailInfo != null && _playInfo.ChannelDetailInfo.ProgramInfos != null) { var historyWatch = await LocalRecentFactory.Instance.GetRecord(_playInfo.ChannelVID); if (historyWatch != null && ChannelUtils.JudgeProgreamIndex(_playInfo.ProgramIndex, historyWatch.ProgramIndex, _playInfo.ChannelDetailInfo)) { _playMessage.StartPosition = historyWatch.Pos; } var vvid = Guid.NewGuid().ToString(); _dacPlayInfo.vvid = vvid; _playMessage.Title = ChannelUtils.CreateChannelTitle(_playInfo.ProgramIndex, _playInfo.ChannelDetailInfo, false); _playInfoFactory.DownLoadDatas(ChannelUtils.CreateChannelId(_playInfo.ProgramIndex, _playInfo.ChannelDetailInfo), vvid); } else { if (PlayErrorAction != null) { PlayErrorAction("无法获取影片播放地址"); } } }
void _playInfoFactory_HttpSucceed(object sender, HttpFactoryArgs <Object> args) { _playMessage.PlayInfos = _playInfoFactory.PlayInfos; _playMessage.HasPreProgram = ChannelUtils.CreatePreviousIndex(_playInfo.ProgramIndex, _playInfo.ChannelDetailInfo) >= 0 ? true : false; _playMessage.HasNextProgram = ChannelUtils.CreateNextIndex(_playInfo.ProgramIndex, _playInfo.ChannelDetailInfo) >= 0 ? true : false; _playMessage.ShareInfo = new PlayShareInfo( ChannelUtils.CreateChannelId(_playInfo.ProgramIndex, _playInfo.ChannelDetailInfo), _playMessage.Title, _playInfo.ChannelDetailInfo.ImageUri); var info = _playInfoFactory.CreatePlayInfo(_playFileType); if (info != null) { _playMessage.CurrentPlayInfo = info; Play(info); if (PlayMessageAction != null) { PlayMessageAction(_playMessage); } } else { if (PlayErrorAction != null) { PlayErrorAction("无法获取影片播放地址"); } } }
protected override void SavePlayHistory(int duration, int position) { var parentId = _playInfo.ChannelDetailInfo.Id; var parentName = _playInfo.ChannelDetailInfo.Title; var image = _playInfo.ChannelDetailInfo.ImageUri; var subId = ChannelUtils.CreateChannelId(_playInfo.ProgramIndex, _playInfo.ChannelDetailInfo); var subName = ChannelUtils.CreateChannelTitle(_playInfo.ProgramIndex, _playInfo.ChannelDetailInfo, true); var index = ChannelUtils.CreateComonIndex(_playInfo.ProgramIndex, _playInfo.ChannelDetailInfo); if (parentId <= 0) { return; } var localInfo = new CloudDataInfo(); localInfo.ProgramIndex = index; localInfo.ImageUri = image; localInfo.Id = parentId; localInfo.Name = parentName; localInfo.SubId = subId; localInfo.SubName = subName; localInfo.VideoType = 3; localInfo.Pos = position; localInfo.Duration = duration; LocalRecentFactory.Instance.InsertLocalRecord(localInfo); }
internal static int Show(ShowConfig !config) { RouteEntry[] in ExHeap routes; RoutingContract.Imp routeConn = ((!)config.routingRef).Acquire(); if (routeConn == null) { Console.WriteLine("Could not initialize routing endpoint."); return(1); } routeConn.RecvReady(); routeConn.SendGetRoutingTable(); routeConn.RecvRoutingTable(out routes); if (routes == null) { throw new Exception("routes is null"); } for (int i = 0; i < routes.Length; i++) { Console.WriteLine("Network : " + ChannelUtils.NetworkToString(routes[i].network)); Console.WriteLine("Gateway : " + ChannelUtils.AddressToString(routes[i].gateway)); Console.WriteLine("Interface address : " + ChannelUtils.AddressToString(routes[i].ifaddr)); Console.WriteLine("Metric : " + routes[i].metric); Console.WriteLine(String.Format("Tag : {0:x8}\n", routes[i].tag)); } delete routes; delete routeConn; return(0); }
internal static int Delete(DeleteConfig !config) { RoutingContract.Imp routeConn = ((!)config.routingRef).Acquire(); if (routeConn == null) { Console.WriteLine("Could not initialize routing endpoint."); return(1); } routeConn.RecvReady(); IPv4Network destination; if (IPv4Network.Parse(config.destination, out destination) == false) { Console.WriteLine("Could not parse destination address."); } Network destNet = ChannelUtils.NetworkToChannelNetwork(destination); routeConn.SendFindSpecificNetRoute(destNet); switch receive { case routeConn.NoRouteFound(): Console.WriteLine("No route for destination."); delete routeConn; return(-1); case routeConn.Route(RouteEntry r): // Do nothing; success. break; case routeConn.ChannelClosed(): Console.WriteLine("routeConn channel closed."); throw new Exception("routeConn channel closed."); } routeConn.SendDeleteRoute(destNet); switch receive { case routeConn.NoRouteFound(): Console.WriteLine("Unexpected error attempting to delete the route"); break; case routeConn.OK(): Console.WriteLine("Route successfully deleted"); break; case routeConn.ChannelClosed(): Console.WriteLine("routeConn channel closed"); throw new Exception("routeConn channel closed"); } delete routeConn; return(0); }
public override void NextProgram() { int nextIndex = ChannelUtils.CreateNextIndex(_playInfo.ProgramIndex, _playInfo.ChannelDetailInfo); if (nextIndex >= 0) { End(); InitInformation(); _playInfo.UpdateProgramIndex(nextIndex); BeginGetPlayInfo(); } }
public override void PreProgram() { var preIndex = ChannelUtils.CreatePreviousIndex(_playInfo.ProgramIndex, _playInfo.ChannelDetailInfo); if (preIndex >= 0) { End(); InitInformation(); _playInfo.UpdateProgramIndex(preIndex); BeginGetPlayInfo(); } }
private void Play_Tap(object sender, System.Windows.Input.GestureEventArgs e) { if (_dataSource != null) { int id = _dataSource.Id; int index = 0; if (ChannelUtils.JudgeSingle(_dataSource)) { index = -1; } StartToPlay(id, index); } }
/// <summary> /// Gets all system channels. /// </summary> /// <returns></returns> public async Task <IEnumerable <SystemChannel> > GetSystemChannelsAsync() { try { var transports = await channelClient.DispatchAsync <List <SystemChannelTransport> >(ApiFromClientTopic.GetSystemChannels, JValue.CreateUndefined()); var channels = new List <SystemChannel>(); transports.ForEach(transport => channels.Add(ChannelUtils.GetChannelObject(transport, this) as SystemChannel)); return(channels); } catch (Exception ex) { throw ex; } }
private void playButton_Click(object sender, RoutedEventArgs e) { if (_dataSource != null) { PlayInfoHelp obj; if (ChannelUtils.JudgeSingle(_dataSource)) { obj = new PlayInfoHelp(_dataSource, -1); } else { obj = new PlayInfoHelp(_dataSource, 0); } StartToPlay(obj); } }
private void channelList_SelectionChanged(object sender, SelectionChangedEventArgs e) { var value = channelList.SelectedItem as ProgramInfo; if (value != null) { int id = value.ChannelId; int index = -1; if (!ChannelUtils.JudgeSingle(_dataSource)) { index = ChannelUtils.CreateProgramIndex(value.Index, _dataSource); } StartToPlay(id, index); } channelList.SelectedItem = null; }
private void downloadBar_Click(object sender, RoutedEventArgs e) { try { if (PersonalFactory.Instance.Logined) { var downinfos = new List <DownloadInfo>(_downloadList.Count); foreach (var downInfo in _downloadList) { var index = ChannelUtils.CreateProgramIndex(downInfo.Index, _dataSource); downInfo.IsSelected = false; downInfo.IsDownloading = true; var down = new DownloadInfo() { TypeId = _dataSource.Type, ParentId = _dataSource.Id, ParentName = _dataSource.Title, ProgramIndex = downInfo.Index, ChannelId = downInfo.ChannelId, ImageUri = _dataSource.ImageUri, DownloadState = DownloadState.Await, Title = ChannelUtils.CreateChannelTitle(index, _dataSource, false) }; down.LocalFileName = string.Format("{0}.mp4", down.Title); downinfos.Add(down); } DownloadViewModel.Instance.AddDownloads(downinfos); if (_downloadList.Count > 0) { TileUtils.CreateToastNotifications("已加入下载,请到个人中心查看"); } _downloadList.Clear(); downloadBar.Visibility = Visibility.Collapsed; } else { TileUtils.CreateToastNotifications("请先至个人中心登录"); } bottomBar.IsOpen = false; } catch { TileUtils.CreateToastNotifications("加入下载失败"); } }
private void listView_ItemClick(object sender, ItemClickEventArgs e) { var value = e.ClickedItem as ProgramInfo; if (value != null) { PlayInfoHelp obj; if (ChannelUtils.JudgeSingle(_dataSource)) { obj = new PlayInfoHelp(_dataSource, -1); } else { var index = ChannelUtils.CreateProgramIndex(value.Index, _dataSource); obj = new PlayInfoHelp(_dataSource, index); } StartToPlay(obj); } }
public FDC3Event ToEvent(Connection connection) { var channel = ChannelUtils.GetChannelObject(this.Channel, connection); var previousChannel = ChannelUtils.GetChannelObject(PreviousChannel, connection); switch (Type) { case FDC3EventType.ChannelChanged: return(new ChannelChangedEvent(Identity, channel, previousChannel)); case FDC3EventType.WindowAdded: return(new ChannelWindowAddedEvent(Identity, channel, previousChannel)); case FDC3EventType.WindowRemoved: return(new ChannelWindowRemovedEvent(Identity, channel, previousChannel)); default: throw new System.ArgumentException("unrecognized event type."); } }
public async Task <IChannel> GetChannelAsync(ulong channelId) { return(await ChannelUtils.GetChannelAsync(channelId, this)); }
public Channel(JObject data) { Data = ChannelUtils.CreateFromJson(data.ToObject <ChannelJson>(), null); }
public async Task <ChannelBase> GetChannelByIdAsync(string channelId) { var channelTransport = await channelClient.DispatchAsync <ChannelTransport>(ApiFromClientTopic.GetChannelById, new { id = channelId }); return(ChannelUtils.GetChannelObject(channelTransport, this)); }
public IDirectMessageChannel GetDirectMessageChannel(ulong channelId) { return(ChannelUtils.GetDirectMessageChannel(channelId, this)); }
public async Task <IDirectMessageChannel> GetDirectMessageChannelAsync(ulong channelId) { return(await ChannelUtils.GetDirectMessageChannelAsync(channelId, this)); }
public INonCatServerChannel GetNonCatServerChannel(ulong channelId) { return(ChannelUtils.GetNonCatServerChannel(channelId, this)); }
public async Task <INonCatServerChannel> GetNonCatServerChannelAsync(ulong channelId) { return(await ChannelUtils.GetNonCatServerChannelAsync(channelId, this)); }
public async Task <ChannelBase> GetCurrentChannelAsync(Identity identity) { var channelTransport = await channelClient.DispatchAsync <ChannelTransport>(ApiFromClientTopic.GetCurrentChannel, new { identity }); return(ChannelUtils.GetChannelObject(channelTransport, this)); }
public ChannelModule(CachedManager manager) { Get["/"] = _ => { //Profile.Trace("/ from:{0}", Request.UserHostAddress); return(View["ChannelIndex.html", manager.List()]); }; //curl http://127.0.0.1:2018/Test Get["/Test"] = _ => { var data = new { this.Request.UserHostAddress, this.Request.Headers, this.Request.Query, this.Request.Form, this.Request.Method, this.Request.Url, this.Request.Path }; return(Response.AsText(serializer.Serialize(data), "application/json")); }; //curl http://127.0.0.1:2018/Api/Types Get["/Api/Types"] = _ => { return(manager.Plugins); }; //curl http://127.0.0.1:2018/Api/Index Get["/Api/Index"] = _ => { return(manager.List()); }; //curl http://127.0.0.1:2018/Api/ById/1 Get["/Api/ById/{id:int}"] = p => { return(manager.LoadById(p["id"])); }; //curl http://127.0.0.1:2018/Api/ByName/ECHO1 Get["/Api/ByName/{name}"] = p => { return(manager.LoadByName(p["name"])); }; //curl http://127.0.0.1:2018/Api/List/Echo //curl http://127.0.0.1:2018/Api/List/Serial //curl http://127.0.0.1:2018/Api/List/Modbus //curl http://127.0.0.1:2018/Api/List/Socket Get["/Api/List/{type}"] = p => { return(ChannelUtils.List(p["type"])); }; Get["/New{type}Channel"] = p => { var instance = new ChannelInstance(p["type"]); var view = string.Format("Edit{0}Channel.html", p["type"]); return(View[view, new ChannelModel(instance)]); }; Get["/EditChannel/{id:int}"] = p => { var model = manager.LoadById(p["id"]); if (model == null) { return(new RedirectResponse("/")); } var view = string.Format("Edit{0}Channel.html", model.Type); return(View[view, model]); }; Post["/UpdateChannel/{id:int}/{access}"] = p => { if (IsLoopback(Request.UserHostAddress)) { var access = Enum.Parse(typeof(ChannelAccess), p["access"]); manager.Update(p["id"], access); } return(new RedirectResponse("/")); }; Post["/SaveChannel"] = p => { if (IsLoopback(Request.UserHostAddress)) { var instance = this.Bind <ChannelInstance>(); int id = manager.Save(instance); } return(new RedirectResponse("/")); }; Post["/RemoveChannel/{id:int}"] = p => { if (IsLoopback(Request.UserHostAddress)) { manager.Delete(p["id"]); } return(new RedirectResponse("/")); }; }
public IChannel GetChannel(ulong channelId) { return(ChannelUtils.GetChannel(channelId, this)); }