Exemplo n.º 1
0
        private void AddRecipeBtn_OnClick(object sender, RoutedEventArgs e)
        {
            AddDish addRecipePage = new AddDish();

            addRecipePage.ShowDialog();
            MenuGrid.ItemsSource = GetItems(1).ToList();
        }
Exemplo n.º 2
0
        public async void StartCookingProcess(CancellationToken token)
        {
            while (true)
            {
                Task[] tasks = new Task[CountOfMenu * Enum.GetNames(typeof(DishesEnum)).Length];
                for (int i = 0; i < tasks.Length; i++)
                {
                    int Id = i;
                    if (token.IsCancellationRequested)
                    {
                        LogSys.WriteToLogFile("Работа кухни остановлена!");
                        return;
                    }

                    tasks[Id] = Task.Run(() =>
                    {
                        Thread.Sleep(1000 + Id * 50);
                        AddDish?.Invoke(this, new AddDishEventArgs
                        {
                            DishToAdd = DictionOfTypes[(DishesEnum)(Id % 3)].Invoke(Id + "_" + (int)TotalDate.DayOfWeek)
                        });
                    });
                }
                Task.WaitAll(tasks);
                TotalDate.AddDays(1);
            }
        }
Exemplo n.º 3
0
        private void Panel_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e)
        {
            UIElement panel = sender as UIElement;
            int       x, y;

            x = Grid.GetColumn(panel);
            y = Grid.GetRow(panel);
            AddDish dialog = new AddDish(Dishes[x, y].DataObject);

            dialog.ShowDialog();
        }
Exemplo n.º 4
0
 public void OnAddedDish(AddDish aDish)
 {
     this.OnAddedDishEvent += aDish;
 }