Interaction logic for ConnectDialog.xaml
Inheritance: System.Windows.Window
コード例 #1
0
        /// <summary>
        /// Displays a dialog prompting the user for connection details. The isNewConnection
        /// parameter will be true if the user is creating a new connection rather than editing an
        /// existing connection. This should return true if the user clicked OK. If it returns false,
        /// any changes to the IConnectionInfo object will be rolled back.</summary>
        public override bool ShowConnectionDialog(IConnectionInfo pCxInfo, bool pIsNewConnection)
        {
            VelocityDBProperties lProp;

            if (pIsNewConnection)
            {
                lProp = new VelocityDBProperties(pCxInfo)
                {
                    Host               = Dns.GetHostName(),
                    WindowsAuth        = false,
                    PessimisticLocking = false
                };
            }
            else
            {
                lProp = new VelocityDBProperties(pCxInfo);
            }
            bool?result = new ConnectionDialog(pCxInfo).ShowDialog();

            if (result != true)
            {
                return(false);
            }

            // This function, as well as GetSchemaAndBuildAssembly, runs on a separeted appdomain. But different from
            // GetSchemaAndBuildAssembly, pCxInfo gets persisted if true is returned. So this is the best (found) place to create
            // a list of dependencies.

            // Save already loaded assemblies.
            SchemaInfo  lSchema      = SchemaExtractor.Extract(lProp.ClassesFilenamesArray, lProp.DependencyFilesArray);
            SessionInfo lSessionInfo = new SessionInfo()
            {
                DBFolder           = lProp.DBFolder,
                Host               = lProp.Host,
                PessimisticLocking = lProp.PessimisticLocking,
                SessionType        = lProp.SessionType,
                WindowsAuth        = lProp.WindowsAuth
            };

            VelocityDBAccessBuilder lBuilder = new VelocityDBAccessBuilder(lSchema, lSessionInfo);

            lBuilder.BuildAssembly(new AssemblyName("DummyName"), "DummyName", "DummyName", false);

            lProp.ActualDepencies = lSchema.LoadedAssemblies;
            return(true);
        }
コード例 #2
0
        /// <summary>
        /// Displays a dialog prompting the user for connection details. The isNewConnection
        /// parameter will be true if the user is creating a new connection rather than editing an
        /// existing connection. This should return true if the user clicked OK. If it returns false,
        /// any changes to the IConnectionInfo object will be rolled back.</summary>
        public override bool ShowConnectionDialog(IConnectionInfo pCxInfo, bool pIsNewConnection)
        {
            VelocityDBProperties lProp;
            if (pIsNewConnection)
            {
                lProp = new VelocityDBProperties(pCxInfo)
                {
                    Host = Dns.GetHostName(),
                    WindowsAuth = false,
                    PessimisticLocking = false
                };
            }
            else 
              lProp = new VelocityDBProperties(pCxInfo);
            bool? result = new ConnectionDialog(pCxInfo).ShowDialog();
            if (result != true)
              return false;

            // This function, as well as GetSchemaAndBuildAssembly, runs on a separeted appdomain. But different from 
            // GetSchemaAndBuildAssembly, pCxInfo gets persisted if true is returned. So this is the best (found) place to create
            // a list of dependencies.
            
            // Save already loaded assemblies.
            SchemaInfo lSchema = SchemaExtractor.Extract(lProp.ClassesFilenamesArray, lProp.DependencyFilesArray);
            SessionInfo lSessionInfo = new SessionInfo()
            {
                DBFolder = lProp.DBFolder,
                Host = lProp.Host,
                PessimisticLocking = lProp.PessimisticLocking,
                SessionType = lProp.SessionType,
                WindowsAuth = lProp.WindowsAuth
            };

            VelocityDBAccessBuilder lBuilder = new VelocityDBAccessBuilder(lSchema, lSessionInfo);
            lBuilder.BuildAssembly(new AssemblyName("DummyName"), "DummyName", "DummyName", false);

            lProp.ActualDepencies = lSchema.LoadedAssemblies;
            return true;
        }