示例#1
0
        public override void Install(IDictionary stateSaver)
        {
#if ADD_DB_TO_SQL_SERVER_DATA
            //var targetdir = this.Context.Parameters["assemblypath"];
            //Debug.Assert(targetdir != null);
            //string path = Path.Combine(Path.GetPathRoot(targetdir), DBINSTALLPATH);
#else //INSTALL ON SYSTEM DRIVE
            string path = Path.Combine(Path.GetPathRoot(Environment.GetFolderPath(Environment.SpecialFolder.System)), DBINSTALLPATH);
#endif
            try
            {
                if (ClientDataAccess.TestConnection() != null)
                {
                    string sql = string.Format(Resources.PTFLocalInstallScript, path);
                    ClientDataAccess.SetupDatabase(path, sql);
                }
            }
            catch (Exception ex)
            {
                ex.ShowDialog();
            }
            finally
            {
                base.Install(stateSaver);
            }
        }
示例#2
0
 private void TestConnection_Click(object sender, EventArgs e)
 {
     if (sender == btnDbTestConnection)
     {
         errorProvider.SetError(btnDbTestConnection, ClientDataAccess.TestConnection());
     }
     else if (sender == btnRcvTestConnection)
     {
         new MethodInvoker(() =>
         {
             string url = SettingsTable.Get <string>(Strings.All_CentralServerUrl);
             Debug.Assert(url != null);
             UserAuth auth = SettingsTable.Get <UserAuth>(Strings.Transferring_AuthObject, UserAuth.Default);
             this.InvokeSafe(new MethodInvoker(() => errorProvider.SetError(btnRcvTestConnection, DataServiceClient.CallTestConnection())));
         }).FireAndForgetSafe();
     }
     else if (sender == btnTrfTestConnection)
     {
         errorProvider.SetError(btnTrfTestConnection, OS.TestService(Strings.TransferringService, TimeSpan.FromSeconds(10)));
     }
 }