PageRenderTime 41ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/Visual Studio 2008/CSVstoGetWrapperObject/GetWrapperRibbon.cs

#
C# | 61 lines | 36 code | 7 blank | 18 comment | 2 complexity | 31fb642e92c1cce001ca392b03f8dccb MD5 | raw file
  1. /************************************* Module Header **************************************\
  2. * Module Name: GetWrapperRibbon.cs
  3. * Project: CSVstoGetWrapperObject
  4. * Copyright (c) Microsoft Corporation.
  5. *
  6. * The CSVstoGetWrapperObject project demonstrates how to get a VSTO wrapper
  7. * object from an existing Office COM object.
  8. *
  9. * This feature requires Visual Studio Tools for Office 3.0 SP1 (included in
  10. * Visual Studio 2008 SP1) for both design-time and runtime support.
  11. *
  12. * This source is subject to the Microsoft Public License.
  13. * See http://www.microsoft.com/opensource/licenses.mspx#Ms-PL.
  14. * All other rights reserved.
  15. *
  16. * History:
  17. * * 6/13/2009 3:00 PM Wang Jie Created
  18. \******************************************************************************************/
  19. #region Using directives
  20. using System;
  21. using System.Collections.Generic;
  22. using System.Linq;
  23. using System.Text;
  24. using Microsoft.Office.Tools.Ribbon;
  25. using System.Windows.Forms;
  26. using System.Diagnostics;
  27. #endregion
  28. namespace CSVstoGetWrapperObject
  29. {
  30. public partial class GetWrapperRibbon : OfficeRibbon
  31. {
  32. private GetWrapperForm getWrapperForm = null;
  33. public GetWrapperRibbon()
  34. {
  35. InitializeComponent();
  36. }
  37. private void GetWrapperRibbon_Load(object sender, RibbonUIEventArgs e)
  38. {
  39. }
  40. private void btnShowGetWrapperCS_Click(object sender, RibbonControlEventArgs e)
  41. {
  42. if (getWrapperForm == null ||
  43. getWrapperForm.IsDisposed)
  44. {
  45. getWrapperForm = new GetWrapperForm();
  46. getWrapperForm.Show(NativeWindow.FromHandle(Process.GetCurrentProcess().MainWindowHandle));
  47. }
  48. else
  49. {
  50. getWrapperForm.Activate();
  51. }
  52. }
  53. }
  54. }