commit
e7d590bd23
@ -1,11 +1,24 @@
|
||||
using Microsoft.Office.Interop.Excel;
|
||||
using ExcelDna.Integration;
|
||||
using Microsoft.Office.Interop.Excel;
|
||||
using System;
|
||||
|
||||
namespace RehauSku.Interface
|
||||
{
|
||||
internal abstract class AbstractBar
|
||||
internal abstract class AbstractBar : IDisposable
|
||||
{
|
||||
protected Application Excel = AddIn.Excel;
|
||||
|
||||
public abstract void Update();
|
||||
|
||||
[ExcelFunction]
|
||||
public static void ResetStatusBar()
|
||||
{
|
||||
AddIn.Excel.StatusBar = false;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
AddIn.Excel.OnTime(DateTime.Now + new TimeSpan(0, 0, 5), "ResetStatusBar");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -16,16 +16,7 @@
|
||||
public override void Update()
|
||||
{
|
||||
double percent = (++CurrentProgress / TaskWeight) * 100;
|
||||
|
||||
if (percent < 100)
|
||||
{
|
||||
Excel.StatusBar = $"{Message} Выполнено {percent:#.#} %";
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
Excel.StatusBar = false;
|
||||
}
|
||||
Excel.StatusBar = $"{Message} Выполнено {percent:#.#} %";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System.Text;
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace RehauSku.Interface
|
||||
{
|
||||
|
@ -93,6 +93,7 @@ namespace RehauSku.Interface
|
||||
"Ошибка",
|
||||
MessageBoxButtons.OK,
|
||||
MessageBoxIcon.Information);
|
||||
AddIn.Excel.StatusBar = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ using RehauSku.Interface;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Dialog = RehauSku.Interface.Dialog;
|
||||
|
||||
namespace RehauSku.PriceListTools
|
||||
@ -27,33 +26,31 @@ namespace RehauSku.PriceListTools
|
||||
}
|
||||
}
|
||||
|
||||
public override async void FillTarget()
|
||||
public override void FillTarget()
|
||||
{
|
||||
ProgressBar = new ProgressBar("Заполняю строки...", SourceFiles.Sum(file => file.PositionAmount.Count));
|
||||
ResultBar = new ResultBar();
|
||||
|
||||
foreach (SourcePriceList source in SourceFiles)
|
||||
using (ProgressBar = new ProgressBar("Заполняю строки...", SourceFiles.Sum(file => file.PositionAmount.Count)))
|
||||
using (ResultBar = new ResultBar())
|
||||
{
|
||||
TargetFile.Sheet.Columns[TargetFile.AmountCell.Column]
|
||||
.EntireColumn
|
||||
.Insert(XlInsertShiftDirection.xlShiftToRight, XlInsertFormatOrigin.xlFormatFromRightOrBelow);
|
||||
|
||||
Range newColumnHeader = TargetFile.Sheet.Cells[TargetFile.AmountCell.Row, TargetFile.AmountCell.Column - 1];
|
||||
newColumnHeader.Value2 = $"{source.Name}";
|
||||
newColumnHeader.WrapText = true;
|
||||
|
||||
foreach (var kvp in source.PositionAmount)
|
||||
foreach (SourcePriceList source in SourceFiles)
|
||||
{
|
||||
FillPositionAmountToColumns(kvp, TargetFile.AmountCell.Column - 1, TargetFile.AmountCell.Column);
|
||||
ProgressBar.Update();
|
||||
TargetFile.Sheet.Columns[TargetFile.AmountCell.Column]
|
||||
.EntireColumn
|
||||
.Insert(XlInsertShiftDirection.xlShiftToRight, XlInsertFormatOrigin.xlFormatFromRightOrBelow);
|
||||
|
||||
Range newColumnHeader = TargetFile.Sheet.Cells[TargetFile.AmountCell.Row, TargetFile.AmountCell.Column - 1];
|
||||
newColumnHeader.Value2 = $"{source.Name}";
|
||||
newColumnHeader.WrapText = true;
|
||||
|
||||
foreach (var kvp in source.PositionAmount)
|
||||
{
|
||||
FillPositionAmountToColumns(kvp, TargetFile.AmountCell.Column - 1, TargetFile.AmountCell.Column);
|
||||
ProgressBar.Update();
|
||||
}
|
||||
}
|
||||
|
||||
FilterByAmount();
|
||||
ResultBar.Update();
|
||||
}
|
||||
|
||||
FilterByAmount();
|
||||
ResultBar.Update();
|
||||
|
||||
await Task.Delay(new TimeSpan(0, 0, 5));
|
||||
ExcelApp.StatusBar = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,4 @@
|
||||
using RehauSku.Interface;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RehauSku.PriceListTools
|
||||
{
|
||||
@ -13,22 +11,20 @@ namespace RehauSku.PriceListTools
|
||||
Current = new SourcePriceList(ExcelApp.ActiveWorkbook);
|
||||
}
|
||||
|
||||
public override async void FillTarget()
|
||||
public override void FillTarget()
|
||||
{
|
||||
ProgressBar = new ProgressBar("Заполняю строки...", Current.PositionAmount.Count);
|
||||
ResultBar = new ResultBar();
|
||||
|
||||
foreach (var kvp in Current.PositionAmount)
|
||||
using (ProgressBar = new ProgressBar("Заполняю строки...", Current.PositionAmount.Count))
|
||||
using (ResultBar = new ResultBar())
|
||||
{
|
||||
FillPositionAmountToColumns(kvp, TargetFile.AmountCell.Column);
|
||||
ProgressBar.Update();
|
||||
foreach (var kvp in Current.PositionAmount)
|
||||
{
|
||||
FillPositionAmountToColumns(kvp, TargetFile.AmountCell.Column);
|
||||
ProgressBar.Update();
|
||||
}
|
||||
|
||||
FilterByAmount();
|
||||
ResultBar.Update();
|
||||
}
|
||||
|
||||
FilterByAmount();
|
||||
ResultBar.Update();
|
||||
|
||||
await Task.Delay(new TimeSpan(0, 0, 5));
|
||||
ExcelApp.StatusBar = false;
|
||||
}
|
||||
}
|
||||
}
|
@ -2,7 +2,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using RehauSku.Interface;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RehauSku.PriceListTools
|
||||
{
|
||||
@ -22,22 +21,20 @@ namespace RehauSku.PriceListTools
|
||||
}
|
||||
}
|
||||
|
||||
public override async void FillTarget()
|
||||
public override void FillTarget()
|
||||
{
|
||||
ProgressBar = new ProgressBar("Заполняю строки...", PositionAmount.Count);
|
||||
ResultBar = new ResultBar();
|
||||
|
||||
foreach (var kvp in PositionAmount)
|
||||
using (ProgressBar = new ProgressBar("Заполняю строки...", PositionAmount.Count))
|
||||
using (ResultBar = new ResultBar())
|
||||
{
|
||||
FillPositionAmountToColumns(kvp, TargetFile.AmountCell.Column);
|
||||
ProgressBar.Update();
|
||||
foreach (var kvp in PositionAmount)
|
||||
{
|
||||
FillPositionAmountToColumns(kvp, TargetFile.AmountCell.Column);
|
||||
ProgressBar.Update();
|
||||
}
|
||||
|
||||
FilterByAmount();
|
||||
ResultBar.Update();
|
||||
}
|
||||
|
||||
FilterByAmount();
|
||||
ResultBar.Update();
|
||||
|
||||
await Task.Delay(new TimeSpan(0, 0, 5));
|
||||
ExcelApp.StatusBar = false;
|
||||
}
|
||||
|
||||
private void GetSelected()
|
||||
|
@ -2,7 +2,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RehauSku.PriceListTools
|
||||
{
|
||||
@ -25,25 +24,23 @@ namespace RehauSku.PriceListTools
|
||||
}
|
||||
}
|
||||
|
||||
public override async void FillTarget()
|
||||
public override void FillTarget()
|
||||
{
|
||||
ProgressBar = new ProgressBar("Заполняю строки...", SourceFiles.Sum(x => x.PositionAmount.Count));
|
||||
ResultBar = new ResultBar();
|
||||
|
||||
foreach (SourcePriceList source in SourceFiles)
|
||||
using (ProgressBar = new ProgressBar("Заполняю строки...", SourceFiles.Sum(x => x.PositionAmount.Count)))
|
||||
using (ResultBar = new ResultBar())
|
||||
{
|
||||
foreach (var kvp in source.PositionAmount)
|
||||
foreach (SourcePriceList source in SourceFiles)
|
||||
{
|
||||
FillPositionAmountToColumns(kvp, TargetFile.AmountCell.Column);
|
||||
ProgressBar.Update();
|
||||
foreach (var kvp in source.PositionAmount)
|
||||
{
|
||||
FillPositionAmountToColumns(kvp, TargetFile.AmountCell.Column);
|
||||
ProgressBar.Update();
|
||||
}
|
||||
}
|
||||
|
||||
FilterByAmount();
|
||||
ResultBar.Update();
|
||||
}
|
||||
|
||||
FilterByAmount();
|
||||
ResultBar.Update();
|
||||
|
||||
await Task.Delay(new TimeSpan(0, 0, 5));
|
||||
ExcelApp.StatusBar = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -77,9 +77,9 @@ namespace RehauSku.PriceListTools
|
||||
|
||||
for (int row = AmountCell.Row + 1; row <= Sheet.Cells[Sheet.Rows.Count, AmountCell.Column].End[XlDirection.xlUp].Row; row++)
|
||||
{
|
||||
object amount = Sheet.Cells[row, AmountCell.Column].Value2;
|
||||
double? amount = Sheet.Cells[row, AmountCell.Column].Value2 as double?;
|
||||
|
||||
if (amount != null && (double)amount != 0)
|
||||
if (amount != null && amount.Value != 0)
|
||||
{
|
||||
object group = Sheet.Cells[row, GroupCell.Column].Value2;
|
||||
object name = Sheet.Cells[row, NameCell.Column].Value2;
|
||||
@ -95,12 +95,12 @@ namespace RehauSku.PriceListTools
|
||||
|
||||
if (PositionAmount.ContainsKey(p))
|
||||
{
|
||||
PositionAmount[p] += (double)amount;
|
||||
PositionAmount[p] += amount.Value;
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
PositionAmount.Add(p, (double)amount);
|
||||
PositionAmount.Add(p, amount.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.4.2")]
|
||||
[assembly: AssemblyFileVersion("1.0.4.2")]
|
||||
[assembly: AssemblyVersion("1.0.4.3")]
|
||||
[assembly: AssemblyFileVersion("1.0.4.3")]
|
||||
|
Loading…
Reference in New Issue
Block a user