/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel() { StoreSources = new ObservableCollection<Connection>(); if (IsInDesignMode) { // Code runs in Blend --> create design time data. Configuration = new PolarisConfigurationModel(); Configuration.ConnectionStrings.Add(new NamedConnectionString { Name = "Local", ConnectionString = "type=embedded;storesDirectory=c:\\brightstar" }); Configuration.ConnectionStrings.Add(new NamedConnectionString { Name="Remote", ConnectionString = "type=http;endpoint=http://invalid/url" }); } else { // Code runs "for real" if (!PolarisConfigurationModel.Exists && PolarisConfigurationModel.LegacyPathExists) { Configuration = PolarisConfigurationModel.ImportLegacyConfiguration(); } else { Configuration = PolarisConfigurationModel.Load(); } } foreach(var namedConnection in Configuration.ConnectionStrings) { var connection = new Connection(namedConnection.Name, namedConnection.ConnectionString); connection.TryConnect(); StoreSources.Add(connection); } TabItems = new ObservableCollection<TabItemViewModel>(); NewSparqlQueryCommand = new RelayCommand<Store>((s)=>NewSparqlQuery(s)); NewSparqlUpdateCommand = new RelayCommand<Store>((s) => NewSparqlUpdate(s)); NewImportJobCommand = new RelayCommand<Store>(s=>NewImportJob(s)); NewExportJobCommand = new RelayCommand<Store>(s => NewExportJob(s)); NewTransactionCommand = new RelayCommand<Store>(s=>NewTransaction(s)); TabItemChangedCommand = new RelayCommand<TabItemViewModel>(DisplayTabItemToolbars); // KA: Not currently supported for the b-plus tree store // AnalyzeStoreCommand = new RelayCommand<Store>(s=>AnalyzeStore(s)); NewConnectionCommand=new RelayCommand(NewConnection); ServerRefreshCommand = new RelayCommand<Connection>(ServerRefresh); ServerEditCommand = new RelayCommand<Connection>(ServerEdit); ServerDisconnectCommand = new RelayCommand<Connection>(ServerDisconnect); ServerCreateStoreCommand = new RelayCommand<Connection>(ServerCreateStore); StoreDeleteCommand = new RelayCommand<Store>(StoreDelete); NewHistoryViewCommand = new RelayCommand<Store>(NewHistoryView); NewStatisticsViewCommand = new RelayCommand<Store>(NewStatisticsView); AboutClickCommand = new RelayCommand(About); ExitCommand = new RelayCommand(Exit); PrefixSettingsCommand = new RelayCommand(PrefixSettings); }
/// <summary> /// Initializes a new instance of the MainViewModel class. /// </summary> public MainViewModel() { StoreSources = new ObservableCollection <Connection>(); if (IsInDesignMode) { // Code runs in Blend --> create design time data. Configuration = new PolarisConfigurationModel(); Configuration.ConnectionStrings.Add(new NamedConnectionString { Name = "Local", ConnectionString = "type=embedded;storesDirectory=c:\\brightstar" }); Configuration.ConnectionStrings.Add(new NamedConnectionString { Name = "Remote", ConnectionString = "type=http;endpoint=http://invalid/url" }); } else { // Code runs "for real" if (!PolarisConfigurationModel.Exists && PolarisConfigurationModel.LegacyPathExists) { Configuration = PolarisConfigurationModel.ImportLegacyConfiguration(); } else { Configuration = PolarisConfigurationModel.Load(); } } foreach (var namedConnection in Configuration.ConnectionStrings) { var connection = new Connection(namedConnection.Name, namedConnection.ConnectionString); connection.TryConnect(); StoreSources.Add(connection); } TabItems = new ObservableCollection <TabItemViewModel>(); NewSparqlQueryCommand = new RelayCommand <Store>((s) => NewSparqlQuery(s)); NewSparqlUpdateCommand = new RelayCommand <Store>((s) => NewSparqlUpdate(s)); NewImportJobCommand = new RelayCommand <Store>(s => NewImportJob(s)); NewExportJobCommand = new RelayCommand <Store>(s => NewExportJob(s)); NewTransactionCommand = new RelayCommand <Store>(s => NewTransaction(s)); TabItemChangedCommand = new RelayCommand <TabItemViewModel>(DisplayTabItemToolbars); // KA: Not currently supported for the b-plus tree store // AnalyzeStoreCommand = new RelayCommand<Store>(s=>AnalyzeStore(s)); NewConnectionCommand = new RelayCommand(NewConnection); ServerRefreshCommand = new RelayCommand <Connection>(ServerRefresh); ServerEditCommand = new RelayCommand <Connection>(ServerEdit); ServerDisconnectCommand = new RelayCommand <Connection>(ServerDisconnect); ServerCreateStoreCommand = new RelayCommand <Connection>(ServerCreateStore); StoreDeleteCommand = new RelayCommand <Store>(StoreDelete); NewHistoryViewCommand = new RelayCommand <Store>(NewHistoryView); AboutClickCommand = new RelayCommand(About); ExitCommand = new RelayCommand(Exit); PrefixSettingsCommand = new RelayCommand(PrefixSettings); }
public void ServerRefresh(Connection connectionToRefresh) { connectionToRefresh.TryConnect(); }
public void ServerRefresh(Connection connectionToRefresh) { connectionToRefresh.TryConnect(); }