SetItemChecked() public method

public SetItemChecked ( int index, bool value ) : void
index int
value bool
return void
Example #1
1
        /// <summary>
        /// Set all items in a CheckedListBox checked/unchecked
        /// </summary>
        /// <param name="_listBox">ListBox to perform operation on</param>
        /// <param name="_select">Selected?</param>
        private void CheckListBoxItems(CheckedListBox _listBox, bool _select) {
            if(_listBox.Items.Count == 0) {
                status.Text = _select ? "Nothing to select." : "Nothing to deselect.";
            }

            for(int i = 0 ; i < _listBox.Items.Count ; i++ ) {
                _listBox.SetItemChecked(i, _select);
            }
        }
Example #2
0
 private void btnAll_Click(object sender, System.EventArgs e)
 {
     for (int n = 0; n < lbCont.Items.Count; n++)
     {
         lbCont.SetItemChecked(n, true);
     }
 }
        private void RefreshTechnologies()
        {
            for (int i = 0; i <= lstTechnologies.Items.Count - 1; i++)
            {
                lstTechnologies.SetItemChecked(i, false);
            }

            if (this.currencyManager == null)
            {
                return;
            }

            if (this.currencyManager.Position == -1)
            {
                return;
            }

            DataRow improvement = ((DataRowView)this.currencyManager.Current).Row;

            DataRow[] techs = improvement.GetChildRows("Improvement_ImprovementTechnologies");

            if (techs == null)
            {
                return;
            }

            int idx;

            foreach (DataRow row in techs)
            {
                idx = lstTechnologies.Items.IndexOf(row);
                lstTechnologies.SetItemChecked(idx, true);
            }
        }
Example #4
0
 public void SetSpell(MonsterXfer.SpellEntry spell)
 {
     // указываем имя заклинания
     spellsListBox.SelectedIndex = Array.IndexOf(spellIDArray, spell.SpellName);
     // чекаем флаги
     if ((spell.UseFlags & 0x08000000) == 0x08000000)
     {
         usageCheckBox.SetItemChecked(0, true);
     }
     if ((spell.UseFlags & 0x10000000) == 0x10000000)
     {
         usageCheckBox.SetItemChecked(1, true);
     }
     if ((spell.UseFlags & 0x20000000) == 0x20000000)
     {
         usageCheckBox.SetItemChecked(2, true);
     }
     if ((spell.UseFlags & 0x40000000) == 0x40000000)
     {
         usageCheckBox.SetItemChecked(3, true);
     }
     if ((spell.UseFlags & 0x80000000) == 0x80000000)
     {
         usageCheckBox.SetItemChecked(4, true);
     }
 }
Example #5
0
 // select all reports
 private void _btnSelectAll_Click(object sender, System.EventArgs e)
 {
     for (int i = 0; i < _chkList.Items.Count; i++)
     {
         _chkList.SetItemChecked(i, true);
     }
 }
Example #6
0
 private void mnuAll_Click(object sender, System.EventArgs e)
 {
     for (int i = 0; i < clbObjects.Items.Count; i++)
     {
         clbObjects.SetItemChecked(i, true);
     }
 }
Example #7
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Handles the Load event of the ExportUsfmDialog control.
        /// </summary>
        /// <param name="e">The <see cref="T:System.EventArgs"/> instance containing the event data.</param>
        /// ------------------------------------------------------------------------------------
        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);

            if (DesignMode)
            {
                return;
            }

            // Get file format settings.
            LoadFileNameSchemeControl(RegistrySettingType, DefaultSuffix);

            // Populate checked list box with currently used analysis writing systems
            foreach (int hvoWs in m_cache.GetUsedScriptureBackTransWs())
            {
                chklbWritingSystems.Items.Add(new LgWritingSystem(m_cache, hvoWs));
            }
            if (chklbWritingSystems.Items.Count > 0)
            {
                chklbWritingSystems.SetItemChecked(0, true);                 // select default analysis ws
                // Display writing systems checked list box only if back translations are enabled.
                chklbWritingSystems.Enabled = ExportBackTranslationDomain;
                UpdateBtWsChecks();
            }
            else
            {
                chklbWritingSystems.Enabled = false;
            }
        }
 /// <summary>
 ///   Overrides <c>InitLayout</c> method to check all version types by
 ///   default.
 /// </summary>
 protected override void InitLayout()
 {
     base.InitLayout();
     for (int i = 0; i < m_checkedListBoxVersions.Items.Count; ++i)
     {
         m_checkedListBoxVersions.SetItemChecked(i, true);
     }
 }
Example #9
0
 private void SetGroupButton_Click(object sender, System.EventArgs e)
 {
     for (int i = 0; i < mNumSections; i++)
     {
         string name = (string)(EnabledSectionListBox.Items[i]);
         if (name.IndexOf(SubStringTextBox.Text) >= 0)
         {
             EnabledSectionListBox.SetItemChecked(i, EnableCheckBox.Checked);
         }
     }
 }
        public void AddLayer(cTileLayer aTLayer, int alPos)
        {
            if (alPos < 0)
            {
                mlstTileLayers.Add(aTLayer);

                objLayerList.Items.Add(objLayerList.Items.Count + " : " + aTLayer.msName);
                objLayerList.SetItemChecked(objLayerList.Items.Count - 1, true);
                objShadowLayerList.Items.Add(objShadowLayerList.Items.Count + " : " + aTLayer.msName);
            }
            else
            {
                mlstTileLayers.Insert(alPos, aTLayer);

                int LastShadowLayer = objShadowLayerList.SelectedIndex;

                objLayerList.Items.Clear();
                objShadowLayerList.Items.Clear();

                for (int i = 0; i < mlstTileLayers.Count; i++)
                {
                    objLayerList.Items.Add(i + " : " + ((cTileLayer)mlstTileLayers[i]).msName);
                    objShadowLayerList.Items.Add(i + " : " + ((cTileLayer)mlstTileLayers[i]).msName);
                }

                for (int i = 0; i < objLayerList.Items.Count; i++)
                {
                    objLayerList.SetItemChecked(i, true);
                }

                if (LastShadowLayer >= alPos)
                {
                    LastShadowLayer++;
                    objShadowLayerList.SelectedIndex = LastShadowLayer;
                }
            }



            if (objLayerList.Items.Count == 1)
            {
                objLayerList.SelectedIndex       = 0;
                objShadowLayerList.SelectedIndex = 0;
                mlSelectedLayer = 0;
            }

            if (objShadowLayerList.SelectedIndex < 0)
            {
                objShadowLayerList.SelectedIndex = 0;
            }
        }
Example #11
0
        private void btUp_Click(object sender, System.EventArgs e)
        {
            int n = clsOrder.SelectedIndex;

            if (n > 0)
            {
                object s = clsOrder.Items[n];
                bool   b = clsOrder.GetItemChecked(n);
                clsOrder.Items.RemoveAt(n);
                clsOrder.Items.Insert(n - 1, s);
                clsOrder.SetItemChecked(n - 1, b);
                clsOrder.SelectedIndex = n - 1;
            }
        }
 private void cmdSASM_Click(object sender, System.EventArgs e)
 {
     for (int i = 0; i < chkLstScanners.Items.Count; i++)
     {
         if (chkLstScanners.Items[i].ToString().IndexOf(strWizModel) == 0)
         {
             chkLstScanners.SetItemChecked(i, true);
         }
         else
         {
             chkLstScanners.SetItemChecked(i, false);
         }
     }
 }
Example #13
0
 public void SetSourceColumns(DataColumnCollection Columns)
 {
     try
     {
         foreach (DataColumn col in Columns)
         {
             ClbShowColumn.Items.Add(col.ColumnName.ToString());
             ClbShowColumn.SetItemChecked(ClbShowColumn.Items.Count - 1, true);
         }
     }
     catch (System.Exception a_Ex)
     {
         MessageBox.Show(a_Ex.Message);
     }
 }
Example #14
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="FunID"></param>
        private void SetItemCheckedByFunID(int FunID)
        {
            try
            {
                int    idx        = m_FunName2FunID.IndexOfValue((object)FunID);
                string strFunName = m_FunName2FunID.GetKey(idx).ToString().Trim();

                int idxOfCklItem = cklPurview.Items.IndexOf(strFunName);
                cklPurview.SetItemChecked(idxOfCklItem, true);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
Example #15
0
 public static void CheckAllItems(this System.Windows.Forms.CheckedListBox clb)
 {
     while (clb.CheckedIndices.Count < clb.Items.Count)
     {
         clb.SetItemChecked(clb.CheckedIndices[0], true);
     }
 }
Example #16
0
        /// <inheritdoc/>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            #region Sanity checks
            if (context == null) throw new ArgumentNullException(nameof(context));
            if (provider == null) throw new ArgumentNullException(nameof(provider));
            #endregion

            var languages = value as LanguageSet;
            if (languages == null) throw new ArgumentNullException(nameof(value));

            var editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            if (editorService == null) return value;

            var listBox = new CheckedListBox {CheckOnClick = true};
            int i = 0;
            foreach (var language in languages)
            {
                listBox.Items.Add(language);
                listBox.SetItemChecked(i++, true);
            }
            foreach (var language in Languages.AllKnown.Except(languages))
                listBox.Items.Add(language);

            editorService.DropDownControl(listBox);

            return new LanguageSet(listBox.CheckedItems.Cast<CultureInfo>());
        }
Example #17
0
        private void m_btnRunUtils_Click(object sender, System.EventArgs e)
        {
            using (new WaitCursor(this))
            {
                // Note: Resetting the steps text doesn't work.
                //m_lSteps.Text = String.Empty;
                //int totalSteps = m_clbUtilities.CheckedItems.Count;
                //int currentStep = 0;
                Set <IUtility> checkedItems = new Set <IUtility>();
                foreach (IUtility util in m_clbUtilities.CheckedItems)
                {
                    //m_lSteps.SuspendLayout();
                    //m_lSteps.Text = String.Format("Step {0} of {1}", ++currentStep, totalSteps);
                    //m_lSteps.ResumeLayout(true);
                    util.Process();
                    m_progressBar.Value = 0;
                    checkedItems.Add(util);
                }

                // Uncheck each one that was done.
                foreach (IUtility checkedUtil in checkedItems)
                {
                    m_clbUtilities.SetItemChecked(m_clbUtilities.Items.IndexOf(checkedUtil), false);
                }

                //m_lSteps.Text = String.Empty;
            }
        }
Example #18
0
 private void linkLabel1_LinkClicked(object sender, System.Windows.Forms.LinkLabelLinkClickedEventArgs e)
 {
     for (int i = 0; i < lbfiles.Items.Count; i++)
     {
         lbfiles.SetItemChecked(i, false);
     }
 }
Example #19
0
 public static void UncheckAllItems(this System.Windows.Forms.CheckedListBox clb)
 {
     while (clb.CheckedIndices.Count > 0)
     {
         clb.SetItemChecked(clb.CheckedIndices[0], false);
     }
 }
 private void ExportProjectDialog_Load(object sender, System.EventArgs e)
 {
     for (int i = 0; i < projListBox.Items.Count; i++)
     {
         projListBox.SetItemChecked(i, true);
     }
 }
Example #21
0
        //检测当前有回所应用的部门,并在相应部门前打勾
        private void RefreshDeptDiscount()
        {
            System.Data.SqlClient.SqlConnection conn = new System.Data.SqlClient.SqlConnection();
            conn.ConnectionString = rms_var.ConnStr;
            try
            {
                SqlCommand selectCMD = new SqlCommand();

                selectCMD.Connection     = conn;
                selectCMD.CommandText    = "select deptcode from DiscountArea where discountcode='" + DiscountCode + "'";
                selectCMD.CommandTimeout = 30;
                SqlDataAdapter dbDA = new SqlDataAdapter();
                dbDA.SelectCommand = selectCMD;
                conn.Open();
                DataSet dbDS = new DataSet();
                dbDA.Fill(dbDS, "t");

                int tmp;

                for (int i = 0; i <= dbDS.Tables[0].Rows.Count - 1; i++)
                {
                    tmp = CheckedListBox1.Items.IndexOf(rms_var.GetDeptName(dbDS.Tables[0].Rows[i][0].ToString()));
                    CheckedListBox1.SetItemChecked(tmp, true);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                conn.Close();
            }
        }
Example #22
0
 public static void ClearCheckedListBox(CheckedListBox ch)
 {
     while (ch.CheckedIndices.Count > 0)
     {
         ch.SetItemChecked(ch.CheckedIndices[0], false);
     }
 }
Example #23
0
 public static void clearItemCheckList(CheckedListBox check)
 {
     for (int item = 0; item < check.Items.Count; item++)
     {
         check.SetItemChecked(item, false);
     }
 }
 private void UncheckAllDevices()
 {
     foreach (int i in cklbCameras.CheckedIndices)
     {
         cklbCameras.SetItemChecked(i, false);
     }
 }
Example #25
0
 private void btnRun_Click(object sender, System.EventArgs e)
 {
     foreach (System.IO.FileInfo f in clbSrc.CheckedItems)
     {
         //------------------------------------------------------------------//
         System.IO.Stream stream = null;
         try
         {
             ReportBuilder builder = new ReportBuilder();
             Report        activeReport;
             builder.Build(f.FullName);
             activeReport          = builder.Report;
             activeReport.Location = new Point((this.Width - activeReport.Width) / 2, 0);
             //***//
             stream = new System.IO.FileStream(fbd.SelectedPath + "\\" + f.Name + ".xml", System.IO.FileMode.Create);
             //ReportBuilder rb = new ReportBuilder(r);
             XmlSerializer xml = new XmlSerializer(/*rb*/ builder.GetType());
             xml.Serialize(stream, /*rb*/ builder);
             stream.Close();
             //------------------------------------------------------------------//
             clbDst.SetItemChecked(clbDst.FindStringExact(f.Name), true);
         }
         catch (Exception err)
         {
             if (stream != null)
             {
                 if (stream.CanWrite)
                 {
                     stream.Close();
                 }
             }
         }
     }
 }
 void InitSidesListBox()
 {
     for (int n = 0; n < checkedListBoxSides.Items.Count; n++)
     {
         checkedListBoxSides.SetItemChecked(n, (m_tgr.Sides & (1 << n)) != 0);
     }
 }
Example #27
0
 private void selall_click(Object sender, EventArgs e)
 {
     for (int i = 0; i < lb.Items.Count; i++)
     {
         lb.SetItemChecked(i, true);
     }
 }
 /// <summary>
 /// Checks all.
 /// </summary>
 /// <param name="cb">The cb.</param>
 /// <param name="value">if set to <c>true</c> [value].</param>
 public static void CheckAll(CheckedListBox cb, bool value)
 {
     for (var a = 0; a < cb.Items.Count; a++)
     {
         cb.SetItemChecked(a, value);
     }
 }
Example #29
0
        private void btGoUp_Click(object sender, System.EventArgs e)
        {
            int index = checkedListBox1.SelectedIndex;

            if (index > 0)
            {
                Layer layer = checkedListBox1.SelectedItem as Layer;

                bool flag = checkedListBox1.GetItemChecked(index);
                layer.GoUp();
                checkedListBox1.Items.Remove(layer);
                checkedListBox1.Items.Insert(index - 1, layer);
                checkedListBox1.SetItemChecked(index - 1, flag);
                checkedListBox1.SelectedItem = layer;
            }
        }
Example #30
0
        //</Snippet2>

        //<Snippet4>
        //<Snippet3>
        private void CheckEveryOther_Click(object sender, System.EventArgs e)
        {
            // Cycle through every item and check every other.

            // Set flag to true to know when this code is being executed. Used in the ItemCheck
            // event handler.
            insideCheckEveryOther = true;

            for (int i = 0; i < checkedListBox1.Items.Count; i++)
            {
                // For every other item in the list, set as checked.
                if ((i % 2) == 0)
                {
                    // But for each other item that is to be checked, set as being in an
                    // indeterminate checked state.
                    if ((i % 4) == 0)
                    {
                        checkedListBox1.SetItemCheckState(i, CheckState.Indeterminate);
                    }
                    else
                    {
                        checkedListBox1.SetItemChecked(i, true);
                    }
                }
            }

            insideCheckEveryOther = false;
        }
Example #31
0
        /// //////////////////////////////////////////////////////
        private void m_arbre_AfterSelect(object sender, System.Windows.Forms.TreeViewEventArgs e)
        {
            ValideModifsDroitEnCours();
            CDroitNode        node  = (CDroitNode)e.Node;
            CDroitUtilisateur droit = node.Droit;

            m_listeExtensions.Visible = droit.TypeAssocieURI != null && droit.TypeAssocieURI != "";
            m_labelInfo.Text          = droit.Infos;
            OptionsDroit[] options = droit.ListeOptionsPossibles;
            m_wndListeOptions.Items.Clear();
            if (options.Length == 0)
            {
                m_wndListeOptions.Visible = false;
            }
            else
            {
                foreach (OptionsDroit option in options)
                {
                    int nItem = m_wndListeOptions.Items.Add(new COptionDroitUtilisateur(option));
                    if (node.Relation != null)
                    {
                        m_wndListeOptions.SetItemChecked(nItem, node.Relation.HasOption(option));
                    }
                }
                m_wndListeOptions.Visible = true;
            }
            if (droit.TypeAssocieURI != null)
            {
                CListeObjetsDonnees lst = droit.ListeObjetsAssocies;
                m_listeExtensions.Remplir(lst);
                if (node.Relation != null)
                {
                    //Coche ce qui doit l'être
                    Hashtable tableCheck = new Hashtable();
                    foreach (CObjetDonnee obj in node.Relation.ListeObjetsOption)
                    {
                        tableCheck[obj] = true;
                    }
                    foreach (ListViewItem item in m_listeExtensions.Items)
                    {
                        if (tableCheck[item.Tag] != null)
                        {
                            item.Checked = true;
                        }
                    }
                }
            }
            if (e.Node.Checked && !m_bLockEdition)
            {
                m_listeExtensions.Enabled = true;
                m_wndListeOptions.Enabled = true;
            }
            else
            {
                m_listeExtensions.Enabled = false;
                m_wndListeOptions.Enabled = false;
            }
            m_lastNodeAffiche = (CDroitNode)e.Node;
        }
 /// <summary>
 /// Sets the specified item's check state.
 /// </summary>
 /// <param name="index">The index of the item.</param>
 /// <param name="value">Checked if set to <c>true</c>; otherwise unchecked.</param>
 public void SetItemChecked(int index, bool value)
 {
     if (GetItemChecked(index) != value)
     {
         checkedListBox1.SetItemChecked(index, value);
         CheckedItemsChanged();
     }
 }
Example #33
0
 private void txb_TextBox_TextChanged(object sender, EventArgs e)
 {
     string[] blocks = ((TextBox)sender).Text.Split(' ');
     for (int idx = 0; idx < clb_CheckedListBox.Items.Count; idx++)
     {
         clb_CheckedListBox.SetItemChecked(idx, clb_CheckedListBox.Items[idx].ToString().Split(' ').Intersect(blocks).Any());
     }
 }
Example #34
0
        public void OnPrinterSettingChange(SPrinterSetting ss, CaliConfig cc)
        {
            int PassListNum = ss.sFrequencySetting.nPass;

            m_CheckedListBoxPass.Items.Clear();
            string spass = ResString.GetDisplayPass();

            for (int i = 0; i < PassListNum; i++)
            {
                string dispPass = (i + 1).ToString() + " " + spass;
                m_CheckedListBoxPass.Items.Add(dispPass);
                m_CheckedListBoxPass.SetItemChecked(i, true);
            }
            //CoreInterface.GetSeviceSetting(ref sSeviceSet);
            //OnServiceSettingChange(sSeviceSet,cc);
            //this.isDirty = false;
        }
Example #35
0
 public override void ToggleItem(ListItemProvider item)
 {
     if (ContainsItem(item) == true)
     {
         SWF.CheckedListBox checkedListBox = (SWF.CheckedListBox)Control;
         bool chcked = checkedListBox.GetItemChecked(item.Index);
         checkedListBox.SetItemChecked(item.Index, !chcked);
     }
 }
 /// <summary>
 /// Checks the item.
 /// </summary>
 /// <param name="cb">The cb.</param>
 /// <param name="item">The item.</param>
 public static void CheckItem(CheckedListBox cb, string item)
 {
     for (var a = 0; a < cb.Items.Count; a++)
     {
         if (cb.Items[a].Equals(item))
         {
             cb.SetItemChecked(a, true);
         }
     }
 }
Example #37
0
        /// <summary>
        /// Sets up check list boxs 
        /// </summary>
        /// <param name="listbox"></param>
        /// <param name="defaultExcludeTypes"></param>
        /// <param name="userExcludeTypes"></param>
        private void InitExcludes(CheckedListBox listbox, List<Type> defaultExcludeTypes, List<Type> userExcludeTypes)
        {
            ((ListBox)listbox).DataSource = defaultExcludeTypes;
            ((ListBox)listbox).DisplayMember = "Name";

            for (int i = 0; i < listbox.Items.Count; i++)
            {
                Type typeObj = (Type)listbox.Items[i];
                if (userExcludeTypes.Contains(typeObj))
                    listbox.SetItemChecked(i, true);
            }
        }
Example #38
0
        public static void Draw( CheckedListBox list )
        {
            list.BeginUpdate();
            list.Items.Clear();

            for (int i=0;i<m_Filters.Count;i++)
            {
                Filter f = (Filter)m_Filters[i];
                list.Items.Add( f );
                list.SetItemChecked( i, f.Enabled );
            }
            list.EndUpdate();
        }
Example #39
0
 public static void SetCheck(CheckedListBox cblItems, string valueList)
 {
     string[] strtemp = valueList.Split(',');
     foreach (string str in strtemp)
     {
         for (int i = 0; i < cblItems.Items.Count; i++)
         {
             if (cblItems.GetItemText(cblItems.Items[i]) == str)
             {
                 cblItems.SetItemChecked(i, true);
             }
         }
     }
 }
Example #40
0
 public void SetCheckboxItemChecked(CheckedListBox control, int index, bool val)
 {
     if (control.InvokeRequired)
       {
     SetCheckboxItemCheckedCallback d = SetCheckboxItemChecked;
     try
     {
       Invoke(d, new object[] { control, index, val });
     }
     catch (Exception) { }
       }
       else
       {
     control.SetItemChecked(index, val);
       }
 }
Example #41
0
 private void CheckToggleAll(CheckedListBox chibby,CheckBox master)
 {
     if (master.Checked)
     {
         for (int i = 0; i < chibby.Items.Count; i++)
         {
             chibby.SetItemChecked(i, true);
         }
     }
     else
     {
         for (int i = 0; i < chibby.Items.Count; i++)
         {
             chibby.SetItemChecked(i, false);
         }
     }
 }
Example #42
0
		public void ItemCheckTest ()
		{
			Form myform = new Form ();
			myform.ShowInTaskbar = false;
			CheckedListBox mychklstbox = new CheckedListBox ();
			mychklstbox.Items.Add ("test1"); 
			mychklstbox.Items.Add ("test2"); 
			//Test ItemCheck Event
			mychklstbox.ItemCheck += new ItemCheckEventHandler (ItemCheck_EventHandler);		
			mychklstbox.Items.Add ("test1",CheckState.Checked);
			myform.Controls.Add (mychklstbox);
			myform.Show ();
			Assert.AreEqual (true, eventhandled, "#A1");
			eventhandled = false;
			mychklstbox.SetItemChecked (1,true);
			Assert.AreEqual (true, eventhandled, "#A2");
			myform.Dispose ();
		}
Example #43
0
        private void SetChkListChecked(CheckedListBox lb, string checkedId)
        {
            if (checkedId == null)
            {
                ClearListCheckStatus(lb);
                return;
            }

            string[] ids = checkedId.Split(',');
            for (int i = 0; i < lb.Items.Count; i++)
            {
                ExtItem item = lb.Items[i] as ExtItem;
                lb.SetItemChecked(i, ids.Contains<string>(item.Tag.ToString()));
            }
        }
Example #44
0
 private void UpdateCheckedList(CheckedListBox list)
 {
     object wasSelected = list.SelectedItem;
      list.BeginUpdate();
      for (int i = 0; i < list.Items.Count; i++)
     list.SetItemChecked(i, ((Item)list.Items[i]).IsVisible);
      list.SelectedItem = wasSelected;
      list.EndUpdate();
 }
Example #45
0
 private void ClearListCheckStatus(CheckedListBox lb)
 {
     for (int i = 0; i < lb.Items.Count; i++)
     {
         lb.SetItemChecked(i, false);
     }
 }
 private List<EnvComparisonFilter> GetPrefilterList(CheckedListBox clbAvailableFilters)
 {
     List<EnvComparisonFilter> prefilters = new List<EnvComparisonFilter>();
     for (int i = 0; i < clbAvailableFilters.Items.Count; i++) {
         EnvComparisonFilter filter = clbAvailableFilters.Items[i] as EnvComparisonFilter;
         if (filter.FilterType == (int)EnvComparisonFilter.ComparisonFilterType.PreFilter) {
             //prefilters = prefilters + "-" + filter.localName + " [" + filter.localFilterPattern + "]\n";
             prefilters.Add(filter);
             clbAvailableFilters.SetItemChecked(i, true);
         }
     }
     return prefilters;
 }
Example #47
0
 private void TableSelectSet(CheckedListBox control, Dictionary<string, TableSelect> list)
 {
     control.Items.Clear();
     foreach (TableSelect select in list.Values)
     {
         control.Items.Add(select);
         if (select.active)
             control.SetItemChecked(control.Items.IndexOf(select), true);
     }
 }
Example #48
0
        private void FillCheckedListBoxFromString(object obj, CheckedListBox listBox)
        {
            string value = obj.ToString();
            if (value == NoFlags)
                return;

            char[] delimiters = new[] { '|', ';', ',', ':' };
            string[] flags = value.Split(delimiters, StringSplitOptions.RemoveEmptyEntries);
            foreach (string flag in flags)
            {
                for (int i = 0; i < m_names.Length; i++)
                {
                    if (flag == m_names[i])
                    {
                        listBox.SetItemChecked(i, true);
                        break;
                    }
                }
            }
        }
Example #49
0
        /// <summary>
        /// Deletes the selected tasks.
        /// </summary>
        /// <param name="viewAbleList">The view able list.</param>
        /// <param name="filterList">The filter list.</param>
        /// <param name="tags">The tags.</param>
        public void DeleteSelectedTasks(ListView viewAbleList, CheckedListBox filterList, string[] tags)
        {
            List<string> preservedFilterChecks = GetFiltersSelected(filterList);
            filterList.Items.Clear();
            filters.Clear();
            SetDefaultFilters(filterList, tags);

            int i = 0;
            while (i < taskList.Count)
            {
                int j = 0;
                while (j < viewAbleList.SelectedItems.Count)
                {
                    if (taskList[i].date.ToShortDateString() == viewAbleList.SelectedItems[j].SubItems[0].Text
                         && taskList[i].tag == viewAbleList.SelectedItems[j].SubItems[1].Text
                         && taskList[i].task == viewAbleList.SelectedItems[j].SubItems[2].Text)
                    {
                        taskList.RemoveAt(i);
                        i -= 1;
                        break;
                    }
                    ++j;
                }
                ++i;
            }
            UpdateTaskList(viewAbleList, filterList, false);
            i = 0;
            while (i < filterList.Items.Count)
            {
                if (preservedFilterChecks.Contains(filterList.Items[i].ToString()))
                {
                    filterList.SetItemChecked(i, true);
                }
                ++i;
            }
            UpdateTaskList(viewAbleList, filterList);
            this.Save();
        }
Example #50
0
        //, Dictionary<string,TableSelect> dictionary)
        private void TableSelectionsEdit(CheckedListBox listBox, bool filterList)
        {
            TableSelectForm form = dbDeployForm.tableSelectForm;
            ListBox list = form.TableList;

            form.TablesLoad(meta);

            int index;

            foreach (TableSelect select in listBox.Items)
            {
                index = list.Items.IndexOf(select.name);
                if (index >= 0)
                {
                    list.SelectedItems.Add(select.name);
                }
                else
                {
                    //TODO: Issue an error that table no longer exists and will be immediately deleted (peform deletion here)
                }
            }

            if (dbDeployForm.tableSelectForm.ShowDialog() == DialogResult.OK)
            {
                bool found;

                foreach (string name in list.SelectedItems)
                {
                    found = false;
                    foreach (TableSelect select in listBox.Items)
                    {
                        if (name == select.name)
                        {
                            found = true;
                            break;
                        }
                    }

                    if (!found)
                    {
                        TableSelect select;
                        if (filterList)
                            select = new TableFilter(true, name, "");
                        else
                            select = new TableSelect(true, name);
                        listBox.Items.Add(select);
                        listBox.SetItemChecked(listBox.Items.IndexOf(select), true);
                    }
                }

                index = 0;
                while (index < listBox.Items.Count)
                {
                    if (list.SelectedItems.Contains(((TableSelect)(listBox.Items[index])).name))
                    {
                        index++;
                    }
                    else
                    {
                        listBox.Items.RemoveAt(index);
                    }
                }

                foreach (TableSelect select in listBox.Items)
                {
                    if (!list.SelectedItems.Contains(select.name))
                    {
                        listBox.Items.Remove(select);
                    }
                }

            }
        }
Example #51
0
        public static void initChartZhiBiao(CheckedListBox cklst, string dbtype, string itemname)
        {
            using (MySqlDataContext db = new MySqlDataContext())
            {
                cklst.Items.Clear();
                List<ChartZHIbiAO> res = null;
                switch (dbtype.ToUpper())
                {
                    case "CPRS":
                        res = (from tmp in db.ChartZHIbiAO
                               where tmp.CN == 1 && tmp.ItemName == itemname
                               select tmp).ToList<ChartZHIbiAO>();
                        break;
                    case "WPI":
                        res = (from tmp in db.ChartZHIbiAO
                               where tmp.Wpi == 1 && tmp.ItemName == itemname
                               select tmp).ToList<ChartZHIbiAO>();
                        break;
                    case "EPODOC":
                        res = (from tmp in db.ChartZHIbiAO
                               where tmp.EPodOC == 1 && tmp.ItemName == itemname
                               select tmp).ToList<ChartZHIbiAO>();
                        break;
                }
                foreach (var tmp in res)
                {
                    cklst.Items.Add(tmp);
                }
                cklst.DisplayMember = "ShowName";
                if (cklst.Items.Count > 0)
                {
                    cklst.SetItemChecked(0, true);
                    cklst.SelectedIndex = 0;

                }
            }
        }
        private void BuildView(ClassificationScheme classificationScheme)
        {
            this.SuspendLayout();
            this.Text = classificationScheme.Settings.Name;
            var table = GUIUtils.CreateTable(new double[] { .33, .33, .33 }, Direction.Horizontal);

            // classifier
            var classifierSettings = new DerivedTypeConfigurationPanel(typeof(IClassifier), classificationScheme.Classifier);
            this.getClassifier = () => (IClassifier)classifierSettings.GetConfiguredObject();
            table.Controls.Add(classifierSettings, 0, 0);

            // general settings
            var generalSettings = new ConfigurationPanel(classificationScheme.Settings);
            table.Controls.Add(generalSettings, 1, 0);

            // bin selection
            var panel = new Panel() { Dock = DockStyle.Fill };

            var binList = new CheckedListBox() { Dock = DockStyle.Fill, CheckOnClick = true };
            binList.AddContextMenu();
            this.ToolTip.SetToolTip(binList, "Select which time bins from each trial will be used to train the classifier");
            var timeBins = GeneralClassifierSettings.MAX_BINS
                .CountTo()
                .Select(i => new TimeBin(i) { Checked = classificationScheme.Settings.SelectedBins.Contains(i) })
                .ToIArray();
            binList.ItemCheck += (sender, args) => ((TimeBin)binList.Items[args.Index]).Checked = (args.NewValue == CheckState.Checked);
            Action<int> refreshBinList = (binWidth) =>
            {
                // ensure the right number of items
                int binCount = GeneralClassifierSettings.GetBinCount(binWidth);
                if (binList.Items.Count < binCount)
                    binList.Items.AddRange(timeBins.SubView(binList.Items.Count, binCount - binList.Items.Count).ToArray());
                else
                    for (int i = binList.Items.Count - 1; i >= binCount; i--)
                        binList.Items.RemoveAt(i);

                // ensure correct width and uncheck all
                TimeBin timeBin;
                for (int i = 0; i < binCount; i++)
                {
                    timeBin = (TimeBin)binList.Items[i];
                    timeBin.BinWidth = binWidth;
                    binList.SetItemChecked(i, timeBin.Checked);
                }

                binList.Invalidate();
            };
            refreshBinList(classificationScheme.Settings.BinWidthMillis);
            var binWidthProp = typeof(GeneralClassifierSettings).GetProperty("BinWidthMillis");
            var nameProp = typeof(GeneralClassifierSettings).GetProperty("Name");
            if (binWidthProp == null || nameProp == null)
                throw new Exception("Failed to find properties!");
            generalSettings.PropertyChanged += args =>
            {
                if (args.Property.Equals(binWidthProp))
                    refreshBinList((int)args.Getter());
                else if (args.Property.Equals(nameProp))
                    this.Text = args.Getter().ToString();
            };
            this.getSettings = () =>
            {
                var settings = (GeneralClassifierSettings)generalSettings.GetConfiguredObject();
                settings.SelectedBins = binList.CheckedIndices.Cast<int>().ToIArray();

                return settings;
            };
            panel.Controls.Add(binList);
            panel.Controls.Add("Time Bins".ToLabel());
            var saveButton = GUIUtils.CreateFlatButton("Save", (b) =>
            {
                this.saveDialog.FileName = this.Text;
                if (this.saveDialog.ShowDialog() != DialogResult.OK)
                    return;

                bool saved = this.ClassificationScheme.TrySerializeToFile(this.saveDialog.FileName);
                GUIUtils.Alert((saved ? "Saved" : "Failed to save")
                    + " classifier info to " + this.saveDialog.FileName,
                    (saved ? MessageBoxIcon.Information : MessageBoxIcon.Error));

                string directory = Path.GetDirectoryName(this.saveDialog.FileName);
                if (Directory.Exists(directory))
                    this.saveDialog.InitialDirectory = directory;
            });
            saveButton.Dock = DockStyle.Bottom;
            panel.Controls.Add(saveButton);
            table.Controls.Add(panel, 2, 0);

            this.Controls.Add(table);
            this.ResumeLayout(false);
        }
 public static void UnpackLicense(TextPackage[] sourcePacks, CheckedListBox licenseCheckedListBox)
 {
     if (sourcePacks != null)
     {
         foreach (var item in sourcePacks)
         {
             var checkedItems = licenseCheckedListBox.Items;	// チェックボックスの中身とライセンスが一致していたらチェックする
             for (int i = 0; i < checkedItems.Count; i++)
             {
                 if (item["Type"] == (string)checkedItems[i])
                     licenseCheckedListBox.SetItemChecked(i, true);
             }
         }
     }
 }
Example #54
0
        /// <summary>
        /// Set Up Object Lists
        /// </summary>
        /// <param name="listbox">CheckedListBox</param>
        /// <param name="objs">Dictionary of string, bool></param>
        private void SetUpObjectsList(CheckedListBox listbox, Dictionary<string, bool> objs)
        {
            
            ((ListBox)listbox).DataSource = objs.Keys.ToList();
            
            for (int i = 0; i < listbox.Items.Count; i++)
            {
                string value = (string)listbox.Items[i];

                listbox.SetItemChecked(i, objs[value]);

            }
           
        }
Example #55
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		///
		/// </summary>
		/// <param name="list"></param>
		/// <param name="moveDown"></param>
		/// ------------------------------------------------------------------------------------
		protected void MoveListItem(CheckedListBox list, bool moveDown)
		{
			Debug.Assert(list != null);

			int index = list.SelectedIndex;
			bool isChecked = list.GetItemChecked(index);

			// Don't allow moving if there is no current item or moving down when the current
			// item is the last item in the list or moving up when the current item is the first
			// item in the list.
			if (index < 0 || (moveDown && index == list.Items.Count - 1) ||
				(!moveDown && index == 0))
				return;

			// Store the selected writing system and remove it.
			var ws = (ILgWritingSystem)list.SelectedItem;
			list.Items.RemoveAt(index);

			// Determine the new place in the list for the stored writing system. Then
			// insert it in its new location in the list.
			index += (moveDown ? 1 : -1);
			list.Items.Insert(index, ws);

			// Now restore the writing system's checked state and select it.
			list.SetItemChecked(index, isChecked);
			list.SelectedIndex = index;
		}
Example #56
0
        /// <summary>
        /// Проверка на наличие выписки ТП для дисциплин
        /// </summary>
        /// <param name="parCheckedListBoxCathedra">ЛистЧекБокс с дисциплинами</param>
        /// <param name="parCodeSpecialty">Код специальности</param>
        /// <param name="parSpecialty">Название специальности</param>
        /// <param name="parCodeSpecialization">Код специализации</param>
        /// <param name="parSpecialization">Название специализации</param>
        public void Verify(/*ListBox parListBox,*/ CheckedListBox parCheckedListBoxCathedra, string parCodeSpecialty, string parSpecialty, string parCodeSpecialization, string parSpecialization)
        {
            this.specialization = new Specialization(parCodeSpecialization, parSpecialization);
            this.specialty = new Specialty(parCodeSpecialty, parSpecialty);
            string discipline;

            //foreach (object item in parCheckedListBoxCathedra.Items)
            //Пробегаем по всему списку листачекбокса
                for (int i = 0; i<parCheckedListBoxCathedra.Items.Count;i++)
            {
                //discipline = item.ToString().Replace(" - ","");
                    //берем название дисциплины
                discipline = parCheckedListBoxCathedra.Items[i].ToString().Replace(" - ", "").Trim();
                    //проверяем есть ли такая в выписке и вытаскием инфу по ней, при наличии
                if (ProcessingDiscipline(discipline))
                {
                    /*parCheckedListBoxCathedra.SetItemChecked(parListBox.Items.IndexOf(item), true);
                    parCheckedListBoxCathedra.Items[parListBox.Items.IndexOf(item)] = this.cathedra;*/
                   // parCheckedListBoxCathedra.Items[parCheckedListBoxCathedra.Items.IndexOf(item)] = this.cathedra + " - " + discipline;
                    //parCheckedListBoxCathedra.SetItemChecked(parCheckedListBoxCathedra.Items.IndexOf(item), true);
                    parCheckedListBoxCathedra.Items[i] =   discipline+" - "+this.cathedra;
                    parCheckedListBoxCathedra.SetItemChecked(i, true);
                    //добавляем характеристику к дисциплине
                    listCharacteristics.Add(new Characteristic(i,fileadres,numberlist,discipline,specialty,specialization));

                }

            }
        }
Example #57
0
        public static void SetCheck(string id, string item, CheckedListBox field)
        {
            if (!field.Items.Contains(item))
            {
                if (((JsonFormTag)field.Tag).dataSource > JsonFormTag.DataSourceType.PRESET_COUNT)
                {
                    IssueTracker.PostIssue(
                        "Item '" + id + "': tag \"" + item + "\" doesn't exist and cannot add.",
                        IssueTracker.IssueLevel.ERROR);
                    return;
                }

                IssueTracker.PostIssue(
                    "Item '" + id + "': tag \"" + item + "\" doesn't exist. Will add...",
                    IssueTracker.IssueLevel.WARNING);

                //Create tag/mat
                Storage.UpdateDataSource(((JsonFormTag)field.Tag).dataSource, item);
            }

            field.SetItemChecked(field.Items.IndexOf(item), true);
        }
        private Control InitializeResponseControl(List<StandardValidTerm> codeList, List<StandardValidTerm> initialSelection, bool addFirstDefault)
        {
            var ptX = _lblEntity.Location.X + 3;
            var ptY = _lblEntity.Location.Y + _lblEntity.Height;
            if (_staticDisplayItems != null)
            {
                var staticLines = String.Empty;
                foreach (var staticDisplayItem in _staticDisplayItems)
                    staticLines += staticDisplayItem + Environment.NewLine;

                var label = new Label
                {
                    Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right,
                    Margin = new Padding(4),
                    Location = new System.Drawing.Point(ptX, ptY),
                    Name = "staticDisplayItemLabel"
                };
                label.AutoSize = true;
                label.Text = staticLines;

                return label;
            }

            if (_maxNumberOfAnswers > 1)
            {
                var chklistEntity = new CheckedListBox();
                chklistEntity.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
                chklistEntity.FormattingEnabled = true;
                chklistEntity.Margin = new Padding(4);
                chklistEntity.Location = new System.Drawing.Point(ptX, ptY);
                chklistEntity.IntegralHeight = false;
                chklistEntity.Name = "chklistEntity";
                var ctrlHeight = (codeList == null ? 1 : Math.Max(1, codeList.Count)) * (chklistEntity.ItemHeight + 2) + chklistEntity.ItemHeight / 2;
                chklistEntity.Size = new System.Drawing.Size(Width - ptX, ctrlHeight);
                chklistEntity.TabIndex = 1;
                chklistEntity.CheckOnClick = true;

                foreach (var validTerm in codeList)
                {
                    var idx = chklistEntity.Items.Add(new ValidTermListItem(validTerm));
                    var sequence = validTerm;
                    if (initialSelection != null && CollectionUtils.Contains(initialSelection, cs => cs.Equals(sequence)))
                        chklistEntity.SetItemChecked(idx, true);
                }
                chklistEntity.ItemCheck += OnItemCheck;

                return chklistEntity;
            }

            var ddlEntity = new ComboBox();
            ddlEntity.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
            ddlEntity.DropDownStyle = ComboBoxStyle.DropDownList;
            ddlEntity.FormattingEnabled = true;
            ddlEntity.Margin = new Padding(4);
            ddlEntity.Location = new System.Drawing.Point(ptX, ptY);
            ddlEntity.Name = "ddlEntity";
            ddlEntity.Size = new System.Drawing.Size(Width - ptX, ddlEntity.Height);
            ddlEntity.TabIndex = 1;

            if (addFirstDefault)
                ddlEntity.Items.Add(new ValidTermListItem(null));
            foreach (var validTerm in codeList)
            {
                var idx = ddlEntity.Items.Add(new ValidTermListItem(validTerm));
                var term = validTerm;
                if (initialSelection != null && ddlEntity.SelectedIndex == -1 && CollectionUtils.Contains(initialSelection, cs => cs.Equals(term)))
                    ddlEntity.SelectedIndex = idx;
            }

            if (ddlEntity.SelectedIndex == -1 && ddlEntity.Items.Count > 0)
                ddlEntity.SelectedIndex = 0;

            ddlEntity.DropDown += OnDropDown;
            ddlEntity.SelectedIndexChanged += OnSelectedIndexChanged;

            return ddlEntity;
        }
 private void UpdateChkList(CheckedListBox chkLst, Shape shape)
 {
     chkLst.Items.Clear();
     int intCount = shape.GDIPropertyCount;
     for (short i = 0; i < intCount; i++)
     {
         chkLst.Items.Add(shape.GetPropertyName(i));
         chkLst.SetItemChecked(i,
             (bool)shape.GetGDIValue(i));
     }
 }
Example #60
0
 private void FillCheckedListBoxFromInt(object value, CheckedListBox listBox)
 {
     int flags = (int)value;
     for (int i = 0; i < m_values.Length; ++i)
     {
         bool isChecked = (flags & m_values[i]) == m_values[i];
         listBox.SetItemChecked(i, isChecked);
     }
 }