示例#1
0
        /// <summary>
        /// </summary>
        private void UseRecentSessionInfo()
        {
            var sessionObj = GetRecentSessionInfo();

            if (sessionObj != null)
            {
                txtQuery.Text          = GenUtil.NormalizeEol(sessionObj.txtQuery);
                txtRowLimit.Text       = sessionObj.txtRowLimit;
                txtSiteUrl.Text        = sessionObj.txtSiteUrl;
                txtViewAttributes.Text = GenUtil.NormalizeEol(sessionObj.txtViewAttributes);
                txtViewFields.Text     = GenUtil.NormalizeEol(sessionObj.txtViewFields);
            }
        }
示例#2
0
        /// <summary>
        /// </summary>
        private void SaveCurrentSessionInfo()
        {
            if (GenUtil.SafeToBool(ConfigurationManager.AppSettings["disableSession"]))
            {
                return;
            }

            StreamWriter sw = null;

            try
            {
                string iniPath = AppDomain.CurrentDomain.BaseDirectory.TrimEnd(new char[] { '\\' }) + "\\" + "session.ini";
                sw = new StreamWriter(iniPath, false);

                var sso = new SessionObject();
                sso.txtQuery          = GenUtil.NormalizeEol(txtQuery.Text);
                sso.txtRowLimit       = GenUtil.SafeTrim(txtRowLimit.Text);
                sso.txtSiteUrl        = GenUtil.SafeTrim(txtSiteUrl.Text);
                sso.txtViewAttributes = GenUtil.NormalizeEol(txtViewAttributes.Text);
                sso.txtViewFields     = GenUtil.NormalizeEol(txtViewFields.Text);

                sso.txtUsername = formChooser.credUsername;
                sso.txtPassword = formChooser.credPassword;
                sso.txtDomain   = formChooser.credDomain;

                sso.appMode = ((int)formChooser.appMode).ToString();

                var xml = XmlSerialization.Serialize(sso);

                sw.Write(xml);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
            finally
            {
                if (sw != null)
                {
                    sw.Dispose();
                }
            }
        }