• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Association类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Association的典型用法代码示例。如果您正苦于以下问题:C# Association类的具体用法?C# Association怎么用?C# Association使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Association类属于命名空间,在下文中一共展示了Association类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: GetChunks

        /// <summary>
        ///     Splits the DICOM object into chunks that are within the max PDU size
        /// </summary>
        /// <param name="dicomObject"> the DICOM objec to be split</param>
        /// <param name="maxPduSize">the max length (in bytes) for a PDU</param>
        /// <param name="asc">the association that the file will be sent</param>
        /// <returns></returns>
        private static List<byte[]> GetChunks(DICOMObject dicomObject, int maxPduSize, Association asc)
        {
            byte[] dicomBytes;
            using (var stream = new MemoryStream())
            {
                using (var dw = new DICOMBinaryWriter(stream))
                {
                    DICOMObjectWriter.Write(dw,
                        new DICOMWriteSettings
                        {
                            TransferSyntax =
                                TransferSyntaxHelper.GetSyntax(asc.PresentationContexts.First().TransferSyntaxes.First()),
                            DoWriteIndefiniteSequences = false
                        }, dicomObject);
                    dicomBytes = stream.ToArray();
                }
            }

            var split = new List<byte[]>();
            int i = 0;
            while (i < dicomBytes.Length)
            {
                int toTake = dicomBytes.Length >= (maxPduSize - 6) + i ? maxPduSize - 6 : dicomBytes.Length - i;
                byte[] fragment = dicomBytes.Skip(i).Take(toTake).ToArray();
                i += fragment.Length;
                split.Add(fragment);
            }
            return split;
        }
开发者ID:Baasanjav,项目名称:Evil-DICOM,代码行数:36,代码来源:PDataMessenger.cs


示例2: buttonSave_Click

	void buttonSave_Click(object sender, EventArgs e)
	{
		try
		{
			Page.Validate();
			if (Page.IsValid)
			{
				Association association = AssociationBL.GetBy(base.AssociationId, false);
				if (association == null)
				{
					// insert
					association = new Association();
					association.Name = TextName.Text;
					association.Description = TextDescription.Text;
					association = AssociationBL.Insert(association);
				}
				else
				{
					// update
					association.Name = TextName.Text;
					association.Description = TextDescription.Text;
					association = AssociationBL.Update(association);
				}
				if (association == null) { message.Text = "Save failed"; }
				else { _redirectToListUrl(); }
			}
		}
		catch (Exception ex)
		{
			message.Text = ex.Message;
		}
	}
开发者ID:djokinen,项目名称:my_leagues_20140901,代码行数:32,代码来源:Detail.ascx.cs


示例3: SendAccept

 public static void SendAccept(Accept accept, Association asc)
 {
     var stream = asc.Stream;
     byte[] message = accept.Write();
     asc.Logger.Log("-->" + accept);
     stream.Write(message, 0, message.Length);
 }
开发者ID:DMIAOCHEN,项目名称:Evil-DICOM,代码行数:7,代码来源:AssociationMessenger.cs


示例4: Simple

        public void Simple()
        {
            var assoc = new Association<int, string>(5, "aa");

            Assert.AreEqual(assoc.Key, 5);
            Assert.AreEqual(assoc.Value, "aa");
        }
开发者ID:havok,项目名称:ngenerics,代码行数:7,代码来源:Construction.cs


示例5: Add

        public void Add(Association association)
        {
            if (string.IsNullOrEmpty(association.Name))
            {
                throw new Exception("You must complete the field name to continue!");
            }
            else if(string.IsNullOrEmpty(association.Action))
            {
                throw new Exception("You must choose an action to continue!");
            }
            else if (string.IsNullOrEmpty(association.Destination))
            {
                throw new Exception("You must complete the field destination choosing a folder to continue!");
            }
            else if (string.IsNullOrEmpty(association.Extension))
            {
                throw new Exception("You must add a file extension to continue!");
            }
            else if (!isValidExtension(association.Extension))
            {
                throw new Exception("The extension is not correct, It must be in this format example: *.jpg or *.yourExtension");
            }
            else
            {
                if (!(_dassociation.Add(association) >= 1))
                {
                    throw new Exception("There was a problem adding this association, please try again.");
                }
            }

        }
开发者ID:jefridev,项目名称:AFileOrganizer,代码行数:31,代码来源:BAssociation.cs


示例6: createAssociation

 public static Association createAssociation(string name, string rolename, Group group)
 {
     Association asso = new Association();
     asso.name = name;
     asso.roleName = rolename;
     asso.Item = group;
     return asso;
 }
开发者ID:CuriousX,项目名称:annotation-and-image-markup,代码行数:8,代码来源:CreateAttrAssoGroup.cs


示例7: AssociationsManager

        public AssociationsManager()
        {
            _association = null;

            InitializeComponent();
            //
            _bassociation = new BAssociation();
        }
开发者ID:jefridev,项目名称:AFileOrganizer,代码行数:8,代码来源:AssociationsManager.xaml.cs


示例8: Equality

 public void Equality()
 {
     var assoc = new Association<int, string>(5, "aa");
     var assoc2 = new Association<int, string>(5, "aa");
     Assert.AreEqual(assoc.Key, assoc2.Key);
     Assert.AreEqual(assoc.Key, assoc2.Key);
     Assert.AreEqual(assoc, assoc2);
 }
开发者ID:havok,项目名称:ngenerics,代码行数:8,代码来源:Construction.cs


示例9: Simple

        public void Simple()
        {
            var assoc = new Association<int, string>(5, "aa");
            var newAssoc = SerializeUtil.BinarySerializeDeserialize(assoc);

            Assert.AreEqual(assoc.Key, newAssoc.Key);
            Assert.AreEqual(assoc.Value, newAssoc.Value);
            Assert.AreNotSame(assoc, newAssoc);
        }
开发者ID:GTuritto,项目名称:ngenerics,代码行数:9,代码来源:Serializable.cs


示例10: Add

 public int Add(Association association)
 {
     try
     {
         _FileOContext.Associations.Add(association);
         return _FileOContext.SaveChanges();
     }
     catch (Exception) { return 0; }
 }
开发者ID:jefridev,项目名称:AFileOrganizer,代码行数:9,代码来源:DAssociation.cs


示例11: Set

		/// <summary>
		/// Stores an <see cref="Association"/> in the collection.
		/// </summary>
		/// <param name="association">The association to add to the collection.</param>
		public void Set(Association association) {
			Requires.NotNull(association, "association");
			lock (this.associations) {
				this.associations.Remove(association.Handle); // just in case one already exists.
				this.associations.Add(association);
			}

			Assumes.True(this.Get(association.Handle) == association);
		}
开发者ID:Balamir,项目名称:DotNetOpenAuth,代码行数:13,代码来源:Associations.cs


示例12: Set

		/// <summary>
		/// Stores an <see cref="Association"/> in the collection.
		/// </summary>
		/// <param name="association">The association to add to the collection.</param>
		public void Set(Association association) {
			Contract.Requires<ArgumentNullException>(association != null);
			Contract.Ensures(this.Get(association.Handle) == association);
			lock (this.associations) {
				this.associations.Remove(association.Handle); // just in case one already exists.
				this.associations.Add(association);
			}

			Contract.Assume(this.Get(association.Handle) == association);
		}
开发者ID:enslam,项目名称:dotnetopenid,代码行数:14,代码来源:Associations.cs


示例13: Insert

		public Association Insert(Association association)
		{
			association.Enabled = true;
			association.ID = Guid.NewGuid();
			association.Created = DateTime.Now;
			association.Modified = DateTime.Now;
			DataContextHelper.CurrentContext.Associations.InsertOnSubmit(association);
			DataContextHelper.CurrentContext.SubmitChanges();
			return association;
		}
开发者ID:djokinen,项目名称:my_leagues_20140901,代码行数:10,代码来源:AssociationDao.cs


示例14: XmlSimple

        public void XmlSimple()
        {
            var assoc = new Association<int, string>(5, "aa");
            var serialize = assoc.Serialize();
            var newAssoc = ObjectExtensions.Deserialize<Association<int, string>>(serialize);

            Assert.AreEqual(assoc.Key, newAssoc.Key);
            Assert.AreEqual(assoc.Value, newAssoc.Value);
            Assert.AreEqual(assoc, newAssoc);
        }
开发者ID:GTuritto,项目名称:ngenerics,代码行数:10,代码来源:Serializable.cs


示例15: SendReleaseResponse

 public static void SendReleaseResponse(Association asc)
 {
     var resp = new ReleaseResponse();
     asc.Logger.Log("-->" + resp);
     byte[] message = resp.Write();
     if (asc.Stream.CanWrite)
     {
         asc.Stream.Write(message, 0, message.Length);
     }
 }
开发者ID:DMIAOCHEN,项目名称:Evil-DICOM,代码行数:10,代码来源:AssociationMessenger.cs


示例16: Delete

        public int Delete(Association association)
        {
            try
            {
               _FileOContext.Associations.Remove(association);
                return _FileOContext.SaveChanges(); 
            }
            catch (Exception) { return 0; }

        }
开发者ID:jefridev,项目名称:AFileOrganizer,代码行数:10,代码来源:DAssociation.cs


示例17: ToKeyValuePairExample

        public void ToKeyValuePairExample()
        {
            var association = new Association<int, string>(1, "dove");

            var pair = association.ToKeyValuePair();

            // The value and key will be the same as in the association.
            Assert.AreEqual(pair.Key, association.Key);
            Assert.AreEqual(pair.Value, association.Value);
        }
开发者ID:havok,项目名称:ngenerics,代码行数:10,代码来源:AssociationExamples.cs


示例18: SendReject

 public static void SendReject(Association asc)
 {
     var rej = new Reject
     {
         Result = RejectResult.REJECTED_PERMANENT,
         Reason = (byte) RejectReason_SCU.NO_REASON_GIVEN
     };
     asc.Logger.Log("-->" + rej);
     byte[] rejBytes = rej.Write();
     asc.Stream.Write(rejBytes, 0, rejBytes.Length);
 }
开发者ID:DMIAOCHEN,项目名称:Evil-DICOM,代码行数:11,代码来源:AssociationMessenger.cs


示例19: ConstructorExample

        public void ConstructorExample()
        {
            // Create a new association
            var association = new Association<int, string>(4, "four");

            // Key will be equal to 4
            Assert.AreEqual(association.Key, 4);

            // Value will be equal to "four"
            Assert.AreEqual(association.Value, "four");
        }
开发者ID:havok,项目名称:ngenerics,代码行数:11,代码来源:AssociationExamples.cs


示例20: SendReleaseRequest

 public static void SendReleaseRequest(Association asc)
 {
     var req = new ReleaseRequest();
     asc.State = NetworkState.AWAITING_RELEASE_RESPONSE;
     asc.Logger.Log("-->" + req);
     byte[] message = req.Write();
     if ( asc.Stream.CanWrite)
     {
         asc.Stream.Write(message, 0, message.Length);
     }
    
 }
开发者ID:DMIAOCHEN,项目名称:Evil-DICOM,代码行数:12,代码来源:AssociationMessenger.cs



注:本文中的Association类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# AssociativeGraph类代码示例发布时间:2022-05-24
下一篇:
C# AssignmentStatement类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap