public SasServerLoginDlg(SasServer s) : this() { SasServer = s; txtHost.Text = s.Host; txtName.Text = s.Name; txtUser.Text = s.UserId; txtPort.Text = s.Port; chkLocal.Checked = SasServer.UseLocal; }
public KeyDataSet_Dynamic(SasServer session) { InitializeComponent(); activeSession = session; cmCol = new DataGridViewComboBoxColumn(); //Set libnames combobox to be libnames from SAS foreach (Libname libname in Instance.study.Libnames) { comboBox1.Items.Add(libname.SASLibname); } comboBox1.SelectedIndex = 0; }
protected override void OnClosing(CancelEventArgs e) { if (DialogResult == System.Windows.Forms.DialogResult.OK) { SasServer = new SasServer(); SasServer.UseLocal = chkLocal.Checked; SasServer.Host = txtHost.Text; SasServer.Port = txtPort.Text; SasServer.UserId = txtUser.Text; SasServer.Password = txtPassword.Text; SasServer.Name = txtName.Text; } base.OnClosing(e); }
public static void ConnectBGWorkerToSAS(SasServer activeSession) { if (activeSession != null && activeSession.Workspace != null) { ActiveSession = activeSession; connection = new System.Data.OleDb.OleDbConnection("Provider=sas.iomprovider.1; SAS Workspace ID=" + ActiveSession.Workspace.UniqueIdentifier); // if we don't use a background thread when running this program // we'll BLOCK the UI of the app while a long-running // SAS job completes. // This allows us to keep the UI responsive. _bgSASWorker = new BackgroundWorker(); _bgSASWorker.DoWork += bg_DoWork; _bgSASWorker.RunWorkerCompleted += bg_RunWorkerCompleted; //ActiveSession.Workspace.LanguageService.DatastepComplete += new SAS.CILanguageEvents_DatastepCompleteEventHandler(LanguageService_DatastepComplete); } }
public static SasServer FromXml(string xml) { SasServer s = new SasServer(); try { XElement settings = XElement.Parse(xml); if (settings.Attribute("name") != null) s.Name = settings.Attribute("name").Value; if (settings.Attribute("host") != null) s.Host = settings.Attribute("host").Value; if (settings.Attribute("port") != null) s.Port = settings.Attribute("port").Value; if (settings.Attribute("userid") != null) s.UserId = settings.Attribute("userid").Value; if (settings.Attribute("useLocal") != null) s.UseLocal = XmlConvert.ToBoolean(settings.Attribute("useLocal").Value); } catch (System.Exception) { // no need to bomb if this goes poorly because of bad XML } return s; }
private KeyDataSet_Dynamic CreateKeyDataSet(SasServer session) { KeyDataSet_Dynamic keyDataSet = new KeyDataSet_Dynamic(session); return keyDataSet; }
private void ConnectToServer() { activeSession = new SasServer(); string settingsFile = Path.Combine(Application.LocalUserAppDataPath, appSettings); if (File.Exists(settingsFile)) { string xml = File.ReadAllText(settingsFile); activeSession = SasServer.FromXml(xml); } SasServerLoginDlg login = new SasServerLoginDlg(activeSession); if (login.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { activeSession = login.SasServer; try { activeSession.Connect(); File.WriteAllText(settingsFile, activeSession.ToXml()); if (activeSession.UseLocal) SASstatusMsg.Text = string.Format("Connected to Local SAS session as {0}", System.Environment.UserName); else SASstatusMsg.Text = string.Format("Connected to {0} ({1}) as {2}", activeSession.Name, activeSession.Host, string.IsNullOrEmpty(activeSession.UserId) ? Environment.UserName : activeSession.UserId); } catch (Exception ex) { MessageBox.Show(string.Format("Could not connect: {0}", ex.Message)); SASstatusMsg.Text = "SAS Connection = Not Connected"; } } Instance.ConnectBGWorkerToSAS(activeSession); Instance.SetUpLIBNAMESinSAS(); }