Esempio n. 1
0
        public static void ActivateLicense(Model.IMailGoPG v_mailgo, string v_license_id, out bool v_request, out bool v_activate, out Model.IEmail v_email)
        {
            v_request  = false;
            v_activate = false;
            v_email    = new Model.MEmail();

            v_mailgo.Track.Debug("Start showing activation license");

            ActivateLicenseWF t_form   = new ActivateLicenseWF(v_mailgo, v_license_id);
            DialogResult      t_result = t_form.ShowDialog();

            v_mailgo.Track.Debug("Dialog result : " + t_result.ToString());

            if (t_result == DialogResult.OK)
            {
                v_activate = true;
            }
            else if (t_result == DialogResult.Ignore)
            {
                v_request = true;
                v_email.TO.AddRange(sm_request_email.TO.ToArray());
                v_email.Subject = sm_request_email.Subject;
                v_email.Body    = sm_request_email.Body;
            }

            v_mailgo.Track.Debug("Finish showing activation license");
        }
Esempio n. 2
0
        //private void GetValue(out string v_value, string v_subkey, string v_name)
        //{
        //    RegistryKey t_regkey = Registry.CurrentUser.CreateSubKey(v_subkey);
        //    v_value = (string)t_regkey.GetValue(v_name);
        //    t_regkey.Close();
        //}

        //private void SetValue(string v_subkey, string v_name, string v_value)
        //{
        //    RegistryKey t_regkey = Registry.CurrentUser.CreateSubKey(v_subkey);
        //    t_regkey.SetValue(v_name, v_value);
        //    t_regkey.Close();
        //}

        protected override void OnActivate()
        {
            this.m_mailgo.Track.Debug("ACTIVATION: Start activating license ...");

            bool t_request;
            bool t_activate;

            Model.IEmail t_email;
            ActivateLicenseWF.ActivateLicense(this.m_mailgo, this.m_license_id, out t_request, out t_activate, out t_email);

            if (t_request)
            {
                this.m_mailgo.Track.Debug("ACTIVATION: Activation ID is requested!");
                t_email.Sender       = this.GetSender(null);
                this.m_nocheck_email = t_email;
                this.SendEmail(t_email);
            }
            if (t_activate)
            {
                this.m_mailgo.Track.Debug("ACTIVATION: License is activated!");
                this.m_timer_load.Start();
            }
        }
Esempio n. 3
0
        void TimerLoad_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            this.m_mailgo.Track.Debug("ACTIVATION: Start TimerLoad_Tick ...");
            this.m_timer_load.Stop();

            System.Threading.Thread.CurrentThread.CurrentCulture   = new System.Globalization.CultureInfo("ja-JP");
            System.Threading.Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo("ja-JP");

            this.m_mailgo.Track.Debug("ACTIVATION: checking license ...");
            this.m_mailgo.License.CheckLicense(out this.m_installed, out this.m_evaluated, out this.m_activated, out this.m_expired, out this.m_expired_date, out this.m_license_id);

            if (!this.m_installed)
            {
                this.m_mailgo.Track.Debug("ACTIVATION: License is not installed!");
                return;
            }

            this.m_mailgo.Track.Debug("ACTIVATION: License is installed!");

            this.cmdMailGO.Enabled = true;
            this.cmdOption.Enabled = true;

            if (this.m_activated)
            {
                this.m_mailgo.Track.Debug("ACTIVATION: License is activated!");
                this.UpdateMailGO();
            }
            else if (this.m_expired)
            {
                this.m_mailgo.Track.Debug("ACTIVATION: License is expired!");
                this.SetOffMailGO();
            }
            else
            {
                if (this.IsFirstUse())
                {
                    this.m_mailgo.Track.Debug("ACTIVATION: First use!");

                    this.ClearFirstUse();

                    if (this.AskActivation())
                    {
                        this.m_mailgo.Track.Debug("ACTIVATION: Activate license ...");

                        bool         t_request;
                        bool         t_activate;
                        Model.IEmail t_email;
                        ActivateLicenseWF.ActivateLicense(this.m_mailgo, this.m_license_id, out t_request, out t_activate, out t_email);

                        if (t_activate)
                        {
                            this.m_mailgo.Track.Debug("ACTIVATION: License is activated!");
                            this.m_timer_load.Start();
                            return;
                        }
                        if (t_request)
                        {
                            this.m_mailgo.Track.Debug("ACTIVATION: Activation ID is requested!");
                            t_email.Sender       = this.GetSender(null);
                            this.m_nocheck_email = t_email;
                            this.SendEmail(t_email);
                        }
                    }
                    else
                    {
                        this.m_mailgo.Track.Debug("ACTIVATION: Deadline is displayed!");
                        this.ShowDeadline();
                    }
                    this.SetOnMailGO();
                }
                else
                {
                    this.UpdateMailGO();
                }
            }
        }