/// <summary>
            /// Initializes a new instance of the <see cref="FrameDesignerActionList"/> class.
            /// </summary>
            /// <param name="control">The base control.</param>
            public FrameDesignerActionList(BaseControl control)
                : base(control)
            {
                if (control == null)
                    throw new ArgumentNullException("control");

                this.control = control;

                // Get the Designer Action UI service
                this.designerActionUIService = GetService(typeof(DesignerActionUIService)) as DesignerActionUIService;
            }
Ejemplo n.º 2
0
        /// <summary>
        /// Loads the file from the specified fileName.
        /// It performs a basic lookup for the file:
        ///  - checks for missing extension
        ///  - considers fileName relative to project path
        ///  - checks the file in the root of project directory
        /// </summary>
        /// <param name="fileName">Name of the file.</param>
        /// <returns>an Image object or null</returns>
        public static Image LookupFile(BaseControl baseControl, string fileName)
        {
            if (String.IsNullOrEmpty(fileName))
                return null;

            if (!fileName.EndsWith(".tga"))
                fileName += ".tga";

            if (File.Exists(fileName))
                return LoadFromFile(fileName);

            string projectDirectory = Path.GetDirectoryName(baseControl.DesignerLoader.DocumentMoniker);

            fileName = Path.Combine(projectDirectory, fileName);
            if (File.Exists(fileName))
                return LoadFromFile(fileName);

            fileName = Path.GetFileName(fileName);
            fileName = Path.Combine(projectDirectory, fileName);
            if (File.Exists(fileName))
                return LoadFromFile(fileName);

            return null;
        }