Exemplo n.º 1
0
 public static void StartLisp(string commandName, string file)
 {
     Logger.Log.StartLisp(commandName, file);
     PluginStatisticsHelper.PluginStart(new CommandStart(commandName, null)
     {
         Doc = file, Plugin = "Lisp"
     });
 }
Exemplo n.º 2
0
 private static void LogRestoreTabs(List <string> tabsRestore)
 {
     Task.Run(() =>
     {
         PluginStatisticsHelper.PluginStart("RestoreTabsOpen");
         Logger.Log.Info($"RestoreTabsOpen: {tabsRestore.JoinToString()}");
     });
 }
Exemplo n.º 3
0
        public static void Insert([CanBeNull] IVisualBlock block, bool explode = false)
        {
            if (block == null)
            {
                return;
            }
            var doc = Application.DocumentManager.MdiActiveDocument;
            var db  = doc.Database;

            GetInsertBtr(block.Name, block.File, db);
            BlockInsert.Insert(block.Name, _layer, explode);
            PluginStatisticsHelper.PluginStart(new CommandStart($"Вставка блока {block.Name}", Assembly.GetCallingAssembly()));
        }
Exemplo n.º 4
0
        private static void StartCommand(Action <Document> action, MethodBase caller, string commandName, bool woStatistic = false)
        {
            var doc = Application.DocumentManager.MdiActiveDocument;

            if (doc == null)
            {
                return;
            }
            CommandStart commandStart = null;

            try
            {
                commandStart = GetCallerCommand(caller, commandName);
                if (!woStatistic)
                {
                    Logger.Log.StartCommand(commandStart);
                    Logger.Log.Info($"Document={doc.Name}");
                    PluginStatisticsHelper.PluginStart(commandStart);
                }
            }
            catch (Exception ex)
            {
                Logger.Log.Error(ex, "CommandStart");
            }

            try
            {
                // Проверка блокировки команды
                if (commandStart != null && !CommandLockService.CanStartCommand(commandStart.CommandName))
                {
                    Logger.Log.Info($"Команда заблокирована - {commandStart.CommandName}");
                    return;
                }
            }
            catch (Exception ex)
            {
                Logger.Log.Error(ex, "Проверка блокировки команды");
            }

            try
            {
                Inspector.Clear();
                action(doc);
            }
            catch (OperationCanceledException ex)
            {
                if (!doc.IsDisposed)
                {
                    doc.Editor.WriteMessage(ex.Message);
                }
            }
            catch (Exceptions.ErrorException error)
            {
                Inspector.AddError(error.Error);
            }
            catch (Exception ex)
            {
                Logger.Log.Error(ex, CurrentCommand);
                Inspector.AddError($"Ошибка в программе. {ex.Message}", System.Drawing.SystemIcons.Error);

                if (!doc.IsDisposed)
                {
                    doc.Editor.WriteMessage(ex.Message);
                }
            }

            Inspector.Show();
        }