コード例 #1
0
        public void RefreshFieldValueComboBox(string fieldName)
        {
            try
            {
                FieldValueComboBox.ClearItems();
                QueuedTask.Run(() =>
                {
                    // Get the layer and create a list from all the values
                    var QALayer = MapView.Active.Map.FindLayers((LayerComboBox.SelectedItem).ToString()).FirstOrDefault() as FeatureLayer;

                    if (QALayer == null)
                    {
                        return;
                    }

                    RowCursor QARowCursor = QALayerSelection.Search();                      // if there are already selected records, they will be in the RowCursor

                    List <object> QALayerCodeList = new List <object> {
                    };

                    using (QARowCursor)
                    {
                        while (QARowCursor.MoveNext())
                        {
                            using (Row currentRow = QARowCursor.Current)
                            {
                                // QALayerCodeList.Add(Convert.ToString(currentRow[fieldName]));
                                QALayerCodeList.Add(currentRow[fieldName]);
                            }
                        }
                    }
                    QALayerCodeList.Sort();
                    // Get unique values and counts in the list
                    foreach (object item in QALayerCodeList.Distinct())
                    {
                        if ((item != null) && (item.ToString() != ""))
                        {
                            // add to combobox
                            FieldValueComboBox.AddItem(new ComboBoxItem((item.ToString())));
                        }
                    }


                    FieldValueComboBox.SelectedItem = FieldValueComboBox.ItemCollection.FirstOrDefault();
                    FieldValueComboBox.Text         = FieldValueComboBox.ItemCollection.FirstOrDefault().ToString();

                    // Select the recordset by this first value in the list
                    object selectionvalue = FieldValueComboBox.SelectedItem;
                    SelectByValue(selectionvalue);
                });
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error in RefreshFieldValueComboBox:  " + ex.ToString(), "Error");
            }
        }
コード例 #2
0
        public void ResetTab()
        {
            if (!_deferredRefreshOfLayerList)
            {
                if (Project.Current.HasEdits)
                {
                    MessageBox.Show("You have ended your current review session. You have unsaved edits.");
                }

                // clear the comboboxes
                EditNoteComboBox.ClearItems();
                LayerFieldComboBox.ClearItems();
                QAFieldComboBox.ClearItems();
                FieldValueComboBox.ClearItems();

                // reset states to deactivated
                FrameworkApplication.State.Deactivate("active_state_1");
                FrameworkApplication.State.Deactivate("active_state_2");
                FrameworkApplication.State.Deactivate("active_state_3");
            }
        }
コード例 #3
0
 public void ClearValueComboBox()
 {
     FieldValueComboBox.ClearItems();
 }