Exemplo n.º 1
0
 protected override void OnNavigatedTo(NavigationEventArgs e)
 {
     if ((e.Parameter).GetType() == typeof(RecipeController))
     {
         this.recipeController = (RecipeController)e.Parameter;
     }
 }
Exemplo n.º 2
0
        int sortingMethod             = 0; // maybe convert to enum properly

        public MainPage()
        {
            this.InitializeComponent();
            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Collapsed;
            //registerBackgroundTask();

            setTooltips();

            recipeController             = new RecipeController();
            recipeController.jsonReady  += RecipeController_jsonReady;
            recipeController.jsonFailed += RecipeController_jsonFailed;
        }
Exemplo n.º 3
0
        private void cbx_type_Loaded(object sender, RoutedEventArgs e)
        {
            var comboBox = sender as ComboBox;

            string[] source = new string[RecipeController.getRecipeTypes().Length + 1];
            int      x      = 0;

            for (x = 0; x < RecipeController.getRecipeTypes().Length; x++)
            {
                source[x] = RecipeController.getRecipeTypes()[x];
            }
            source[x]            = ""; // an empty selection so user can de-select
            comboBox.ItemsSource = source;
        }
Exemplo n.º 4
0
        public string getRecipeType()
        {
            StringBuilder sb = new StringBuilder();

            string[] myTypes = types.Split(',');
            for (int x = 0; x < myTypes.Length; x++)
            {
                sb.Append(RecipeController.getRecipeTypes()[int.Parse(myTypes[x])]);
                if (x != (myTypes.Length - 1))
                {
                    sb.Append(", ");
                }
            }
            return(sb.ToString());
        }
Exemplo n.º 5
0
        public async void buildFlyout(object sender, int type)
        {
            MenuFlyout menuFlyout = new MenuFlyout();

            if (type == 0)
            {
                for (int x = 0; x < recipeController.getCategories().Count; x++)
                {
                    MenuFlyoutItem flyItem = new MenuFlyoutItem();
                    flyItem.Text   = recipeController.getCategories()[x];
                    flyItem.Click += FlyItemCategory_Click;
                    menuFlyout.Items.Add(flyItem);
                }
                StorageManager storageManager = new StorageManager();

                bool fileExists = await storageManager.fileExists();

                if (fileExists)
                {
                    MenuFlyoutItem favItem = new MenuFlyoutItem();
                    favItem.Text   = "Mijn Favorieten";
                    favItem.Click += FlyItem_Click_Favorites;
                    menuFlyout.Items.Add(favItem);
                }
            }
            else if (type == 1)
            {
                for (int x = 0; x < RecipeController.getSortingItems().Length; x++)
                {
                    MenuFlyoutItem flyItem = new MenuFlyoutItem();
                    flyItem.Text   = RecipeController.getSortingItems()[x];
                    flyItem.Tag    = x;
                    flyItem.Click += FlyItemType_Click;
                    menuFlyout.Items.Add(flyItem);
                }
            }

            menuFlyout.ShowAt((FrameworkElement)sender);
        }
Exemplo n.º 6
0
 public int getCategoryInteger()
 {
     return(RecipeController.getCategory(category));
 }
Exemplo n.º 7
0
 private void setCategory(string category)
 {
     changeButtonText(category);
     fillRectanglesWithColors(RecipeController.getCategory(category));
 }
Exemplo n.º 8
0
 private void RecipeController_jsonFailed(RecipeController rc, EventArgs e)
 {
     prog_main.IsActive   = false;
     lbl_error.Text       = "Er kan geen verbinding worden gemaakt met de server...";
     lbl_error.Visibility = Visibility.Visible;
 }