private void NewFileCommand_Execute() { MessageBoxResult res = MessageBox.Show("Any unsaved data will be lost. Are you sure you want to initiate a new file?", "Warning", MessageBoxButton.YesNo, MessageBoxImage.Question, MessageBoxResult.No); if (res == MessageBoxResult.Yes) { Depts.Clear(); filename = ""; } }
private void DeptsListCreator(IList <Dept> list, Delegate lambdaDevice) { Depts.Clear(); foreach (var item in list) { var devices = item.Devices; var devicesCount = devices.Count(); if (lambdaDevice != null) { devicesCount = devices.Where((Func <Device, bool>)lambdaDevice).Count(); } Depts.Add(new DView(item, devicesCount, Depts.Count() + 1)); } }