Skip to content

Commit

Permalink
Closed content publish event
Browse files Browse the repository at this point in the history
  • Loading branch information
chandramouleswaran committed Sep 16, 2013
1 parent b0eeed9 commit 0661ca4
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Src/Wide/Core/CoreModule.cs
Expand Up @@ -283,6 +283,7 @@ private void CloseDocument(object obj)
{
logger.Log("Closing document " + activeDocument.Model.Location, LogCategory.Info, LogPriority.None);
workspace.Documents.Remove(activeDocument);
_eventAggregator.GetEvent<ClosedContentEvent>().Publish(activeDocument);
menuService.Refresh();
}
else
Expand All @@ -292,6 +293,7 @@ private void CloseDocument(object obj)
if (activeDocument.Model.Location == null)
{
workspace.Documents.Remove(activeDocument);
_eventAggregator.GetEvent<ClosedContentEvent>().Publish(activeDocument);
}
}
}
Expand Down
23 changes: 23 additions & 0 deletions Src/Wide/Interfaces/Events/ClosedContentEvent.cs
@@ -0,0 +1,23 @@
#region License

// Copyright (c) 2013 Chandramouleswaran Ravichandran
//
// Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

#endregion

using Microsoft.Practices.Prism.Events;

namespace Wide.Interfaces.Events
{
/// <summary>
/// Class OpenContentEvent - This event happens when a new document is opened.
/// </summary>
public class ClosedContentEvent : CompositePresentationEvent<ContentViewModel>
{
}
}
1 change: 1 addition & 0 deletions Src/Wide/Wide.csproj
Expand Up @@ -105,6 +105,7 @@
<Compile Include="Core\Services\AllFileHandler.cs" />
<Compile Include="Interfaces\Converters\NullToBooleanConverter.cs" />
<Compile Include="Interfaces\Converters\DocumentContextMenuMixingConverter.cs" />
<Compile Include="Interfaces\Events\ClosedContentEvent.cs" />
<Compile Include="Interfaces\Settings\IRecentViewItem.cs" />
<Compile Include="Interfaces\Settings\IToolbarPositionSettings.cs" />
<Compile Include="Core\Settings\ToolbarSettingItem.cs" />
Expand Down

0 comments on commit 0661ca4

Please sign in to comment.