Skip to content

Commit 5fd074a

Browse files
committed
refactor: use view locator instead of creating views manually in viewmodels (#1213)
Signed-off-by: leo <[email protected]>
1 parent 4136697 commit 5fd074a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+52
-140
lines changed

src/ViewModels/AddRemote.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,6 @@ public string SSHKey
4747
public AddRemote(Repository repo)
4848
{
4949
_repo = repo;
50-
View = new Views.AddRemote() { DataContext = this };
5150
}
5251

5352
public static ValidationResult ValidateRemoteName(string name, ValidationContext ctx)

src/ViewModels/AddSubmodule.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ public bool Recursive
3131
public AddSubmodule(Repository repo)
3232
{
3333
_repo = repo;
34-
View = new Views.AddSubmodule() { DataContext = this };
3534
}
3635

3736
public static ValidationResult ValidateURL(string url, ValidationContext ctx)

src/ViewModels/AddWorktree.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,6 @@ public AddWorktree(Repository repo)
7878
SelectedTrackingBranch = RemoteBranches[0];
7979
else
8080
SelectedTrackingBranch = string.Empty;
81-
82-
View = new Views.AddWorktree() { DataContext = this };
8381
}
8482

8583
public static ValidationResult ValidateWorktreePath(string path, ValidationContext ctx)

src/ViewModels/Apply.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ public Apply(Repository repo)
3131
_repo = repo;
3232

3333
SelectedWhiteSpaceMode = Models.ApplyWhiteSpaceMode.Supported[0];
34-
View = new Views.Apply() { DataContext = this };
3534
}
3635

3736
public static ValidationResult ValidatePatchFile(string file, ValidationContext _)

src/ViewModels/ApplyStash.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ public ApplyStash(Repository repo, Models.Stash stash)
2626
{
2727
_repo = repo;
2828
Stash = stash;
29-
View = new Views.ApplyStash() { DataContext = this };
3029
}
3130

3231
public override Task<bool> Sure()

src/ViewModels/Archive.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public Archive(Repository repo, Models.Branch branch)
2525
_revision = branch.Head;
2626
_saveFile = $"archive-{Path.GetFileName(branch.Name)}.zip";
2727
BasedOn = branch;
28-
View = new Views.Archive() { DataContext = this };
2928
}
3029

3130
public Archive(Repository repo, Models.Commit commit)
@@ -34,7 +33,6 @@ public Archive(Repository repo, Models.Commit commit)
3433
_revision = commit.SHA;
3534
_saveFile = $"archive-{commit.SHA.Substring(0, 10)}.zip";
3635
BasedOn = commit;
37-
View = new Views.Archive() { DataContext = this };
3836
}
3937

4038
public Archive(Repository repo, Models.Tag tag)
@@ -43,7 +41,6 @@ public Archive(Repository repo, Models.Tag tag)
4341
_revision = tag.SHA;
4442
_saveFile = $"archive-{Path.GetFileName(tag.Name)}.zip";
4543
BasedOn = tag;
46-
View = new Views.Archive() { DataContext = this };
4744
}
4845

4946
public override Task<bool> Sure()

src/ViewModels/Checkout.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public Checkout(Repository repo, string branch)
2020
_repo = repo;
2121
Branch = branch;
2222
DiscardLocalChanges = false;
23-
View = new Views.Checkout() { DataContext = this };
2423
}
2524

2625
public override Task<bool> Sure()

src/ViewModels/CheckoutCommit.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ public CheckoutCommit(Repository repo, Models.Commit commit)
2020
_repo = repo;
2121
Commit = commit;
2222
DiscardLocalChanges = false;
23-
View = new Views.CheckoutCommit() { DataContext = this };
2423
}
2524

2625
public override Task<bool> Sure()

src/ViewModels/CherryPick.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ public CherryPick(Repository repo, List<Models.Commit> targets)
5050
MainlineForMergeCommit = 0;
5151
AppendSourceToMessage = true;
5252
AutoCommit = true;
53-
View = new Views.CherryPick() { DataContext = this };
5453
}
5554

5655
public CherryPick(Repository repo, Models.Commit merge, List<Models.Commit> parents)
@@ -62,7 +61,6 @@ public CherryPick(Repository repo, Models.Commit merge, List<Models.Commit> pare
6261
MainlineForMergeCommit = 0;
6362
AppendSourceToMessage = true;
6463
AutoCommit = true;
65-
View = new Views.CherryPick() { DataContext = this };
6664
}
6765

6866
public override Task<bool> Sure()

src/ViewModels/Cleanup.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ public class Cleanup : Popup
77
public Cleanup(Repository repo)
88
{
99
_repo = repo;
10-
View = new Views.Cleanup() { DataContext = this };
1110
}
1211

1312
public override Task<bool> Sure()

0 commit comments

Comments
 (0)