public void WriteFaces(ContentName name, TextWriter writer) { foreach (KeyValuePair <IPEndPoint, FaceCounter> pair in Faces) { writer.WriteLine("{0} -> {1}:{2}", name, pair.Key, pair.Value.Count); } }
public void AddData(string name, object value) { switch (name) { case "КодКонтента": ID.Add((int)value); break; case "Название": ContentName.Add((string)value); break; case "Рейтинг": Rating.Add(double.Parse(value.ToString())); break; case "Год": Year.Add((int)value); break; case "Сюжет": Story.Add((string)value); break; case "Продолжительность": Duration.Add((int)value); break; case "ЦенаПокупки": PurchasePrice.Add(double.Parse(value.ToString())); break; case "ЦенаПроката": RentalPrice.Add(double.Parse(value.ToString())); break; case "Постер": Poster.Add((string)value); break; default: MessageBox.Show($"Поле {name} отсутствует!"); break; } }
/// <summary> /// Checks for at least one filter in the GetContent request. /// See GetContent Post https://developers.neto.com.au/documentation/engineers/api-documentation/content/getcontent /// </summary> /// <returns>bool</returns> internal override bool isValid() { if (DatePostedFrom != DateTime.MinValue) { return(true); } if (DatePostedTo != DateTime.MinValue) { return(true); } if (DateUpdatedFrom != DateTime.MinValue) { return(true); } if (DateUpdatedTo != DateTime.MinValue) { return(true); } int requiredFilterCount = ContentID.NullSafeLength() + ParentContentID.NullSafeLength() + ContentName.NullSafeLength(); if (requiredFilterCount != 0) { return(true); } throw new NetoRequestException("At least one filter is required in the GetContent request"); }
public void OnData(int connectionId, int channelId, byte key, byte[] data, byte error) { CircleVRPacketType type = (CircleVRPacketType)key; if (type == CircleVRPacketType.VideoPlayer) { ContentName name = new ContentName(CircleVR.ContentName); string msg = JsonUtility.ToJson(name); CircleVRNetwork.Send(CircleVRPacketType.Name, CircleVRNetwork.StringToByte(msg), connectionId, CircleVRNetwork.reliableChannel); Debug.Log("[CircleVR Host Network] Send ContentName To Video Player : " + msg); return; } if (type == CircleVRPacketType.ClientInfo) { ClientData clientData = JsonUtility.FromJson <ClientData>(CircleVRNetwork.ByteToString(data)); CircleVRErrorType cvError; if (host.AddConnectedUserIDs(clientData.userId, out cvError)) { AddConnectedPair(new UserIDAndConnectionIDPair(clientData.userId, connectionId)); return; } CircleVRNetwork.SendError(connectionId, cvError); Disconnect(CircleVRNetwork.hostID, connectionId, error); Debug.Log("[CircleVR Host Network] Connect Failed : " + cvError.ToString() + "\nUser ID : " + clientData.userId); return; } }
public IBaseMessage Execute(IPipelineContext pipelineContext, IBaseMessage message) { if (pipelineContext == null) { throw new ArgumentNullException(nameof(pipelineContext)); } if (message == null) { throw new ArgumentNullException(nameof(message)); } message.BodyPart.WrapOriginalDataStream( originalStream => { if (_logger.IsDebugEnabled) { _logger.Debug("Wrapping message stream in a MultipartFormDataContentStream."); } var multipartFormDataContentStream = ContentName.IsNullOrEmpty() ? UseBodyPartNameAsContentName ? new MultipartFormDataContentStream(originalStream, message.BodyPartName) : new MultipartFormDataContentStream(originalStream) : new MultipartFormDataContentStream(originalStream, ContentName); message.BodyPart.ContentType = multipartFormDataContentStream.ContentType; return(multipartFormDataContentStream); }, pipelineContext.ResourceTracker); return(message); }
public Publisher(string name, IPEndPoint localEP, ContentName flowName, int packetCount, IPEndPoint firstHop, IQueue <Packet> queue, int bandwidthInBitsPerSecond, int linkBandwidthInBitsPerSecond, long delayInMS) : base(name, localEP, firstHop, queue, bandwidthInBitsPerSecond, linkBandwidthInBitsPerSecond, delayInMS) { FlowName = flowName; PacketCount = packetCount; for (int i = 0; i < PacketCount; i++) { SendPacket(new Data(FlowName.GetChild(new string[] { i.ToString() }), new RandomContent(1500 - 36))); } }
public override void Initialize() { ContentTypeName = "File"; if (ViewMode == ContentViewMode.Custom) { if (ContentName == null) { throw new InvalidManifestException( "If the ViewMode is Custom then the 'ContentName' parameter is expected in an InstallContentView step. " + ToString()); } if (ParentFolderName == null) { if (!ContentName.StartsWith("/Root/")) { throw new InvalidManifestException( "If the ViewMode is Custom and ContentTypeName is not specified in an InstallContentView step then 'ContentName' must be an absolute RepositoryPath. " + ToString()); } ContainerPath = ContentManager.Path.GetParentPath(ContentName); ContentName = ContentManager.Path.GetFileName(ContentName); } else { if (ContentName.StartsWith("/") || ContentName.StartsWith("Root")) { throw new InvalidManifestException( "If ContentTypeName is specified in an InstallContentView step then ContentName must be a relative RepositoryPath. " + ToString()); } ContainerPath = ContentManager.Path.Combine(ContentManager.ContentViewsFolderPath, ParentFolderName); } } else { if (ParentFolderName == null) { throw new InvalidManifestException( "If the ViewMode is not Custom in an InstallContentView step then ContentTypeName parameter is required. " + ToString()); } if (ContentName != null) { throw new InvalidManifestException( "If the ViewMode is not Custom in an InstallContentView step then ContentName parameter is forbidden. " + ToString()); } ContainerPath = ContentManager.Path.Combine(ContentManager.ContentViewsFolderPath, ParentFolderName); ContentName = String.Concat(ViewMode, ".ascx"); } RawAttachments = "Binary:" + ResourceName; base.Initialize(); }
public object GetDetails(int page, int rows, string QueryString, string Value) { string ContentName = ""; string ContentCode = ""; if (QueryString == "ContentName") { ContentName = Value; } else { ContentCode = Value; } IQueryable <HelpContent> HelpContentQuery = HelpContentRepository.GetQueryable(); var HelpContent = HelpContentQuery.Where(c => c.ContentName.Contains(ContentName) && c.ContentCode.Contains(ContentCode)) .OrderBy(c => c.ContentCode) .Select(c => c); if (!ContentName.Equals(string.Empty)) { HelpContent = HelpContent.Where(p => p.ContentName == ContentName); } int total = HelpContent.Count(); HelpContent = HelpContent.Skip((page - 1) * rows).Take(rows); var temp = HelpContent.ToArray().Select(c => new { ID = c.ID, ContentCode = c.ContentCode, ContentName = c.ContentName, FatherNode = c.ID == c.FatherNodeID? "": c.FatherNode.ContentCode + " " + c.FatherNode.ContentName, NodeType = WhatType(c.NodeType), NodeOrder = c.NodeOrder, IsActive = c.IsActive == "1" ? "可用" : "不可用" }); return(new { total, rows = temp.ToArray() }); }
public void AddFIB(ContentName prefix, IPEndPoint target, int hops = 1) { Trace.Assert(IsLinkedTo(target)); bool exist = false; FIB.ForEachLongestPrefixMatch(prefix, (name, entry) => { if (!name.Equals(prefix) || entry.Node != target) { return; } exist = true; entry.Hops = hops; }); if (!exist) { bool nameAdded, valueAdded; FIB.Add(prefix, new FIBEntry { Node = target, Hops = hops }, out nameAdded, out valueAdded); } }
public void AddContent(ContentName name, ISerializable content) { LinkedListNode <ContentName> node = LRU.Find(name); if (node == null) { container.Add(name, content); LRU.AddLast(name); } else { container [name] = content; LRU.Remove(node); LRU.AddLast(node); } while (LRU.Count > Capacity) { node = LRU.First; container.Remove(node.Value); LRU.RemoveFirst(); } }
public object GetDetails(int page, int rows, string QueryString, string Value) { string ContentName = ""; string ContentCode = ""; if (QueryString == "ContentName") { ContentName = Value; } else { ContentCode = Value; } IQueryable <AUTH_HELP_CONTENT> HelpContentQuery = HelpContentRepository.GetQueryable(); var HelpContent = HelpContentQuery.Where(c => c.CONTENT_NAME.Contains(ContentName) && c.CONTENT_CODE.Contains(ContentCode)) .OrderBy(c => c.CONTENT_CODE) .Select(c => c); if (!ContentName.Equals(string.Empty)) { HelpContent = HelpContent.Where(p => p.CONTENT_NAME == ContentName); } int total = HelpContent.Count(); HelpContent = HelpContent.Skip((page - 1) * rows).Take(rows); var temp = HelpContent.ToArray().Select(c => new { ID = c.ID, ContentCode = c.CONTENT_CODE, ContentName = c.CONTENT_NAME, FatherNode = c.ID == c.FATHER_NODE_ID ? "": c.FATHER_NODE.CONTENT_CODE + " " + c.FATHER_NODE.CONTENT_NAME, NodeType = WhatType(c.NODE_TYPE), NodeOrder = c.NODE_ORDER, IsActive = c.IS_ACTIVE == "1" ? "可用" : "不可用" }); return(new { total, rows = temp.ToArray() }); }
public bool TryGetContent(ContentName name, out ISerializable content) { return(container.TryGetValue(name, out content)); }
public void SendData(ContentName name, ISerializable content) { SendPacket(FirstHop, new Data(name, content)); }
public void SendInterest(ContentName name, byte interestType) { SendPacket(FirstHop, new Interest(name, interestType)); }
public Subscriber(string name, IPEndPoint localEP, ContentName flowName, IPEndPoint firstHop, IQueue <Packet> queue, int bandwidthInBitsPerSecond, int linkBandwidthInBitsPerSecond, long delayInMS) : base(name, localEP, firstHop, queue, bandwidthInBitsPerSecond, linkBandwidthInBitsPerSecond, delayInMS) { this.PacketReceived += HandlePacket; FlowName = flowName; SendInterest(1); }
/// <summary> /// 生成和显示弹窗方法 /// </summary> protected override void Invoke(object parameter) { if (Content == null) { throw new NotFiniteNumberException("Content is null"); } if (Title == null) { throw new NotFiniteNumberException("Title is null"); } object[] args = null; if (Args != null) { args = Args.ToArray(); } // 调取有参构造失败后调取无参构造,待修改 IContentWindow win = null; BaseUserControl content = null; ContentWindow contentWindow = null; //当前打开的窗体 try { content = Content.Assembly.CreateInstance(Content.FullName, true, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public, null, args, null, null) as BaseUserControl; } catch (Exception) { content = Content.Assembly.CreateInstance(Content.FullName) as BaseUserControl; } // 根据弹窗类型反向生成对应的的窗口类 switch (WindowType) { case ContentWindowType.ToolBox: contentWindow = HasOpenedWindow(Title); if (contentWindow != null) { // 若已打开,则使当前窗口弹出至最上层 contentWindow.Topmost = true; return; } else { win = ToolBoxContentWindow.Create(content, Title) .SetContentMargin(ContentMargin) .SetHeight(Height) .SetWidth(Width) .SetTileBackground(TileBackground) .SetIcon(Icon); } break; case ContentWindowType.Document: contentWindow = HasOpenedWindow(Title); if (contentWindow != null) { // 若已打开,则使当前窗口弹出至最上层 contentWindow.Topmost = true; return; } else { win = ConfirmContentWindow.Create(content, Title) .SetContentMargin(ContentMargin) .SetHeight(Height) .SetTileBackground(TileBackground) .SetWidth(Width); } break; default: contentWindow = HasOpenedWindow(Title); if (contentWindow != null) { // 若已打开,则使当前窗口弹出至最上层 contentWindow.Topmost = true; return; } else { if (Title == "麻醉评分") { win = ContentWindow.Create(content, Title, false) .SetContentMargin(ContentMargin) .SetResizeMode(ResizeMode) .SetMinHeight(MinHeight) .SetMinWidth(MinWidth) .SetHeight(Height) .SetWidth(Width) .SetBorderMargin(BorderMargin) .SetTileBackground(TileBackground) .SetIcon(content.Icon); } else { win = ContentWindow.Create(content, Title) .SetContentMargin(ContentMargin) .SetResizeMode(ResizeMode) .SetMinHeight(MinHeight) .SetMinWidth(MinWidth) .SetHeight(Height) .SetWidth(Width) .SetBorderMargin(BorderMargin) .SetTileBackground(TileBackground) .SetIcon(content.Icon); } } break; } //设置内容控制窗体大小 if (!(Height > 0 & Width > 0)) { (win as Window).SizeToContent = SizeToContent.WidthAndHeight; } //边界控制 if (PositionX > 0 || PositionY > 0) { win.SetStartupLocation(WindowStartupLocation.Manual); //防止窗体显示不全 //获取屏幕的边界 double maxWidth = SystemParameters.PrimaryScreenWidth; //得到屏幕整体宽度 double maxHeight = SystemParameters.PrimaryScreenHeight; //得到屏幕整体高度 if (PositionX + Width > maxWidth) { PositionX = maxWidth - Width - 20; } if (PositionY + Height > maxHeight & PositionY - Height > 0) { PositionY = PositionY - Height; } else { if (ContentName.Equals("OperationInterfaceControl")) { } else { PositionY = maxHeight - Height - 5; } } win.SetX(PositionX); win.SetY(PositionY); } else { win.SetStartupLocation(WindowStartupLocation.CenterScreen); } content.CallBack = obj => { if (CallBackCommand != null) { CallBackCommand.Execute(obj); } }; content.Close = () => (win as Window).Close(); content.ParentWindow = (win as Window); var vm = content.DataContext as BaseViewModel; if (vm != null) { vm.Args = args; vm.CloseContentWindowDelegate = () => (win as Window).Close(); } (win as Window).Loaded += ShowContentWindowAction_Loaded; (win as Window).Closed += (s1, e1) => { content.Dispose(); object result = null; if (vm != null) { if (vm.Result != null) { result = vm.Result; } } else { result = content.Result; } // 出发回调函数 if (CallBackCommand != null) { CallBackCommand.Execute(result); } // 设置返回值 if (ContentMessage != null) { ContentMessage.Result = result; } //content.DataContext = null; //content = null; //(win as Window).Content = null; //win = null; }; if (win is ContentWindow) { ContentWindow contentWin = win as ContentWindow; contentWin.ClosingAction = (s1, e1) => { if (e1.Cancel) { return; } if (!contentWin.IsAnimationCloseWindow) { double durationTime = 0.2; switch (WindowAnimation) { case ContentWindowAnimation.FadeIn: e1.Cancel = true; DoubleAnimation daShow = new DoubleAnimation(); daShow.From = 1; daShow.To = 0.4; daShow.Duration = TimeSpan.FromSeconds(durationTime); contentWin.IsAnimationCloseWindow = true; daShow.Completed += (sender, e) => { (s1 as Window).Close(); }; (s1 as Window).BeginAnimation(Window.OpacityProperty, daShow); break; case ContentWindowAnimation.VerticalFloating: TranslateTransform tt = new TranslateTransform(); DoubleAnimation da = new DoubleAnimation(); Duration duration = new Duration(TimeSpan.FromSeconds(durationTime)); (s1 as Window).RenderTransform = tt; tt.Y = 0; da.To = (s1 as Window).ActualHeight; da.Duration = duration; contentWin.IsAnimationCloseWindow = true; da.Completed += (sender, e) => { (s1 as Window).Close(); }; tt.BeginAnimation(TranslateTransform.YProperty, da); e1.Cancel = true; break; case ContentWindowAnimation.HorizontalFloating: TranslateTransform ttHorizontal = new TranslateTransform(); DoubleAnimation daHorizontal = new DoubleAnimation(); Duration durationHorizontal = new Duration(TimeSpan.FromSeconds(durationTime)); (s1 as Window).RenderTransform = ttHorizontal; daHorizontal.From = 0; daHorizontal.To = -(s1 as Window).ActualWidth; daHorizontal.Duration = durationHorizontal; contentWin.IsAnimationCloseWindow = true; daHorizontal.Completed += (sender, e) => { (s1 as Window).Close(); }; ttHorizontal.BeginAnimation(TranslateTransform.XProperty, daHorizontal); e1.Cancel = true; break; } } else { e1.Cancel = false; } }; } if (this.Owner != null) { win.SetOwner(Owner); } if (IsModal) { win.ShowDialog(); } else { win.Show(); } }