瀏覽代碼

Adding setting to disable pull button

Kenric Nugteren 1 年之前
父節點
當前提交
be3bdbbb4f
共有 1 個文件被更改,包括 6 次插入3 次删除
  1. 6 3
      prs.desktop/Utils/PostUtils.cs

+ 6 - 3
prs.desktop/Utils/PostUtils.cs

@@ -295,6 +295,7 @@ public static class PostUtils
                         var successCount = 0;
                         var importCount = 0;
                         var updateCount = 0;
+                        var linkCount = 0;
                         foreach (var item in items)
                         {
                             if (item.Item.PostedStatus == PostedStatus.PostFailed)
@@ -309,8 +310,10 @@ public static class PostUtils
                                     case PullResultType.New:
                                         importCount++;
                                         break;
-                                    case PullResultType.Updated:
                                     case PullResultType.Linked:
+                                        linkCount++;
+                                        break;
+                                    case PullResultType.Updated:
                                     default:
                                         updateCount++;
                                         break;
@@ -329,7 +332,7 @@ public static class PostUtils
                             }
                             else
                             {
-                                MessageWindow.ShowMessage($"Import successful; {importCount} items imported.", "Import successful.");
+                                MessageWindow.ShowMessage($"Import successful; {importCount} items imported, {linkCount} items linked.", "Import successful.");
                             }
                         }
                         else
@@ -440,7 +443,7 @@ public static class PostUtils
                         configurePost);
                 }
             });
-            if(posterEngine.Get(out var posterEngineType, out var _) && posterEngineType.HasInterface(typeof(IPullerEngine<>)))
+            if(posterEngine.Get(out var posterEngineType, out var _) && posterEngineType.HasInterface(typeof(IPullerEngine<>)) && postSettings.ShowPullButton)
             {
                 host.CreatePanelAction(new PanelAction($"Import {inflector.Pluralize(typeof(T).Name)}", image ?? PRSDesktop.Resources.doc_xls, action =>
                 {