コード例 #1
0
ファイル: MainForm.cs プロジェクト: uwitec/ideacode
        private void configToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DBConnectForm f = new DBConnectForm();

            if (f.ShowDialog() == DialogResult.OK)
            {
                ConnectDialog d = new ConnectDialog();
                if (d.ShowDialog() == DialogResult.OK)
                {
                    // 1. 保存配置
                    Properties.Settings.Default.Subscriber = f.Connection.ServerInstance;
                    if (!f.Connection.LoginSecure)
                    {
                        Properties.Settings.Default.SqlLoginMode    = true;
                        Properties.Settings.Default.SqlUserName     = f.Connection.Login;
                        Properties.Settings.Default.SqlUserPassword = f.Connection.Password;
                    }

                    Properties.Settings.Default.Publisher             = d.Publisher;
                    Properties.Settings.Default.Publication           = d.Publication;
                    Properties.Settings.Default.PublicationDatabase   = d.PublisherDB;
                    Properties.Settings.Default.WebSynchronizationUrl = d.WebSyncUrl;
                    Properties.Settings.Default.InternetLogin         = d.InternetUserName;
                    Properties.Settings.Default.InternetPassword      = d.InternetUserPassword;

                    Properties.Settings.Default.Save();
                    // 2.
                    MessageBox.Show("配置已经更改,需要重新同步数据!", "同步数据", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    showSyncDialog();
                }
            }
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: honj51/ideacode
        private void configToolStripMenuItem_Click(object sender, EventArgs e)
        {
            DBConnectForm f = new DBConnectForm();
            if (f.ShowDialog() == DialogResult.OK)
            {
                ConnectDialog d = new ConnectDialog();
                if (d.ShowDialog() == DialogResult.OK)
                {
                    // 1. 保存配置
                    Properties.Settings.Default.Subscriber = f.Connection.ServerInstance;
                    if (!f.Connection.LoginSecure)
                    {
                        Properties.Settings.Default.SqlLoginMode = true;
                        Properties.Settings.Default.SqlUserName = f.Connection.Login;
                        Properties.Settings.Default.SqlUserPassword = f.Connection.Password;
                    }

                    Properties.Settings.Default.Publisher = d.Publisher;
                    Properties.Settings.Default.Publication = d.Publication;
                    Properties.Settings.Default.PublicationDatabase = d.PublisherDB;
                    Properties.Settings.Default.WebSynchronizationUrl = d.WebSyncUrl;
                    Properties.Settings.Default.InternetLogin = d.InternetUserName;
                    Properties.Settings.Default.InternetPassword = d.InternetUserPassword;

                    Properties.Settings.Default.Save();
                    // 2.
                    MessageBox.Show("配置已经更改,需要重新同步数据!", "同步数据", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    showSyncDialog();

                }
            }
        }