當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。