private ObservableCollection <OraDB> GetDbsBySelectedCluster() { var updated_items = WorkloadSetupInfo.GetValue <ObservableCollection <Cluster> >(WorkloadSetupKeys.CLUSTERS); var selected = from m in updated_items where m.IsSelected == true select m; var rs_list = new ObservableCollection <OraDB>(); if (selected.Count() == 1) { var cluster = selected.First <Cluster>(); var candiate_node = SelectOneNodeFromCluster(cluster.ClusterName); var proxy = GammaProxyFactory.GetCrsEnvProxy(candiate_node); var rs = proxy.GetDBNames(); var dbnames = rs.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList(); int count = 0; foreach (var db in dbnames) { var dbhome = proxy.GetDBHOMEByName(db); rs_list.Add(new OraDB(count) { DBHome = dbhome, DBName = db }); count++; } return(rs_list); } else { return(null); } }
private ObservableCollection <Cluster> GetClusterInfo() { ObservableCollection <Cluster> clusters = new ObservableCollection <Cluster>(); var net_mgr = NodeNetManagerFactory.GetSimpleNetworkManager(); var tasks = new List <Task>(); var results = new List <string>(); foreach (var machine in from m in net_mgr.Machines where m.Alive == NodeState.Online && m.IsSelected select m) { var proxy = GammaProxyFactory.GetCrsEnvProxy(machine); var rs = proxy.GetClusterNamesAsync(); tasks.Add(rs.ContinueWith((t) => { machine.ClusterName = t.Result; results.Add(t.Result); })); } Task.WhenAll(tasks).GetAwaiter().GetResult(); int counter = 0; foreach (var rs in results.Distinct()) { clusters.Add(new Cluster(counter) { ClusterName = rs.Trim() }); counter += 1; } return(clusters); }
private ObservableCollection <IOraDB> GetDBnames(IMachineInfo machine) { var proxy = GammaProxyFactory.GetCrsEnvProxy(machine); var rs = proxy.GetDBNames(); var dbnames = rs.Split(new string[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries).ToList(); int count = 0; var rs_list = new ObservableCollection <IOraDB>(); foreach (var db in dbnames) { var dbhome = proxy.GetDBHOMEByName(db); rs_list.Add(OraDBFactory.GetOraDB(count, db, dbhome)); count++; } return(rs_list); }
private async Task <ObservableCollection <ICluster> > GetClusterInfo() { ObservableCollection <ICluster> clusters = new ObservableCollection <ICluster>(); var tasks = new List <Task>(); var results = new List <string>(); foreach (var machine in from m in BaseFacility.NodeMgr.Machines where m.Alive == NodeState.Online && m.IsSelected select m) { var proxy = GammaProxyFactory.GetCrsEnvProxy(machine); var rs = proxy.GetClusterNamesAsync(); tasks.Add(rs.ContinueWith((t) => { if (!t.Result.ToLower().Contains("error") && !t.Result.ToLower().Contains(no_crs_home_found)) { machine.ClusterName = t.Result; results.Add(t.Result); } else { MessageBox.Show(t.Result); } })); } await Task.WhenAll(tasks); int counter = 0; foreach (var rs in results.Distinct()) { clusters.Add(new Cluster(counter) { ClusterName = rs.Trim() }); counter += 1; } return(clusters); }