Esempio n. 1
0
		public ImageListOptions(ImageListOptions other) {
			this.Name = other.Name ?? string.Empty;
			this.ColorDepth = other.ColorDepth;
			this.ImageSize = other.ImageSize;
			this.TransparentColor = other.TransparentColor;
			this.ImageSources.AddRange(other.ImageSources);
		}
Esempio n. 2
0
 public ImageListOptions(ImageListOptions other)
 {
     this.Name             = other.Name ?? string.Empty;
     this.ColorDepth       = other.ColorDepth;
     this.ImageSize        = other.ImageSize;
     this.TransparentColor = other.TransparentColor;
     this.ImageSources.AddRange(other.ImageSources);
 }
Esempio n. 3
0
 void InitializeFrom(ImageListOptions options)
 {
     Name                      = options.Name;
     HeightVM.Value            = options.ImageSize.Height;
     WidthVM.Value             = options.ImageSize.Width;
     TransparentColorVM.Value  = options.TransparentColor;
     ColorDepthVM.SelectedItem = options.ColorDepth;
     ImageListStreamerVM.InitializeFrom(options.ImageSources);
 }
Esempio n. 4
0
 ImageListOptions CopyTo(ImageListOptions options)
 {
     options.Name             = Name;
     options.ImageSize        = new Size(WidthVM.Value, HeightVM.Value);
     options.TransparentColor = TransparentColorVM.Value;
     options.ColorDepth       = (ColorDepth)ColorDepthVM.SelectedItem;
     options.ImageSources.Clear();
     options.ImageSources.AddRange(ImageListStreamerVM.Collection.Select(a => a.ImageSource));
     return(options);
 }
Esempio n. 5
0
		public ImageListVM(ImageListOptions options) {
			this.origOptions = options;

			this.imageListStreamerVM = new ImageListStreamerVM();
			ImageListStreamerVM.Collection.CollectionChanged += (s, e) => HasErrorUpdated();
			this.widthVM = new Int32VM(a => HasErrorUpdated(), true) {
				Min = 1,
				Max = 256,
			};
			this.heightVM = new Int32VM(a => HasErrorUpdated(), true) {
				Min = 1,
				Max = 256,
			};
			this.transparentColorVM = new DefaultConverterVM<Color>(a => HasErrorUpdated());

			Reinitialize();
		}
Esempio n. 6
0
        public ImageListVM(ImageListOptions options)
        {
            this.origOptions = options;

            this.ImageListStreamerVM = new ImageListStreamerVM();
            ImageListStreamerVM.Collection.CollectionChanged += (s, e) => HasErrorUpdated();
            this.WidthVM = new Int32VM(a => HasErrorUpdated(), true)
            {
                Min = 1,
                Max = 256,
            };
            this.HeightVM = new Int32VM(a => HasErrorUpdated(), true)
            {
                Min = 1,
                Max = 256,
            };
            this.TransparentColorVM = new DefaultConverterVM <Color>(a => HasErrorUpdated());

            Reinitialize();
        }
Esempio n. 7
0
        static void Execute(ILSpyTreeNode[] nodes)
        {
            if (!CanExecute(nodes))
                return;

            var imgNode = (SerializedImageListStreamerResourceElementTreeNode)nodes[0];
            var options = new ImageListOptions(imgNode.ImageListOptions);
            var data = new ImageListVM(options);
            var win = new ImageListDlg();
            win.Title = CMD_NAME;
            win.DataContext = data;
            win.Owner = MainWindow.Instance;
            if (win.ShowDialog() != true)
                return;

            var listOpts = data.CreateImageListOptions();

            if (listOpts.ImageSources.Count == 0) {
                MainWindow.Instance.ShowMessageBox("It's not possible to create an empty image list");
                return;
            }

            ResourceElementOptions opts = null;
            string error;
            try {
                opts = new ResourceElementOptions(SerializedImageListStreamerResourceElementTreeNode.Serialize(listOpts));
                error = imgNode.CheckCanUpdateData(opts.Create());
            }
            catch (Exception ex) {
                error = string.Format("Couldn't serialize the images. Error: {0}", ex.Message);
            }
            if (!string.IsNullOrEmpty(error)) {
                MainWindow.Instance.ShowMessageBox(error);
                return;
            }

            UndoCommandManager.Instance.Add(new SerializedImageListStreamerResourceElementSettingsCommand(imgNode, opts));
        }
Esempio n. 8
0
 void InitializeFrom(ImageListOptions options)
 {
     Name = options.Name;
     HeightVM.Value = options.ImageSize.Height;
     WidthVM.Value = options.ImageSize.Width;
     TransparentColorVM.Value = options.TransparentColor;
     ColorDepthVM.SelectedItem = options.ColorDepth;
     ImageListStreamerVM.InitializeFrom(options.ImageSources);
 }
Esempio n. 9
0
 ImageListOptions CopyTo(ImageListOptions options)
 {
     options.Name = Name;
     options.ImageSize.Height = HeightVM.Value;
     options.ImageSize.Width = WidthVM.Value;
     options.TransparentColor = TransparentColorVM.Value;
     options.ColorDepth = (ColorDepth)ColorDepthVM.SelectedItem;
     options.ImageSources.Clear();
     options.ImageSources.AddRange(ImageListStreamerVM.Collection.Select(a => a.ImageSource));
     return options;
 }