juno building preview

This commit is contained in:
Asval
2024-05-25 00:19:47 +02:00
parent eb49b3c853
commit 9781446aef
11 changed files with 208 additions and 54 deletions

View File

@@ -86,6 +86,8 @@ public class TabImage : ViewModel
public class TabItem : ViewModel
{
public string ParentExportType { get; private set; }
private string _header;
public string Header
{
@@ -211,20 +213,28 @@ public class TabItem : ViewModel
private GoToCommand _goToCommand;
public GoToCommand GoToCommand => _goToCommand ??= new GoToCommand(null);
public TabItem(string header, string directory)
public TabItem(string header, string directory, string parentExportType)
{
Header = header;
Directory = directory;
ParentExportType = parentExportType;
_images = new ObservableCollection<TabImage>();
}
public void ClearImages()
public void SoftReset(string header, string directory)
{
Header = header;
Directory = directory;
ParentExportType = string.Empty;
ScrollTrigger = null;
Application.Current.Dispatcher.Invoke(() =>
{
_images.Clear();
SelectedImage = null;
RaisePropertyChanged("HasMultipleImages");
Document ??= new TextDocument();
Document.Text = string.Empty;
});
}
@@ -274,15 +284,6 @@ public class TabItem : ViewModel
});
}
public void ResetDocumentText()
{
Application.Current.Dispatcher.Invoke(() =>
{
Document ??= new TextDocument();
Document.Text = string.Empty;
});
}
public void SaveImage() => SaveImage(SelectedImage, true);
private void SaveImage(TabImage image, bool updateUi)
{
@@ -368,12 +369,13 @@ public class TabControlViewModel : ViewModel
SelectedTab = TabsItems.FirstOrDefault();
}
public void AddTab(string header = null, string directory = null)
public void AddTab(string header = null, string directory = null, string parentExportType = null)
{
if (!CanAddTabs) return;
var h = header ?? "New Tab";
var d = directory ?? string.Empty;
var p = parentExportType ?? string.Empty;
if (SelectedTab is { Header : "New Tab" })
{
SelectedTab.Header = h;
@@ -383,7 +385,7 @@ public class TabControlViewModel : ViewModel
Application.Current.Dispatcher.Invoke(() =>
{
_tabItems.Add(new TabItem(h, d));
_tabItems.Add(new TabItem(h, d, p));
SelectedTab = _tabItems.Last();
});
}
@@ -445,6 +447,6 @@ public class TabControlViewModel : ViewModel
private static IEnumerable<TabItem> EnumerateTabs()
{
yield return new TabItem("New Tab", string.Empty);
yield return new TabItem("New Tab", string.Empty, string.Empty);
}
}