Exemplo n.º 1
0
        public void configure()
        {
            // configure log
            XmlConfigurator.Configure(new System.IO.FileInfo("frontend_appender.xml"));
            log.Info("EmEx Frontend logger configured.");

            // try to open settings file
            if (File.Exists( EMEX_OPTIONS ))
            {
                this.settings = new Settings( EMEX_OPTIONS );
            }
            else
            {
                if (File.Exists(EMEX_OPTIONS_TEMPLATE))
                    File.Copy(EMEX_OPTIONS_TEMPLATE, EMEX_OPTIONS);
                this.settings = new Settings(EMEX_OPTIONS);
            }

            // [DIALOG] configure frontend - to - backend
            if ( ! Bootstrap.Instance().Settings.IsConfigured )
            {
                frmWizGeneral wizGeneral = new frmWizGeneral();
                if (DialogResult.Cancel == wizGeneral.ShowDialog())
                    throw new Exception("EmEx cannot start without configuration!");
            }

            // [DIALOG] configure Account
            if ( ! Bootstrap.Instance().Settings.IsAccountConfigured )
            {
                frmWizAccount wizAccount = new frmWizAccount();
                if (DialogResult.Cancel == wizAccount.ShowDialog())
                    throw new Exception("EmEx cannot start without configuring an account!");

                SplashManager.Instance().show();

                Bootstrap.Instance().Settings.Reload();
                Bootstrap.Instance().start();

                // register user
                Hashtable bizSettings = wizAccount.AccountInfo;
                Result res = Bootstrap.Instance().Talker.RegisterUser(bizSettings);
                ErrorHandler.checkBizResult(res);

                // rebuild mailbox
                res = Bootstrap.Instance().Talker.BuildMbox();
                ErrorHandler.checkBizResult(res);
            }
            else
            {
                SplashManager.Instance().show();
                Bootstrap.Instance().start();
            }

            // stop splash
            SplashManager.Instance().close();
        }
Exemplo n.º 2
0
 public Talker(Settings settings)
 {
     // connect to Backend
     this.settings = settings;
     this.session = new Session(
         settings["backend_server"],
         Convert.ToInt32( settings["backend_port"] ),
         settings["backend_auth_user"],
         settings["backend_auth_pass"],
         settings["account_address"]
         );
 }