Exemple #1
0
        private void SuccessAuthenticate(object pObject, EventArgs pEventArgs)
        {
            // Check if the agent exists.
            if (Logics.Logic.Agent != null)
            {
                Oids.Oid          lAgent     = Logics.Logic.Agent;
                Logics.LogInAgent logInAgent = Logics.Agents.GetLogInAgentByName(lAgent.ClassName);
                if (logInAgent.AlternateKeyName != string.Empty)
                {
                    // Get the alternate key of the Oid.
                    lAgent = (Oids.Oid)lAgent.GetAlternateKey(logInAgent.AlternateKeyName);
                }
                // HAT Multilanguage: Apply multilanguage to the HAT elements.
                Controller.ApplyMultilanguage();

                // ... and to the fixed strings.
                MultilanguageFixedString();

                Controller.ApplyConnectedAgentVisibility();

                // Put the connected agent and the culture on the main form status label.
                StringBuilder lStringBuilder = new StringBuilder();
                if ((lAgent != null) && (lAgent is Oids.AnonymousAgentInfo))
                {
                    lStringBuilder.Append(logInAgent.Alias);
                }
                else
                {
                    lStringBuilder.Append(logInAgent.Alias);
                    lStringBuilder.Append(" : ");
                    lStringBuilder.Append(UtilFunctions.OidFieldsToString(lAgent, ' '));
                }
                toolStripStatusLabel.Text = UtilFunctions.ProtectAmpersandChars(lStringBuilder.ToString());

                // Show Current culture.
                toolStripStatusLabelCulture.Text = CultureManager.Culture.Name;

                // Load instance reports configuration.
                Logics.Logic.InstanceReportsList.LoadFromFile(Properties.Settings.Default.ConfigurationOfReports);

                // Load configuration reports file.
                LoadConfigurationReportsFile();
            }
            else
            {
                Close();
            }
        }
Exemple #2
0
        public void SetFormatDisplaySetItem(string name, string alias, ModelType modelType, List <KeyValuePair <object, string> > definedSelectionOptions, int width, bool editable, bool allowsNullInEditMode)
        {
            foreach (KeyValuePair <string, KeyValuePair <ILabelPresentation, IEditorPresentation> > attribute in mControlList)
            {
                if (name.Equals(attribute.Key, StringComparison.OrdinalIgnoreCase))
                {
                    // Alias
                    if (attribute.Value.Key != null)
                    {
                        attribute.Value.Key.Visible = true;
                        attribute.Value.Key.Value   = UtilFunctions.ProtectAmpersandChars(alias);
                    }

                    // If the control is a Selector, assign the possible values.
                    if (attribute.Value.Value != null)
                    {
                        attribute.Value.Value.Visible = true;
                        ISelectorPresentation selector = attribute.Value.Value as ISelectorPresentation;
                        if (selector != null && definedSelectionOptions != null)
                        {
                            // Fill the presentation with the list of options.
                            selector.Items = definedSelectionOptions;
                        }

                        // Add the control the editable control list
                        if (editable)
                        {
                            mEditableControls.Add(name);
                            // Suscribe to the Value changed event
                            attribute.Value.Value.ValueChanged += new EventHandler <ValueChangedEventArgs>(HandleEditorValueChanged);

                            // If the Display Set element allows null, set it to the control
                            if (allowsNullInEditMode)
                            {
                                attribute.Value.Value.NullAllowed = true;
                            }
                        }
                        else
                        {
                            attribute.Value.Value.NullAllowed = true;
                        }
                    }
                }
            }
        }
Exemple #3
0
        /// <summary>
        /// Checks if the Login form must be showed or not.
        /// This is calculated according the number of agents defined in the View,
        /// its kind (anonymous or not), and the number of languages of the application.
        /// </summary>
        /// <returns>A boolean value indicating if the Login form is going to be shown or not.</returns>
        private bool CheckIsAnonymousAndLogIn()
        {
            bool lResult = false;

            if (Logics.Agents.All.Length == 1)
            {
                // Create agent info.
                string         lAgentClassName = Logics.Agents.All[0].ToString();
                Oids.Oid       lagent          = Oids.Oid.Create(lAgentClassName);
                Oids.AgentInfo lAgentInfo      = lagent as Oids.AgentInfo;

                if (lAgentInfo is Oids.AnonymousAgentInfo)
                {
                    if (CultureManager.SupportedLanguages.Count > 1)
                    {
                        // Apply Change Language menu entry.
                        this.mValidateAgent.Text = CultureManager.TranslateString(LanguageConstantKeys.L_MAIN_CHANGE_LANGUAGE, LanguageConstantValues.L_MAIN_CHANGE_LANGUAGE);
                        // Login form will be showed, because there are more than one language.
                        lResult = false;
                    }
                    else
                    {
                        // Hide Login and Change Password menu entries.
                        this.mValidateAgent.Visible = false;

                        // Login form will not be showed, because the unique agent is anonymous.
                        // and there is only one language.
                        lResult = true;

                        // Assign the unique language supported.
                        foreach (System.Globalization.CultureInfo cultureInfo in CultureManager.SupportedLanguages.Values)
                        {
                            CultureManager.Culture = cultureInfo;
                        }
                    }

                    // Show anonymous agent alias.
                    StringBuilder lStringBuilder = new StringBuilder();
                    lStringBuilder.Append(CultureManager.TranslateString(lAgentInfo.IdXML + "_Alias", UtilFunctions.ProtectAmpersandChars(lAgentInfo.Alias)));
                    toolStripStatusLabel.Text = lStringBuilder.ToString();
                    // Show Current culture.
                    toolStripStatusLabelCulture.Text = CultureManager.Culture.Name;

                    // Hide Change Password menu entry.
                    this.mChangePassword.Visible = false;
                }
                else
                {
                    // Login form will be showed, because the agent is not anonymous.
                    lResult = false;
                }
            }

            // Result return.
            return(lResult);
        }