Exemple #1
0
        /// <summary>
        /// Save options to score center.
        /// </summary>
        private void SaveOptions()
        {
            if (m_center.Setup == null)
            {
                m_center.Setup = new ScoreCenterSetup();
            }

            m_center.Setup.Name                = tbxName.Text;
            m_center.Setup.BackdropDir         = tbxBackdrop.Text;
            m_center.Setup.CacheExpiration     = (int)numCacheExpiration.Value;
            m_center.Setup.LiveNotifTime       = (int)numNotificationTime.Value;
            m_center.Setup.LiveCheckDelay      = (int)numCheckDelay.Value;
            m_center.Setup.LivePlaySound       = ckxPlaySound.Checked;
            m_center.Setup.UseAltColor         = ckxUseAltColor.Checked;
            m_center.Setup.AutoRefresh.enabled = ckxAutoRefresh.Checked;
            m_center.Setup.AutoRefresh.Value   = (int)numAutoRefreshDelay.Value;

            m_center.Setup.UpdateOnlineMode = Tools.ParseEnum <UpdateMode>(comboBox1.SelectedValue.ToString());
            m_center.Setup.UpdateUrl        = tbxUrl.Text;

            ImportOptions options = ReadImportOptions();

            m_center.Setup.UpdateRule = options.ToString();

            List <ScoreParameter> plist = new List <ScoreParameter>();
            DataTable             dt    = dataGridView1.DataSource as DataTable;

            foreach (DataRow r in dt.Rows)
            {
                ScoreParameter p = new ScoreParameter();
                p.name  = r["Name"] as string;
                p.Value = r["Value"] as string;
                if (!String.IsNullOrEmpty(p.name) && !String.IsNullOrEmpty(p.Value))
                {
                    plist.Add(p);
                }
            }

            m_center.Parameters = plist.ToArray();
        }
Exemple #2
0
        private void btnUpdateNow_Click(object sender, EventArgs e)
        {
            UpdateMode mode       = m_center.Setup.UpdateOnlineMode;
            string     strOptions = m_center.Setup.UpdateRule;

            try
            {
                this.Cursor = Cursors.WaitCursor;
                ImportOptions options = ReadImportOptions();

                m_reload = true;
                m_center.Setup.UpdateOnlineMode = UpdateMode.Manually;
                m_center.Setup.UpdateRule       = options.ToString();
                ExchangeManager.OnlineUpdate(m_center, true);
            }
            finally
            {
                m_center.Setup.UpdateOnlineMode = mode;
                m_center.Setup.UpdateRule       = strOptions;
                this.Cursor = Cursors.Default;
            }
        }