Ejemplo n.º 1
0
		public bool Run (IWindowFrameBackend parent, string title, bool supportsAlpha)
		{
			if (!String.IsNullOrEmpty (title))
				dlg.Title = title;
			else
				dlg.Title = defaultTitle;

			dlg.ColorSelection.HasOpacityControl = supportsAlpha;
			
			dlg.ColorSelection.CurrentColor = color.ToGtkValue ();
			if (supportsAlpha)
				dlg.ColorSelection.CurrentAlpha = (ushort) (((double)ushort.MaxValue) * color.Alpha);
		
			var p = (WindowFrameBackend) parent;
			int result = MessageService.RunCustomDialog (dlg, p != null ? p.Window : null);
			
			if (result == (int) Gtk.ResponseType.Ok) {
				color = dlg.ColorSelection.CurrentColor.ToXwtValue ();
				if (supportsAlpha)
					color = color.WithAlpha ((double)dlg.ColorSelection.CurrentAlpha / (double)ushort.MaxValue);
				return true;
			}
			else
				return false;
		}