コード例 #1
0
ファイル: Dispatcher.cs プロジェクト: treasureboy/XLToolbox
        static void ExportScreenshot()
        {
            ScreenshotExporterViewModel vm = new ScreenshotExporterViewModel();

            if (vm.ExportSelectionCommand.CanExecute(null))
            {
                vm.ChooseFileNameMessage.Sent += (sender, args) =>
                {
                    try
                    {
                        Logger.Info("Choose file name message was received");
                        ChooseFileSaveAction a = new ChooseFileSaveAction();
                        a.Invoke(args);
                    }
                    catch (Excel.CopyException)
                    {
                        NotificationAction a = new NotificationAction();
                        a.Caption = Strings.ScreenshotExport;
                        a.Message = Strings.GraphicHasNoCopyMethod;
                        a.Invoke();
                    }
                };
                vm.ExportSelectionCommand.Execute(null);
            }
            else
            {
                NotificationAction a = new NotificationAction();
                a.Caption = Strings.ScreenshotExport;
                a.Message = Strings.ScreenshotExportRequiresGraphic;
                a.Invoke();
            }
        }
コード例 #2
0
ファイル: Dispatcher.cs プロジェクト: treasureboy/XLToolbox
 static bool CheckSelectionIsRange()
 {
     Xl.Range range = Instance.Default.Application.Selection as Xl.Range;
     if (range == null)
     {
         NotificationAction a = new NotificationAction(
             Strings.RangeSelectionRequired, Strings.ActionRequiresSelectionOfCells, Strings.OK);
         a.Invoke();
         return(false);
     }
     else
     {
         return(true);
     }
 }
コード例 #3
0
ファイル: Dispatcher.cs プロジェクト: treasureboy/XLToolbox
        static void JumpToTarget()
        {
            Xl.Range r     = Instance.Default.Application.Selection as Xl.Range;
            string   value = (r == null) ? String.Empty : Convert.ToString(r.Formula);
            Jumper   j     = new Jumper(value);

            if (!j.Jump())
            {
                NotificationAction a = new NotificationAction(
                    Strings.JumpToTarget,
                    Strings.UnableToJump,
                    Strings.Close);
                a.Invoke();
            }
        }