/// <summary> /// Called when the user selects the "submit assignment" menu option /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SubmitAssignmentCallback(object sender, EventArgs e) { IVsUIShell uiShell = (IVsUIShell)GetService(typeof(SVsUIShell)); Guid clsid = Guid.Empty; SubmitEvent evt = new SubmitEvent(); DTE2 dte = (DTE2)this.GetService(typeof(SDTE)); if (dte.Solution.FullName.Length == 0) { MessageBox.Show("No solution is currently open."); return; } object cacheItem = _cache[StringConstants.AuthenticationCacheKey]; if (cacheItem != null && string.IsNullOrEmpty(cacheItem.ToString()) == false) { evt.SolutionName = dte.Solution.FullName; SubmitAssignmentViewModel vm = new SubmitAssignmentViewModel( _cache[StringConstants.UserNameCacheKey] as string, _cache[StringConstants.AuthenticationCacheKey] as string, evt ); MessageBoxResult result = SubmitAssignmentWindow.ShowModalDialog(vm); //assume that data was changed and needs to be saved if (result == MessageBoxResult.OK) { } } else { MessageBox.Show("You must be logged into OSBIDE in order to submit an assignment."); } }
private void SubmitAssignmentCallback(object sender, EventArgs e) { var evt = new SubmitEvent(); var dte = (DTE2)GetService(typeof(SDTE)); dte.Solution.Projects.DTE.Documents.SaveAll(); var build = dte.Solution.SolutionBuild.BuildState; var result = MessageBox.Show(@"If you do not build your soultion, all your files may not be submitted, would you like to build? If not, you may still submit your assignment.", "", MessageBoxButtons.YesNo); if (result == DialogResult.Yes) { dte.Solution.SolutionBuild.Build(true); } if (dte.Solution.FullName.Length == 0) { MessageBox.Show(@"No solution is currently open."); return; } var cacheItem = _cache[StringConstants.AuthenticationCacheKey]; if (cacheItem != null && string.IsNullOrEmpty(cacheItem.ToString()) == false) { evt.SolutionName = dte.Solution.FullName; var vm = new SubmitAssignmentViewModel( _cache[StringConstants.UserNameCacheKey] as string, _cache[StringConstants.AuthenticationCacheKey] as string, evt ); SubmitAssignmentWindow.ShowModalDialog(vm); } else { MessageBox.Show(@"You must be logged into OSBLE+ in order to submit an assignment."); } }