public DlgSendToRoundTable(ProjectServerConnection psc, ref Word.Application word) { // // Required for Windows Form Designer support // InitializeComponent(); this.Location = new Point((Screen.PrimaryScreen.WorkingArea.Width - this.Width) / 3, (Screen.PrimaryScreen.WorkingArea.Height - this.Height) / 3); this.StartPosition = FormStartPosition.Manual; this.msword = word; this.psc = psc; hshProjects = new Hashtable(); Project[] projects = psc.ProjectManager.getAllProjectsForAccount(psc.Account.id); foreach (Project p in projects) { comboBox1.Items.Add(p.name); hshProjects.Add(p.name, p); } if (comboBox1.Items.Count > 0) { comboBox1.Text = (string)comboBox1.Items[0]; } else { MessageBox.Show("You are not currently a member of any RoundTable Projects."); } }
public DlgOpenFromRoundTable(IDocumentActivator activator, ProjectServerConnection psc) { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // listBox1.MouseDown += new MouseEventHandler(listBox1_MouseDown); listBox1.KeyDown += new KeyEventHandler(listBox1_KeyDown); this.documentActivator = activator; this.psc = psc; hshProjects = new Hashtable(); hshDocuments = new Hashtable(); Project[] projects = psc.ProjectManager.getAllProjectsForAccount(psc.Account.id); foreach (Project p in projects) { comboBox1.Items.Add(p.name); hshProjects.Add(p.name, p); } if (comboBox1.Items.Count > 0) { comboBox1.Text = (string)comboBox1.Items[0]; } else { MessageBox.Show("You are not currently a member of any RoundTable Projects."); } }
public void TearDown() { adminPsc.logout(); adminPsc = null; GC.Collect(); GC.WaitForPendingFinalizers(); GC.Collect(); GC.WaitForPendingFinalizers(); }
/* * Activates a word document. */ public void ActivateDocument(Document slDoc, ProjectServerConnection psc) { Word.Document wdDoc = null; try { Document slDocDeep = psc.DocumentManager.getDocumentDeep(slDoc.id); // Todo: I think part of the problem here is opening one document in word, // overwriting that document (FHANDLE, ETC) and reloading as a new doc // with the existing one still open. // // This should be testable by uploading multiple documents to RoundTable // and opening each one. FileStream fs = new FileStream(slDocDeep.filename, FileMode.Create); BinaryWriter bw = new BinaryWriter(fs); bw.Write(slDocDeep.document, 0, slDocDeep.document.Length); bw.Flush(); bw.Close(); fs.Close(); // Already done by bw? // Activate the RoundTable Document. object missing = Type.Missing; object filepath = Path.GetFullPath(slDocDeep.filename); wdDoc = wordApp.Documents.Open(ref filepath, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing, ref missing); wdDoc.Activate(); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { try { Marshal.ReleaseComObject(wdDoc); } catch (Exception ex) { } } }
private void bnBuildSched_Click(CommandBarButton Ctrl, ref bool CancelDefault) { try { if (!loggedIn) { psc = psc = new ProjectServerConnection("brian", "brian", 1, "dan", 8080); //rtc.Username, rtc.Password, 1, rtc.IPAddress, rtc.Port); psc.login(); loggedIn = true; } BuildSchedule buildSchedule = new BuildSchedule(projectApp, psc); buildSchedule.Show(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void bnOpenFromRoundTable_Click(CommandBarButton Ctrl, ref bool CancelDefault) { // TODO: Add progress bar, etc. try { ProjectServerConnection psc = new ProjectServerConnection("brian", "brian", 1, "localhost", 8080); psc.login(); DlgOpenFromRoundTable dlgOpenFrom = new DlgOpenFromRoundTable(this, psc); dlgOpenFrom.Show(); } catch (Exception e) { MessageBox.Show("Unable to connect and authenticate with RoundTable.", "RoundTable Connection Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public BuildSchedule(MSProject.Application projectApp, ProjectServerConnection psc) { // // Required for Windows Form Designer support // InitializeComponent(); // // TODO: Add any constructor code after InitializeComponent call // this.projectApp = projectApp; this.psc = psc; Project[] userProjects = psc.getProjectManager().getAllProjectsForAccount(psc.getAccount().id); foreach (Project project in userProjects) { ProjectListItem pli = new ProjectListItem(); pli.Name = project.name; pli.Project = project; cbSelectProject.Items.Add(pli); } }
public void Setup() { adminPsc = new ProjectServerConnection("administrator", "dommoni", 1, "localhost", 8080); adminPsc.login(); }
public RoundTableConnection(ConnectionSettings settings) { connected = false; serverConnection = new ProjectServerConnection(settings.Username, settings.Password, 1, settings.IPAddr, settings.Port); }
// // Event Handlers... // private void bnSendToRoundTable_Click(CommandBarButton Ctrl, ref bool CancelDefault) { try { ConnectionSettings cs = ConnectionSettings.LoadSettings(); ProjectServerConnection psc = new ProjectServerConnection(cs.Username, cs.Password, 1, cs.IPAddr, cs.Port); psc.login(); DlgSendToRoundTable dSendToRoundTable = new DlgSendToRoundTable(psc, ref wordApp); dSendToRoundTable.Show(); } catch (System.Exception ex) { MessageBox.Show(Utils.MSG_CONNECTION_ERROR, Utils.MSG_CONNECTION_ERROR_DLGTITLE, MessageBoxButtons.OK, MessageBoxIcon.Error); } /*Word.Document doc = wordApp.ActiveDocument; * if (!doc.Saved) * { * // Prompt for save * DialogResult dr; * dr = MessageBox.Show("This document has not been saved. Would you like to save first?", * "Un-Saved Document", * MessageBoxButtons.YesNoCancel, * MessageBoxIcon.Question); * * if (dr == DialogResult.Yes) * { * bool docSaved = false; * try * { * doc.Save(); * docSaved = true; * } * catch(System.Exception ex) * { * docSaved = false; * } * } * else if (dr == DialogResult.No) * { * return; * } * else if (dr == DialogResult.Cancel) * { * return; * } * } * * if (doc.Saved) * { * try * { * object missing = Type.Missing; * string tmpPath = doc.Path + "\\" + doc.Name; * doc.Close(ref missing, ref missing, ref missing); * object filepath = Path.GetFullPath(tmpPath); * FileStream fs = new FileStream((string)filepath, FileMode.Open, FileAccess.Read); * BinaryReader br = new BinaryReader(fs); * byte[] bDocument = br.ReadBytes((int)fs.Length); * * br.Close(); * * doc = wordApp.Documents.Open(ref filepath, * ref missing, ref missing, ref missing, * ref missing, ref missing, ref missing, * ref missing, ref missing, ref missing, * ref missing, ref missing, ref missing, * ref missing, ref missing, ref missing); * * if (doc != null) * { * // Create the RoundTable document * ProjectServerConnection psc = new ProjectServerConnection("brian", "brian", 1, "localhost", 8080); * psc.login(); * * RoundTable.Document rtDoc = new RoundTable.Document(); * rtDoc.document = bDocument; * rtDoc.name = doc.Name; * rtDoc.documentType = RoundTable.DocumentType.MSOFFICE_WORD; * rtDoc.description = "none for now"; * rtDoc.filename = doc.Name; * rtDoc.ownerId = psc.Account.id; * rtDoc.projectId = 1; * * // TODO: Need to be sure to always set the current project here! * RoundTable.Project p = psc.ProjectManager.getProject(1); * psc.CurrentProject = p; * * psc.DocumentManager.addDocument(rtDoc); * } * } * catch(System.Exception ex) * { * MessageBox.Show(ex.Message); * } * }*/ }
public void Setup() { adminPsc = new ProjectServerConnection(testUsername, testPassword, testSessionType, testHost, testPort); adminPsc.login(); }