Пример #1
0
        /// <summary>
        /// When the frequency cell is edited, update slider and TagCloud
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void dataGridViewSearchEngines_CellValueChanged(object sender, DataGridViewCellEventArgs e)
        {
            if (e.ColumnIndex == 2 && !Creating)
            {
                // empty cell -> 1
                if (dtSearchEngines.Rows[e.RowIndex]["frequency"] == DBNull.Value)
                {
                    dtSearchEngines.Rows[e.RowIndex]["frequency"] = 1;
                }

                int value = Convert.ToInt32(dtSearchEngines.Rows[e.RowIndex]["frequency"]);
                // set to max / min value
                if (value > 25)
                {
                    value = 25;
                }
                else if (value < 1)
                {
                    value = 1;
                }

                RefreshTagCloud();
                SFSlider sfSlider = this.dataGridViewSearchEngines.Rows[e.RowIndex]["colSlider"].Control as SFSlider;
                sfSlider.Eval("this.setValue(" + value + ")");
                this.dataGridViewSearchEngines.BindingContext[this.dataGridViewSearchEngines.DataSource].EndCurrentEdit();
            }
        }
Пример #2
0
        /// <summary>
        /// A sliders value has changed
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SfSlider_WidgetEvent(object sender, WidgetEventArgs e)
        {
            SFSlider sfSlider = sender as SFSlider;

            if (sfSlider != null)
            {
                if (e.Type == "change")
                {
                    int row = sfSlider.UserData.Row;
                    dtSearchEngines.Rows[row]["frequency"] = e.Data;
                    RefreshTagCloud();
                }
            }
        }
Пример #3
0
 /// <summary>
 /// Create the sliders as controls in the 4th column
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void dataGridViewSearchEngines_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
 {
     for (int i = 0; i < this.dataGridViewSearchEngines.Rows.Count; i++)
     {
         SFSlider sfSlider = new SFSlider()
         {
             Value = Convert.ToInt32(dtSearchEngines.Rows[i]["frequency"])
         };
         this.dataGridViewSearchEngines.Rows[i]["colSlider"].Control = sfSlider;
         sfSlider.Dock         = DockStyle.Fill;
         sfSlider.UserData.Row = i;
         sfSlider.WidgetEvent += SfSlider_WidgetEvent;
     }
 }