Пример #1
0
        public void AddIconsRequested()
        {
            FileInfo[] imageFiles = view.SelectImageFiles();

            if (imageFiles == null)
            {
                return;
            }
            string error = null;

            var validExtensions = new List <string>(new string[] {
                ".BMP",
                ".GIF",
                ".JPEG",
                ".JPG",
                ".PNG",
                ".TIF",
                ".TIFF",
            });

            foreach (FileInfo info in imageFiles)
            {
                if (validExtensions.Contains(info.Extension.ToUpperInvariant()))
                {
                    LoadImage(info);
                }
                else
                {
                    if (error == null)
                    {
                        error = info.Name;
                    }
                    else
                    {
                        error += "\n" + info.Name;
                    }
                }
            }

            if (error != null)
            {
                mainPresenter.ForwardError((string)App.Current.FindResource(ERROR_MESSAGE_COULD_NOT_LOAD_IMAGES) + "\n" + error);
            }
        }