当前位置: 首页>>代码示例>>C#>>正文


C# Association类代码示例

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


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


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