void frmRibbon_OnItemClicked(string ActionType)
        {
            if (ActionType == "Save")
            {
#if !SILVERLIGHT
                var element = FocusManager.GetFocusedElement(UtilDisplay.GetCurentWindow());
                if (element is Control)
                {
                    var ctrl = element as Control;
                    TraversalRequest tReq = new TraversalRequest(FocusNavigationDirection.Down);
                    ctrl.MoveFocus(tReq);
                }
#endif
                var name = (LoadedRow as TableFieldsClient)?.Name;
                if (name == null || name != editrow.Name)
                {
                    if (!TablePropertyPage2.FieldExists(api, this.master.GetType(), editrow.Name))
                    {
                        frmRibbon_BaseActions(ActionType);
                    }
                }
                else
                {
                    frmRibbon_BaseActions(ActionType);
                }
            }
            else
            {
                frmRibbon_BaseActions(ActionType);
            }
        }
Exemple #2
0
        bool ValidateSMTP()
        {
            object element;

#if !SILVERLIGHT
            element = FocusManager.GetFocusedElement(UtilDisplay.GetCurentWindow());
            if (element is Control)
            {
                var ctrl = element as Control;
                TraversalRequest tReq = new TraversalRequest(FocusNavigationDirection.Down);
                ctrl.MoveFocus(tReq);
            }
#else
            element = FocusManager.GetFocusedElement();
            if (element is SLTextBox)
            {
                var dp = (element as TextBox).Tag as DateEditor;
                if (dp != null)
                {
                    dp.UpdateEditValueSource();
                }
            }
#endif
            if (isSMTPValidated == true)
            {
                return(true);
            }
            if (editrow._host == string.Empty)
            {
                editrow._host = null;
            }
            if (editrow._smtpUser == string.Empty)
            {
                editrow._smtpUser = null;
            }
            if (string.IsNullOrEmpty(editrow._smtpPassword))
            {
                editrow._smtpPassword = null;
            }
            var loadedRow = this.LoadedRow as DebtorEmailSetupClient;
            if (loadedRow == null && !string.IsNullOrEmpty(editrow._host))
            {
                isSMTPValidated = false;
            }
            else if (loadedRow != null && ((editrow._host != null && editrow._host != loadedRow._host) || (editrow._port != 0 && editrow._port != loadedRow._port) || (editrow._smtpUser != null && editrow._smtpUser != loadedRow._smtpUser) || (editrow._smtpPassword != null && editrow._smtpPassword != loadedRow._smtpPassword) ||
                                           (editrow.AllowDifferentSender == true && editrow.AllowDifferentSender != loadedRow.AllowDifferentSender) ||
                                           (editrow.AllowDifferentSender == true && editrow.EmailSendFrom != loadedRow.EmailSendFrom)))
            {
                isSMTPValidated = false;
            }
            if (isSMTPValidated == false)
            {
#if !SILVERLIGHT
                if (UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup("SMTPVerifyMsg"), Uniconta.ClientTools.Localization.lookup("Warning"), MessageBoxButton.YesNo) == MessageBoxResult.Yes)
#else
                if (UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup("SMTPVerifyMsg"), Uniconta.ClientTools.Localization.lookup("Warning"), MessageBoxButton.OKCancel) == MessageBoxResult.OK)
#endif
                {
                    FrmRibbon_OnItemClicked("TestMail");
                    return(false);
                }
                else
                {
                    isSMTPValidated = null;
                    return(false);
                }
            }
            return(true);
        }