Multi-Platform Package Manager for Stable Diffusion
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

167 lines
8.4 KiB

<controls:UserControlBase
x:Class="StabilityMatrix.Avalonia.Views.InferencePage"
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:StabilityMatrix.Avalonia.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:mocks="clr-namespace:StabilityMatrix.Avalonia.DesignData"
xmlns:vmInference="using:StabilityMatrix.Avalonia.ViewModels.Inference"
xmlns:ui="using:FluentAvalonia.UI.Controls"
xmlns:vm="clr-namespace:StabilityMatrix.Avalonia.ViewModels"
xmlns:icons="clr-namespace:Projektanker.Icons.Avalonia;assembly=Projektanker.Icons.Avalonia"
xmlns:lang="clr-namespace:StabilityMatrix.Avalonia.Languages"
d:DataContext="{x:Static mocks:DesignData.InferenceViewModel}"
d:DesignHeight="650"
d:DesignWidth="1000"
x:DataType="vm:InferenceViewModel"
mc:Ignorable="d">
<controls:UserControlBase.Resources>
<ui:CommandBarFlyout Placement="Right" x:Key="AddTabFlyout">
<!-- Note: unlike a regular CommandBar, primary items can be set as the xml content and don't need
to be wrapped in a <ui:CommandBarFlyout.PrimaryCommands> tag
-->
<!--<ui:CommandBarButton Label="Text to Image" ToolTip.Tip="Text to Image">
<ui:CommandBarButton.IconSource>
<controls:FASymbolIconSource Symbol="fa-solid fa-bolt"/>
</ui:CommandBarButton.IconSource>
</ui:CommandBarButton>
<ui:CommandBarButton Label="Save" ToolTip.Tip="Save" />
<ui:CommandBarButton Label="Delete" ToolTip.Tip="Delete" />-->
<ui:CommandBarFlyout.SecondaryCommands>
<ui:CommandBarButton
IconSource="FullScreenMaximize"
Label="Text to Image"
Click="AddTabMenu_TextToImageButton_OnClick"
ToolTip.Tip="Text to Image"/>
<ui:CommandBarButton
IsEnabled="False"
IconSource="ImageCopy"
Label="Image to Image"
ToolTip.Tip="Image to Image"/>
<ui:CommandBarButton
IsEnabled="False"
IconSource="ImageEdit"
Label="Inpaint"
ToolTip.Tip="Inpaint"/>
</ui:CommandBarFlyout.SecondaryCommands>
</ui:CommandBarFlyout>
</controls:UserControlBase.Resources>
<Grid>
<!-- AddTabButtonCommand="{Binding AddTabCommand}" -->
<ui:TabView
x:Name="TabView"
CanDragTabs="True"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch"
CanReorderTabs="True"
CloseButtonOverlayMode="Auto"
TabCloseRequested="TabView_OnTabCloseRequested"
AddTabButtonClick="TabView_OnAddTabButtonClick"
TabItems="{Binding Tabs}"
SelectedItem="{Binding SelectedTab}"
SelectedIndex="{Binding SelectedTabIndex}"
TabWidthMode="SizeToContent">
<ui:TabView.TabItemTemplate>
<DataTemplate DataType="{x:Type vmInference:InferenceTextToImageViewModel}">
<ui:TabViewItem Header="{Binding TabTitle}"
IconSource="Document"
Content="{Binding}" />
</DataTemplate>
</ui:TabView.TabItemTemplate>
<ui:TabView.TabStripFooter>
<StackPanel
Orientation="Horizontal"
Spacing="8"
HorizontalAlignment="Right">
<!-- Connecting Progress -->
<controls:ProgressRing
IsVisible="{Binding ClientManager.IsConnecting}"
BorderThickness="4"
IsIndeterminate="True"/>
<!-- Connecting Progress Text -->
<TextBlock
IsVisible="{Binding ClientManager.IsConnecting}"
VerticalAlignment="Center"
Text="{x:Static lang:Resources.Label_ConnectingEllipsis}"/>
<!-- Waiting to connect progress text -->
<TextBlock
VerticalAlignment="Center"
Text="{x:Static lang:Resources.Label_WaitingToConnectEllipsis}">
<Button.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="!ClientManager.IsConnecting" />
<Binding Path="IsWaitingForConnection" />
</MultiBinding>
</Button.IsVisible>
</TextBlock>
<!-- Active connect (when Comfy is running) -->
<Button
Padding="12,4"
Command="{Binding ConnectCommand}"
Classes="success">
<Button.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="ClientManager.CanUserConnect" />
<Binding Path="IsComfyRunning" />
</MultiBinding>
</Button.IsVisible>
<StackPanel Orientation="Horizontal">
<icons:Icon Value="fa-solid fa-circle-question"
Margin="0,0,8,0"
FontSize="14" />
<TextBlock Text="{x:Static lang:Resources.Action_Connect}" />
</StackPanel>
</Button>
<!-- Connect help -->
<Button
Padding="12,4"
Command="{Binding ShowConnectionHelpCommand}">
<Button.IsVisible>
<MultiBinding Converter="{x:Static BoolConverters.And}">
<Binding Path="ClientManager.CanUserConnect" />
<Binding Path="!IsComfyRunning" />
</MultiBinding>
</Button.IsVisible>
<StackPanel Orientation="Horizontal">
<icons:Icon Value="fa-solid fa-circle-question"
Margin="0,0,8,0"
FontSize="14" />
<TextBlock Text="{x:Static lang:Resources.Action_Connect}" />
</StackPanel>
</Button>
<Button
Classes="transparent"
BorderThickness="0">
<ui:SymbolIcon FontSize="18" Symbol="MoreVertical"/>
<Button.Flyout>
<MenuFlyout Placement="BottomEdgeAlignedLeft">
<MenuItem Header="Open Project..."
Command="{Binding MenuOpenProjectCommand}"
InputGesture="Ctrl+O"/>
<Separator/>
<MenuItem Header="Save"
Command="{Binding MenuSaveCommand}"
InputGesture="Ctrl+S"/>
<MenuItem Header="Save As..."
Command="{Binding MenuSaveAsCommand}"
InputGesture="Ctrl+Shift+S"/>
<Separator IsVisible="{Binding ClientManager.IsConnected}"/>
<MenuItem Header="Disconnect"
Command="{Binding DisconnectCommand}"
IsVisible="{Binding ClientManager.IsConnected}"/>
</MenuFlyout>
</Button.Flyout>
</Button>
</StackPanel>
</ui:TabView.TabStripFooter>
</ui:TabView>
</Grid>
</controls:UserControlBase>