mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-20 19:55:00 +00:00
Avoid duplication of Repository tab
This commit is contained in:
parent
01625ada1a
commit
0a50631c06
1 changed files with 13 additions and 4 deletions
|
@ -1,6 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using Avalonia.Collections;
|
using Avalonia.Collections;
|
||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Input;
|
using Avalonia.Input;
|
||||||
|
@ -132,9 +132,18 @@ namespace SourceGit.ViewModels
|
||||||
|
|
||||||
public void AddNewTab()
|
public void AddNewTab()
|
||||||
{
|
{
|
||||||
var page = new LauncherPage();
|
var existingRepositoriesPAge =
|
||||||
Pages.Add(page);
|
Pages.FirstOrDefault(p => string.IsNullOrEmpty(p.Node.Name));
|
||||||
ActivePage = page;
|
if (existingRepositoriesPAge != null)
|
||||||
|
{
|
||||||
|
ActivePage = existingRepositoriesPAge;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var page = new LauncherPage();
|
||||||
|
Pages.Add(page);
|
||||||
|
ActivePage = page;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MoveTab(LauncherPage from, LauncherPage to)
|
public void MoveTab(LauncherPage from, LauncherPage to)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue