示例#1
0
        private void DeleteAlert(object obj)
        {
            var alert = (BaseAlert)obj;

            alert.Uninitialize();
            AlertsCollection.Remove(alert);
        }
示例#2
0
        //private void SaveAlert(object obj)
        //{
        //    var alert = (Alert) obj;
        //    var index = AlertsCollection.IndexOf(alert);
        //    alert.IsEdited = !alert.IsEdited;
        //    AlertsCollection.RemoveAt(index);
        //    AlertsCollection.Insert(index, alert);
        //    if (!alert.IsEdited && !alert.Initialized)
        //        alert.Initialize();
        //}


        public void AddAlert(string board = null, string seccode = null, Window caller = null)
        {
            //AlertsCollection.Add(new Alert());
            var vm = new AlertSelectionViewModel
            {
                Alert = new BaseAlert
                {
                    Board   = board,
                    Seccode = seccode,
                    Name    = seccode
                }
            };

            new AlertSelection {
                Owner = SelectionWindow, DataContext = vm
            }.ShowDialog();
            if (vm.Alert != null && vm.Confirmed)
            {
                AlertsCollection.Add(vm.Alert);
                vm.Alert.Active = true;
            }
        }
示例#3
0
 public void UninitializeAll()
 {
     AlertsCollection.ForEachDo(a => a.Uninitialize());
 }
示例#4
0
 public void InitializeAllActive()
 {
     AlertsCollection.Where(a => a.Active).ForEachDo(a => a.Initialize());
 }