Пример #1
0
        private void ButtonEdit_OnClick(object sender, RoutedEventArgs e)
        {
            var selectedItemCombo = (ItemTabViewModel)ComboBoxItems.SelectedItem;
            var selectedItem      = (NotificationItem)ListBoxNotifications.SelectedItem;

            if (selectedItem != null)
            {
                NotificationViewModel model = new NotificationViewModel();
                model.Type = (NotificationType)selectedItem.NotificationType;
                if (selectedItem.Low != null)
                {
                    model.Low = selectedItem.Low.Value;
                }
                if (selectedItem.High != null)
                {
                    model.High = selectedItem.High.Value;
                }
                model.Message = selectedItem.NotificationMsg;
                if (selectedItem.Priority != null)
                {
                    model.Priority = selectedItem.Priority.Value;
                }

                WindowDefineNotification windowDefineNotification = new WindowDefineNotification();
                windowDefineNotification.Notification   = model;
                windowDefineNotification.NotificationId = selectedItem.NotificationId;
                windowDefineNotification.ItemId         = selectedItemCombo.ItemId;
                windowDefineNotification.Reference      = this;
                windowDefineNotification.Show();
            }
        }
Пример #2
0
        private void ButtonAdd_OnClick(object sender, RoutedEventArgs e)
        {
            var item = (ItemTabViewModel)ComboBoxItems.SelectedItem;

            WindowDefineNotification windowDefineNotification = new WindowDefineNotification();
            NotificationViewModel    model = new NotificationViewModel();

            windowDefineNotification.Notification = model;
            windowDefineNotification.Reference    = this;
            windowDefineNotification.ItemId       = item.ItemId;
            windowDefineNotification.Show();
        }