示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="owner"></param>
        /// <param name="lastTypedUserName"></param>
        /// <param name="windowTitle"></param>
        /// <param name="groupTitle">if not null - set as the group's title (inside the form).</param>
        /// <param name="msgCaption">if not null - set as a message inside the form.</param>
        public AuthenticationForm(AuthenticationDialogHandler owner, String lastTypedUserName, String windowTitle,
                                  String groupTitle, String msgCaption)
        {
            InitializeComponent();
            _owner = owner;
            textBoxUsername.Text = lastTypedUserName;
            Text = windowTitle;
            if (groupTitle != null)
            {
                groupBox1.Text = groupTitle;
            }
            if (msgCaption != null)
            {
                labelInstructions.Text = msgCaption;
            }

            // logon window should be shown RightToLeft
            if (MgEvents.IsLogonRTL())
            {
                this.RightToLeft       = RightToLeft.Yes;
                this.RightToLeftLayout = true;

                // Layout of controls inside groupBox isn't changed if RTL is Yes. So change layout only for controls inside
                // group box. Rest controls layout will be handled automatically by form.
                ApplyRTL(this);

                if (MgEvents.IsSpecialEngLogon())
                {
                    textBoxUsername.RightToLeft = RightToLeft.No;
                    textBoxPassword.RightToLeft = RightToLeft.No;
                }
            }
            labelUsername.Text     = MgEvents.GetMessageString(MsgInterface.STR_USER_ID);
            labelPassword.Text     = MgEvents.GetMessageString(MsgInterface.STR_PASSWORD);
            labelInstructions.Text = MgEvents.GetMessageString(MsgInterface.STR_LOGON_INSTRUCTION);
            buttonOK.Text          = MgEvents.GetMessageString(MsgInterface.GUI_OK_BUTTON);
            buttonCancel.Text      = MgEvents.GetMessageString(MsgInterface.GUI_CANCEL_BUTTON);
        }
示例#2
0
        /// <summary>
        /// CTOR
        /// This constructor would create an customized logon dialog for rich client
        /// from the execution property values for logon dialog.
        /// If the execution properties for logon dialog are not specified then logon dialog
        /// with default values for these properties would be created.
        /// </summary>
        /// <param name="owner"></param>
        /// <param name="lastTypedUserName"></param>
        /// <param name="logonDialogExecutionProps">the customized logon dialog execution props</param>
        public AuthenticationForm(AuthenticationDialogHandler owner, String lastTypedUserName,
                                  Dictionary <string, string> logonDialogExecutionProps)
        {
            InitializeComponent();
            _owner = owner;
            textBoxUsername.Text = lastTypedUserName;

            //if the window title & group title execution properties are not specified
            // default values for these properties are already passed in logonDialogExecutionProps.
            Text           = logonDialogExecutionProps[GuiConstants.STR_LOGON_WIN_TITLE];
            groupBox1.Text = logonDialogExecutionProps[GuiConstants.STR_LOGON_GROUP_TITLE];

            labelInstructions.Text = logonDialogExecutionProps.ContainsKey(GuiConstants.STR_LOGON_MSG_CAPTION)
                                  ? logonDialogExecutionProps[GuiConstants.STR_LOGON_MSG_CAPTION]
                                  : GuiConstants.ENTER_UID_TTL;

            // logon window should be shown RightToLeft
            if (MgEvents.IsLogonRTL())
            {
                this.RightToLeft       = RightToLeft.Yes;
                this.RightToLeftLayout = true;

                // Layout of controls inside groupBox isn't changed if RTL is Yes. So change layout only for controls inside
                // group box. Rest controls layout will be handled automatically by form.
                ApplyRTL(this);
            }

            if (logonDialogExecutionProps.ContainsKey(GuiConstants.STR_LOGO_WIN_ICON_URL))
            {
                Icon windowIcon = Manager.GetIcon(logonDialogExecutionProps[GuiConstants.STR_LOGO_WIN_ICON_URL]);
                if (windowIcon != null)
                {
                    this.Icon = windowIcon;
                }
                else
                {
                    this.ShowIcon = false;
                }
            }

            if (logonDialogExecutionProps.ContainsKey(GuiConstants.STR_LOGON_IMAGE_URL))
            {
                String windowsImageUrlStr = logonDialogExecutionProps[GuiConstants.STR_LOGON_IMAGE_URL];
                Image  windowImage        = GuiUtils.getImageFromFile(windowsImageUrlStr);
                if (windowImage != null)
                {
                    pictureBox1.Image   = windowImage;
                    pictureBox1.Visible = true;
                }
                else
                {
                    pictureBox1.Visible = false;
                }
            }

            labelUsername.Text = logonDialogExecutionProps.ContainsKey(GuiConstants.STR_LOGON_USER_ID_CAPTION)
                               ? logonDialogExecutionProps[GuiConstants.STR_LOGON_USER_ID_CAPTION]
                               : MgEvents.GetMessageString(MsgInterface.STR_USER_ID);

            labelPassword.Text = logonDialogExecutionProps.ContainsKey(GuiConstants.STR_LOGON_PASS_CAPTION)
                              ? logonDialogExecutionProps[GuiConstants.STR_LOGON_PASS_CAPTION]
                              : MgEvents.GetMessageString(MsgInterface.STR_PASSWORD);

            buttonOK.Text = logonDialogExecutionProps.ContainsKey(GuiConstants.STR_LOGON_OK_CAPTION)
                         ? logonDialogExecutionProps[GuiConstants.STR_LOGON_OK_CAPTION]
                         : MgEvents.GetMessageString(MsgInterface.GUI_OK_BUTTON);

            buttonCancel.Text = logonDialogExecutionProps.ContainsKey(GuiConstants.STR_LOGON_CANCEL_CAPTION)
                             ? logonDialogExecutionProps[GuiConstants.STR_LOGON_CANCEL_CAPTION]
                             : MgEvents.GetMessageString(MsgInterface.GUI_CANCEL_BUTTON);
        }