コード例 #1
0
ファイル: AttributesForm.cs プロジェクト: palfrey/ndoc
		/// <summary>
		/// Event handler called when the EDIT (of the property list) is clicked.
		/// </summary>
		/// <param name="sender">Sender</param>
		/// <param name="e">Event argument</param>
		private void EditProp_Click(object sender, System.EventArgs e)
		{
			int index = this.listAttributes.SelectedIndex;
			if (index >= 0)
			{
				int indexProp = this.listProperties.SelectedIndex;
				if (indexProp >= 0)
				{
					SimpleEdit dlg = new SimpleEdit();
					dlg.Value = (string) ((AttributeToShow)(AttributesToShow[index])).PropertiesToShow[indexProp];
					if (dlg.ShowDialog() == DialogResult.OK)
					{
						AttributeToShow att = new AttributeToShow();
						att.Name = ((AttributeToShow)this.AttributesToShow[index]).Name;
						att.PropertiesToShow = (ArrayList)(((AttributeToShow)this.AttributesToShow[index]).PropertiesToShow.Clone());
						att.PropertiesToShow[indexProp] = dlg.Value;
						this.AttributesToShow.RemoveAt(index);
						AttributesToShow.Insert(index, att);
						UpdateAttributes();
					}
				}
			}
		}
コード例 #2
0
ファイル: AttributesForm.cs プロジェクト: palfrey/ndoc
		/// <summary>
		/// Creates and initialize a new AttributesForm object.
		/// </summary>
		/// <param name="val"></param>
		public AttributesForm(object val)
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			this.Edit.Enabled = false;
			this.Delete.Enabled = false;
			this.EditProp.Enabled = false;
			this.DeleteProp.Enabled = false;
			this.AddProp.Enabled = false;

			if (val == null || val.ToString().Length == 0)
				return;

			string nonparsedval = val.ToString();
			string[] tmparray = new string[200];
			char[] attributeDelimiters = { '|' };
			char[] propertyDelimiters = { ',' };
			tmparray = nonparsedval.Split(attributeDelimiters, 199);

			if (tmparray != null)
			{
				int i,j;

				for(i = 0; i < tmparray.Length; i++)
				{
					string[] tmparray2 = new String[200];
					tmparray2 = tmparray[i].Split(propertyDelimiters, 199);
				
					ArrayList PropertiesToShow = new ArrayList();

					AttributeToShow attributeToShow = new AttributeToShow();
					attributeToShow.Name = tmparray2[0];

					for(j = 1; j < tmparray2.Length; j++)
					{
						attributeToShow.PropertiesToShow.Add(tmparray2[j]);
					}
					AttributesToShow.Add(attributeToShow);
					this.listAttributes.DataSource = AttributesToShow;
#if (!MONO) // not yet available in MWF
					this.listAttributes.DisplayMember = "Name";
#endif
				}
			}
			UpdateAttributes();
		}
コード例 #3
0
ファイル: AttributesForm.cs プロジェクト: palfrey/ndoc
		/// <summary>
		/// Event handler called when the ADD button is clicked.
		/// </summary>
		/// <param name="sender">Sender</param>
		/// <param name="e">Event argument</param>
		private void Add_Click(object sender, System.EventArgs e)
		{
			SimpleEdit dlg = new SimpleEdit();
			if (dlg.ShowDialog() == DialogResult.OK)
			{
				AttributeToShow att = new AttributeToShow();
				att.Name = dlg.Value;
				this.AttributesToShow.Add(att);
				UpdateAttributes();
			}
		}