This commit is contained in:
2020-04-30 14:19:18 +00:00
parent 91bbd64149
commit 10662ab5e2
3 changed files with 82 additions and 22 deletions

View File

@@ -33,6 +33,7 @@
this.lblCurrent = new System.Windows.Forms.Label(); this.lblCurrent = new System.Windows.Forms.Label();
this.edCurrent = new System.Windows.Forms.TextBox(); this.edCurrent = new System.Windows.Forms.TextBox();
this.edSubOp = new System.Windows.Forms.TextBox(); this.edSubOp = new System.Windows.Forms.TextBox();
this.btnCancel = new System.Windows.Forms.Button();
this.SuspendLayout(); this.SuspendLayout();
// //
// edOut // edOut
@@ -93,6 +94,22 @@
this.edSubOp.Size = new System.Drawing.Size(870, 22); this.edSubOp.Size = new System.Drawing.Size(870, 22);
this.edSubOp.TabIndex = 4; this.edSubOp.TabIndex = 4;
// //
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Enabled = false;
this.btnCancel.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.btnCancel.Location = new System.Drawing.Point(16, 603);
this.btnCancel.Margin = new System.Windows.Forms.Padding(2);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(82, 32);
this.btnCancel.TabIndex = 5;
this.btnCancel.Text = "Stop";
this.btnCancel.UseVisualStyleBackColor = true;
this.btnCancel.Visible = false;
this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
//
// ProgressForm // ProgressForm
// //
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
@@ -100,6 +117,7 @@
this.CancelButton = this.btnClose; this.CancelButton = this.btnClose;
this.ClientSize = new System.Drawing.Size(870, 646); this.ClientSize = new System.Drawing.Size(870, 646);
this.ControlBox = false; this.ControlBox = false;
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.edSubOp); this.Controls.Add(this.edSubOp);
this.Controls.Add(this.edCurrent); this.Controls.Add(this.edCurrent);
this.Controls.Add(this.lblCurrent); this.Controls.Add(this.lblCurrent);
@@ -122,5 +140,6 @@
private System.Windows.Forms.Label lblCurrent; private System.Windows.Forms.Label lblCurrent;
private System.Windows.Forms.TextBox edCurrent; private System.Windows.Forms.TextBox edCurrent;
private System.Windows.Forms.TextBox edSubOp; private System.Windows.Forms.TextBox edSubOp;
private System.Windows.Forms.Button btnCancel;
} }
} }

View File

@@ -11,22 +11,29 @@ namespace AyaNova.PlugIn.V8
{ {
public partial class ProgressForm : Form public partial class ProgressForm : Form
{ {
public bool KeepGoing { get; set; }
public ProgressForm() public ProgressForm()
{ {
InitializeComponent(); InitializeComponent();
KeepGoing = true;
} }
public void StartedImport() public void StartedImport()
{ {
Cursor.Current = Cursors.WaitCursor; //Cursor.Current = Cursors.WaitCursor;
btnClose.Enabled = false; btnClose.Enabled = false;
btnCancel.Enabled = true;
btnCancel.Visible = true;
} }
public void FinishedImport() public void FinishedImport()
{ {
Cursor.Current = Cursors.Default; //Cursor.Current = Cursors.Default;
btnClose.Enabled = true; btnClose.Enabled = true;
btnCancel.Enabled = false;
btnCancel.Visible = false;
} }
public void Append(string txt) public void Append(string txt)
@@ -58,5 +65,13 @@ namespace AyaNova.PlugIn.V8
{ {
this.Close(); this.Close();
} }
private void btnCancel_Click(object sender, EventArgs e)
{
KeepGoing = false;
}
//eoc
} }
} }

View File

@@ -213,22 +213,35 @@ namespace AyaNova.PlugIn.V8
//TAGS //TAGS
progress.Op("Compiling tags"); progress.Op("Compiling tags");
ExportUnitModelCategories(progress); if (progress.KeepGoing)
ExportUnitServiceTypes(progress); ExportUnitModelCategories(progress);
ExportWorkorderItemTypes(progress); if (progress.KeepGoing)
ExportRegions(progress); ExportUnitServiceTypes(progress);
ExportClientGroups(progress); if (progress.KeepGoing)
ExportWorkorderCategories(progress); ExportWorkorderItemTypes(progress);
ExportPartCategories(progress); if (progress.KeepGoing)
ExportScheduleableUserGroups(progress); ExportRegions(progress);
ExportDispatchZones(progress); if (progress.KeepGoing)
ExportUserSkills(progress); ExportClientGroups(progress);
ExportUserCertifications(progress); if (progress.KeepGoing)
ExportWorkorderCategories(progress);
if (progress.KeepGoing)
ExportPartCategories(progress);
if (progress.KeepGoing)
ExportScheduleableUserGroups(progress);
if (progress.KeepGoing)
ExportDispatchZones(progress);
if (progress.KeepGoing)
ExportUserSkills(progress);
if (progress.KeepGoing)
ExportUserCertifications(progress);
progress.Op("Exporting objects"); progress.Op("Exporting objects");
//BIZ objects //BIZ objects
await ExportUsers(progress); if (progress.KeepGoing)
await ExportLocales(progress); await ExportUsers(progress);
if (progress.KeepGoing)
await ExportLocales(progress);
@@ -244,10 +257,19 @@ namespace AyaNova.PlugIn.V8
//NOTE: when get to PRIORITY, or WORKORDER STATUS be sure to add color code as per already done in USER export //NOTE: when get to PRIORITY, or WORKORDER STATUS be sure to add color code as per already done in USER export
if (progress.KeepGoing)
{
progress.Append("Export completed");
progress.Op("");
progress.Append("Export completed"); goto End;
}
progress.Append("Export cancelled before completing");
progress.Op(""); progress.Op("");
End:
;
} }
catch (Exception ex) catch (Exception ex)
{ {
@@ -327,6 +349,7 @@ namespace AyaNova.PlugIn.V8
foreach (UserPickList.UserPickListInfo i in pl) foreach (UserPickList.UserPickListInfo i in pl)
{ {
if (!progress.KeepGoing) return;
List<string> tags = new List<string>(); List<string> tags = new List<string>();
tags.Add(ImportTag); tags.Add(ImportTag);
@@ -417,6 +440,7 @@ namespace AyaNova.PlugIn.V8
//Because this is the User's we need to do the event log *after* they have all been posted as event log requires all user's id //Because this is the User's we need to do the event log *after* they have all been posted as event log requires all user's id
foreach (UserPickList.UserPickListInfo i in pl) foreach (UserPickList.UserPickListInfo i in pl)
{ {
if (!progress.KeepGoing) return;
User c = User.GetItem(i.ID); User c = User.GetItem(i.ID);
var newId = Map[c.ID]; var newId = Map[c.ID];
var creator = Map[c.Creator]; var creator = Map[c.Creator];
@@ -434,17 +458,18 @@ namespace AyaNova.PlugIn.V8
{ {
//Skip stock locales already handled in Raven //Skip stock locales already handled in Raven
List<string> SkipLocales = new List<string>(); //List<string> SkipLocales = new List<string>();
SkipLocales.Add("Deutsch"); //SkipLocales.Add("Deutsch");
SkipLocales.Add("English"); //SkipLocales.Add("English");
SkipLocales.Add("Español"); //SkipLocales.Add("Español");
SkipLocales.Add("Français"); //SkipLocales.Add("Français");
LocaleList l = LocaleList.GetList(); LocaleList l = LocaleList.GetList();
progress.Append("Exporting " + l.Count.ToString() + " Locales"); progress.Append("Exporting " + l.Count.ToString() + " Locales");
foreach (LocaleList.LocaleListInfo i in l) foreach (LocaleList.LocaleListInfo i in l)
{ {
if (!SkipLocales.Contains(i.Locale)) if (!progress.KeepGoing) return;
if (i.Locale!="English")
{ {
LocalizedTextTable lt = LocalizedTextTable.Load(i.Locale); LocalizedTextTable lt = LocalizedTextTable.Load(i.Locale);
//todo: all locales except English default need to be dealt with //todo: all locales except English default need to be dealt with
@@ -714,6 +739,7 @@ namespace AyaNova.PlugIn.V8
//iterate the files //iterate the files
foreach (AyaFileList.AyaFileListInfo i in fl) foreach (AyaFileList.AyaFileListInfo i in fl)
{ {
if (!progress.KeepGoing) return;
var af = AyaFile.GetItem(i.LT_O_AyaFile.Value); var af = AyaFile.GetItem(i.LT_O_AyaFile.Value);
if (af == null) continue; if (af == null) continue;