Localize() public static method

public static Localize ( string text ) : string
text string
return string
Exemplo n.º 1
0
        public ucIPRange(int securityRangeID)
        {
            InitializeComponent();

            if (securityRangeID > 0)
            {
                hMailServer.SecurityRanges securityRanges = APICreator.SecurityRanges;

                try
                {
                    _representedObject = securityRanges.get_ItemByDBID(securityRangeID);
                }
                catch (Exception)
                {
                    MessageBox.Show(Strings.Localize("The IP range does not exist."), EnumStrings.hMailServerAdministrator, MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                    this.Enabled = false;
                }

                Marshal.ReleaseComObject(securityRanges);
            }

            DirtyChecker.SubscribeToChange(this, OnContentChanged);
            new TabOrderManager(this).SetTabOrder(TabOrderManager.TabScheme.AcrossFirst);
            dateTimeExpiresTime.Value = DateTime.Now;

            EnableDisable();
        }
Exemplo n.º 2
0
        private bool ShowControl(INode node, UserControl control)
        {
            if (panelMain.Controls.Count > 0)
            {
                // Notify the old page that we're leaving, so that it can take care
                // of cleaning up...
                ISettingsControl oldSettingsControl = panelMain.Controls[0] as ISettingsControl;
                oldSettingsControl.OnLeavePage();
            }


            panelMain.Controls.Clear();
            panelMain.Controls.Add(control);

            control.Dock = DockStyle.Fill;

            ISettingsControl settingsControl = (ISettingsControl)control;

            labelTopCaption.Text = node.Title;

            if (!node.IsUserCreated)
            {
                Strings.Localize(labelTopCaption);
            }

            OnContentChanged();



            return(true);
        }
Exemplo n.º 3
0
        private TreeNode CreateNode(INode internalNode)
        {
            TreeNode node = new TreeNode(internalNode.Title);

            if (!internalNode.IsUserCreated)
            {
                Strings.Localize(node);
            }

            node.NodeFont = new Font("MS Sans Serif", 8, FontStyle.Regular);

            string icon = internalNode.Icon;

            if (icon != null)
            {
                if (imageList.Images.ContainsKey(icon))
                {
                    node.ImageKey         = icon;
                    node.SelectedImageKey = icon;
                }
                else
                {
                    throw new Exception("Icon not found for page " + internalNode.Title);
                }
            }

            node.ForeColor = internalNode.ForeColor;
            node.Tag       = internalNode;

            return(node);
        }
Exemplo n.º 4
0
        private bool ValidateFolderName()
        {
            TreeNode currentNode = treeFolders.SelectedNode;
            var      parentNode  = currentNode.Parent;

            List <TreeNode> nodesToCheck = new List <TreeNode>();

            if (parentNode == null)
            {
                foreach (TreeNode node in treeFolders.Nodes)
                {
                    nodesToCheck.Add(node);
                }
            }
            else
            {
                foreach (TreeNode node in parentNode.Nodes)
                {
                    nodesToCheck.Add(node);
                }
            }

            for (int i = 0; i < nodesToCheck.Count; i++)
            {
                var node = nodesToCheck[i];
                if (node != currentNode)
                {
                    if (node.Text == currentNode.Text)
                    {
                        MessageBox.Show(Strings.Localize("There is already an folder with this name."),
                                        EnumStrings.hMailServerAdministrator);

                        textName.Focus();

                        return(false);
                    }
                }
            }

            if (textName.Text.Length > 255)
            {
                return(false);
            }

            if (textName.Text.ToUpper() == "INBOX")
            {
                return(false);
            }

            if (textName.Text.Contains(_folderHierarchyDelimiter))
            {
                MessageBox.Show(Strings.Localize("A folder name can not contain the hierarchy delimiter."), EnumStrings.hMailServerAdministrator);
                return(false);
            }



            return(true);
        }
Exemplo n.º 5
0
        public ucIMAPFolders()
        {
            InitializeComponent();

            new TabOrderManager(this).SetTabOrder(TabOrderManager.TabScheme.AcrossFirst);

            Strings.Localize(contextMenuStrip);
        }
Exemplo n.º 6
0
 private void buttonSelectKey_Click(object sender, EventArgs e)
 {
     openFileDialog.Title  = Strings.Localize("Private key file");
     openFileDialog.Filter = "*.*|*.*";
     if (openFileDialog.ShowDialog() == DialogResult.OK)
     {
         textPrivateKeyFile.Text = openFileDialog.FileName;
     }
 }
Exemplo n.º 7
0
        public formInputDialog()
        {
            InitializeComponent();

            new TabOrderManager(this).SetTabOrder(TabOrderManager.TabScheme.AcrossFirst);
            Strings.Localize(this);

            EnableDisable();
        }
Exemplo n.º 8
0
        public formAbout()
        {
            InitializeComponent();

            hMailServer.Application application = APICreator.Application;

            labelVersion.Text = "hMailServer " + application.Version;

            Strings.Localize(this);
        }
Exemplo n.º 9
0
 private void DisplayLiveLogButtonCaption()
 {
     if (timerLiveLog.Enabled)
     {
         btnStartLiveLog.Text = Strings.Localize("Stop");
     }
     else
     {
         btnStartLiveLog.Text = Strings.Localize("Start");
     }
 }
Exemplo n.º 10
0
        private void ShowNodeRepresentation(INode node)
        {
            UserControl control = node.CreateControl();

            ISettingsControl settingsControl = (ISettingsControl)control;

            settingsControl.LoadData();

            Strings.Localize(control);

            ShowControl(node, control);
        }
Exemplo n.º 11
0
        static internal bool AskDeleteItems()
        {
            string question = Strings.Localize("Are you sure you want to delete the selected items?");

            if (MessageBox.Show(question, EnumStrings.hMailServerAdministrator, MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 12
0
 private void buttonEmptyAccount_Click(object sender, EventArgs e)
 {
     if (MessageBox.Show(Strings.Localize("Are you sure you want to remove all messages in the account?"),
                         EnumStrings.hMailServerAdministrator,
                         MessageBoxButtons.YesNo,
                         MessageBoxIcon.Question) == DialogResult.Yes)
     {
         using (new WaitCursor())
         {
             _representedAccount.DeleteMessages();
         }
     }
 }
Exemplo n.º 13
0
        static internal void AskRestartServer()
        {
            if (MessageBox.Show(Strings.Localize("hMailServer needs to be restarted for the changes to take effect.") + Environment.NewLine +
                                Strings.Localize("Do you want to restart hMailServer now?"), EnumStrings.hMailServerAdministrator, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                using (new WaitCursor())
                {
                    hMailServer.Application application = APICreator.Application;
                    application.Stop();
                    application.Start();

                    MessageBox.Show(Strings.Localize("The hMailServer server has been restarted."), EnumStrings.hMailServerAdministrator, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }
        }
Exemplo n.º 14
0
        private bool ValidateForm()
        {
            if (textPassword.Dirty)
            {
                if (!APICreator.Application.Utilities.IsStrongPassword(textAddress.Text, textPassword.Password))
                {
                    if (MessageBox.Show(Strings.Localize("The password appears to be weak. Are you sure you want to use it?"), EnumStrings.hMailServerAdministrator, MessageBoxButtons.YesNo) != DialogResult.Yes)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
Exemplo n.º 15
0
        static internal bool AskDeleteItem(string objectName)
        {
            string question = Strings.Localize("Are you sure you want to delete %s?");

            question = question.Replace("%s", objectName);

            if (MessageBox.Show(question, EnumStrings.hMailServerAdministrator, MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 16
0
 private void ProcessVirusTestResult(bool found, string messageText)
 {
     if (found)
     {
         string message = Strings.Localize("Test virus was detected successfully. Virus name: ");
         messageText = message + messageText;
         MessageBox.Show(messageText, EnumStrings.hMailServerAdministrator, MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         string message = Strings.Localize("Virus detection failed. Reason: ");
         messageText = message + messageText;
         MessageBox.Show(messageText, EnumStrings.hMailServerAdministrator, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Exemplo n.º 17
0
        public formMain(hMailServer.Application app, string serverHost)
        {
            InitializeComponent();

            application           = app;
            _serverHost           = serverHost;
            currentlySelectedNode = null;

            _language = "English";

            LoadWindowSettings();

            _language = Strings.LoadLanguage(_language);
            Strings.Localize(this);
        }
Exemplo n.º 18
0
        private void buttonDefault_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show(Strings.Localize("This operation will change the configuration of the TCP/IP ports to their default values. Are you sure you want to do this?"), EnumStrings.hMailServerAdministrator, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                hMailServer.Application app = APICreator.Application;

                hMailServer.TCPIPPorts tcpIPPorts = APICreator.TCPIPPortsSettings;
                tcpIPPorts.SetDefault();
                Marshal.ReleaseComObject(tcpIPPorts);

                LoadList();

                Instances.MainForm.RefreshCurrentNode(null);
            }
        }
Exemplo n.º 19
0
        public ucStatus()
        {
            InitializeComponent();

            new TabOrderManager(this).SetTabOrder(TabOrderManager.TabScheme.AcrossFirst);

            Strings.Localize(contextMenuDeliveryQueue);
            Strings.Localize(contextMenuStripLiveLog);

            // Enable dobule-buffering in live log to improve performance.
            PropertyInfo aProp = typeof(ListView).GetProperty("DoubleBuffered", BindingFlags.NonPublic | BindingFlags.Instance);

            aProp.SetValue(listLiveLog, true, null);

            listLiveLog.LoadWidths("StatusLiveLog");
            listDeliveryQueue.LoadWidths("StatusDeliveryQueue");
        }
Exemplo n.º 20
0
        private void buttonMessageIndexingClear_Click(object sender, EventArgs e)
        {
            if (MessageBox.Show(Strings.Localize("Are you sure you want to clear the message index?"),
                                EnumStrings.hMailServerAdministrator, MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question) == DialogResult.Yes)
            {
                hMailServer.Settings        settings = APICreator.Application.Settings;
                hMailServer.MessageIndexing indexing = settings.MessageIndexing;

                indexing.Clear();

                Marshal.ReleaseComObject(indexing);
                Marshal.ReleaseComObject(settings);

                DisplayMessageIndexingStatus();
            }
        }
Exemplo n.º 21
0
        public bool SaveData()
        {
            if (_representedObject == null)
            {
                hMailServer.TCPIPPorts tcpIPPorts = APICreator.TCPIPPortsSettings;
                _representedObject = tcpIPPorts.Add();
                Marshal.ReleaseComObject(tcpIPPorts);
            }

            _representedObject.Address    = textIPAddress.Text;
            _representedObject.PortNumber = textTCPIPPort.Number;
            _representedObject.UseSSL     = checkEnableSSL.Checked;
            _representedObject.Protocol   = (hMailServer.eSessionType)comboProtocol.SelectedValue;

            if (comboSSLCertificate.SelectedValue == null)
            {
                _representedObject.SSLCertificateID = 0;
            }
            else
            {
                _representedObject.SSLCertificateID = (int)comboSSLCertificate.SelectedValue;
            }

            _representedObject.Save();

            DirtyChecker.SetClean(this);

            Utility.RefreshNode(InternalNames.GetPortName(_representedObject));

            if (MessageBox.Show(Strings.Localize("hMailServer needs to be restarted for the changes to take effect.") + Environment.NewLine +
                                Strings.Localize("Do you want to restart hMailServer now?"), EnumStrings.hMailServerAdministrator, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
            {
                using (new WaitCursor())
                {
                    hMailServer.Application application = APICreator.Application;
                    application.Stop();
                    application.Start();

                    MessageBox.Show(Strings.Localize("The hMailServer server has been restarted."), EnumStrings.hMailServerAdministrator, MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
            }

            return(true);
        }
Exemplo n.º 22
0
        public formSelectLanguage(string language)
        {
            InitializeComponent();

            _language = language;

            new TabOrderManager(this).SetTabOrder(TabOrderManager.TabScheme.AcrossFirst);
            Strings.Localize(this);

            hMailServer.Languages languages = APICreator.Application.GlobalObjects.Languages;
            for (int i = 0; i < languages.Count; i++)
            {
                hMailServer.Language lang = languages[i];

                comboLanguage.AddItem(lang.Name, lang);
            }

            comboLanguage.Text = _language;
        }
Exemplo n.º 23
0
        private void buttonEmptyFolder_Click(object sender, EventArgs e)
        {
            TreeNode selectedNode = treeFolders.SelectedNode;

            if (selectedNode == null)
            {
                return;
            }

            if (MessageBox.Show(Strings.Localize("Are you sure you want to delete all messages in the folder?"),
                                EnumStrings.hMailServerAdministrator,
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question) == DialogResult.Yes)
            {
                hMailServer.IMAPFolder folder = selectedNode.Tag as IMAPFolder;

                folder.Messages.Clear();
            }
        }
Exemplo n.º 24
0
        private bool ValidateFolderName()
        {
            TreeNode currentNode = treeFolders.SelectedNode;

            hMailServer.IMAPFolder folder = currentNode.Tag as hMailServer.IMAPFolder;

            TreeNode nodeIterator = currentNode.FirstNode;

            while (nodeIterator != null)
            {
                if (nodeIterator != currentNode)
                {
                    if (nodeIterator.Text == currentNode.Text)
                    {
                        MessageBox.Show(Strings.Localize("There is already an folder with this name."), EnumStrings.hMailServerAdministrator);
                        return(false);
                    }
                }

                nodeIterator = nodeIterator.NextNode;
            }

            if (textName.Text.Length > 255)
            {
                return(false);
            }

            if (textName.Text.ToUpper() == "INBOX")
            {
                return(false);
            }

            if (textName.Text.Contains(_folderHierarchyDelimiter))
            {
                MessageBox.Show(Strings.Localize("A folder name can not contain the hierarchy delimiter."), EnumStrings.hMailServerAdministrator);
                return(false);
            }



            return(true);
        }
Exemplo n.º 25
0
        private void buttonStartRestore_Click(object sender, EventArgs e)
        {
            string message = "WARNING! All settings will be cleared & ALL MESSAGES DELETED prior to restore. Are you sure?";

            if (MessageBox.Show(Strings.Localize(message), EnumStrings.hMailServerAdministrator, MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                if (_backup != null)
                {
                    if (checkRestoreSettings.Enabled ||
                        checkRestoreDomains.Enabled ||
                        checkRestoreMessages.Enabled)
                    {
                        _backup.RestoreDomains  = checkRestoreDomains.Checked;
                        _backup.RestoreMessages = checkRestoreMessages.Checked;
                        _backup.RestoreSettings = checkRestoreSettings.Checked;

                        _backup.StartRestore();
                    }
                }
            }
        }
Exemplo n.º 26
0
        private void menuItemDelete_Click(object sender, EventArgs e)
        {
            string message = "Are you sure you want to delete selected message(s) from queue?";

            if (MessageBox.Show(Strings.Localize(message), EnumStrings.hMailServerAdministrator, MessageBoxButtons.YesNo) == DialogResult.Yes)
            {
                WaitCursor waitCursor = new WaitCursor();

                hMailServer.DeliveryQueue deliveryQueue = GetDeliveryQueue();
                foreach (ListViewItem item in listDeliveryQueue.SelectedItems)
                {
                    string messageID = (string)item.Tag;

                    deliveryQueue.Remove(Convert.ToInt64(messageID));
                }

                Marshal.ReleaseComObject(deliveryQueue);
            }

            RefreshDeliveryQueue();
        }
Exemplo n.º 27
0
        private void DisplayServerState()
        {
            labelCurrentStatus.Text = EnumStrings.GetStateString(_application.ServerState);

            switch (_application.ServerState)
            {
            case eServerState.hStateRunning:
                buttonStartStop.Text    = Strings.Localize("Pause");
                buttonStartStop.Enabled = true;
                break;

            case eServerState.hStateStopped:
                buttonStartStop.Text    = Strings.Localize("Resume");
                buttonStartStop.Enabled = true;
                break;

            default:
                buttonStartStop.Enabled = false;
                break;
            }
        }
Exemplo n.º 28
0
        public void RefreshCurrentNode(string newName)
        {
            INode internalNode = currentlySelectedNode.Tag as INode;

            if (!string.IsNullOrEmpty(newName))
            {
                internalNode.Title = newName;
            }

            if (currentlySelectedNode.Text != Strings.Localize(internalNode.Title))
            {
                currentlySelectedNode.Text = Strings.Localize(internalNode.Title);
            }

            currentlySelectedNode.Nodes.Clear();

            labelTopCaption.Text = currentlySelectedNode.Text;

            int recursion = internalNode.GetType() == typeof(Administrator.Nodes.NodeDomains) ? 1 : 2;

            LoadNodeChildren(currentlySelectedNode, recursion);
        }
Exemplo n.º 29
0
        private void EditSelectedName()
        {
            if (listAliases.SelectedItems.Count != 1)
            {
                return;
            }

            int           id            = Convert.ToInt32(listAliases.SelectedItems[0].Tag);
            DomainAliases domainAliases = _domain.DomainAliases;

            hMailServer.DomainAlias da = domainAliases.get_ItemByDBID(id);

            formInputDialog inputDialog = new formInputDialog();

            inputDialog.Title = "Alias name";
            inputDialog.Text  = "Enter domain alias name";
            inputDialog.Value = da.AliasName;

            if (inputDialog.ShowDialog() == DialogResult.OK)
            {
                // Add it
                string value = inputDialog.Value;
                da.AliasName = value;

                try
                {
                    da.Save();
                }
                catch (Exception ex)
                {
                    MessageBox.Show(Strings.Localize(ex.Message), EnumStrings.hMailServerAdministrator, MessageBoxButtons.OK, MessageBoxIcon.Error);
                }

                ListDomainAliases();
            }

            Marshal.ReleaseComObject(domainAliases);
            Marshal.ReleaseComObject(da);
        }
Exemplo n.º 30
0
        private void deleteFolderToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode selectedNode = treeFolders.SelectedNode;

            if (selectedNode == null)
            {
                return;
            }

            if (MessageBox.Show(Strings.Localize("Are you sure you want to delete the folder?"),
                                EnumStrings.hMailServerAdministrator,
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question) == DialogResult.Yes)
            {
                hMailServer.IMAPFolder folder = selectedNode.Tag as IMAPFolder;

                folder.Delete();

                treeFolders.Nodes.Remove(selectedNode);

                ShowCurrentFolder();
            }
        }