XIVChat/XIVChat Desktop/MainWindow.xaml

309 lines
19 KiB
XML

<local:XivChatWindow x:Class="XIVChat_Desktop.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:XIVChat_Desktop"
xmlns:cc="clr-namespace:XIVChat_Desktop.Controls"
xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:server="clr-namespace:XIVChatCommon.Message.Server;assembly=XIVChatCommon"
xmlns:message="clr-namespace:XIVChatCommon.Message;assembly=XIVChatCommon"
ui:WindowHelper.UseModernWindowStyle="True"
ui:TitleBar.ExtendViewIntoTitleBar="{Binding App.Config.CompactMode}"
mc:Ignorable="d"
Title="XIVChat for Windows"
Height="450"
Width="800"
x:Name="Main"
WindowStyle="None"
AllowsTransparency="True"
Opacity="{Binding App.Config.Opacity}"
Icon="/Resources/logo.ico"
SourceInitialized="MainWindow_OnSourceInitialized"
Closing="MainWindow_OnClosing"
d:DataContext="{d:DesignInstance local:MainWindow}">
<local:XivChatWindow.CommandBindings>
<CommandBinding Command="local:MainWindow.OpenLink"
Executed="OpenLink_Execute"
CanExecute="OpenLink_CanExecute" />
</local:XivChatWindow.CommandBindings>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Menu Grid.Row="0">
<MenuItem Header="XIVChat"
WindowChrome.IsHitTestVisibleInChrome="{Binding App.Config.CompactMode}">
<MenuItem Header="Connect"
Click="Connect_Click"
IsEnabled="{Binding App.Connected, Converter={StaticResource NotConverter}, UpdateSourceTrigger=PropertyChanged}" />
<MenuItem Header="Disconnect"
Click="Disconnect_Click"
IsEnabled="{Binding App.Connected, UpdateSourceTrigger=PropertyChanged}" />
<MenuItem Header="Scan"
Click="Scan_Click" />
<Separator />
<MenuItem Header="Export"
Click="Export_Click" />
<Separator />
<MenuItem Header="Licence"
Click="Licence_Click" />
<MenuItem Header="Configuration"
Click="Configuration_Click" />
<Separator />
<MenuItem Header="Exit"
Click="Exit_Click" />
</MenuItem>
<MenuItem Header="Players"
WindowChrome.IsHitTestVisibleInChrome="{Binding App.Config.CompactMode}">
<MenuItem Header="Friend list"
Click="FriendList_Click" />
</MenuItem>
</Menu>
<TabControl x:Name="Tabs"
Margin="8,0,8,8"
TabStripPlacement="Bottom"
Grid.Row="1"
Loaded="Tabs_Loaded"
SelectionChanged="Tabs_SelectionChanged"
ItemsSource="{Binding App.Config.Tabs}">
<TabControl.CommandBindings>
<CommandBinding Command="local:MainWindow.AddTab"
Executed="AddTab_OnExecuted"
CanExecute="AlwaysTrue_CanExecute" />
<CommandBinding Command="local:MainWindow.ManageTabs"
Executed="ManageTabs_OnExecuted"
CanExecute="AlwaysTrue_CanExecute" />
<CommandBinding Command="local:MainWindow.EditTab"
Executed="EditTab_OnExecuted"
CanExecute="AlwaysTrue_CanExecute" />
<CommandBinding Command="local:MainWindow.DeleteTab"
Executed="DeleteTab_OnExecuted"
CanExecute="AlwaysTrue_CanExecute" />
</TabControl.CommandBindings>
<TabControl.Resources>
<Style TargetType="{x:Type MenuItem}"
BasedOn="{StaticResource DefaultMenuItemStyle}">
<!-- this is necessary to work around an issue where you have to select an item before commands check if they can execute -->
<Setter Property="CommandTarget"
Value="{Binding Path=PlacementTarget, RelativeSource={RelativeSource AncestorType={x:Type ContextMenu}}}" />
</Style>
<ContextMenu x:Key="TabContextMenu"
DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}"
d:DataContext="{d:DesignInstance local:Tab}">
<MenuItem Header="Edit"
Command="local:MainWindow.EditTab"
CommandParameter="{Binding}" />
<MenuItem Header="Delete"
Command="local:MainWindow.DeleteTab"
CommandParameter="{Binding}" />
</ContextMenu>
</TabControl.Resources>
<TabControl.ItemContainerStyle>
<Style TargetType="{x:Type TabItem}"
BasedOn="{StaticResource DefaultTabItemStyle}">
<Setter Property="ContextMenu"
Value="{StaticResource TabContextMenu}" />
</Style>
</TabControl.ItemContainerStyle>
<TabControl.ContextMenu>
<ContextMenu>
<MenuItem Header="Add tab"
Command="local:MainWindow.AddTab" />
<MenuItem Header="Manage tabs"
Command="local:MainWindow.ManageTabs" />
</ContextMenu>
</TabControl.ContextMenu>
<TabControl.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Name}" />
</DataTemplate>
</TabControl.ItemTemplate>
<TabControl.ContentTemplate>
<DataTemplate>
<Grid x:Name="TabGrid"
d:DataContext="{d:DesignInstance local:Tab}">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<ItemsControl Grid.Row="0"
x:Name="items"
Padding="4"
VirtualizingPanel.ScrollUnit="Pixel"
ItemsSource="{Binding .}">
<ItemsControl.Template>
<ControlTemplate TargetType="ItemsControl">
<ScrollViewer x:Name="scroller"
CanContentScroll="True"
Background="#333">
<ItemsPresenter Margin="0,0,16,0" />
</ScrollViewer>
</ControlTemplate>
</ItemsControl.Template>
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<VirtualizingStackPanel IsVirtualizing="True"
VirtualizationMode="Recycling"
VerticalAlignment="Bottom" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<cc:MessageTextBlock
FontFamily="Global User Interface, /Resources/fonts/#XIV AXIS Std ATK"
ProcessMarkdown="{Binding DataContext.ProcessMarkdown, ElementName=TabGrid}"
Message="{Binding .}">
<cc:MessageTextBlock.CommandBindings>
<CommandBinding Command="local:MainWindow.MessageSendTell"
Executed="MessageSendTell_OnExecuted"
CanExecute="MessageSendTell_CanExecute" />
</cc:MessageTextBlock.CommandBindings>
<cc:MessageTextBlock.ContextMenu>
<ContextMenu
DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}"
d:DataContext="{d:DesignInstance server:ServerMessage}">
<MenuItem Header="Send /tell to sender"
Command="local:MainWindow.MessageSendTell"
CommandParameter="{Binding}" />
</ContextMenu>
</cc:MessageTextBlock.ContextMenu>
</cc:MessageTextBlock>
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
<TextBlock Margin="8,4,0,0"
Grid.Row="1"
MouseDown="Channel_MouseDown"
Text="{Binding App.Connection.CurrentChannel, ElementName=Main, UpdateSourceTrigger=PropertyChanged}">
<TextBlock.CommandBindings>
<CommandBinding Command="local:MainWindow.ChangeChannel"
CanExecute="ChangeChannel_CanExecute"
Executed="ChangeChannel_Execute" />
</TextBlock.CommandBindings>
<TextBlock.ContextMenu>
<ContextMenu
DataContext="{Binding PlacementTarget.DataContext, RelativeSource={RelativeSource Self}}">
<MenuItem Header="Tell"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.Tell}" />
<MenuItem Header="Say"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.Say}" />
<MenuItem Header="Party"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.Party}" />
<MenuItem Header="Alliance"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.Alliance}" />
<MenuItem Header="Yell"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.Yell}" />
<MenuItem Header="Shout"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.Shout}" />
<MenuItem Header="Free Company"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.FreeCompany}" />
<MenuItem Header="PvP Team"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.PvpTeam}" />
<MenuItem Header="Novice Network"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.NoviceNetwork}" />
<MenuItem Header="Cross-world Linkshell [1]"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.CrossLinkshell1}" />
<MenuItem Header="Cross-world Linkshell [2]"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.CrossLinkshell2}" />
<MenuItem Header="Cross-world Linkshell [3]"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.CrossLinkshell3}" />
<MenuItem Header="Cross-world Linkshell [4]"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.CrossLinkshell4}" />
<MenuItem Header="Cross-world Linkshell [5]"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.CrossLinkshell5}" />
<MenuItem Header="Cross-world Linkshell [6]"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.CrossLinkshell6}" />
<MenuItem Header="Cross-world Linkshell [7]"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.CrossLinkshell7}" />
<MenuItem Header="Cross-world Linkshell [8]"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.CrossLinkshell8}" />
<MenuItem Header="Linkshell [1]"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.Linkshell1}" />
<MenuItem Header="Linkshell [2]"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.Linkshell2}" />
<MenuItem Header="Linkshell [3]"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.Linkshell3}" />
<MenuItem Header="Linkshell [4]"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.Linkshell4}" />
<MenuItem Header="Linkshell [5]"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.Linkshell5}" />
<MenuItem Header="Linkshell [6]"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.Linkshell6}" />
<MenuItem Header="Linkshell [7]"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.Linkshell7}" />
<MenuItem Header="Linkshell [8]"
Command="local:MainWindow.ChangeChannel"
CommandParameter="{x:Static message:InputChannel.Linkshell8}" />
</ContextMenu>
</TextBlock.ContextMenu>
</TextBlock>
<TextBox x:Name="InputBox"
ui:ControlHelper.PlaceholderText="{Binding InputPlaceholder, ElementName=Main, UpdateSourceTrigger=PropertyChanged}"
IsEnabled="{Binding App.Connection.Available, ElementName=Main, UpdateSourceTrigger=PropertyChanged, FallbackValue=False}"
Grid.Row="2"
Margin="0,0,0,8"
TextWrapping="Wrap"
SpellCheck.IsEnabled="True"
PreviewKeyDown="Input_Submit" />
</Grid>
</DataTemplate>
</TabControl.ContentTemplate>
</TabControl>
<StatusBar Grid.Row="2"
Visibility="{Binding App.Config.CompactMode, Converter={StaticResource InverseBoolToVisibilityConverter}}">
<StatusBarItem x:Name="LoggedInAs"
Content="Not logged in" />
<Separator x:Name="LoggedInAsSeparator"
Visibility="Collapsed" />
<StatusBarItem x:Name="CurrentWorld"
Visibility="Collapsed" />
<Separator x:Name="CurrentWorldSeparator"
Visibility="Collapsed" />
<StatusBarItem x:Name="Location"
Visibility="Collapsed" />
</StatusBar>
</Grid>
</local:XivChatWindow>