예제 #1
0
        /// <summary>
        /// Converts the WinForm control into WiX custom UI control <see cref="T:WixSharp.Control" />.
        /// </summary>
        /// <returns>
        /// Instance of the WixSharp.Control.
        /// </returns>
        /// <exception cref="System.ApplicationException">WixTextBox (' + control.Id + ') must have BoundProperty set to non-empty value.</exception>
        public virtual Wix.Controls.Control ToWControl()
        {
            Wix.Controls.Control control = this.ConvertToWControl(ControlType.Edit);

            if (BoundProperty.IsEmpty())
            {
                throw new ApplicationException("WixTextBox ('" + control.Id + "') must have BoundProperty set to non-empty value.");
            }

            return(control);
        }
예제 #2
0
        /// <summary>
        /// Converts the WinForm control into WiX custom UI control <see cref="T:WixSharp.Control" />.
        /// </summary>
        /// <returns>
        /// Instance of the WixSharp.Control.
        /// </returns>
        /// <exception cref="System.ApplicationException">WixCheckBox (' + control.Id + ') must have BoundProperty set to non-empty value.</exception>
        public virtual Wix.Controls.Control ToWControl()
        {
            Wix.Controls.Control control = this.ConvertToWControl(ControlType.CheckBox);

            //It is tempting to allow WiX compiler report the problem. However WiX is not reliable with the error reporting.
            //For example it does it for "CheckBox" but not for "Edit"
            //Note that control.Name is a better identity value than this.Name, which can be empty.
            if (BoundProperty.IsEmpty())
            {
                throw new ApplicationException("WixCheckBox ('" + control.Id + "') must have BoundProperty set to non-empty value.");
            }

            if (!CheckBoxValue.IsEmpty())
            {
                control.AttributesDefinition += ";CheckBoxValue=" + CheckBoxValue;
            }

            return(control);
        }