// read list of catalogs for the given library (in the tree node) private void PopulateCatalogs(TreeNode tn) { Cursor c = Cursor.Current; Cursor.Current = Cursors.WaitCursor; tvLibsCats.BeginUpdate(); if (tn != null) { SasLibrary l = new SasLibrary(currentServer, tn.Text); if (l != null) { foreach (SasCatalog cat in l.GetSasCatalogMembers()) { TreeNode catNode = tn.Nodes.Add(cat.Name); catNode.ImageIndex = (int)CatImages.Catalog; catNode.SelectedImageIndex = (int)CatImages.Catalog; catNode.Tag = "CATALOG"; } } } tvLibsCats.EndUpdate(); Cursor.Current = c; UpdateToolbar(); }
public ServerViewModel(SasLibrary[] libraries) { _libraries = new ReadOnlyCollection<LibraryViewModel>( (from library in libraries select new LibraryViewModel(library)) .ToList()); }
// When selected library changes, get a new list // of data members (DATA or VIEW types) private void onSelectedLibraryChanged(object sender, EventArgs e) { lbMembers.Items.Clear(); SasLibrary lib = lbLibraries.SelectedItem as SasLibrary; // put selected library in Library properties pgLib.SelectedObject = lib; if (!lib.IsAssigned) { try { lib.Assign(); } catch { } } if (lib.IsAssigned) { // gets a collection of SasData objects lbMembers.Items.AddRange(new List <SasData>(lib.GetSasDataMembers()).ToArray()); } }
// for the selected LIBNAME.MEMBER and COLUMN // get the Distinct values from the data set // This will optionally apply a format as well // if one is specified private void btnGetValues_Click(object sender, EventArgs e) { lbValues.Items.Clear(); SasColumn c = lbItems.SelectedItem as SasColumn; SasLibrary lib = lbLibraries.SelectedItem as SasLibrary; SasData d = lbMembers.SelectedItem as SasData; if (c != null && lib != null) { // Fetch distinct values using SAS format string format = ""; // get a handle to the selected data ISASTaskData2 td = Consumer.LibrefData(Consumer.AssignedServer, lib.Libref, d.Member) as ISASTaskData2; // set the format if not blank if (!string.IsNullOrEmpty(txtformat.Text)) { format = txtformat.Text; } // this can throw an exception if the // selected format does not match // the data type. try { lbValues.Items.AddRange( new List <string>( SAS.Tasks.Toolkit.Helpers.TaskDataHelpers.GetDistinctValues(Consumer, td, c.Name, format)).ToArray() ); } catch (SasDataException) { lbValues.Items.Add("<ERROR: could not fetch values>"); } } }
public LibraryViewModel(SasLibrary library) : base(null, true) { _library = library; }