Update the Progress Bar as the RO values are refreshed in Word
This commit is contained in:
parent
4abaceac23
commit
f2c8ac8740
@ -572,6 +572,7 @@ namespace VEPROMS
|
|||||||
//displayRO.EnabledChanged += new EventHandler(displayRO_EnabledChanged);
|
//displayRO.EnabledChanged += new EventHandler(displayRO_EnabledChanged);
|
||||||
tc.Enter += new EventHandler(tc_Enter);
|
tc.Enter += new EventHandler(tc_Enter);
|
||||||
tc.Leave += new EventHandler(tc_Leave);
|
tc.Leave += new EventHandler(tc_Leave);
|
||||||
|
tc.StatusChanged += new DisplayTabControlStatusEvent(tc_StatusChanged);
|
||||||
tc.ToggleRibbonExpanded += new DisplayTabControlEvent(tc_ToggleRibbonExpanded);
|
tc.ToggleRibbonExpanded += new DisplayTabControlEvent(tc_ToggleRibbonExpanded);
|
||||||
this.Deactivate += new EventHandler(frmVEPROMS_Deactivate);
|
this.Deactivate += new EventHandler(frmVEPROMS_Deactivate);
|
||||||
if (VlnSettings.DemoMode) StepRTB.MyFontFamily = GetFamily("Bookman Old Style");
|
if (VlnSettings.DemoMode) StepRTB.MyFontFamily = GetFamily("Bookman Old Style");
|
||||||
@ -594,6 +595,27 @@ namespace VEPROMS
|
|||||||
StepTabRibbon.PasteNoReturnsSetting = Properties.Settings.Default.PasteNoReturns;
|
StepTabRibbon.PasteNoReturnsSetting = Properties.Settings.Default.PasteNoReturns;
|
||||||
StepTabRibbon.PastePlainTextSetting = Properties.Settings.Default.PastePlainText;
|
StepTabRibbon.PastePlainTextSetting = Properties.Settings.Default.PastePlainText;
|
||||||
}
|
}
|
||||||
|
void tc_StatusChanged(object sender, DisplayTabControlStatusEventArgs args)
|
||||||
|
{
|
||||||
|
switch (args.Type)
|
||||||
|
{
|
||||||
|
case VolianStatusType.Initialize:
|
||||||
|
ProgBarMax = args.Count;
|
||||||
|
ProgBarText = args.Text;
|
||||||
|
ProgBarValue = 0;
|
||||||
|
break;
|
||||||
|
case VolianStatusType.Update:
|
||||||
|
ProgBarText = args.Text;
|
||||||
|
ProgBarValue = args.Count;
|
||||||
|
break;
|
||||||
|
case VolianStatusType.Complete:
|
||||||
|
ProgBarText = args.Text;
|
||||||
|
ProgBarValue = 0;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
void tmrShutDown_Tick(object sender, EventArgs e)
|
void tmrShutDown_Tick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
(sender as Timer).Enabled = false;
|
(sender as Timer).Enabled = false;
|
||||||
|
@ -17,6 +17,13 @@ using System.Diagnostics;
|
|||||||
|
|
||||||
namespace VEPROMS.CSLA.Library
|
namespace VEPROMS.CSLA.Library
|
||||||
{
|
{
|
||||||
|
public enum VolianStatusType
|
||||||
|
{
|
||||||
|
Initialize,
|
||||||
|
Update,
|
||||||
|
Complete
|
||||||
|
}
|
||||||
|
public delegate void VolianStatusChange(VolianStatusType type, int count, string text);
|
||||||
public partial class Document
|
public partial class Document
|
||||||
{
|
{
|
||||||
public string DocumentTitle
|
public string DocumentTitle
|
||||||
@ -363,7 +370,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
_MyFile = new FileInfo(value);
|
_MyFile = new FileInfo(value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void SaveFile(float length, string ascii, ItemInfo myItemInfo, bool cvtLibDoc)
|
public void SaveFile(float length, string ascii, ItemInfo myItemInfo, bool cvtLibDoc, VolianStatusChange statusChange)
|
||||||
{
|
{
|
||||||
// TODO: Add Try & Catch logic
|
// TODO: Add Try & Catch logic
|
||||||
if (_MyDocument == null) return;
|
if (_MyDocument == null) return;
|
||||||
@ -405,7 +412,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
doc.DTS = _MyFile.LastWriteTimeUtc;
|
doc.DTS = _MyFile.LastWriteTimeUtc;
|
||||||
doc = doc.Save();
|
doc = doc.Save();
|
||||||
List<string> roids = new List<string>();
|
List<string> roids = new List<string>();
|
||||||
string pdfTmp = MSWordToPDF.ToPDFReplaceROs(_MyDocument, roids, myItemInfo);
|
string pdfTmp = MSWordToPDF.ToPDFReplaceROs(_MyDocument, roids, myItemInfo,statusChange);
|
||||||
FileInfo pdfFile = new FileInfo(pdfTmp);
|
FileInfo pdfFile = new FileInfo(pdfTmp);
|
||||||
fs = pdfFile.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
fs = pdfFile.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
|
||||||
buf = new byte[pdfFile.Length];
|
buf = new byte[pdfFile.Length];
|
||||||
@ -516,7 +523,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
List<string> roids = new List<string>();
|
List<string> roids = new List<string>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
pdfTmp = MSWordToPDF.ToPDFReplaceROs(docInfo,roids,sect);
|
pdfTmp = MSWordToPDF.ToPDFReplaceROs(docInfo,roids,sect,null);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@ -548,13 +555,13 @@ namespace VEPROMS.CSLA.Library
|
|||||||
docInfo.RefreshConfig();
|
docInfo.RefreshConfig();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
public static string ToPDFReplaceROs(DocumentInfo doc,List<string> roids, ItemInfo sect)
|
public static string ToPDFReplaceROs(DocumentInfo doc, List<string> roids, ItemInfo sect, VolianStatusChange statusChange)
|
||||||
{
|
{
|
||||||
//ItemInfo sect = doc.DocumentEntries[0].MyContent.ContentItems[0];
|
//ItemInfo sect = doc.DocumentEntries[0].MyContent.ContentItems[0];
|
||||||
return ToPDFReplaceROs(sect, false, roids);
|
return ToPDFReplaceROs(sect, false, roids, statusChange);
|
||||||
}
|
}
|
||||||
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
|
||||||
public static string ToPDFReplaceROs(ItemInfo sect, bool openPdf, List<string> roids) //, System.Drawing.Color overrideColor, System.Windows.Forms.Form myForm)
|
public static string ToPDFReplaceROs(ItemInfo sect, bool openPdf, List<string> roids, VolianStatusChange statusChange) //, System.Drawing.Color overrideColor, System.Windows.Forms.Form myForm)
|
||||||
{
|
{
|
||||||
string fileName = GetFileName(sect);
|
string fileName = GetFileName(sect);
|
||||||
// TODO: do we want to cache the word pdfs
|
// TODO: do we want to cache the word pdfs
|
||||||
@ -653,9 +660,14 @@ namespace VEPROMS.CSLA.Library
|
|||||||
selxy.WholeStory();
|
selxy.WholeStory();
|
||||||
selxy = FindXyPlot();
|
selxy = FindXyPlot();
|
||||||
}
|
}
|
||||||
LBSelection sel = hasRos ? FindRO() : null;
|
LBSelection sel = MyApp.Selection;
|
||||||
|
sel.WholeStory();
|
||||||
|
if(statusChange != null) statusChange(VolianStatusType.Initialize, sel.End, "Refreshing ROs");
|
||||||
|
sel = hasRos ? FindRO() : null;
|
||||||
|
int roCount = 0;
|
||||||
while (sel != null)
|
while (sel != null)
|
||||||
{
|
{
|
||||||
|
if (statusChange != null) statusChange(VolianStatusType.Update, sel.Start, string.Format("{0} ROs Refreshed", ++roCount));
|
||||||
string val = lookup.GetROValueByAccPagID(sel.Text, spPrefix, igPrefix);
|
string val = lookup.GetROValueByAccPagID(sel.Text, spPrefix, igPrefix);
|
||||||
int? type = lookup.GetROTypeByAccPagID(sel.Text, spPrefix, igPrefix);
|
int? type = lookup.GetROTypeByAccPagID(sel.Text, spPrefix, igPrefix);
|
||||||
// if type is null, then set type to zero so that InsertROValue will put in "RO Not Found" for the value
|
// if type is null, then set type to zero so that InsertROValue will put in "RO Not Found" for the value
|
||||||
@ -753,6 +765,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
sel = FindRO();
|
sel = FindRO();
|
||||||
}
|
}
|
||||||
|
if (statusChange != null) statusChange(VolianStatusType.Update, 0, "Creating PDF");
|
||||||
sel = MyApp.Selection;
|
sel = MyApp.Selection;
|
||||||
sel.WholeStory();
|
sel.WholeStory();
|
||||||
//sel.Range.Font.Color = (LBWdColor)WordColor(PrintOverride.OverrideTextColor(System.Drawing.Color.Black));
|
//sel.Range.Font.Color = (LBWdColor)WordColor(PrintOverride.OverrideTextColor(System.Drawing.Color.Black));
|
||||||
@ -764,6 +777,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
CloseAppAfterWait();
|
CloseAppAfterWait();
|
||||||
}
|
}
|
||||||
|
if (statusChange != null) statusChange(VolianStatusType.Complete, 0, "");
|
||||||
return fileName;
|
return fileName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -347,7 +347,7 @@ namespace Volian.Controls.Library
|
|||||||
DialogResult ans = MessageBox.Show("Save as Library Document for all usages?", "Document Save", MessageBoxButtons.YesNo);
|
DialogResult ans = MessageBox.Show("Save as Library Document for all usages?", "Document Save", MessageBoxButtons.YesNo);
|
||||||
if (ans == DialogResult.No) cvtLibDoc = true;
|
if (ans == DialogResult.No) cvtLibDoc = true;
|
||||||
}
|
}
|
||||||
MyDSOFile.SaveFile(doc.Length,doc.Ascii,MyDisplayTabItem.MyItemInfo, cvtLibDoc);
|
MyDSOFile.SaveFile(doc.Length, doc.Ascii, MyDisplayTabItem.MyItemInfo, cvtLibDoc, StatusChanged);
|
||||||
if (cvtLibDoc)
|
if (cvtLibDoc)
|
||||||
{
|
{
|
||||||
MyDisplayTabItem.Text = MyDisplayTabItem.MyItemInfo.TabTitle;
|
MyDisplayTabItem.Text = MyDisplayTabItem.MyItemInfo.TabTitle;
|
||||||
@ -355,6 +355,11 @@ namespace Volian.Controls.Library
|
|||||||
MyDisplayTabItem.SetPrivateTooltip(MyDisplayTabItem.MyItemInfo.TabToolTip);
|
MyDisplayTabItem.SetPrivateTooltip(MyDisplayTabItem.MyItemInfo.TabToolTip);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void StatusChanged(VolianStatusType type, int count, string text)
|
||||||
|
{
|
||||||
|
DisplayTabControl tc = Parent.Parent.Parent as DisplayTabControl;
|
||||||
|
tc.ONStatusChanged(this, new DisplayTabControlStatusEventArgs(type, count, text));
|
||||||
|
}
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Before a document closes check to see if it's contents should be saved.
|
/// Before a document closes check to see if it's contents should be saved.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -12,8 +12,47 @@ using DevComponents.DotNetBar;
|
|||||||
namespace Volian.Controls.Library
|
namespace Volian.Controls.Library
|
||||||
{
|
{
|
||||||
public delegate void DisplayTabControlEvent(object sender,EventArgs args);
|
public delegate void DisplayTabControlEvent(object sender,EventArgs args);
|
||||||
|
public delegate void DisplayTabControlStatusEvent(object sender, DisplayTabControlStatusEventArgs args);
|
||||||
|
public partial class DisplayTabControlStatusEventArgs : EventArgs
|
||||||
|
{
|
||||||
|
private VolianStatusType _Type;
|
||||||
|
public VolianStatusType Type
|
||||||
|
{
|
||||||
|
get { return _Type; }
|
||||||
|
set { _Type = value; }
|
||||||
|
}
|
||||||
|
private int _Count;
|
||||||
|
public int Count
|
||||||
|
{
|
||||||
|
get { return _Count; }
|
||||||
|
set { _Count = value; }
|
||||||
|
}
|
||||||
|
private string _Text;
|
||||||
|
public string Text
|
||||||
|
{
|
||||||
|
get { return _Text; }
|
||||||
|
set { _Text = value; }
|
||||||
|
}
|
||||||
|
public DisplayTabControlStatusEventArgs()
|
||||||
|
{
|
||||||
|
_Type = VolianStatusType.Initialize;
|
||||||
|
_Count = 0;
|
||||||
|
_Text = "Default";
|
||||||
|
}
|
||||||
|
public DisplayTabControlStatusEventArgs(VolianStatusType type, int count, string text)
|
||||||
|
{
|
||||||
|
_Type = type;
|
||||||
|
_Count = count;
|
||||||
|
_Text = text;
|
||||||
|
}
|
||||||
|
}
|
||||||
public partial class DisplayTabControl : UserControl
|
public partial class DisplayTabControl : UserControl
|
||||||
{
|
{
|
||||||
|
public event DisplayTabControlStatusEvent StatusChanged;
|
||||||
|
public void ONStatusChanged(object Sender, DisplayTabControlStatusEventArgs args)
|
||||||
|
{
|
||||||
|
if (StatusChanged != null) StatusChanged(Sender, args);
|
||||||
|
}
|
||||||
public event DisplayTabControlEvent ToggleRibbonExpanded;
|
public event DisplayTabControlEvent ToggleRibbonExpanded;
|
||||||
public void OnToggleRibbonExpanded(object sender, EventArgs args)
|
public void OnToggleRibbonExpanded(object sender, EventArgs args)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user