コード例 #1
0
        public RecipesView()
        {
            mDataTable = new RecipeTable(this);
            AddDataTableEventHandlers(mDataTable);

            InitializeComponent();

            // Add column names to the filter combobox
            filterCbx.Items.Add(kAllCol);
            filterCbx.Items.Add(RecipeTable.kAlias);
            filterCbx.Items.Add(RecipeTable.kDisplayName);
            filterCbx.Items.Add(RecipeTable.kCategory);
            filterCbx.Items.Add(RecipeTable.kMaterialTags);
            filterCbx.Items.Add(RecipeTable.kCrafter);
            filterCbx.Items.Add(RecipeTable.kLvlReq);
            filterCbx.Items.Add(RecipeTable.kNetWorth);
            filterCbx.Items.Add(RecipeTable.kAppeal);
            filterCbx.Items.Add(RecipeTable.kEffort);
            filterCbx.Items.Add(IngredientColumnGroup.kIngr + " " + IngredientColumnGroup.kName);
            filterCbx.Items.Add(IngredientColumnGroup.kIngr + " " + IngredientColumnGroup.kAmount);

            // Paint deprecated rows in gray.
            recipesGridView.RowPrePaint += (object sender, DataGridViewRowPrePaintEventArgs e) =>
            {
                if (((recipesGridView.Rows[e.RowIndex].DataBoundItem as DataRowView).Row as RecipeRow).IsDeprecated)
                {
                    recipesGridView.Rows[e.RowIndex].DefaultCellStyle.ForeColor = Color.Gray;
                }
            };
        }
コード例 #2
0
        public IngredientColumnGroup(RecipeTable table, int index, RecipesView recipesView)
        {
            this.mIndex       = index;
            this.mRecipesView = recipesView;

            table.AddDataColumn(IconColumnKey, typeof(Image), new IngrIconColumnBehavior(this));
            table.AddDataColumn(NameColumnKey, typeof(string), new IngrNameColumnBehavior(this, recipesView));
            table.AddDataColumn(AmountColumnKey, typeof(int), new IngrAmountColumnBehavior(this));
        }
コード例 #3
0
 public void Reload()
 {
     // Disable render while adding rows
     mIsLoading = true;
     SelectContextMenuItems();
     recipesGridView.DataSource = null;
     mDataTable.Dispose();
     mDataTable = new RecipeTable(this);
     AddDataTableEventHandlers(mDataTable);
     mModifiedCells.Clear();
     mComboBoxColumns.Clear();
     mUndoStack.Clear();
     mRedoStack.Clear();
     LoadColumnsData();
     FilterRows();
     mIsLoading = false;
 }