53 lines
1.1 KiB
C#
53 lines
1.1 KiB
C#
using System;
|
|
using System.Diagnostics;
|
|
|
|
namespace CPF.ReoGrid.Actions
|
|
{
|
|
public class SetSortedRangeDataAction : BaseWorksheetAction
|
|
{
|
|
public SetSortedRangeDataAction(RangePosition range, object[,] data)
|
|
{
|
|
this.range = range;
|
|
this.data = data;
|
|
this.isRegularExecution = true;
|
|
}
|
|
|
|
public override void Do()
|
|
{
|
|
this.backupData = base.Worksheet.GetRangeData(this.range);
|
|
Debug.Assert(this.backupData != null);
|
|
base.Worksheet.SetRangeData(this.range, this.data, true);
|
|
bool flag = this.isRegularExecution;
|
|
if (flag)
|
|
{
|
|
this.isRegularExecution = false;
|
|
}
|
|
else
|
|
{
|
|
base.Worksheet.SelectRange(this.range);
|
|
}
|
|
}
|
|
|
|
public override void Undo()
|
|
{
|
|
Debug.Assert(this.backupData != null);
|
|
base.Worksheet.SetRangeData(this.range, this.backupData);
|
|
this.isRegularExecution = false;
|
|
base.Worksheet.SelectRange(this.range);
|
|
}
|
|
|
|
public override string GetName()
|
|
{
|
|
return "Set Sorted Cells Data";
|
|
}
|
|
|
|
private readonly RangePosition range;
|
|
|
|
private readonly object[,] data;
|
|
|
|
private object[,] backupData;
|
|
|
|
private bool isRegularExecution;
|
|
}
|
|
}
|