Exemplo n.º 1
0
        public bool CanClose()
        {
            var unsavedItems = _pluginController.GetUnsavedItems();

            if (unsavedItems.Count == 0)
            {
                return(true);
            }

            var sb = new StringBuilder();

            sb.AppendLine("The following items are not saved:");
            foreach (var data in unsavedItems)
            {
                sb.AppendLine("\t" + data.Key.Title + ":");
                foreach (var item in data.Value)
                {
                    sb.AppendLine("\t\t" + item);
                }
            }

            sb.AppendLine();
            sb.Append("Are you sure you want to close the application and lose this data?");
            return(_errorHandlingService.Confirm(sb.ToString()));
        }