Beispiel #1
0
 /// <summary>
 ///     Executes this CreateViewModelCommandFromSelectedClassCommand.
 /// </summary>
 public override void Execute()
 {
     logger.Trace("Entered Execute()");
     try
     {
         var         remoteTypeReflector = new RemoteTypeReflector();
         ClassEntity classEntity         =
             remoteTypeReflector.GetClassEntityFromSelectedClass(
                 this.Application.SelectedItems.Item(1)
                 .ProjectItem.ContainingProject,
                 this.Caption);
         if (classEntity != null)
         {
             var obj = new CreateViewModelWindow(classEntity,
                                                 this.Application.ActiveWindow.Caption.EndsWith(".vb"));
             bool?result = obj.ShowDialog();
             if (result ?? false)
             {
                 try
                 {
                     Clipboard.Clear();
                     Clipboard.SetText(obj.ViewModelText);
                 }
                 catch //(Exception ex)
                 {
                     // Had to do this to avoid useless exception message when running this code in a
                     // VPC, since Vista & VPC and the Clipboard don't play nice together sometimes.
                     // the operation works, you just get an exception for no reason.
                 }
                 UIUtilities.ShowInformationMessage("Ready to Paste",
                                                    "Position cursor inside a ViewModel file and execute a paste operation.");
             }
         }
     }
     catch (FileNotFoundException ex)
     {
         UIUtilities.ShowInformationMessage("File Not Found",
                                            "Unable to find an assemble for the file specified. Have you compiled the project?");
         logger.Info("File not found error in Execute().");
     }
     catch (Exception ex)
     {
         UIUtilities.ShowExceptionMessage(this.Caption, ex.Message);
         logger.Error("An exception was raised in Execute().", ex);
     }
 }
Beispiel #2
0
        /// <summary>
        ///     Executes this CreateFormListViewDataGridFromSelectedClassCommand.
        /// </summary>
        public override void Execute()
        {
            logger.Trace("Entered Execute()");
            try
            {
                var remoteTypeReflector = new RemoteTypeReflector();
                var classEntity         = remoteTypeReflector.
                                          GetClassEntityFromSelectedClass(Application.
                                                                          SelectedItems.
                                                                          Item(1).ProjectItem.
                                                                          ContainingProject,
                                                                          Caption);

                if (classEntity == null)
                {
                    return;
                }

                var obj    = new CreateBusinessFormFromClassWindow(classEntity);
                var result = obj.ShowDialog();

                if (result ?? false)
                {
                    try
                    {
                        System.Windows.Clipboard.Clear();
                        System.Windows.Clipboard.SetText(obj.BusinessForm);
                    }
                    catch //(Exception ex)
                    {
                        // Had to do this to avoid useless exception message
                        // when running this code in a VPC, since Vista &
                        // VPC and the Clipboard don't play nice together
                        // sometimes.
                        // the operation works, you just get an exception
                        // for no reason.
                    }
                }
            }
            catch (Exception ex)
            {
                UIUtilities.ShowExceptionMessage(this.Caption, ex.Message);
                logger.Error("An exception was raised in Execute().", ex);
            }
        }
Beispiel #3
0
        /// <summary>
        ///     Executes this FieldsListFromSelectedClassCommand.
        /// </summary>
        /// <seealso cref="M:XamlHelpmeet.Commands.CommandBase.Execute()"/>
        public override void Execute()
        {
            try
            {
                var remoteTypeReflector = new RemoteTypeReflector();
                var classEntity         = remoteTypeReflector.GetClassEntityFromSelectedClass(Application.SelectedItems.Item(1).ProjectItem.ContainingProject, Caption);

                if (classEntity != null && classEntity.Success)
                {
                    var obj = new FieldsListWindow(classEntity);
                    obj.Topmost = true;
                    obj.Show();
                }
            }
            catch (Exception ex)
            {
                UIUtilities.ShowExceptionMessage(Caption, ex.Message, String.Empty, ex.ToString());
            }
        }
Beispiel #4
0
        /// <summary>
        ///     Executes this FieldsListFromSelectedClassCommand.
        /// </summary>
        /// <seealso cref="M:XamlHelpmeet.Commands.CommandBase.Execute()"/>
        public override void Execute()
        {
            logger.Trace("Entered Execute()");
            try
            {
                var remoteTypeReflector = new RemoteTypeReflector();
                var classEntity         = remoteTypeReflector.GetClassEntityFromSelectedClass(
                    Application.SelectedItems.Item(1).ProjectItem.ContainingProject, Caption);

                if (classEntity != null && classEntity.Success)
                {
                    var obj = new FieldsListWindow(classEntity);
                    obj.Topmost = true;
                    obj.Show();
                }
            }
            catch (Exception ex)
            {
                UIUtilities.ShowExceptionMessage(this.Caption, ex.Message);
                logger.Error("An exception was raised in Execute().", ex);
            }
        }