Skip to content

Commit ea88db8

Browse files
committed
Automatically save mappings when junction points are created
Related Work Items: #20
1 parent 18b5a7c commit ea88db8

3 files changed

Lines changed: 6 additions & 1 deletion

File tree

Junctionizer/Model/FolderCollection.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,8 @@ private FolderCollection(Func<bool> isDesiredThread, PauseTokenSource pauseToken
103103
public bool BothCollectionsInitialized => Location != null && CorrespondingCollection.Location != null;
104104

105105
[NotNull] private readonly FileSystemWatcher _directoryWatcher = new FileSystemWatcher();
106+
107+
public event Action JunctionCreated;
106108

107109
[CanBeNull] private PauseTokenSource PauseTokenSource { get; }
108110
private PauseToken PauseToken { get; }
@@ -313,6 +315,7 @@ public void CreateJunctionTo([NotNull] GameFolder junctionTarget)
313315
if (junctionDirectory.Exists == false)
314316
{
315317
JunctionPoint.Create(junctionDirectory, junctionTarget.DirectoryInfo, false);
318+
JunctionCreated?.Invoke();
316319
}
317320
}
318321
catch (Exception e) when (e is IOException || e is UnauthorizedAccessException)

Junctionizer/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,5 +51,5 @@
5151
// [assembly: AssemblyVersion("1.0.*")]
5252

5353
[assembly: AssemblyVersion("0.0.0")]
54-
[assembly: AssemblyFileVersion("0.5.1")]
54+
[assembly: AssemblyFileVersion("0.6.0")]
5555
[assembly: AssemblyInformationalVersion("Alpha")]

Junctionizer/ViewModels/MainWindowViewModel.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ public void Initialize()
3737
{
3838
(SourceCollection, DestinationCollection) = FolderCollection.Factory.CreatePair(() => SynchronizationContext.Current is DispatcherSynchronizationContext, UISettings.PauseTokenSource);
3939

40+
SourceCollection.JunctionCreated += () => SelectedMapping.IsSavedMapping = true;
41+
4042
FolderPairCollection = new GameFolderPairEnumerable(SourceCollection, DestinationCollection, UISettings.PauseTokenSource);
4143

4244
BindingOperations.EnableCollectionSynchronization(DisplayedMappings, new object());

0 commit comments

Comments
 (0)