示例#1
0
 protected void _Initialize()
 {
     _handler = new DatabaseHandler(_testDatabaseName, "password");
     _handler.Open();
     CreateMembers(300);
 }
示例#2
0
        private void OpenDatabase()
        {
            try
            {
                DateTime startTime = DateTime.Now; // count the time used to open

                DatabaseHandler handler = new DatabaseHandler(_recentItem.File.FullName, Password);
                RecentFiles.AddNewFile(_recentItem.File.FullName);
                handler.Open();

                Registry.View.MainWindow mw = new Registry.View.MainWindow();
                MainWindowViewModel viewModel = new MainWindowViewModel(handler.Database, mw.Dispatcher, startTime);
                mw.DataContext = viewModel;
                mw.Show();
                OnRequestClose();
            }
            catch (ArgumentException ex)
            {
            #if DEBUG
                MessageBox.Show(ex.ToString(), Properties.Resources.DatabaseCannotBeOpenedInvalidPassword);
            #else
                MessageBox.Show(Properties.Resources.DatabaseCannotBeOpenedInvalidPassword, Properties.Resources.DatabaseCannotBeOpenedInvalidPassword);
            #endif
            }
        }
        private DatabaseHandler DoCreateDatabase()
        {
            try
            {
                if (File.Exists(DatabaseInfo.FullPathToDatabase))
                    throw new System.IO.IOException(String.Format(CultureInfo.CurrentCulture,
                                                                 Properties.Resources.AFileWithThisNameAlreadyExistsOnDisk,
                                                                 DatabaseInfo.FullPathToDatabase));

                DatabaseHandler handler = new DatabaseHandler(DatabaseInfo.FullPathToDatabase, DatabaseInfo.DatabasePassword);
                handler.Open();

                RecentFiles.AddNewFile(DatabaseInfo.FullPathToDatabase);
                return handler;
            }
            catch (IOException exception)
            {
                MessageBox.Show(exception.Message);
            }
            return null;
        }
 private static void OpenCreatedDatabase(DatabaseHandler handler)
 {
     Registry.View.MainWindow mw = new Registry.View.MainWindow();
     MainWindowViewModel viewModel = new MainWindowViewModel(handler.Database, mw.Dispatcher, DateTime.Now);
     mw.DataContext = viewModel;
     mw.Show();
 }
示例#5
0
 public virtual void Initialize()
 {
     _handler = new DatabaseHandler(_testDatabaseName, "password");
     _handler.Open();
     _container = _handler.Database;
 }
示例#6
0
 public void Initialize()
 {
     _handler = new DatabaseHandler(_testDatabaseName, "password");
     _handler.Open();
 }
示例#7
0
 //[TestInitialize]
 // Don't initialize automatically because the test data file has not been yet deployed
 /// <summary>
 /// Will initialize a test database with 85 users.
 /// </summary>
 public virtual void Initialize()
 {
     _handler = new DatabaseHandler(_testDatabaseName, "password");
     _handler.Open();
     new SampleXmlImport().Import(new FileInfo(_deploymentItem).Name, _handler.Database);
 }