|
|
@ -23,6 +23,15 @@ public partial class TextToImageViewModel : ObservableObject |
|
|
|
[ObservableProperty] |
|
|
|
[ObservableProperty] |
|
|
|
private bool isGenerating; |
|
|
|
private bool isGenerating; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty] |
|
|
|
|
|
|
|
[NotifyPropertyChangedFor(nameof(ProgressRingVisibility))] |
|
|
|
|
|
|
|
[NotifyPropertyChangedFor(nameof(ImagePreviewVisibility))] |
|
|
|
|
|
|
|
private bool isProgressRingActive; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Visibility ProgressRingVisibility => IsProgressRingActive ? Visibility.Visible : Visibility.Collapsed; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Visibility ImagePreviewVisibility => IsProgressRingActive ? Visibility.Collapsed : Visibility.Visible; |
|
|
|
|
|
|
|
|
|
|
|
[ObservableProperty] |
|
|
|
[ObservableProperty] |
|
|
|
[NotifyPropertyChangedFor(nameof(ProgressBarVisibility))] |
|
|
|
[NotifyPropertyChangedFor(nameof(ProgressBarVisibility))] |
|
|
|
private int progressValue; |
|
|
|
private int progressValue; |
|
|
@ -63,6 +72,7 @@ public partial class TextToImageViewModel : ObservableObject |
|
|
|
|
|
|
|
|
|
|
|
private void StopProgressTracking() |
|
|
|
private void StopProgressTracking() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
IsProgressRingActive = false; |
|
|
|
ProgressValue = 0; |
|
|
|
ProgressValue = 0; |
|
|
|
progressQueryTimer?.Stop(); |
|
|
|
progressQueryTimer?.Stop(); |
|
|
|
} |
|
|
|
} |
|
|
@ -86,6 +96,9 @@ public partial class TextToImageViewModel : ObservableObject |
|
|
|
var result = response.CurrentImage; |
|
|
|
var result = response.CurrentImage; |
|
|
|
if (result != null) |
|
|
|
if (result != null) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
// Stop indeterminate progress ring |
|
|
|
|
|
|
|
IsProgressRingActive = false; |
|
|
|
|
|
|
|
// Set preview image |
|
|
|
var bitmap = Base64ToBitmap(result); |
|
|
|
var bitmap = Base64ToBitmap(result); |
|
|
|
ImagePreview = bitmap; |
|
|
|
ImagePreview = bitmap; |
|
|
|
} |
|
|
|
} |
|
|
@ -109,6 +122,9 @@ public partial class TextToImageViewModel : ObservableObject |
|
|
|
[RelayCommand] |
|
|
|
[RelayCommand] |
|
|
|
private async void TextToImageGenerate() |
|
|
|
private async void TextToImageGenerate() |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
// Start indeterminate progress ring |
|
|
|
|
|
|
|
IsProgressRingActive = true; |
|
|
|
|
|
|
|
|
|
|
|
var request = new TextToImageRequest |
|
|
|
var request = new TextToImageRequest |
|
|
|
{ |
|
|
|
{ |
|
|
|
Prompt = PositivePromptText, |
|
|
|
Prompt = PositivePromptText, |
|
|
|