Beispiel #1
0
        /// <summary>
        ///     Executes this CreateBusinessFormCommand.
        /// </summary>
        public override void Execute()
        {
            logger.Trace("Entered Execute()");
            try
            {
                ClassEntity classEntity = null;
                var         Guids       = PtHelpers.GetProjectTypeGuids(
                    Application.ActiveDocument.ProjectItem.ContainingProject).Split(';');
                if (PtHelpers.IsProjectSilverlight(Guids))
                {
                    classEntity = new ClassEntity(string.Empty, true)
                    {
                        SilverlightVersion =
                            this.Application.ActiveDocument
                            .ProjectItem.ContainingProject
                            .Properties.Item(
                                "TargetFrameworkMoniker")
                            .Value.ToString()
                            .Replace(
                                "Silverlight,Version=v",
                                string.Empty)
                    };
                }

                var createBusinessFormWindow = new CreateBusinessFormWindow(classEntity);
                var result = createBusinessFormWindow.ShowDialog();
                if (!(result ?? false))
                {
                    return;
                }

                var ts = this.Application.ActiveDocument.Selection as TextSelection;
                if (ts == null)
                {
                    throw new Exception("ts is null.");
                }

                ts.Insert(createBusinessFormWindow.BusinessForm);
            }
            catch (Exception ex)
            {
                UIUtilities.ShowExceptionMessage(Caption, ex.Message);
                logger.Debug("An exception was raised in Execute().", ex);
            }
        }
Beispiel #2
0
 /// <summary>
 ///     Executes this CreateBusinessFormCommand.
 /// </summary>
 public override void Execute()
 {
     try
     {
         ClassEntity classEntity = null;
         var         Guids       = PtHelpers.GetProjectTypeGuids(Application.ActiveDocument.ProjectItem.ContainingProject).Split(';');
         if (PtHelpers.IsProjectSilverlight(Guids))
         {
             classEntity = new ClassEntity(string.Empty, true);
             classEntity.SilverlightVersion = Application.ActiveDocument.ProjectItem.ContainingProject.Properties.Item("TargetFrameworkMoniker").Value.ToString().Replace("Silverlight,Version=v", string.Empty);
         }
         var createBusinessFormWindow = new CreateBusinessFormWindow(classEntity);
         var result = createBusinessFormWindow.ShowDialog();
         if (result ?? false)
         {
             var ts = Application.ActiveDocument.Selection as TextSelection;
             ts.Insert(createBusinessFormWindow.BusinessForm);
         }
     }
     catch (Exception ex)
     {
         UIUtilities.ShowExceptionMessage(Caption, ex.Message, string.Empty, ex.ToString());
     }
 }