I am trying to display the warning message in the Tridion Message bar when the page or component is checkedout.
I have subscribed and tried with (Processed and Initiated) Phase and tried to Subscribe and SubscribeAynsc.
subscribor line below:
EventSystem.Subscribe<VersionedItem, CheckOutEventArgs>(displaymessage, EventPhases.Processed);
Function below:
public override void displaymessage(VersionedItem item, TcmEventArgs args, EventPhases phase)
{
if (item.GetType().Name == "Component" || item.GetType().Name == "Page")
{
string chkuser = "aa" ;
sting revisor = "bb"
if(chkuser != revisor
{
throw new Exception("Warning-->some one is already modified this item and u are checking out now");
}
}
}
I would like to display the warning message if the checkout user and revisor is different. I will take the checkout user and revisor details shortly and will compare.
Issues:
- The abaove code display the message in the Tridion message bar, when i select any item and click the "Check Out". at the same time, the item is not in edit mode, it is in read only mode.
- When i select any item and clik "Open" or double click the item, checkout event is triggered but the message is not displayed in the Message bar. and still the item is read only mode.
- And if i used try{}Catch{} inside my code, when the line "throw new exception" reached, the code is automatically goest to catch block. and mesaage is not displayed even in the "1st (Issues:1)" situation.
Can any one give some insight on this? that would be great!!