Example #1
0
        public static void RestoreSettingsByName(
            CheckedListBoxControl c,
            IPersistentPairStorage storage,
            string key)
        {
            var names = new List <string>();

            for (var i = 0; i < c.Items.Count; ++i)
            {
                if (c.GetItemChecked(i))
                {
                    names.Add(c.GetItem(i).ToString());
                }
            }

            var def = string.Join(@"###{{{}}}###", names.ToArray());

            // --

            var s = PersistanceHelper.RestoreValue(
                storage,
                key,
                def) as string;

            if (string.IsNullOrEmpty(s))
            {
                for (var i = 0; i < c.Items.Count; ++i)
                {
                    c.SetItemChecked(i, false);
                }
            }
            else
            {
                var splitted = new List <string>(s.Split(new[] { @"###{{{}}}###" }, StringSplitOptions.RemoveEmptyEntries));

                var ris = new List <string>(splitted);

                for (var i = 0; i < c.Items.Count; ++i)
                {
                    c.SetItemChecked(i, ris.Contains(c.GetItem(i).ToString()));
                }
            }
        }
        private void settingSecondaryItemListBoxControl_MouseMove(object sender, MouseEventArgs e)
        {
            CheckedListBoxControl listBoxControl = sender as CheckedListBoxControl;
            int index = listBoxControl.IndexFromPoint(new Point(e.X, e.Y));

            if (index != -1)
            {
                string item = listBoxControl.GetItem(index) as string;
                toolTipController1.ShowHint(item, listBoxControl.PointToScreen(new Point(e.X, e.Y)));
            }
            else
            {
                toolTipController1.HideHint();
            }
        }
Example #3
0
 private void chkSuppliersList_GetItemEnabled(object sender, DevExpress.XtraEditors.Controls.GetItemEnabledEventArgs e)
 {
     try
     {
         CheckedListBoxControl control = sender as CheckedListBoxControl;
         DataRowView           row     = control.GetItem(e.Index) as DataRowView;
         if (Convert.ToInt16(row["ItemChecked"]) == 1)
         {
             e.Enabled = false;
         }
     }
     catch (Exception ex)
     {
         Utility.ShowError(ex);
     }
 }
Example #4
0
        public static void PersistSettingsByName(
            CheckedListBoxControl c,
            IPersistentPairStorage storage,
            string key)
        {
            var names = new List <string>();

            for (var i = 0; i < c.Items.Count; ++i)
            {
                if (c.GetItemChecked(i))
                {
                    names.Add(c.GetItem(i).ToString());
                }
            }

            PersistanceHelper.SaveValue(storage, key, string.Join(@"###{{{}}}###", names.ToArray()));
        }
Example #5
0
 private void CheckUncheckListboxItems(CheckedListBoxControl AListBox, bool ACheckState)
 {
     try
     {
         for (int i = 0; i < AListBox.ItemCount; i++)
         {
             DataRowView row = AListBox.GetItem(i) as DataRowView;
             AListBox.SetItemChecked(i, ACheckState);
         }
     }
     catch (Exception error)
     {
         XtraMessageBox.Show("An error occurred while setting selected preferences to checked/unchecked." + Environment.NewLine +
                             "Error CNF-323 in " + FORM_NAME + ".CheckUncheckListboxItems(): " + error.Message,
                             FORM_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #6
0
      private void CheckUncheckListboxItems(CheckedListBoxControl AListBox, bool ACheckState)
      {
         try
         {

            for (int i = 0; i < AListBox.ItemCount; i++)
            {
               DataRowView row = AListBox.GetItem(i) as DataRowView;
               AListBox.SetItemChecked(i, ACheckState);
            }
         }
         catch (Exception error)
         {
            XtraMessageBox.Show("An error occurred while setting selected preferences to checked/unchecked." + Environment.NewLine +
                   "Error CNF-323 in " + FORM_NAME + ".CheckUncheckListboxItems(): " + error.Message,
                 FORM_ERROR_CAPTION, MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
      }
		public static void PersistSettingsByName(
			CheckedListBoxControl c,
			IPersistentPairStorage storage,
			string key )
		{
			var names = new List<string>();

			for ( var i = 0; i < c.Items.Count; ++i )
			{
				if ( c.GetItemChecked( i ) )
				{
					names.Add( c.GetItem(i).ToString() );
				}
			}

			PersistanceHelper.SaveValue( storage, key, string.Join( @"###{{{}}}###", names.ToArray() ) );
		}
		public static void RestoreSettingsByName(
			CheckedListBoxControl c,
			IPersistentPairStorage storage,
			string key )
		{
			var names = new List<string>();

			for ( var i = 0; i < c.Items.Count; ++i )
			{
				if ( c.GetItemChecked( i ) )
				{
					names.Add(c.GetItem(i).ToString());
				}
			}

			var def = string.Join(@"###{{{}}}###", names.ToArray());

			// --

			var s = PersistanceHelper.RestoreValue(
				storage,
				key,
				def ) as string;

			if ( string.IsNullOrEmpty( s ) )
			{
				for ( var i = 0; i < c.Items.Count; ++i )
				{
					c.SetItemChecked( i, false );
				}
			}
			else
			{
				var splitted = new List<string>(s.Split(new[] {@"###{{{}}}###"}, StringSplitOptions.RemoveEmptyEntries));

				var ris = new List<string>(splitted);

				for ( var i = 0; i < c.Items.Count; ++i )
				{
					c.SetItemChecked(i, ris.Contains(c.GetItem(i).ToString()));
				}
			}
		}