Ejemplo n.º 1
0
        public MainWindow()
        {
            InitializeComponent();
            // Выбор недели в для формирования меню

            CB1.SelectedIndex = 0;
            sel = CB1.SelectedIndex;

            // Выбор недели в для формирования списка
            CB2.SelectedIndex = 0;
            selList = CB2.SelectedIndex;

            // ВьюМодел главного окна (передаем выбранные недели)
            viewModelMain = new MainViewModel(sel, selList);
            this.DataContext = viewModelMain;

            // ViewModel для пользовательского элемента "повареная книга"
            bookViewModel = new MenuBookViewModel();
            MBV1.DataContext = bookViewModel;
            MBV1.TreeMeals.SelectedItemChanged += TreeView_OnSelectedItemChanged;

            // ViewModel для пользовательского элемента "просмотр блюда"
            showMealViewModel = new ShowMealViewModel(0);
            VM1.DataContext = showMealViewModel;
            VM1.Visibility = Visibility.Hidden;
            VM1.save.Click += Button_Click;
        }
Ejemplo n.º 2
0
 void mi_Click(object sender, RoutedEventArgs e)
 {
     MenuItem mi = sender as MenuItem;
     ContextMenu cm = mi.Parent as ContextMenu;
     DataGridCell curCell = (DataGridCell)cm.PlacementTarget;
     string colName = (string)curCell.Column.Header;
     MenuDays md = (MenuDays)curCell.DataContext;
     ChoseMealView mbv = new ChoseMealView(md, viewModelMain.Id, colName);
     mbv.ShowDialog();
     viewModelMain = new MainViewModel(sel, selList);
     this.DataContext = viewModelMain;
 }
Ejemplo n.º 3
0
 private void ListProdCB_SelectedIndexChanged(object sender, RoutedEventArgs e)
 {
     selList = CB2.SelectedIndex;
     viewModelMain = new MainViewModel(sel, selList);
     this.DataContext = viewModelMain;
 }
Ejemplo n.º 4
0
 private void Generate(object sender, RoutedEventArgs e)
 {
     GetPortions();
     GetGroupsBr();
     GetGroupsDn1();
     GetGroupsDn2();
     GetGroupsDn3();
     GetGroupsSp();
     viewModelMain.MakeMenu(portions, groupsBr, groupsDn1, groupsDn2, groupsDn3, groupsSp);
     viewModelMain = new MainViewModel(sel, selList);
     this.DataContext = viewModelMain;
 }
Ejemplo n.º 5
0
 void do_Click(object sender, MouseButtonEventArgs e)
 {
     DataGrid mi = sender as DataGrid;
     DataGridCellInfo curCell=(DataGridCellInfo)mi.CurrentCell;
     string colName = (string)curCell.Column.Header;
     if (!colName.Equals("День"))
     {
         MenuDays md = (MenuDays)curCell.Item;
         ChoseMealView mbv = new ChoseMealView(md, viewModelMain.Id, colName);
         mbv.ShowDialog();
         viewModelMain = new MainViewModel(sel, selList);
         this.DataContext = viewModelMain;
     }
 }
Ejemplo n.º 6
0
 private void ComboBoxEdit_SelectedIndexChanged(object sender, RoutedEventArgs e)
 {
     sel = CB1.SelectedIndex;
     viewModelMain = new MainViewModel(sel, selList);
     this.DataContext = viewModelMain;
 }