Beispiel #1
0
        /// <summary>
        /// Open a window for selecting an AMT database and settings.
        /// </summary>
        private void SelectAMT()
        {
            var dmsWindow        = new DatabaseSearchToolWindow();
            var optionsViewModel = new MassTagDatabaseOptionsViewModel(this.analysis.Options.MassTagDatabaseOptions);
            var databaseView     = new DatabasesViewModel {
                MassTagOptions = optionsViewModel
            };

            dmsWindow.DataContext           = databaseView;
            dmsWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;

            var loader    = MassTagDatabaseLoaderFactory.Create(MtdbDatabaseServerType.Dms);
            var databases = loader.LoadDatabases();

            DmsDatabaseServerViewModel selectedDatabaseServer = null;

            foreach (var database in databases)
            {
                databaseView.AddDatabase(database);
            }

            var result = dmsWindow.ShowDialog();

            if (result == true)
            {
                if (databaseView.SelectedDatabase != null)
                {
                    selectedDatabaseServer = databaseView.SelectedDatabase;
                    this.SelectedDatabase  = selectedDatabaseServer.Database;
                    this.SelectedDatabase.DatabaseFormat = MassTagDatabaseFormat.MassTagSystemSql;
                }
            }
        }
Beispiel #2
0
        private void FindDmsDatabaseDelegate()
        {
            var dmsWindow    = new DatabaseSearchToolWindow();
            var databaseView = new DatabasesViewModel();

            dmsWindow.DataContext           = databaseView;
            dmsWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
            var loader    = MassTagDatabaseLoaderFactory.Create(MtdbDatabaseServerType.Dms);
            var databases = loader.LoadDatabases();

            foreach (var database in databases)
            {
                databaseView.AddDatabase(database);
            }

            if (SelectedDatabaseServer != null)
            {
                databaseView.SelectedDatabase = SelectedDatabaseServer;
            }

            var result = dmsWindow.ShowDialog();

            if (result == true)
            {
                if (databaseView.SelectedDatabase != null)
                {
                    SelectedDatabaseServer = databaseView.SelectedDatabase;
                    var database = SelectedDatabaseServer.Database;
                    database.DatabaseName        = database.DatabaseName;
                    database.DatabaseServer      = database.DatabaseServer;
                    m_analysis.MetaData.Database = database;
                    IsDatabaseDms = true;
                    OnPropertyChanged("RequiresDatabaseSelection");
                }
            }
        }