From b7c65d64e98092049fddc1b482bfc7aa97759d60 Mon Sep 17 00:00:00 2001 From: Sergey Chebotar Date: Fri, 10 Dec 2021 13:56:28 +0300 Subject: [PATCH] Refactoring --- Source/AddIn/AddIn.cs | 8 ++++---- Source/Assistant/HttpClientUtil.cs | 2 +- Source/DataExport/Exporter.cs | 4 ++-- Source/Ribbon/RibbonController.cs | 5 ++++- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Source/AddIn/AddIn.cs b/Source/AddIn/AddIn.cs index 5255e2e..e29c070 100644 --- a/Source/AddIn/AddIn.cs +++ b/Source/AddIn/AddIn.cs @@ -17,8 +17,8 @@ namespace RehauSku public class AddIn : IExcelAddIn { public static readonly HttpClient httpClient = new HttpClient(); - public static ResponseOrder responseOrder; - public static string priceListPath; + public static ResponseOrder StoreResponse { get; set; } + public static string PriceListPath { get; set; } public void AutoOpen() { @@ -46,8 +46,8 @@ namespace RehauSku .OpenSubKey("REHAU") .OpenSubKey("SkuAssist"); - responseOrder = (ResponseOrder)addInKeys.GetValue("ResponseOrder"); - priceListPath = (string)addInKeys.GetValue("PriceListPath"); + StoreResponse = (ResponseOrder)addInKeys.GetValue("ResponseOrder"); + PriceListPath = (string)addInKeys.GetValue("PriceListPath"); } } } diff --git a/Source/Assistant/HttpClientUtil.cs b/Source/Assistant/HttpClientUtil.cs index 95a90e9..131bd7f 100644 --- a/Source/Assistant/HttpClientUtil.cs +++ b/Source/Assistant/HttpClientUtil.cs @@ -36,7 +36,7 @@ namespace RehauSku.Assistant baseUri.Path = "/catalogsearch/result/index/"; string cleanedRequest = request.CleanRequest(); - switch (AddIn.responseOrder) + switch (AddIn.StoreResponse) { case ResponseOrder.Relevance: baseUri.Query = "dir=asc&order=relevance&q=" + cleanedRequest; diff --git a/Source/DataExport/Exporter.cs b/Source/DataExport/Exporter.cs index 5a691b7..cc7621e 100644 --- a/Source/DataExport/Exporter.cs +++ b/Source/DataExport/Exporter.cs @@ -76,7 +76,7 @@ namespace RehauSku.DataExport public void FillPriceList() { string exportFile = _GetExportFullPath(); - File.Copy(AddIn.priceListPath, exportFile, true); + File.Copy(AddIn.PriceListPath, exportFile, true); Workbook wb = xlApp.Workbooks.Open(exportFile); Worksheet ws = wb.ActiveSheet; @@ -94,7 +94,7 @@ namespace RehauSku.DataExport private string _GetExportFullPath() { - string fileExtension = Path.GetExtension(AddIn.priceListPath); + string fileExtension = Path.GetExtension(AddIn.PriceListPath); return Path.GetTempFileName() + fileExtension; } diff --git a/Source/Ribbon/RibbonController.cs b/Source/Ribbon/RibbonController.cs index 94d3b0d..39cf71a 100644 --- a/Source/Ribbon/RibbonController.cs +++ b/Source/Ribbon/RibbonController.cs @@ -34,7 +34,10 @@ namespace RehauSku.Ribbon { if (!dw.IsRangeValid()) { - MessageBox.Show("Выделен неверный диапазон!", "Неверный диапазон", MessageBoxButtons.OK, MessageBoxIcon.Information); + MessageBox.Show("Выделен неверный диапазон!", + "Неверный диапазон", + MessageBoxButtons.OK, + MessageBoxIcon.Information); return; }