C2019-036 View Only mode work with Checked Out Procedures
This commit is contained in:
@@ -98,6 +98,8 @@ namespace VEPROMS
|
||||
_SelectedStepTabPanel.MyStepTabRibbon.ContActionSummaryRequest += MyStepTabRibbon_ContActionSummaryRequest;
|
||||
_SelectedStepTabPanel.MyStepTabRibbon.AddProcToDVInTree -= new StepTabRibbonEvent(MyStepTabRibbon_AddProcToDocVersionInTree);
|
||||
_SelectedStepTabPanel.MyStepTabRibbon.AddProcToDVInTree += new StepTabRibbonEvent(MyStepTabRibbon_AddProcToDocVersionInTree);
|
||||
_SelectedStepTabPanel.MyStepTabRibbon.EnableDisableStepProperties -= EnableDisableStepProperties;
|
||||
_SelectedStepTabPanel.MyStepTabRibbon.EnableDisableStepProperties += new StepTabRibbonEvent(EnableDisableStepProperties);
|
||||
// F2022-024 Time Critical Action Summary
|
||||
_SelectedStepTabPanel.MyStepTabRibbon.TimeCriticalActionSummaryRequest -= MyStepTabRibbon_TimeCriticalActionSummaryRequest;
|
||||
_SelectedStepTabPanel.MyStepTabRibbon.TimeCriticalActionSummaryRequest += MyStepTabRibbon_TimeCriticalActionSummaryRequest;
|
||||
@@ -119,7 +121,7 @@ namespace VEPROMS
|
||||
|
||||
//added by jcb 20130718 to support create pdf button when multi-unit and user selects a unit
|
||||
pi.MyDocVersion.DocVersionConfig.SelectedSlave = pi.ProcedureConfig.SelectedSlave;
|
||||
|
||||
|
||||
DlgPrintProcedure prnDlg = new DlgPrintProcedure(pi);
|
||||
|
||||
//added by jcb 20130718 to support create pdf button when multi-unit and user selects a unit
|
||||
@@ -372,12 +374,12 @@ namespace VEPROMS
|
||||
cmbFont.SelectedIndex = -1;
|
||||
string[] parameters = System.Environment.CommandLine.Split(" ".ToCharArray());
|
||||
string db = Volian.Base.Library.VlnSettings.GetDB();
|
||||
|
||||
|
||||
if (db != null)
|
||||
Database.SelectedDatabase = db;
|
||||
|
||||
//B2018-129 Most Recently Used list was being cleared. Needed to remove a (string) type case in the IF statement
|
||||
if (!string.IsNullOrEmpty((string)Properties.Settings.Default["DefaultDB"]))
|
||||
if (!string.IsNullOrEmpty((string)Properties.Settings.Default["DefaultDB"]))
|
||||
Database.LastDatabase = Properties.Settings.Default.DefaultDB;
|
||||
|
||||
// Setup the Context menu for DisplaySearch including the symbols
|
||||
@@ -416,7 +418,7 @@ namespace VEPROMS
|
||||
// B2019-107 Error Log message for inconsistent PromsFixes
|
||||
_MyLog.InfoFormat("\r\nSession Beginning\r\n<===={0}[SQL:{1:yyMM.ddHH}]====== User: {2}/{3} Started {4} ===============>{5}"
|
||||
, Application.ProductVersion, Database.RevDate, Environment.UserDomainName, Environment.UserName, DateTime.Now.ToString("dddd MMMM d, yyyy h:mm:ss tt"), FormatInfo.Failed ?? "");
|
||||
|
||||
|
||||
// C2022-030 Notify the user if the stored procedure in the database are not update to date
|
||||
// with those in the PROMSFixes.sql delivered with the PROMS executable
|
||||
string pfVersion = ExeInfo.GetAssocicatedPROMSFixesVersion();
|
||||
@@ -546,7 +548,7 @@ namespace VEPROMS
|
||||
tv.ProcedureCheckedOutTo += new vlnTreeViewEvent(tv_ProcedureCheckedOutTo);
|
||||
tv.ViewPDF += new vlnTreeViewPdfEvent(tv_ViewPDF);
|
||||
displayApplicability.ApplicabilityViewModeChanged += new DisplayApplicability.DisplayApplicabilityEvent(displayApplicability_ApplicabilityViewModeChanged);
|
||||
|
||||
|
||||
tv.ExportImportProcedureSets += new vlnTreeViewEvent(tv_ExportImportProcedureSets);
|
||||
tv.PrintTransitionReport += new vlnTreeViewEvent(tv_PrintTransitionReport);
|
||||
tv.ProcessingComplete += tv_ProcessingComplete;
|
||||
@@ -587,7 +589,7 @@ namespace VEPROMS
|
||||
}
|
||||
}
|
||||
|
||||
void tv_SelectDateToStartChangeBars(object sender, vlnTreeEventArgs args)
|
||||
void tv_SelectDateToStartChangeBars(object sender, vlnTreeEventArgs args)
|
||||
{
|
||||
ProcedureInfo pi = (args.Node as VETreeNode).VEObject as ProcedureInfo;
|
||||
if (pi == null) return;
|
||||
@@ -1196,6 +1198,7 @@ namespace VEPROMS
|
||||
|
||||
if (!MySessionInfo.CanCheckOutItem(pi.ItemID, CheckOutType.Procedure, ref message))
|
||||
{
|
||||
message = message.Replace("\r\nWould You like to open the procedure in View Only Mode?", "");
|
||||
MessageBox.Show(this, message, "Procedure Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
@@ -2085,7 +2088,10 @@ namespace VEPROMS
|
||||
{
|
||||
foreach (DisplayTabItem dti in tc.MyBar.Items)
|
||||
{
|
||||
if (!myList.Contains(dti.OwnerID))
|
||||
//C2019-036 View Only mode work with Checked Out Procedures
|
||||
// View Only Mode is no longer checked out, so no longer has an OwnerID
|
||||
// This will keep those tabs from auto-closing based on the timer
|
||||
if (!myList.Contains(dti.OwnerID) && dti.MyStepTabPanel.MyStepPanel.VwMode != E_ViewMode.View)
|
||||
{
|
||||
MyCloseTabList.PushDTI(dti);
|
||||
}
|
||||
@@ -3926,6 +3932,7 @@ namespace VEPROMS
|
||||
string message = string.Empty;
|
||||
if (!MySessionInfo.CanCheckOutItem(args.ProcedureConfig.MyProcedure.ItemID, CheckOutType.Procedure, ref message))
|
||||
{
|
||||
message = message.Replace("\r\nWould You like to open the procedure in View Only Mode?", "");
|
||||
MessageBox.Show(this, message, "Procedure Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
this.Cursor = Cursors.Default;
|
||||
return DialogResult.None;
|
||||
@@ -3949,6 +3956,7 @@ namespace VEPROMS
|
||||
string message = string.Empty;
|
||||
if (!MySessionInfo.CanCheckOutItem(args.SectionConfig.MySection.MySectionInfo.MyProcedure.ItemID, CheckOutType.Procedure, ref message))
|
||||
{
|
||||
message = message.Replace("\r\nWould You like to open the procedure in View Only Mode?", "");
|
||||
MessageBox.Show(this, message, "Procedure Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
this.Cursor = Cursors.Default;
|
||||
return DialogResult.None;
|
||||
@@ -4749,6 +4757,11 @@ namespace VEPROMS
|
||||
// B2022-026 RO Memory reduction coding (Jakes Merge)
|
||||
displayRO.SetFindDocROButton(false);
|
||||
displayRO.LoadTree();
|
||||
|
||||
//C2019-036 View Only mode work with Checked Out Procedures
|
||||
//In View Only Mode - Step Properties should be disabled
|
||||
EnableDisableStepProperties(sender, new StepTabRibbonEventArgs(args.MyEditItem.MyItemInfo, 0, args.MyEditItem.MyStepPanel.VwMode));
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -4780,6 +4793,22 @@ namespace VEPROMS
|
||||
|
||||
}
|
||||
|
||||
//C2019-036 View Only mode work with Checked Out Procedures
|
||||
//In View Only Mode - Step Properties should be disabled
|
||||
public void EnableDisableStepProperties(object sender, StepTabRibbonEventArgs args)
|
||||
{
|
||||
if (args.ViewMode == E_ViewMode.View && (infoTabs.Enabled || infoTabs.SelectedTab != infotabTags))
|
||||
{
|
||||
infoTabs.Enabled = true;
|
||||
infoTabs.SelectedTab = infotabTags;
|
||||
infoTabs.Enabled = false;
|
||||
}
|
||||
else if (args.ViewMode != E_ViewMode.View && !infoTabs.Enabled)
|
||||
{
|
||||
infoTabs.Enabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
void _LastStepRTB_EditModeChanged(object sender, EventArgs args)
|
||||
{
|
||||
if (_LastStepRTB.EditMode) // going into edit mode in a cell of the grid.
|
||||
|
||||
@@ -7984,12 +7984,20 @@ namespace VEPROMS.CSLA.Library
|
||||
public ProcedureInfo(SafeDataReader dr) : base(dr) { }
|
||||
#endif
|
||||
private ProcedureInfo() : base() { ;}
|
||||
public new static ProcedureInfo Get(int itemID)
|
||||
public new static ProcedureInfo Get(int itemID, bool forcerefresh = false)
|
||||
{
|
||||
//if (!CanGetObject())
|
||||
// throw new System.Security.SecurityException("User not authorized to view a Item");
|
||||
try
|
||||
{
|
||||
//C2019-036 View Only mode work with Checked Out Procedures
|
||||
// fixes caching issue
|
||||
// so this forces a refresh of the cache
|
||||
if (forcerefresh)
|
||||
{
|
||||
_CacheByPrimaryKey.Remove(itemID.ToString());
|
||||
}
|
||||
|
||||
ProcedureInfo tmp = GetCachedByPrimaryKey(itemID);
|
||||
if (tmp == null)
|
||||
{
|
||||
|
||||
@@ -186,7 +186,7 @@ namespace VEPROMS.CSLA.Library
|
||||
if (string.IsNullOrEmpty(name))
|
||||
{ name = tmpproc.DisplayText; }
|
||||
|
||||
message = string.Format("The procedure {0} is already checked out to {1}", name, si.UserID);
|
||||
message = string.Format("The procedure {0} is already checked out to {1}.\r\nWould You like to open the procedure in View Only Mode?", name, si.UserID);
|
||||
rv = rv && false;
|
||||
}
|
||||
else if (si.ProcessID != this.ProcessID && objectType == CheckOutType.Document)
|
||||
|
||||
@@ -990,12 +990,21 @@ namespace VEPROMS.CSLA.Library
|
||||
}
|
||||
return tmp;
|
||||
}
|
||||
public static Content Get(int contentID)
|
||||
public static Content Get(int contentID, bool forcerefresh = false)
|
||||
{
|
||||
if (!CanGetObject())
|
||||
throw new System.Security.SecurityException("User not authorized to view a Content");
|
||||
try
|
||||
{
|
||||
//C2019-036 View Only mode work with Checked Out Procedures
|
||||
// fixes caching issue
|
||||
// this forces a refresh of the cache for a case when need to do a hard refresh
|
||||
if (forcerefresh)
|
||||
{
|
||||
ConvertListToDictionary();
|
||||
_CacheByPrimaryKey.Remove(contentID.ToString());
|
||||
}
|
||||
|
||||
Content tmp = GetCachedByPrimaryKey(contentID);
|
||||
if (tmp == null)
|
||||
{
|
||||
|
||||
@@ -603,6 +603,8 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
ItemInfo myItemInfo = myItemInfo2;
|
||||
|
||||
bool viewonlymode = false;
|
||||
|
||||
//B2025-046 Remember Tabs failing when swapping versions of PROMS
|
||||
if (myItemInfo?.MyDocVersion == null) // bug fix: B2016-108 disconnected data will not have a MyDocVersion
|
||||
{
|
||||
@@ -620,8 +622,11 @@ namespace Volian.Controls.Library
|
||||
{
|
||||
if (!MySessionInfo.CanCheckOutItem(myItemInfo.MyProcedure.ItemID, CheckOutType.Procedure, ref message))
|
||||
{
|
||||
FlexibleMessageBox.Show(this, message, "Procedure Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return null;
|
||||
//C2019-036 View Only mode work with Checked Out Procedures
|
||||
if (MessageBox.Show(this, message, "Procedure Already Checked Out", MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
|
||||
viewonlymode = true;
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -682,7 +687,7 @@ namespace Volian.Controls.Library
|
||||
// C2023-016 if a Word section and doing Find/Replace don't open Word section, position to section title in step editor instead
|
||||
if (myItemInfo.MyContent.MyEntry == null || doingFindReplace) // If it is not a Word document open in step editor
|
||||
{
|
||||
return OpenStepTabPage(myItemInfo, setFocus);
|
||||
return OpenStepTabPage(myItemInfo, setFocus, viewonlymode);
|
||||
}
|
||||
else // Otherwise open it in the Word editor
|
||||
{
|
||||
@@ -1178,7 +1183,7 @@ namespace Volian.Controls.Library
|
||||
//}
|
||||
//public Dictionary<DocVersionInfo, frmEnhanced> dicEnhancedDocuments = new Dictionary<DocVersionInfo, frmEnhanced>();
|
||||
|
||||
private DisplayTabItem OpenStepTabPage(ItemInfo myItemInfo, bool setFocus)
|
||||
private DisplayTabItem OpenStepTabPage(ItemInfo myItemInfo, bool setFocus, bool viewonlymode = false)
|
||||
{
|
||||
ItemInfo proc = myItemInfo.MyProcedure; // Find procedure Item
|
||||
string key = "Item - " + proc.ItemID.ToString();
|
||||
@@ -1197,7 +1202,7 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
else // If not already open, create a new Page
|
||||
{
|
||||
pg = new DisplayTabItem(this.components, this, proc, key); // Open a new Procedure Tab
|
||||
pg = new DisplayTabItem(this.components, this, proc, key, viewonlymode); // Open a new Procedure Tab
|
||||
_MyDisplayTabItems.Add(key, pg);
|
||||
if (setFocus)
|
||||
{
|
||||
|
||||
@@ -98,13 +98,18 @@ namespace Volian.Controls.Library
|
||||
}
|
||||
#endregion
|
||||
#region Constructors
|
||||
public DisplayTabItem(IContainer container, DisplayTabControl myDisplayTabControl, ItemInfo myItemInfo, string myKey)
|
||||
public DisplayTabItem(IContainer container, DisplayTabControl myDisplayTabControl, ItemInfo myItemInfo, string myKey, bool viewonlymode = false)
|
||||
{
|
||||
_MyItemInfo = myItemInfo;
|
||||
if (MyItemInfo.MyContent.MyEntry == null)
|
||||
OwnerID = myDisplayTabControl.MySessionInfo.CheckOutItem(myItemInfo.MyProcedure.ItemID, CheckOutType.Procedure);
|
||||
else
|
||||
OwnerID = myDisplayTabControl.MySessionInfo.CheckOutItem(myItemInfo.MyContent.MyEntry.DocID, CheckOutType.Document);
|
||||
//C2019-036 View Only mode work with Checked Out Procedures
|
||||
//don't want to check out if opening in View Only Mode Due to someone else having it checked out
|
||||
if (!viewonlymode)
|
||||
{
|
||||
if (MyItemInfo.MyContent.MyEntry == null)
|
||||
OwnerID = myDisplayTabControl.MySessionInfo.CheckOutItem(myItemInfo.MyProcedure.ItemID, CheckOutType.Procedure);
|
||||
else
|
||||
OwnerID = myDisplayTabControl.MySessionInfo.CheckOutItem(myItemInfo.MyContent.MyEntry.DocID, CheckOutType.Document);
|
||||
}
|
||||
//Console.WriteLine("DisplayTabItem");
|
||||
_MyKey = myKey;
|
||||
_MyDisplayTabControl = myDisplayTabControl;
|
||||
@@ -112,7 +117,7 @@ namespace Volian.Controls.Library
|
||||
InitializeComponent();
|
||||
this.Click += new EventHandler(DisplayTabItem_Click);
|
||||
if (myItemInfo.MyContent.MyEntry == null)
|
||||
SetupStepTabPanel();
|
||||
SetupStepTabPanel(viewonlymode);
|
||||
else
|
||||
SetupDSOTabPanel();
|
||||
SetupSecurity(myItemInfo);
|
||||
@@ -128,6 +133,11 @@ namespace Volian.Controls.Library
|
||||
private bool MesssageShown = false;
|
||||
public void SetupSecurity(ItemInfo myItem)
|
||||
{
|
||||
//C2019-036 View Only mode work with Checked Out Procedures
|
||||
//is in View Only Mode, so do not set up the Security
|
||||
if (OwnerID == 0)
|
||||
return;
|
||||
|
||||
UserInfo ui = UserInfo.GetByUserID(OwnerInfo.Get(OwnerID).SessionUserID);
|
||||
|
||||
if (ui == null)
|
||||
@@ -246,7 +256,7 @@ namespace Volian.Controls.Library
|
||||
/// <summary>
|
||||
/// Creates and sets-up a StepTabPanel
|
||||
/// </summary>
|
||||
private void SetupStepTabPanel()
|
||||
private void SetupStepTabPanel(bool viewonlymode = false)
|
||||
{
|
||||
((System.ComponentModel.ISupportInitialize)(_MyDisplayTabControl.MyBar)).BeginInit();
|
||||
_MyDisplayTabControl.MyBar.SuspendLayout();
|
||||
@@ -276,7 +286,7 @@ namespace Volian.Controls.Library
|
||||
_MyDisplayTabControl.MyBar.ResumeLayout(false);
|
||||
DocVersionInfo dvi = _MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo; //MyRTBItem.MyItemInfo.MyProcedure.ActiveParent as DocVersionInfo;
|
||||
if (dvi == null) return;
|
||||
if (dvi.VersionType > 127)
|
||||
if (dvi.VersionType > 127 || viewonlymode)
|
||||
MyStepTabPanel.MyStepPanel.VwMode = E_ViewMode.View;
|
||||
// C2021 - 027: Procedure level PC/PC - add _MyIteminfo to argument list
|
||||
if (dvi.MultiUnitCount > 1)
|
||||
|
||||
@@ -9,6 +9,7 @@ using System.Drawing;
|
||||
using System.Text.RegularExpressions;
|
||||
using Volian.Base.Library;
|
||||
using JR.Utils.GUI.Forms;
|
||||
using System.Linq;
|
||||
|
||||
namespace Volian.Controls.Library
|
||||
{
|
||||
@@ -386,6 +387,26 @@ namespace Volian.Controls.Library
|
||||
// The following line expands the items needed to display SelectedItemInfo
|
||||
ExpandAsNeeded(myItemInfo);
|
||||
}
|
||||
|
||||
//C2019-036 View Only mode work with Checked Out Procedures
|
||||
public void ResetAll()
|
||||
{
|
||||
List<int> itemIDs = Controls.OfType<RTBItem>().Where(t => t?.MyItemInfo?.ActiveParent != null && t.MyItemInfo.ActiveParent.GetType() == typeof(ItemInfo)).Select(x => (x.MyItemInfo.ActiveParent as ItemInfo).ItemID).Distinct().ToList();
|
||||
|
||||
foreach (int itemID in itemIDs)
|
||||
{
|
||||
ItemInfo.ResetParts(itemID);
|
||||
}
|
||||
|
||||
// The following line actually reloads the procedure item
|
||||
MyProcedureItemInfo = ItemInfo.Get(MyProcedureItemInfo.ItemID, true);
|
||||
MyProcedureItemInfo.RefreshConfig();
|
||||
ContentInfo.Refresh(Content.Get(MyProcedureItemInfo.MyContent.ContentID, true));
|
||||
|
||||
// The following line expands the items needed to display SelectedItemInfo
|
||||
ExpandAsNeeded(SelectedItemInfo);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Currently selected StepRTB
|
||||
/// </summary>
|
||||
|
||||
@@ -16,6 +16,8 @@ using DevComponents.DotNetBar;
|
||||
using Microsoft.Win32;
|
||||
using System.Diagnostics;
|
||||
using JR.Utils.GUI.Forms;
|
||||
using System.Collections.Concurrent;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Volian.Controls.Library
|
||||
{
|
||||
@@ -906,6 +908,11 @@ namespace Volian.Controls.Library
|
||||
// //SetButtonAndMenuEnabling(false);
|
||||
//}
|
||||
private Bitmap createTextBitmap(char ch)
|
||||
{
|
||||
return createTextBitmap(ch, new Font("FreeMono", 18, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel));
|
||||
}
|
||||
|
||||
private Bitmap createTextBitmap(char ch, Font objFont)
|
||||
{
|
||||
string txt = string.Format("{0}", ch);
|
||||
Bitmap objBmpImage = new Bitmap(1, 1);
|
||||
@@ -916,8 +923,6 @@ namespace Volian.Controls.Library
|
||||
// Create the Font object for the image text drawing.
|
||||
// later on, we could add logic to use either FreeMono or Arial Unicode MS based on the format being used
|
||||
// but for now, we are going to use FreeMono to create the symbol list
|
||||
Font objFont = new Font("FreeMono", 18, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
//Font objFont = new Font("Arial Unicode MS", 18, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Pixel);
|
||||
|
||||
// Create a graphics object to measure the text's width and height.
|
||||
Graphics objGraphics = Graphics.FromImage(objBmpImage);
|
||||
@@ -937,7 +942,6 @@ namespace Volian.Controls.Library
|
||||
objGraphics.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
objGraphics.TextContrast = 0;
|
||||
objGraphics.TextRenderingHint = TextRenderingHint.AntiAlias;
|
||||
//objGraphics.DrawString(txt, objFont, new SolidBrush(Color.FromArgb(102, 102, 102)), 0, 0);
|
||||
objGraphics.DrawString(txt, objFont, new SolidBrush(Color.Black),0,0);
|
||||
objGraphics.Flush();
|
||||
return (objBmpImage);
|
||||
@@ -2067,6 +2071,9 @@ namespace Volian.Controls.Library
|
||||
rtabHome.Select();
|
||||
rtabTableGridTools.Visible = false;
|
||||
SetButtonMenuEnabledDisabledOnStepType(false);
|
||||
//C2019-036 View Only mode work with Checked Out Procedures
|
||||
//Is in View Only Mode so show button as selected
|
||||
btnEditMode.Checked = btnCMEditMode1.Checked = true;
|
||||
this.Refresh();
|
||||
return;
|
||||
}
|
||||
@@ -3338,10 +3345,43 @@ namespace Volian.Controls.Library
|
||||
public void SetupAdminMode()
|
||||
{
|
||||
}
|
||||
|
||||
//C2019-036 View Only mode work with Checked Out Procedures
|
||||
public event StepTabRibbonEvent EnableDisableStepProperties;
|
||||
private void OnEnableDisableStepProperties(StepTabRibbonEventArgs args)
|
||||
{
|
||||
if (EnableDisableStepProperties != null)
|
||||
EnableDisableStepProperties(this, args);
|
||||
}
|
||||
private void btnToggleEditView_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (MyEditItem == null) return;
|
||||
|
||||
//C2019-036 View Only mode work with Checked Out Procedures
|
||||
string message = string.Empty;
|
||||
if (MyEditItem.MyStepPanel.VwMode == E_ViewMode.View && !MySessionInfo.CanCheckOutItem(MyEditItem.MyItemInfo.MyProcedure.ItemID, CheckOutType.Procedure, ref message))
|
||||
{
|
||||
//someone else has the procedure checked out so cannot swap out of view only mode
|
||||
message = message.Replace("\r\nWould You like to open the procedure in View Only Mode?", "\r\n\r\nYou will be unable to turn off View Only Mode for this procedure until it is checked in by the user specified above.");
|
||||
MessageBox.Show(this, message, "Procedure Already Checked Out", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
else if (MyEditItem.MyStepPanel.VwMode == E_ViewMode.View)
|
||||
{
|
||||
//swapping into edit mode, so check out procedure and Setup Security
|
||||
(this.Parent as StepTabPanel).MyDisplayTabItem.OwnerID = MySessionInfo.CheckOutItem(MyEditItem.MyItemInfo.MyProcedure.ItemID, 0);
|
||||
(this.Parent as StepTabPanel).MyDisplayTabItem.SetupSecurity(MyItemInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
//swapping into View Only mode, so check in procedure
|
||||
OwnerInfo oi = OwnerInfo.GetByItemID(MyEditItem.MyItemInfo.MyProcedure.ItemID, CheckOutType.Procedure);
|
||||
MySessionInfo.CheckInItem(oi.OwnerID);
|
||||
}
|
||||
|
||||
MyEditItem.MyStepPanel.VwMode = MyEditItem.MyStepPanel.VwMode == E_ViewMode.Edit ? E_ViewMode.View : E_ViewMode.Edit;
|
||||
//enable / disable the Step Properties Panel based on the ViewMode
|
||||
OnEnableDisableStepProperties(new StepTabRibbonEventArgs(MyEditItem.MyItemInfo, 0, MyEditItem.MyStepPanel.VwMode));
|
||||
MyEditItem.ToggleEditView(MyEditItem.MyStepPanel.VwMode);
|
||||
SetButtonAndMenuEnabling(true);
|
||||
SetStepButtonAndMenuEnabling(true);
|
||||
@@ -3355,7 +3395,62 @@ namespace Volian.Controls.Library
|
||||
// btnEnhancedDocSync.Checked = !btnEnhancedDocSync.Checked;
|
||||
//}
|
||||
|
||||
//C2019-036 View Only mode work with Checked Out Procedures
|
||||
// using a blocking collection to make it thread safe in case someone
|
||||
// spams hitting the refresh button
|
||||
private BlockingCollection<bool> blockingRefreshProcedure = new BlockingCollection<bool>();
|
||||
|
||||
//C2019-036 View Only mode work with Checked Out Procedures
|
||||
private void btnRefreshProcedure_Click(object sender, EventArgs e)
|
||||
{
|
||||
//Consumer
|
||||
Task.Run(() =>
|
||||
{
|
||||
//Blocks until a newRefresh Procedure Run is available
|
||||
while (!blockingRefreshProcedure.IsCompleted)
|
||||
{
|
||||
_ = blockingRefreshProcedure.Take();
|
||||
RefreshProcedure();
|
||||
}
|
||||
});
|
||||
|
||||
//Producer
|
||||
Task.Run(() => { blockingRefreshProcedure.Add(true); });
|
||||
}
|
||||
|
||||
public void RefreshProcedure()
|
||||
{
|
||||
StepTabPanel stab_Panel = Parent as StepTabPanel;
|
||||
|
||||
if (MyEditItem != null)
|
||||
{
|
||||
if (!MyEditItem.MyStepPanel.ContainsFocus)
|
||||
this.Invoke((Action)(() => { MyEditItem.MyStepPanel.Focus(); }));
|
||||
|
||||
E_ViewMode mode = MyEditItem.MyStepPanel.VwMode;
|
||||
Application.DoEvents();
|
||||
this.Invoke((Action)(() => {MyEditItem.MyStepPanel.ResetAll();}));
|
||||
Application.DoEvents();
|
||||
this.Invoke((Action)(() => {MyEditItem.MyStepPanel.Refresh();}));
|
||||
Application.DoEvents();
|
||||
MyEditItem.MyStepPanel.VwMode = mode;
|
||||
Application.DoEvents();
|
||||
}
|
||||
else if (stab_Panel != null)
|
||||
{
|
||||
if (!stab_Panel.MyStepPanel.ContainsFocus)
|
||||
this.Invoke((Action)(() => {stab_Panel.MyStepPanel.Focus();}));
|
||||
|
||||
E_ViewMode mode = stab_Panel.MyStepPanel.VwMode;
|
||||
Application.DoEvents();
|
||||
this.Invoke((Action)(() => {stab_Panel.MyStepPanel.ResetAll();}));
|
||||
Application.DoEvents();
|
||||
this.Invoke((Action)(() => {stab_Panel.MyStepPanel.Refresh();}));
|
||||
Application.DoEvents();
|
||||
stab_Panel.MyStepPanel.VwMode = mode;
|
||||
Application.DoEvents();
|
||||
}
|
||||
}
|
||||
private void btnROEdit_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (VlnSettings.ReleaseMode.Equals("DEMO"))
|
||||
@@ -4865,10 +4960,11 @@ namespace Volian.Controls.Library
|
||||
public class StepTabRibbonEventArgs : EventArgs
|
||||
{
|
||||
public StepTabRibbonEventArgs() { ; }
|
||||
public StepTabRibbonEventArgs(ItemInfo proc, int oringFlg = 0)
|
||||
public StepTabRibbonEventArgs(ItemInfo proc, int oringFlg = 0, E_ViewMode viewMode = E_ViewMode.Edit)
|
||||
{
|
||||
_Proc = proc;
|
||||
OringFlg = oringFlg;
|
||||
ViewMode = viewMode;
|
||||
}
|
||||
private ItemInfo _Proc;
|
||||
|
||||
@@ -4884,6 +4980,9 @@ namespace Volian.Controls.Library
|
||||
get { return _OringFlg; }
|
||||
set { _OringFlg = value; }
|
||||
}
|
||||
|
||||
//C2019-036 View Only mode work with Checked Out Procedures
|
||||
public E_ViewMode ViewMode { get; set; }
|
||||
}
|
||||
public delegate void StepTabRibbonEvent(object sender, StepTabRibbonEventArgs args);
|
||||
|
||||
|
||||
BIN
PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs
generated
BIN
PROMS/Volian.Controls.Library/StepTabRibbon.designer.cs
generated
Binary file not shown.
Reference in New Issue
Block a user