示例#1
0
        // creates the single instance of Database on first call, then returns that one later
        public static Database getInstance()
        {
            if (globalInstance == null)
            {
               globalInstance = new Database();
            }

            return globalInstance;
        }
        // constructor
        public RecipeSelectionMenu()
        {
            InitializeComponent();

            recipeDB = Database.getInstance();
            numRecipes = recipeDB.recipeList.Count();
            recipeBlocks = new List<Canvas>();
            activeFilters = new List<String>();
            checkList = new List<CheckBox>();

            // add recipe containers to a list
            recipeBlocks.Add(canvRecipe1);
            recipeBlocks.Add(canvRecipe2);
            recipeBlocks.Add(canvRecipe3);
            recipeBlocks.Add(canvRecipe4);

            // add all skill checkboxes to a list
            checkList.Add(chkbxBread);
            checkList.Add(chkbxDeco);
            checkList.Add(chkBxDeglaze);
            checkList.Add(chkBxDegrease);
            checkList.Add(chkbxFolding);
            checkList.Add(chkbxGlaze);
            checkList.Add(chkBxKneeding);
            checkList.Add(chkbxMarinate);
            checkList.Add(chkbxMixing);
            checkList.Add(chkBxWhisking);

            // assign and load all recipes
            for (int i = 0; i < numRecipes; i++)
                recipeDB.recipeList[i].ID = i;
            LoadRecipes(numRecipes);

            LoadHandlers();
            
        }