Пример #1
0
        private void SendCatalogRequest()
        {
            try
            {
                // Delete all previous content requests
                FoeClientRequest.DeleteOldRequest(_requestInterval);

                // Create Foe Message
                string requestId = FoeClientRequest.GenerateId();

                FoeClientMessage.SendMessage(
                    FoeClientMessage.GetSmtpServer(),
                    FoeClientRegistry.GetEntry("useremail").Value,
                    FoeClientRegistry.GetEntry("processoremail").Value,
                    SubjectGenerator.RequestSubject(RequestType.Catalog, requestId, FoeClientRegistry.GetEntry("userid").Value),
                    "");

                // save requestid to DB
                FoeClientRequestItem reqItem = new FoeClientRequestItem();
                reqItem.Id          = requestId;
                reqItem.Type        = "catalog";
                reqItem.DtRequested = DateTime.Now;
                FoeClientRequest.Add(reqItem);

                // remember when the request was sent
                _lastRequestSent = DateTime.Now;
                // Set status
                tssStatus.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " requested catalog.";
            }
            catch (Exception)
            {
                tssStatus.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " error sending request.";
            }
        }
Пример #2
0
        static bool IsRegistered()
        {
            FoeClientRegistryEntry userIdKey = FoeClientRegistry.GetEntry("userid");

            if (userIdKey == null)
            {
                return(false);
            }

            return(true);
        }
Пример #3
0
        static bool IsFirstRun()
        {
            FoeClientRegistryEntry firstRunKey = FoeClientRegistry.GetEntry("firstrun");

            if ((firstRunKey == null) || (firstRunKey.Value == "T"))
            {
                return(true);
            }

            return(false);
        }
Пример #4
0
        private void SendSubscriptionRequest()
        {
            try
            {
                // Delete all previous content requests
                FoeClientRequest.DeleteOldRequest(_requestInterval);

                // Create Foe Message
                string catalogs = "";
                List <FoeClientCatalogItem> catalog = FoeClientCatalog.GetAll();
                if (catalog.Count == 0)
                {
                    return;
                }
                foreach (FoeClientCatalogItem item in catalog)
                {
                    if (item.IsSubscribed)
                    {
                        catalogs += item.Code + ",";
                    }
                }
                string requestId = FoeClientRequest.GenerateId();

                FoeClientMessage.SendMessage(
                    FoeClientMessage.GetSmtpServer(),
                    FoeClientRegistry.GetEntry("useremail").Value,
                    FoeClientRegistry.GetEntry("processoremail").Value,
                    SubjectGenerator.RequestSubject(RequestType.Content, requestId, FoeClientRegistry.GetEntry("userid").Value),
                    catalogs);

                // save requestid to DB
                FoeClientRequestItem reqItem = new FoeClientRequestItem();
                reqItem.Id          = requestId;
                reqItem.Type        = "content";
                reqItem.DtRequested = DateTime.Now;
                FoeClientRequest.Add(reqItem);

                // remember when the request was sent
                _lastRequestSent = DateTime.Now;
                // Set status
                tssStatus.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " requested update.";
            }
            catch (Exception)
            {
                tssStatus.Text = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss") + " error sending request.";
            }
        }
Пример #5
0
        private void timerCheckRegistration_Tick(object sender, EventArgs e)
        {
            try
            {
                // Stop timer
                timerCheckRegistration.Stop();

                // Check messages
                lblStatus.Text = "Checking registration status...";
                FoeClientMessage.DownloadMessages();

                // Check if user ID is now set
                FoeClientRegistryEntry userId = FoeClientRegistry.GetEntry("userid");
                if ((userId == null) || (userId.Value.Trim().Length == 0))
                {
                    lblStatus.Text = "[" + DateTime.Now.ToString("HH:mm:ss") + "] registration still processing. Wait 15 seconds.";
                    timerCheckRegistration.Start();
                    return;
                }

                // Registration is completed
                lblStatus.Text = "Registration completed.";
                _result        = DialogResult.OK;
                Close();
            }
            catch (Exception)
            {
                MessageBox.Show("Error checking registration request. Make sure your computer is connected to the Internet and the POP3 servers " +
                                "settings are correct. You can click the Email Settings button to reconfigure SMTP and POP3 settings.",
                                "Foe", MessageBoxButtons.OK, MessageBoxIcon.Error);

                // re-enable buttons
                btnRegister.Enabled      = true;
                btnEmailSettings.Enabled = true;

                // Update status
                lblStatus.Text = "Error checking registration request.";
            }
        }
Пример #6
0
        public EmailInfo()
        {
            InitializeComponent();

            // Try to load existing email address, SMTP and POP3 information
            FoeClientRegistryEntry smtpServer      = FoeClientRegistry.GetEntry("smtpserver");
            FoeClientRegistryEntry smtpPort        = FoeClientRegistry.GetEntry("smtpport");
            FoeClientRegistryEntry smtpRequireAuth = FoeClientRegistry.GetEntry("smtpauthrequired");
            FoeClientRegistryEntry smtpRequireSsl  = FoeClientRegistry.GetEntry("smtpsslenabled");
            FoeClientRegistryEntry smtpUsername    = FoeClientRegistry.GetEntry("smtpusername");
            FoeClientRegistryEntry smtpPassword    = FoeClientRegistry.GetEntry("smtppassword");

            FoeClientRegistryEntry popServer     = FoeClientRegistry.GetEntry("popserver");
            FoeClientRegistryEntry popPort       = FoeClientRegistry.GetEntry("popport");
            FoeClientRegistryEntry popRequireSsl = FoeClientRegistry.GetEntry("popsslenabled");
            FoeClientRegistryEntry popUsername   = FoeClientRegistry.GetEntry("popusername");
            FoeClientRegistryEntry popPassword   = FoeClientRegistry.GetEntry("poppassword");

            FoeClientRegistryEntry userEmail = FoeClientRegistry.GetEntry("useremail");

            // Pre-fill info
            tbxEmail.Text = ((userEmail == null) ? "" : userEmail.Value);

            tbxSmtpServer.Text         = ((smtpServer == null) ? "" : smtpServer.Value);
            tbxSmtpPort.Text           = ((smtpPort == null) ? "" : smtpPort.Value);
            cbxSmtpRequireAuth.Checked = ((smtpRequireAuth == null) || (smtpRequireAuth.Value.ToUpper() == "T"));
            cbxSmtpRequireSsl.Checked  = ((smtpRequireSsl != null) && (smtpRequireSsl.Value.ToUpper() == "T"));
            tbxSmtpUsername.Text       = ((smtpUsername == null) ? "" : smtpUsername.Value);
            tbxSmtpPassword.Text       = ((smtpPassword == null) ? "" : smtpPassword.Value);

            tbxPopServer.Text        = ((popServer == null) ? "" : popServer.Value);
            tbxPopPort.Text          = ((popPort == null) ? "" : popPort.Value);
            cbxPopRequireSsl.Checked = ((popRequireSsl != null) && (popRequireSsl.Value.ToUpper() == "T"));
            tbxPopUsername.Text      = ((popUsername == null) ? "" : popUsername.Value);
            tbxPopPassword.Text      = ((popPassword == null) ? "" : popPassword.Value);
        }