private void DeleteAlert(object obj) { var alert = (BaseAlert)obj; alert.Uninitialize(); AlertsCollection.Remove(alert); }
//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; } }
public void UninitializeAll() { AlertsCollection.ForEachDo(a => a.Uninitialize()); }
public void InitializeAllActive() { AlertsCollection.Where(a => a.Active).ForEachDo(a => a.Initialize()); }