Revert "Turn off save as file dialog at the end of tool process. Version update."

This reverts commit eaf3ebaa94.
This commit is contained in:
Sergey Chebotar 2022-03-30 12:26:18 +03:00
parent 443364e66c
commit 1e91c34e46
6 changed files with 29 additions and 17 deletions

View File

@ -36,5 +36,22 @@ namespace RehauSku.Interface
else return null; else return null;
} }
} }
public static void SaveWorkbookAs()
{
Workbook workbook = AddIn.Excel.ActiveWorkbook;
using (SaveFileDialog dialog = new SaveFileDialog())
{
dialog.FileName = workbook.Name;
dialog.Filter = "Файлы Excel (*.xls;*.xlsx;*.xlsm)|*.xls;*.xlsx;*.xlsm";
if (dialog.ShowDialog() == DialogResult.OK)
{
string fileName = dialog.FileName;
workbook.SaveAs(fileName);
}
}
}
} }
} }

View File

@ -3,7 +3,6 @@ using RehauSku.Interface;
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks;
using Dialog = RehauSku.Interface.Dialog; using Dialog = RehauSku.Interface.Dialog;
namespace RehauSku.PriceListTools namespace RehauSku.PriceListTools
@ -27,7 +26,7 @@ namespace RehauSku.PriceListTools
} }
} }
public override async void FillTarget() public override void FillTarget()
{ {
ProgressBar = new ProgressBar("Заполняю строки...", SourceFiles.Sum(file => file.PositionAmount.Count)); ProgressBar = new ProgressBar("Заполняю строки...", SourceFiles.Sum(file => file.PositionAmount.Count));
ResultBar = new ResultBar(); ResultBar = new ResultBar();
@ -52,7 +51,7 @@ namespace RehauSku.PriceListTools
FilterByAmount(); FilterByAmount();
ResultBar.Update(); ResultBar.Update();
await Task.Delay(new TimeSpan(0, 0, 5)); Interface.Dialog.SaveWorkbookAs();
ExcelApp.StatusBar = false; ExcelApp.StatusBar = false;
} }
} }

View File

@ -1,6 +1,4 @@
using RehauSku.Interface; using RehauSku.Interface;
using System;
using System.Threading.Tasks;
namespace RehauSku.PriceListTools namespace RehauSku.PriceListTools
{ {
@ -13,7 +11,7 @@ namespace RehauSku.PriceListTools
Current = new SourcePriceList(ExcelApp.ActiveWorkbook); Current = new SourcePriceList(ExcelApp.ActiveWorkbook);
} }
public override async void FillTarget() public override void FillTarget()
{ {
ProgressBar = new ProgressBar("Заполняю строки...", Current.PositionAmount.Count); ProgressBar = new ProgressBar("Заполняю строки...", Current.PositionAmount.Count);
ResultBar = new ResultBar(); ResultBar = new ResultBar();
@ -27,7 +25,7 @@ namespace RehauSku.PriceListTools
FilterByAmount(); FilterByAmount();
ResultBar.Update(); ResultBar.Update();
await Task.Delay(new TimeSpan(0, 0, 5)); Dialog.SaveWorkbookAs();
ExcelApp.StatusBar = false; ExcelApp.StatusBar = false;
} }
} }

View File

@ -2,7 +2,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using RehauSku.Interface; using RehauSku.Interface;
using System.Threading.Tasks;
namespace RehauSku.PriceListTools namespace RehauSku.PriceListTools
{ {
@ -22,11 +21,11 @@ namespace RehauSku.PriceListTools
} }
} }
public override async void FillTarget() public override void FillTarget()
{ {
ProgressBar = new ProgressBar("Заполняю строки...", PositionAmount.Count); ProgressBar = new ProgressBar("Заполняю строки...", PositionAmount.Count);
ResultBar = new ResultBar(); ResultBar = new ResultBar();
foreach (var kvp in PositionAmount) foreach (var kvp in PositionAmount)
{ {
FillPositionAmountToColumns(kvp, TargetFile.AmountCell.Column); FillPositionAmountToColumns(kvp, TargetFile.AmountCell.Column);
@ -36,13 +35,13 @@ namespace RehauSku.PriceListTools
FilterByAmount(); FilterByAmount();
ResultBar.Update(); ResultBar.Update();
await Task.Delay(new TimeSpan(0, 0, 5)); Interface.Dialog.SaveWorkbookAs();
ExcelApp.StatusBar = false; ExcelApp.StatusBar = false;
} }
private void GetSelected() private void GetSelected()
{ {
object[,] cells = Selection.Value2; object[,] cells = Selection.Value2;
PositionAmount = new Dictionary<Position, double>(); PositionAmount = new Dictionary<Position, double>();
int rowsCount = Selection.Rows.Count; int rowsCount = Selection.Rows.Count;

View File

@ -2,7 +2,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks;
namespace RehauSku.PriceListTools namespace RehauSku.PriceListTools
{ {
@ -25,7 +24,7 @@ namespace RehauSku.PriceListTools
} }
} }
public override async void FillTarget() public override void FillTarget()
{ {
ProgressBar = new ProgressBar("Заполняю строки...", SourceFiles.Sum(x => x.PositionAmount.Count)); ProgressBar = new ProgressBar("Заполняю строки...", SourceFiles.Sum(x => x.PositionAmount.Count));
ResultBar = new ResultBar(); ResultBar = new ResultBar();
@ -42,7 +41,7 @@ namespace RehauSku.PriceListTools
FilterByAmount(); FilterByAmount();
ResultBar.Update(); ResultBar.Update();
await Task.Delay(new TimeSpan(0, 0, 5)); Dialog.SaveWorkbookAs();
ExcelApp.StatusBar = false; ExcelApp.StatusBar = false;
} }
} }

View File

@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
// You can specify all the values or you can default the Build and Revision Numbers // You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below: // by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")] // [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.4.2")] [assembly: AssemblyVersion("1.0.4.1")]
[assembly: AssemblyFileVersion("1.0.4.2")] [assembly: AssemblyFileVersion("1.0.4.1")]