first commit
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
<UserControl x:Class="ClassicAssist.UI.Controls.CustomWindowTitleControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:misc="clr-namespace:ClassicAssist.UI.Misc"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="50" d:DesignWidth="800"
|
||||
DataContext="{Binding Mode=OneWay, RelativeSource={RelativeSource Self}}"
|
||||
Background="{DynamicResource ThemeWindowBackgroundBrush}">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../Resources/Icons.xaml" />
|
||||
<ResourceDictionary Source="../../Resources/ResourceDictionary.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<i:Interaction.Behaviors>
|
||||
<misc:WindowMouseDownBehaviour />
|
||||
</i:Interaction.Behaviors>
|
||||
<Grid Margin="5">
|
||||
<ContentPresenter Content="{Binding AdditionalContent}" DockPanel.Dock="Left" />
|
||||
<Label DockPanel.Dock="Left" Content="{Binding CustomTitle}" FontSize="16" Margin="5,0,5,0"
|
||||
Foreground="{DynamicResource ThemeForegroundBrush}" />
|
||||
<StackPanel DockPanel.Dock="Right" HorizontalAlignment="Right" Orientation="Horizontal">
|
||||
<Button Background="{DynamicResource ThemeWindowBackgroundBrush}" BorderBrush="Transparent" Height="24"
|
||||
Width="24" DockPanel.Dock="Right"
|
||||
IsEnabled="{Binding CanMinimize}">
|
||||
<i:Interaction.Behaviors>
|
||||
<misc:WindowCommandBehaviour Command="Minimize" />
|
||||
</i:Interaction.Behaviors>
|
||||
<Image Source="{StaticResource minusIcon}" />
|
||||
</Button>
|
||||
<Button Background="{DynamicResource ThemeWindowBackgroundBrush}" BorderBrush="Transparent" Height="24"
|
||||
Width="24" DockPanel.Dock="Right"
|
||||
IsEnabled="{Binding CanMaximize}">
|
||||
<i:Interaction.Behaviors>
|
||||
<misc:WindowCommandBehaviour Command="Maximize" />
|
||||
</i:Interaction.Behaviors>
|
||||
<Image Source="{StaticResource squareIcon}" />
|
||||
</Button>
|
||||
<Button Background="{DynamicResource ThemeWindowBackgroundBrush}" BorderBrush="Transparent" Height="24"
|
||||
Width="24" DockPanel.Dock="Right"
|
||||
IsEnabled="{Binding CanClose}">
|
||||
<i:Interaction.Behaviors>
|
||||
<misc:WindowCommandBehaviour Command="Close" />
|
||||
</i:Interaction.Behaviors>
|
||||
<Image Source="{StaticResource closeIcon}" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,65 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace ClassicAssist.UI.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for CustomWindowTitleControl.xaml
|
||||
/// </summary>
|
||||
public partial class CustomWindowTitleControl
|
||||
{
|
||||
public static readonly DependencyProperty AdditionalContentProperty =
|
||||
DependencyProperty.Register( "AdditionalContent", typeof( object ), typeof( CustomWindowTitleControl ),
|
||||
new PropertyMetadata( null ) );
|
||||
|
||||
public static readonly DependencyProperty CustomTitleProperty = DependencyProperty.Register( "CustomTitle",
|
||||
typeof( string ), typeof( CustomWindowTitleControl ),
|
||||
new FrameworkPropertyMetadata( default( string ), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault ) );
|
||||
|
||||
public static readonly DependencyProperty CanCloseProperty = DependencyProperty.Register( "CanClose",
|
||||
typeof( bool ), typeof( CustomWindowTitleControl ),
|
||||
new FrameworkPropertyMetadata( true, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault ) );
|
||||
|
||||
public static readonly DependencyProperty CanMinimizeProperty = DependencyProperty.Register( "CanMinimize",
|
||||
typeof( bool ), typeof( CustomWindowTitleControl ),
|
||||
new FrameworkPropertyMetadata( true, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault ) );
|
||||
|
||||
public static readonly DependencyProperty CanMaxmizeProperty = DependencyProperty.Register( "CanMaximize",
|
||||
typeof( bool ), typeof( CustomWindowTitleControl ),
|
||||
new FrameworkPropertyMetadata( true, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault ) );
|
||||
|
||||
public CustomWindowTitleControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public object AdditionalContent
|
||||
{
|
||||
get => GetValue( AdditionalContentProperty );
|
||||
set => SetValue( AdditionalContentProperty, value );
|
||||
}
|
||||
|
||||
public bool CanClose
|
||||
{
|
||||
get => (bool) GetValue( CanCloseProperty );
|
||||
set => SetValue( CanCloseProperty, value );
|
||||
}
|
||||
|
||||
public bool CanMaximize
|
||||
{
|
||||
get => (bool) GetValue( CanMaxmizeProperty );
|
||||
set => SetValue( CanMaxmizeProperty, value );
|
||||
}
|
||||
|
||||
public bool CanMinimize
|
||||
{
|
||||
get => (bool) GetValue( CanMinimizeProperty );
|
||||
set => SetValue( CanMinimizeProperty, value );
|
||||
}
|
||||
|
||||
public string CustomTitle
|
||||
{
|
||||
get => (string) GetValue( CustomTitleProperty );
|
||||
set => SetValue( CustomTitleProperty, value );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<UserControl x:Name="root" x:Class="ClassicAssist.UI.Controls.EditTextBlock"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:valueConverters="clr-namespace:ClassicAssist.UI.Misc.ValueConverters"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||
<DrawingImage x:Key="PencilIcon">
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V512 H512 V0 H0 Z">
|
||||
<DrawingGroup Opacity="1">
|
||||
<DrawingGroup Opacity="1">
|
||||
<GeometryDrawing
|
||||
Geometry="F1 M512,512z M0,0z M434.214,0L0,434.213 0,512 77.787,512 512,77.786 434.214,0z M65.359,481.998L30.002,481.998 30.002,446.641 50.125,426.518 85.482,461.875 65.359,481.998z M399.206,77.437L434.214,42.429 469.571,77.786 434.563,112.794 399.206,77.437z"
|
||||
Brush="{Binding Foreground, ElementName=root}" />
|
||||
</DrawingGroup>
|
||||
</DrawingGroup>
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
<valueConverters:PriorityMultiValueConverter x:Key="PriorityMultiValueConverter" />
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<TextBlock x:Name="textBlock" VerticalAlignment="Center"
|
||||
MouseDown="TextBlock_OnMouseDown" Background="Transparent"
|
||||
Foreground="{Binding Foreground, ElementName=root}">
|
||||
<TextBlock.Text>
|
||||
<MultiBinding Converter="{StaticResource PriorityMultiValueConverter}">
|
||||
<Binding Path="Label" ElementName="root" />
|
||||
<Binding Path="Text" ElementName="root" />
|
||||
</MultiBinding>
|
||||
</TextBlock.Text>
|
||||
</TextBlock>
|
||||
<TextBox x:Name="textBox"
|
||||
Text="{Binding ElementName=root, Path=Text, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
|
||||
VerticalAlignment="Center" Visibility="Collapsed" KeyDown="TextBox_OnKeyDown"
|
||||
LostFocus="TextBox_LostFocus" />
|
||||
<Button Width="12" Height="12" BorderThickness="0" Background="Transparent" Margin="0" Padding="0"
|
||||
HorizontalAlignment="Right"
|
||||
Visibility="{Binding ShowIcon, Converter={StaticResource BooleanToVisibilityConverter}, ElementName=root}"
|
||||
Click="Button_OnClick" x:Name="pencilButton">
|
||||
<Image Source="{StaticResource PencilIcon}" Width="16" HorizontalAlignment="Center" />
|
||||
</Button>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,89 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace ClassicAssist.UI.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for EditTextBlock.xaml
|
||||
/// </summary>
|
||||
public partial class EditTextBlock
|
||||
{
|
||||
public static readonly DependencyProperty TextProperty = DependencyProperty.Register( "Text", typeof( string ),
|
||||
typeof( EditTextBlock ),
|
||||
new FrameworkPropertyMetadata( null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault ) );
|
||||
|
||||
public static readonly DependencyProperty LabelProperty = DependencyProperty.Register( "Label",
|
||||
typeof( string ), typeof( EditTextBlock ),
|
||||
new FrameworkPropertyMetadata( null, FrameworkPropertyMetadataOptions.None ) );
|
||||
|
||||
public static readonly DependencyProperty ShowIconProperty = DependencyProperty.Register( "ShowIcon",
|
||||
typeof( bool ), typeof( EditTextBlock ), new UIPropertyMetadata() );
|
||||
|
||||
public EditTextBlock()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public string Label
|
||||
{
|
||||
get => (string) GetValue( LabelProperty );
|
||||
set => SetValue( LabelProperty, value );
|
||||
}
|
||||
|
||||
public bool ShowIcon
|
||||
{
|
||||
get => (bool) GetValue( ShowIconProperty );
|
||||
set => SetValue( ShowIconProperty, value );
|
||||
}
|
||||
|
||||
public string Text
|
||||
{
|
||||
get => (string) GetValue( TextProperty );
|
||||
set => SetValue( TextProperty, value );
|
||||
}
|
||||
|
||||
private void TextBlock_OnMouseDown( object sender, MouseButtonEventArgs e )
|
||||
{
|
||||
if ( e.ClickCount <= 1 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ShowTextBox();
|
||||
}
|
||||
|
||||
private void ShowTextBox()
|
||||
{
|
||||
textBlock.Visibility = Visibility.Collapsed;
|
||||
pencilButton.Visibility = Visibility.Collapsed;
|
||||
textBox.Visibility = Visibility.Visible;
|
||||
textBox.CaretIndex = textBox.Text.Length;
|
||||
textBox.SelectAll();
|
||||
|
||||
Dispatcher?.BeginInvoke( (Action) ( () => Keyboard.Focus( textBox ) ), DispatcherPriority.Render );
|
||||
}
|
||||
|
||||
private void TextBox_OnKeyDown( object sender, KeyEventArgs e )
|
||||
{
|
||||
if ( e.Key == Key.Return )
|
||||
{
|
||||
TextBox_LostFocus( sender, null );
|
||||
}
|
||||
}
|
||||
|
||||
private void TextBox_LostFocus( object sender, RoutedEventArgs e )
|
||||
{
|
||||
textBlock.Visibility = Visibility.Visible;
|
||||
pencilButton.Visibility = ShowIcon ? Visibility.Visible : Visibility.Hidden;
|
||||
( (TextBox) sender ).Visibility = Visibility.Collapsed;
|
||||
}
|
||||
|
||||
private void Button_OnClick( object sender, RoutedEventArgs e )
|
||||
{
|
||||
ShowTextBox();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
<UserControl x:Class="ClassicAssist.UI.Controls.HexDumpControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ClassicAssist.UI.Controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="600">
|
||||
<UserControl.Resources>
|
||||
<Style x:Key="TextBlockStyle" TargetType="TextBlock">
|
||||
<Setter Property="FontFamily" Value="Consolas" />
|
||||
</Style>
|
||||
</UserControl.Resources>
|
||||
<StackPanel
|
||||
DataContext="{Binding Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type local:HexDumpControl}}}">
|
||||
<Label Content="{Binding Packet.Title}" />
|
||||
<Grid>
|
||||
<Grid.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="Copy byte[] declaration" Click="Copy_OnClick" />
|
||||
<MenuItem Header="Replay" Click="Replay_OnClick" />
|
||||
</ContextMenu>
|
||||
</Grid.ContextMenu>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBlock Text="{Binding BinaryData}" Style="{StaticResource TextBlockStyle}" Grid.Column="0"
|
||||
ScrollViewer.VerticalScrollBarVisibility="Disabled" Margin="10,10,0,0" Width="310" />
|
||||
<TextBlock Text="{Binding TextData}" Style="{StaticResource TextBlockStyle}" Grid.Column="1"
|
||||
Margin="10,10,0,0" ScrollViewer.VerticalScrollBarVisibility="Disabled" />
|
||||
</Grid>
|
||||
<Label Content="{Binding Status}" />
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,154 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
using System.Windows;
|
||||
using ClassicAssist.Shared;
|
||||
using ClassicAssist.UI.Misc;
|
||||
using ClassicAssist.UO.Network.PacketFilter;
|
||||
|
||||
namespace ClassicAssist.UI.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for HexDumpControl.xaml
|
||||
/// </summary>
|
||||
public partial class HexDumpControl
|
||||
{
|
||||
public static readonly DependencyProperty PacketProperty = DependencyProperty.Register( "Packet",
|
||||
typeof( PacketEntry ), typeof( HexDumpControl ), new UIPropertyMetadata() );
|
||||
|
||||
public HexDumpControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public string BinaryData
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( Packet?.Data == null )
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
StringBuilder binaryBuilder = new StringBuilder();
|
||||
|
||||
for ( int i = 0; i < Packet.Length; i++ )
|
||||
{
|
||||
byte b1 = (byte) ( Packet.Data[i] >> 4 );
|
||||
byte b2 = (byte) ( Packet.Data[i] & 0xF );
|
||||
binaryBuilder.Append( (char) ( b1 > 9 ? b1 + 0x37 : b1 + 0x30 ) );
|
||||
binaryBuilder.Append( (char) ( b2 > 9 ? b2 + 0x37 : b2 + 0x30 ) );
|
||||
binaryBuilder.Append( ' ' );
|
||||
|
||||
if ( ( i + 1 ) % 16 != 0 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
binaryBuilder.Remove( binaryBuilder.Length - 1, 1 );
|
||||
binaryBuilder.AppendLine();
|
||||
}
|
||||
|
||||
return binaryBuilder.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
public PacketEntry Packet
|
||||
{
|
||||
get => (PacketEntry) GetValue( PacketProperty );
|
||||
set => SetValue( PacketProperty, value );
|
||||
}
|
||||
|
||||
public string Status
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( Packet?.Data == null )
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
return "Length: " + Packet.Length;
|
||||
}
|
||||
}
|
||||
|
||||
public string TextData
|
||||
{
|
||||
get
|
||||
{
|
||||
if ( Packet?.Data == null )
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
StringBuilder textBuilder = new StringBuilder();
|
||||
|
||||
for ( int i = 0; i < Packet.Length; i++ )
|
||||
{
|
||||
byte b1 = Packet.Data[i];
|
||||
|
||||
if ( b1 < 0x20 || b1 == 0xB7 || b1 == 0xFF )
|
||||
{
|
||||
b1 = (byte) '.';
|
||||
}
|
||||
|
||||
textBuilder.Append( (char) b1 );
|
||||
|
||||
if ( ( i + 1 ) % 16 == 0 )
|
||||
{
|
||||
textBuilder.AppendLine();
|
||||
}
|
||||
}
|
||||
|
||||
return textBuilder.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
private void Copy_OnClick( object sender, RoutedEventArgs e )
|
||||
{
|
||||
try
|
||||
{
|
||||
string prepend = "byte[] packet = new byte[] { ";
|
||||
|
||||
for ( int i = 0; i < Packet.Data.Length; i++ )
|
||||
{
|
||||
prepend += $"0x{Packet.Data[i]:X2}";
|
||||
|
||||
if ( i + 1 < Packet.Data.Length )
|
||||
{
|
||||
prepend += ", ";
|
||||
}
|
||||
}
|
||||
|
||||
prepend += " };";
|
||||
|
||||
Clipboard.SetData( DataFormats.Text, prepend );
|
||||
}
|
||||
catch ( Exception )
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
|
||||
private void Replay_OnClick( object sender, RoutedEventArgs e )
|
||||
{
|
||||
if ( Packet == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( Packet.Direction )
|
||||
{
|
||||
case PacketDirection.Incoming:
|
||||
Engine.SendPacketToClient( Packet.Data, Packet.Data.Length );
|
||||
break;
|
||||
case PacketDirection.Outgoing:
|
||||
Engine.SendPacketToServer( Packet.Data, Packet.Data.Length );
|
||||
break;
|
||||
case PacketDirection.Any:
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<UserControl x:Class="ClassicAssist.UI.Controls.HueEntryControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ClassicAssist.UI.Controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="20" d:DesignWidth="640">
|
||||
<d:DesignerProperties.DesignStyle>
|
||||
<Style TargetType="UserControl">
|
||||
<Setter Property="Background" Value="White" />
|
||||
</Style>
|
||||
</d:DesignerProperties.DesignStyle>
|
||||
<StackPanel Orientation="Horizontal" x:Name="StackPanel">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="Rectangle">
|
||||
<Setter Property="Fill" Value="Black" />
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
</StackPanel>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,56 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Shapes;
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UI.Controls
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for HueEntryControl.xaml
|
||||
/// </summary>
|
||||
public partial class HueEntryControl : UserControl
|
||||
{
|
||||
public static readonly DependencyProperty HueEntryProperty = DependencyProperty.Register( "HueEntry",
|
||||
typeof( HueEntry ), typeof( HueEntryControl ),
|
||||
new FrameworkPropertyMetadata( default( HueEntry ), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
|
||||
PropertyChangedCallback ) );
|
||||
|
||||
public HueEntryControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public HueEntry HueEntry
|
||||
{
|
||||
get => (HueEntry) GetValue( HueEntryProperty );
|
||||
set => SetValue( HueEntryProperty, value );
|
||||
}
|
||||
|
||||
private static void PropertyChangedCallback( DependencyObject d, DependencyPropertyChangedEventArgs e )
|
||||
{
|
||||
if ( d is HueEntryControl control )
|
||||
{
|
||||
control.SetHues( (HueEntry) e.NewValue );
|
||||
}
|
||||
}
|
||||
|
||||
private void SetHues( HueEntry entry )
|
||||
{
|
||||
for ( int i = 0; i < 32; i++ )
|
||||
{
|
||||
SolidColorBrush brush = new SolidColorBrush( Convert555ToARGB( entry.Colors[i] ) );
|
||||
|
||||
StackPanel.Children.Add( new Rectangle { Fill = brush, Width = 10 } );
|
||||
}
|
||||
}
|
||||
|
||||
protected static Color Convert555ToARGB( short Col )
|
||||
{
|
||||
int r = ( (short) ( Col >> 10 ) & 31 ) * 8;
|
||||
int g = ( (short) ( Col >> 5 ) & 31 ) * 8;
|
||||
int b = ( Col & 31 ) * 8;
|
||||
return Color.FromArgb( 255, (byte) r, (byte) g, (byte) b );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,324 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClassicAssist.UI.Controls
|
||||
{
|
||||
/*
|
||||
* https://stackoverflow.com/questions/8004981/how-to-make-wpf-wrappanel-child-items-to-stretch
|
||||
*/
|
||||
public class StretchyWrapPanel : Panel
|
||||
{
|
||||
public static readonly DependencyProperty ItemWidthProperty = DependencyProperty.Register( nameof( ItemWidth ),
|
||||
typeof( double ), typeof( StretchyWrapPanel ),
|
||||
new FrameworkPropertyMetadata( double.NaN, FrameworkPropertyMetadataOptions.AffectsMeasure ) );
|
||||
|
||||
public static readonly DependencyProperty ItemHeightProperty =
|
||||
DependencyProperty.Register( nameof( ItemHeight ), typeof( double ), typeof( StretchyWrapPanel ),
|
||||
new FrameworkPropertyMetadata( double.NaN, FrameworkPropertyMetadataOptions.AffectsMeasure ) );
|
||||
|
||||
public static readonly DependencyProperty OrientationProperty =
|
||||
StackPanel.OrientationProperty.AddOwner( typeof( StretchyWrapPanel ),
|
||||
new FrameworkPropertyMetadata( Orientation.Horizontal, FrameworkPropertyMetadataOptions.AffectsMeasure,
|
||||
OnOrientationChanged ) );
|
||||
|
||||
public static readonly DependencyProperty StretchProportionallyProperty =
|
||||
DependencyProperty.Register( nameof( StretchProportionally ), typeof( bool ), typeof( StretchyWrapPanel ),
|
||||
new PropertyMetadata( true, OnStretchProportionallyChanged ) );
|
||||
|
||||
private Orientation _orientation = Orientation.Horizontal;
|
||||
|
||||
private bool _stretchProportionally = true;
|
||||
|
||||
[TypeConverter( typeof( LengthConverter ) )]
|
||||
public double ItemHeight
|
||||
{
|
||||
get => (double) GetValue( ItemHeightProperty );
|
||||
set => SetValue( ItemHeightProperty, value );
|
||||
}
|
||||
|
||||
[TypeConverter( typeof( LengthConverter ) )]
|
||||
public double ItemWidth
|
||||
{
|
||||
get => (double) GetValue( ItemWidthProperty );
|
||||
set => SetValue( ItemWidthProperty, value );
|
||||
}
|
||||
|
||||
public Orientation Orientation
|
||||
{
|
||||
get => _orientation;
|
||||
set => SetValue( OrientationProperty, value );
|
||||
}
|
||||
|
||||
public bool StretchProportionally
|
||||
{
|
||||
get => _stretchProportionally;
|
||||
set => SetValue( StretchProportionallyProperty, value );
|
||||
}
|
||||
|
||||
private static void OnOrientationChanged( DependencyObject d, DependencyPropertyChangedEventArgs e )
|
||||
{
|
||||
( (StretchyWrapPanel) d )._orientation = (Orientation) e.NewValue;
|
||||
}
|
||||
|
||||
private static void OnStretchProportionallyChanged( DependencyObject o, DependencyPropertyChangedEventArgs e )
|
||||
{
|
||||
( (StretchyWrapPanel) o )._stretchProportionally = (bool) e.NewValue;
|
||||
}
|
||||
|
||||
protected override Size MeasureOverride( Size constraint )
|
||||
{
|
||||
UVSize curLineSize = new UVSize( Orientation );
|
||||
UVSize panelSize = new UVSize( Orientation );
|
||||
UVSize uvConstraint = new UVSize( Orientation, constraint.Width, constraint.Height );
|
||||
double itemWidth = ItemWidth;
|
||||
double itemHeight = ItemHeight;
|
||||
bool itemWidthSet = !double.IsNaN( itemWidth );
|
||||
bool itemHeightSet = !double.IsNaN( itemHeight );
|
||||
|
||||
Size childConstraint = new Size( itemWidthSet ? itemWidth : constraint.Width,
|
||||
itemHeightSet ? itemHeight : constraint.Height );
|
||||
|
||||
UIElementCollection children = InternalChildren;
|
||||
|
||||
for ( int i = 0, count = children.Count; i < count; i++ )
|
||||
{
|
||||
UIElement child = children[i];
|
||||
|
||||
if ( child == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Flow passes its own constrint to children
|
||||
child.Measure( childConstraint );
|
||||
|
||||
// This is the size of the child in UV space
|
||||
UVSize sz = new UVSize( Orientation, itemWidthSet ? itemWidth : child.DesiredSize.Width,
|
||||
itemHeightSet ? itemHeight : child.DesiredSize.Height );
|
||||
|
||||
if ( curLineSize.U + sz.U > uvConstraint.U )
|
||||
{
|
||||
// Need to switch to another line
|
||||
panelSize.U = Math.Max( curLineSize.U, panelSize.U );
|
||||
panelSize.V += curLineSize.V;
|
||||
curLineSize = sz;
|
||||
|
||||
if ( sz.U > uvConstraint.U )
|
||||
{
|
||||
// The element is wider then the constrint - give it a separate line
|
||||
panelSize.U = Math.Max( sz.U, panelSize.U );
|
||||
panelSize.V += sz.V;
|
||||
curLineSize = new UVSize( Orientation );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Continue to accumulate a line
|
||||
curLineSize.U += sz.U;
|
||||
curLineSize.V = Math.Max( sz.V, curLineSize.V );
|
||||
}
|
||||
}
|
||||
|
||||
// The last line size, if any should be added
|
||||
panelSize.U = Math.Max( curLineSize.U, panelSize.U );
|
||||
panelSize.V += curLineSize.V;
|
||||
|
||||
// Go from UV space to W/H space
|
||||
return new Size( panelSize.Width, panelSize.Height );
|
||||
}
|
||||
|
||||
protected override Size ArrangeOverride( Size finalSize )
|
||||
{
|
||||
int firstInLine = 0;
|
||||
double itemWidth = ItemWidth;
|
||||
double itemHeight = ItemHeight;
|
||||
double accumulatedV = 0;
|
||||
double itemU = Orientation == Orientation.Horizontal ? itemWidth : itemHeight;
|
||||
UVSize curLineSize = new UVSize( Orientation );
|
||||
UVSize uvFinalSize = new UVSize( Orientation, finalSize.Width, finalSize.Height );
|
||||
bool itemWidthSet = !double.IsNaN( itemWidth );
|
||||
bool itemHeightSet = !double.IsNaN( itemHeight );
|
||||
bool useItemU = Orientation == Orientation.Horizontal ? itemWidthSet : itemHeightSet;
|
||||
|
||||
UIElementCollection children = InternalChildren;
|
||||
|
||||
for ( int i = 0, count = children.Count; i < count; i++ )
|
||||
{
|
||||
UIElement child = children[i];
|
||||
|
||||
if ( child == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
UVSize sz = new UVSize( Orientation, itemWidthSet ? itemWidth : child.DesiredSize.Width,
|
||||
itemHeightSet ? itemHeight : child.DesiredSize.Height );
|
||||
|
||||
if ( curLineSize.U + sz.U > uvFinalSize.U )
|
||||
{
|
||||
// Need to switch to another line
|
||||
if ( !useItemU && StretchProportionally )
|
||||
{
|
||||
ArrangeLineProportionally( accumulatedV, curLineSize.V, firstInLine, i, uvFinalSize.Width );
|
||||
}
|
||||
else
|
||||
{
|
||||
ArrangeLine( accumulatedV, curLineSize.V, firstInLine, i, true,
|
||||
useItemU ? itemU : uvFinalSize.Width / Math.Max( 1, i - firstInLine - 1 ) );
|
||||
}
|
||||
|
||||
accumulatedV += curLineSize.V;
|
||||
curLineSize = sz;
|
||||
|
||||
if ( sz.U > uvFinalSize.U )
|
||||
{
|
||||
// The element is wider then the constraint - give it a separate line
|
||||
// Switch to next line which only contain one element
|
||||
if ( !useItemU && StretchProportionally )
|
||||
{
|
||||
ArrangeLineProportionally( accumulatedV, sz.V, i, ++i, uvFinalSize.Width );
|
||||
}
|
||||
else
|
||||
{
|
||||
ArrangeLine( accumulatedV, sz.V, i, ++i, true, useItemU ? itemU : uvFinalSize.Width );
|
||||
}
|
||||
|
||||
accumulatedV += sz.V;
|
||||
curLineSize = new UVSize( Orientation );
|
||||
}
|
||||
|
||||
firstInLine = i;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Continue to accumulate a line
|
||||
curLineSize.U += sz.U;
|
||||
curLineSize.V = Math.Max( sz.V, curLineSize.V );
|
||||
}
|
||||
}
|
||||
|
||||
// Arrange the last line, if any
|
||||
if ( firstInLine < children.Count )
|
||||
{
|
||||
if ( !useItemU && StretchProportionally )
|
||||
{
|
||||
ArrangeLineProportionally( accumulatedV, curLineSize.V, firstInLine, children.Count,
|
||||
uvFinalSize.Width );
|
||||
}
|
||||
else
|
||||
{
|
||||
ArrangeLine( accumulatedV, curLineSize.V, firstInLine, children.Count, true,
|
||||
useItemU ? itemU : uvFinalSize.Width / Math.Max( 1, children.Count - firstInLine - 1 ) );
|
||||
}
|
||||
}
|
||||
|
||||
return finalSize;
|
||||
}
|
||||
|
||||
private void ArrangeLineProportionally( double v, double lineV, int start, int end, double limitU )
|
||||
{
|
||||
double u = 0d;
|
||||
bool horizontal = Orientation == Orientation.Horizontal;
|
||||
UIElementCollection children = InternalChildren;
|
||||
|
||||
double total = 0d;
|
||||
|
||||
for ( int i = start; i < end; i++ )
|
||||
{
|
||||
total += horizontal ? children[i].DesiredSize.Width : children[i].DesiredSize.Height;
|
||||
}
|
||||
|
||||
double uMultipler = limitU / total;
|
||||
|
||||
for ( int i = start; i < end; i++ )
|
||||
{
|
||||
UIElement child = children[i];
|
||||
|
||||
if ( child != null )
|
||||
{
|
||||
UVSize childSize = new UVSize( Orientation, child.DesiredSize.Width, child.DesiredSize.Height );
|
||||
double layoutSlotU = childSize.U * uMultipler;
|
||||
child.Arrange( new Rect( horizontal ? u : v, horizontal ? v : u, horizontal ? layoutSlotU : lineV,
|
||||
horizontal ? lineV : layoutSlotU ) );
|
||||
u += layoutSlotU;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ArrangeLine( double v, double lineV, int start, int end, bool useItemU, double itemU )
|
||||
{
|
||||
double u = 0d;
|
||||
bool horizontal = Orientation == Orientation.Horizontal;
|
||||
UIElementCollection children = InternalChildren;
|
||||
|
||||
for ( int i = start; i < end; i++ )
|
||||
{
|
||||
UIElement child = children[i];
|
||||
|
||||
if ( child != null )
|
||||
{
|
||||
UVSize childSize = new UVSize( Orientation, child.DesiredSize.Width, child.DesiredSize.Height );
|
||||
double layoutSlotU = useItemU ? itemU : childSize.U;
|
||||
child.Arrange( new Rect( horizontal ? u : v, horizontal ? v : u, horizontal ? layoutSlotU : lineV,
|
||||
horizontal ? lineV : layoutSlotU ) );
|
||||
u += layoutSlotU;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private struct UVSize
|
||||
{
|
||||
internal UVSize( Orientation orientation, double width, double height )
|
||||
{
|
||||
U = V = 0d;
|
||||
_orientation = orientation;
|
||||
Width = width;
|
||||
Height = height;
|
||||
}
|
||||
|
||||
internal UVSize( Orientation orientation )
|
||||
{
|
||||
U = V = 0d;
|
||||
_orientation = orientation;
|
||||
}
|
||||
|
||||
internal double U;
|
||||
internal double V;
|
||||
private readonly Orientation _orientation;
|
||||
|
||||
internal double Width
|
||||
{
|
||||
get => _orientation == Orientation.Horizontal ? U : V;
|
||||
private set
|
||||
{
|
||||
if ( _orientation == Orientation.Horizontal )
|
||||
{
|
||||
U = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
V = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal double Height
|
||||
{
|
||||
get => _orientation == Orientation.Horizontal ? V : U;
|
||||
private set
|
||||
{
|
||||
if ( _orientation == Orientation.Horizontal )
|
||||
{
|
||||
V = value;
|
||||
}
|
||||
else
|
||||
{
|
||||
U = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
<UserControl x:Class="ClassicAssist.UI.Controls.TextBoxKey"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="300" x:Name="UserControl">
|
||||
<Grid>
|
||||
<TextBox Text="{Binding Shortcut, ElementName=UserControl, Mode=OneWay}"
|
||||
PreviewKeyDown="TextBox_PreviewKeyDown" IsReadOnly="True" IsReadOnlyCaretVisible="False"
|
||||
IsUndoEnabled="False" PreviewMouseDown="UIElement_OnPreviewMouseDown"
|
||||
MouseWheel="UIElement_OnMouseWheel" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,98 @@
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using ClassicAssist.Data.Hotkeys;
|
||||
using Key = ClassicAssist.Misc.Key;
|
||||
|
||||
namespace ClassicAssist.UI.Controls
|
||||
{
|
||||
/// <inheritdoc cref="TextBox" />
|
||||
/// <summary>
|
||||
/// Interaction logic for TestBoxKey.xaml
|
||||
/// </summary>
|
||||
public partial class TextBoxKey
|
||||
{
|
||||
public static readonly DependencyProperty ShortcutProperty = DependencyProperty.Register( nameof( Shortcut ),
|
||||
typeof( ShortcutKeys ), typeof( TextBoxKey ),
|
||||
new FrameworkPropertyMetadata( default( ShortcutKeys ),
|
||||
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault ) );
|
||||
|
||||
private readonly Key[] _modifiers =
|
||||
{
|
||||
Key.LeftCtrl, Key.RightCtrl, Key.LeftShift, Key.RightShift, Key.LeftAlt, Key.RightAlt
|
||||
};
|
||||
|
||||
public TextBoxKey()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public Key Key { get; private set; }
|
||||
public Key Modifier { get; set; }
|
||||
|
||||
public object Shortcut
|
||||
{
|
||||
get => GetValue( ShortcutProperty );
|
||||
set => SetValue( ShortcutProperty, value );
|
||||
}
|
||||
|
||||
private Key CheckModifiers()
|
||||
{
|
||||
return _modifiers.FirstOrDefault( e => Keyboard.IsKeyDown( (System.Windows.Input.Key) e ) );
|
||||
}
|
||||
|
||||
private bool IsModifier( Key key )
|
||||
{
|
||||
return _modifiers.Any( k => key == k );
|
||||
}
|
||||
|
||||
private void TextBox_PreviewKeyDown( object sender, KeyEventArgs e )
|
||||
{
|
||||
e.Handled = true;
|
||||
Key key = (Key) e.Key;
|
||||
|
||||
if ( key == Key.System )
|
||||
{
|
||||
key = (Key) e.SystemKey;
|
||||
}
|
||||
|
||||
if ( IsModifier( key ) )
|
||||
{
|
||||
e.Handled = true;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Modifier = CheckModifiers();
|
||||
|
||||
Key = key;
|
||||
|
||||
Shortcut = new ShortcutKeys { Modifier = Modifier, Key = Key };
|
||||
}
|
||||
|
||||
private void UIElement_OnPreviewMouseDown( object sender, MouseButtonEventArgs e )
|
||||
{
|
||||
if ( ( e.ChangedButton == MouseButton.Left ) | ( e.ChangedButton == MouseButton.Right ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
e.Handled = true;
|
||||
|
||||
Modifier = CheckModifiers();
|
||||
|
||||
Shortcut = new ShortcutKeys { Mouse = (MouseOptions) e.ChangedButton };
|
||||
}
|
||||
|
||||
private void UIElement_OnMouseWheel( object sender, MouseWheelEventArgs e )
|
||||
{
|
||||
e.Handled = true;
|
||||
|
||||
Modifier = CheckModifiers();
|
||||
|
||||
Shortcut = e.Delta < 0
|
||||
? new ShortcutKeys { Mouse = MouseOptions.MouseWheelDown, Modifier = Modifier }
|
||||
: new ShortcutKeys { Mouse = MouseOptions.MouseWheelUp, Modifier = Modifier };
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClassicAssist.UI.Misc
|
||||
{
|
||||
internal class ListBoxBehavior
|
||||
{
|
||||
private static readonly Dictionary<ListBox, Capture> Associations = new Dictionary<ListBox, Capture>();
|
||||
|
||||
public static readonly DependencyProperty ScrollOnNewItemProperty =
|
||||
DependencyProperty.RegisterAttached( "ScrollOnNewItem", typeof( bool ), typeof( ListBoxBehavior ),
|
||||
new UIPropertyMetadata( false, OnScrollOnNewItemChanged ) );
|
||||
|
||||
public static bool GetScrollOnNewItem( DependencyObject obj )
|
||||
{
|
||||
return (bool) obj.GetValue( ScrollOnNewItemProperty );
|
||||
}
|
||||
|
||||
public static void SetScrollOnNewItem( DependencyObject obj, bool value )
|
||||
{
|
||||
obj.SetValue( ScrollOnNewItemProperty, value );
|
||||
}
|
||||
|
||||
public static void OnScrollOnNewItemChanged( DependencyObject d, DependencyPropertyChangedEventArgs e )
|
||||
{
|
||||
ListBox listBox = d as ListBox;
|
||||
|
||||
if ( listBox == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool oldValue = (bool) e.OldValue, newValue = (bool) e.NewValue;
|
||||
|
||||
if ( newValue == oldValue )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( newValue )
|
||||
{
|
||||
listBox.Loaded += ListBox_Loaded;
|
||||
listBox.Unloaded += ListBox_Unloaded;
|
||||
PropertyDescriptor itemsSourcePropertyDescriptor =
|
||||
TypeDescriptor.GetProperties( listBox )["ItemsSource"];
|
||||
itemsSourcePropertyDescriptor.AddValueChanged( listBox, ListBox_ItemsSourceChanged );
|
||||
}
|
||||
else
|
||||
{
|
||||
listBox.Loaded -= ListBox_Loaded;
|
||||
listBox.Unloaded -= ListBox_Unloaded;
|
||||
|
||||
if ( Associations.ContainsKey( listBox ) )
|
||||
{
|
||||
Associations[listBox].Dispose();
|
||||
}
|
||||
|
||||
PropertyDescriptor itemsSourcePropertyDescriptor =
|
||||
TypeDescriptor.GetProperties( listBox )["ItemsSource"];
|
||||
itemsSourcePropertyDescriptor.RemoveValueChanged( listBox, ListBox_ItemsSourceChanged );
|
||||
}
|
||||
}
|
||||
|
||||
private static void ListBox_ItemsSourceChanged( object sender, EventArgs e )
|
||||
{
|
||||
ListBox listBox = (ListBox) sender;
|
||||
|
||||
if ( Associations.ContainsKey( listBox ) )
|
||||
{
|
||||
Associations[listBox].Dispose();
|
||||
}
|
||||
|
||||
Associations[listBox] = new Capture( listBox );
|
||||
}
|
||||
|
||||
private static void ListBox_Unloaded( object sender, RoutedEventArgs e )
|
||||
{
|
||||
ListBox listBox = (ListBox) sender;
|
||||
|
||||
if ( Associations.ContainsKey( listBox ) )
|
||||
{
|
||||
Associations[listBox].Dispose();
|
||||
}
|
||||
|
||||
listBox.Unloaded -= ListBox_Unloaded;
|
||||
}
|
||||
|
||||
private static void ListBox_Loaded( object sender, RoutedEventArgs e )
|
||||
{
|
||||
ListBox listBox = (ListBox) sender;
|
||||
|
||||
listBox.Loaded -= ListBox_Loaded;
|
||||
Associations[listBox] = new Capture( listBox );
|
||||
}
|
||||
|
||||
private class Capture : IDisposable
|
||||
{
|
||||
private readonly INotifyCollectionChanged incc;
|
||||
private readonly ListBox listBox;
|
||||
|
||||
public Capture( ListBox listBox )
|
||||
{
|
||||
this.listBox = listBox;
|
||||
incc = listBox.ItemsSource as INotifyCollectionChanged;
|
||||
|
||||
if ( incc != null )
|
||||
{
|
||||
incc.CollectionChanged += incc_CollectionChanged;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if ( incc != null )
|
||||
{
|
||||
incc.CollectionChanged -= incc_CollectionChanged;
|
||||
}
|
||||
}
|
||||
|
||||
private void incc_CollectionChanged( object sender, NotifyCollectionChangedEventArgs e )
|
||||
{
|
||||
if ( e.Action == NotifyCollectionChangedAction.Add )
|
||||
{
|
||||
listBox.ScrollIntoView( e.NewItems[0] );
|
||||
listBox.SelectedItem = e.NewItems[0];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class AutoScrollBehavior
|
||||
{
|
||||
public static readonly DependencyProperty AutoScrollProperty =
|
||||
DependencyProperty.RegisterAttached( "AutoScroll", typeof( bool ), typeof( AutoScrollBehavior ),
|
||||
new PropertyMetadata( false, AutoScrollPropertyChanged ) );
|
||||
|
||||
public static void AutoScrollPropertyChanged( DependencyObject obj, DependencyPropertyChangedEventArgs args )
|
||||
{
|
||||
ScrollViewer scrollViewer = obj as ScrollViewer;
|
||||
|
||||
if ( scrollViewer != null && (bool) args.NewValue )
|
||||
{
|
||||
scrollViewer.ScrollChanged += ScrollViewer_ScrollChanged;
|
||||
scrollViewer.ScrollToEnd();
|
||||
}
|
||||
else
|
||||
{
|
||||
if ( scrollViewer != null )
|
||||
{
|
||||
scrollViewer.ScrollChanged -= ScrollViewer_ScrollChanged;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void ScrollViewer_ScrollChanged( object sender, ScrollChangedEventArgs e )
|
||||
{
|
||||
// Only scroll to bottom when the extent changed. Otherwise you can't scroll up
|
||||
if ( e.ExtentHeightChange != 0 )
|
||||
{
|
||||
ScrollViewer scrollViewer = sender as ScrollViewer;
|
||||
scrollViewer?.ScrollToBottom();
|
||||
}
|
||||
}
|
||||
|
||||
public static bool GetAutoScroll( DependencyObject obj )
|
||||
{
|
||||
return (bool) obj.GetValue( AutoScrollProperty );
|
||||
}
|
||||
|
||||
public static void SetAutoScroll( DependencyObject obj, bool value )
|
||||
{
|
||||
obj.SetValue( AutoScrollProperty, value );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Interactivity;
|
||||
|
||||
namespace ClassicAssist.UI.Misc
|
||||
{
|
||||
public class AutoScrollTextBoxBehaviour : Behavior<TextBox>
|
||||
{
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
|
||||
AssociatedObject.TextChanged += OnTextChanged;
|
||||
}
|
||||
|
||||
private void OnTextChanged( object sender, TextChangedEventArgs e )
|
||||
{
|
||||
AssociatedObject.ScrollToEnd();
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
base.OnDetaching();
|
||||
|
||||
if ( AssociatedObject != null )
|
||||
{
|
||||
AssociatedObject.TextChanged -= OnTextChanged;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Interactivity;
|
||||
using ICSharpCode.AvalonEdit;
|
||||
using ICSharpCode.AvalonEdit.Document;
|
||||
using ICSharpCode.AvalonEdit.Editing;
|
||||
|
||||
namespace ClassicAssist.UI.Misc
|
||||
{
|
||||
public class AvalonBindingBehaviour : Behavior<TextEditor>
|
||||
{
|
||||
public static readonly DependencyProperty DocumentBindingProperty = DependencyProperty.Register(
|
||||
"DocumentBinding", typeof( TextDocument ), typeof( AvalonBindingBehaviour ),
|
||||
new FrameworkPropertyMetadata( default( TextDocument ),
|
||||
FrameworkPropertyMetadataOptions.BindsTwoWayByDefault, PropertyChangedCallback ) );
|
||||
|
||||
public static readonly DependencyProperty CaretBindingProperty = DependencyProperty.Register( "CaretBinding",
|
||||
typeof( int ), typeof( AvalonBindingBehaviour ),
|
||||
new FrameworkPropertyMetadata( default( int ), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
|
||||
PropertyChangedCallback ) );
|
||||
|
||||
public int CaretBinding
|
||||
{
|
||||
get => (int) GetValue( CaretBindingProperty );
|
||||
set => SetValue( CaretBindingProperty, value );
|
||||
}
|
||||
|
||||
public TextDocument DocumentBinding
|
||||
{
|
||||
get => (TextDocument) GetValue( DocumentBindingProperty );
|
||||
set => SetValue( DocumentBindingProperty, value );
|
||||
}
|
||||
|
||||
private static void PropertyChangedCallback( DependencyObject d, DependencyPropertyChangedEventArgs e )
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
|
||||
AssociatedObject.Loaded += OnLoaded;
|
||||
AssociatedObject.TextArea.Caret.PositionChanged += CaretOnPositionChanged;
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
base.OnDetaching();
|
||||
|
||||
AssociatedObject.Loaded -= OnLoaded;
|
||||
AssociatedObject.TextArea.Caret.PositionChanged -= CaretOnPositionChanged;
|
||||
}
|
||||
|
||||
private void CaretOnPositionChanged( object sender, EventArgs e )
|
||||
{
|
||||
if ( sender is Caret caret )
|
||||
{
|
||||
CaretBinding = caret.Offset;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnLoaded( object sender, RoutedEventArgs args )
|
||||
{
|
||||
if ( sender is TextEditor textEditor )
|
||||
{
|
||||
DocumentBinding = textEditor.Document;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Interactivity;
|
||||
using ICSharpCode.AvalonEdit;
|
||||
|
||||
namespace ClassicAssist.UI.Misc
|
||||
{
|
||||
public sealed class AvalonEditBehaviour : Behavior<TextEditor>
|
||||
{
|
||||
public static readonly DependencyProperty TextBindingProperty = DependencyProperty.Register( "TextBinding",
|
||||
typeof( string ), typeof( AvalonEditBehaviour ),
|
||||
new FrameworkPropertyMetadata( default( string ), FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
|
||||
PropertyChangedCallback ) );
|
||||
|
||||
public string TextBinding
|
||||
{
|
||||
get => (string) GetValue( TextBindingProperty );
|
||||
set => SetValue( TextBindingProperty, value );
|
||||
}
|
||||
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
|
||||
if ( AssociatedObject != null )
|
||||
{
|
||||
AssociatedObject.TextChanged += AssociatedObjectOnTextChanged;
|
||||
AssociatedObject.LostFocus += AssociatedObjectOnLostFocus;
|
||||
}
|
||||
}
|
||||
|
||||
private void AssociatedObjectOnLostFocus( object sender, RoutedEventArgs routedEventArgs )
|
||||
{
|
||||
if ( !( sender is TextEditor textEditor ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( textEditor.Document != null )
|
||||
{
|
||||
TextBinding = textEditor.Document.Text;
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
base.OnDetaching();
|
||||
|
||||
if ( AssociatedObject != null )
|
||||
{
|
||||
AssociatedObject.TextChanged -= AssociatedObjectOnTextChanged;
|
||||
AssociatedObject.LostFocus -= AssociatedObjectOnLostFocus;
|
||||
}
|
||||
}
|
||||
|
||||
private void AssociatedObjectOnTextChanged( object sender, EventArgs eventArgs )
|
||||
{
|
||||
if ( !( sender is TextEditor textEditor ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( textEditor.Document == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int carot = textEditor.CaretOffset;
|
||||
TextBinding = textEditor.Document.Text;
|
||||
textEditor.CaretOffset = carot;
|
||||
}
|
||||
|
||||
private static void PropertyChangedCallback( DependencyObject dependencyObject,
|
||||
DependencyPropertyChangedEventArgs dependencyPropertyChangedEventArgs )
|
||||
{
|
||||
AvalonEditBehaviour behavior = dependencyObject as AvalonEditBehaviour;
|
||||
|
||||
TextEditor editor = behavior?.AssociatedObject;
|
||||
|
||||
if ( editor?.Document == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( dependencyPropertyChangedEventArgs.NewValue == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
editor.Document.Text = dependencyPropertyChangedEventArgs.NewValue.ToString();
|
||||
editor.CaretOffset = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Interactivity;
|
||||
|
||||
namespace ClassicAssist.UI.Misc
|
||||
{
|
||||
public class BindableSelectedItemBehavior : Behavior<TreeView>
|
||||
{
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
|
||||
AssociatedObject.SelectedItemChanged += OnTreeViewSelectedItemChanged;
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
base.OnDetaching();
|
||||
|
||||
if ( AssociatedObject != null )
|
||||
{
|
||||
AssociatedObject.SelectedItemChanged -= OnTreeViewSelectedItemChanged;
|
||||
}
|
||||
}
|
||||
|
||||
private void OnTreeViewSelectedItemChanged( object sender, RoutedPropertyChangedEventArgs<object> e )
|
||||
{
|
||||
SelectedItem = e.NewValue;
|
||||
}
|
||||
|
||||
#region SelectedItem Property
|
||||
|
||||
public object SelectedItem
|
||||
{
|
||||
get => GetValue( SelectedItemProperty );
|
||||
set => SetValue( SelectedItemProperty, value );
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SelectedItemProperty = DependencyProperty.Register( "SelectedItem",
|
||||
typeof( object ), typeof( BindableSelectedItemBehavior ),
|
||||
new UIPropertyMetadata( null, OnSelectedItemChanged ) );
|
||||
|
||||
private static void OnSelectedItemChanged( DependencyObject sender, DependencyPropertyChangedEventArgs e )
|
||||
{
|
||||
if ( e.NewValue is TreeViewItem item )
|
||||
{
|
||||
item.SetValue( TreeViewItem.IsSelectedProperty, true );
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace ClassicAssist.Misc
|
||||
{
|
||||
public class BindingProxy : Freezable
|
||||
{
|
||||
// Using a DependencyProperty as the backing store for Data. This enables animation, styling, binding, etc...
|
||||
public static readonly DependencyProperty DataProperty = DependencyProperty.Register( "Data", typeof( object ),
|
||||
typeof( BindingProxy ), new UIPropertyMetadata( null ) );
|
||||
|
||||
public object Data
|
||||
{
|
||||
get => GetValue( DataProperty );
|
||||
set => SetValue( DataProperty, value );
|
||||
}
|
||||
|
||||
#region Overrides of Freezable
|
||||
|
||||
protected override Freezable CreateInstanceCore()
|
||||
{
|
||||
return new BindingProxy();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
|
||||
//https://stackoverflow.com/questions/4305565/wpf-context-menu-on-left-click
|
||||
namespace ClassicAssist.UI.Misc
|
||||
{
|
||||
public class ClickOpensContextMenuBehaviour
|
||||
{
|
||||
private static readonly DependencyProperty ClickOpensContextMenuProperty =
|
||||
DependencyProperty.RegisterAttached( "Enabled", typeof( bool ), typeof( ClickOpensContextMenuBehaviour ),
|
||||
new PropertyMetadata( HandlePropertyChanged ) );
|
||||
|
||||
public static bool GetEnabled( DependencyObject obj )
|
||||
{
|
||||
return (bool) obj.GetValue( ClickOpensContextMenuProperty );
|
||||
}
|
||||
|
||||
public static void SetEnabled( DependencyObject obj, bool value )
|
||||
{
|
||||
obj.SetValue( ClickOpensContextMenuProperty, value );
|
||||
}
|
||||
|
||||
private static void HandlePropertyChanged( DependencyObject obj, DependencyPropertyChangedEventArgs args )
|
||||
{
|
||||
switch ( obj )
|
||||
{
|
||||
case Image image:
|
||||
image.MouseLeftButtonDown -= ExecuteMouseDown;
|
||||
image.MouseLeftButtonDown += ExecuteMouseDown;
|
||||
break;
|
||||
case Hyperlink hyperlink:
|
||||
hyperlink.Click -= ExecuteClick;
|
||||
hyperlink.Click += ExecuteClick;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private static void ExecuteMouseDown( object sender, MouseButtonEventArgs args )
|
||||
{
|
||||
if ( !( sender is DependencyObject obj ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool enabled = (bool) obj.GetValue( ClickOpensContextMenuProperty );
|
||||
|
||||
if ( !enabled )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Image image = sender as Image;
|
||||
|
||||
if ( image?.ContextMenu != null )
|
||||
{
|
||||
image.ContextMenu.IsOpen = true;
|
||||
}
|
||||
}
|
||||
|
||||
private static void ExecuteClick( object sender, RoutedEventArgs args )
|
||||
{
|
||||
if ( !( sender is DependencyObject obj ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
bool enabled = (bool) obj.GetValue( ClickOpensContextMenuProperty );
|
||||
|
||||
if ( !enabled )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !( sender is Hyperlink hyperlink ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( hyperlink.ContextMenu != null )
|
||||
{
|
||||
hyperlink.ContextMenu.IsOpen = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interactivity;
|
||||
|
||||
namespace ClassicAssist.UI.Misc
|
||||
{
|
||||
public class ClipboardBehaviour : Behavior<UIElement>
|
||||
{
|
||||
public static readonly DependencyProperty CopyCommandProperty = DependencyProperty.Register( "CopyCommand",
|
||||
typeof( ICommand ), typeof( ClipboardBehaviour ),
|
||||
new FrameworkPropertyMetadata( null, FrameworkPropertyMetadataOptions.None ) );
|
||||
|
||||
public static readonly DependencyProperty PasteCommandProperty = DependencyProperty.Register( "PasteCommand",
|
||||
typeof( ICommand ), typeof( ClipboardBehaviour ),
|
||||
new FrameworkPropertyMetadata( null, FrameworkPropertyMetadataOptions.None ) );
|
||||
|
||||
public static readonly DependencyProperty CommandParameterProperty = DependencyProperty.Register(
|
||||
"CommandParameter", typeof( object ), typeof( ClipboardBehaviour ),
|
||||
new FrameworkPropertyMetadata( null, FrameworkPropertyMetadataOptions.None ) );
|
||||
|
||||
public object CommandParameter
|
||||
{
|
||||
get => GetValue( CommandParameterProperty );
|
||||
set => SetValue( CommandParameterProperty, value );
|
||||
}
|
||||
|
||||
public ICommand CopyCommand
|
||||
{
|
||||
get => (ICommand) GetValue( CopyCommandProperty );
|
||||
set => SetValue( CopyCommandProperty, value );
|
||||
}
|
||||
|
||||
public ICommand PasteCommand
|
||||
{
|
||||
get => (ICommand) GetValue( PasteCommandProperty );
|
||||
set => SetValue( PasteCommandProperty, value );
|
||||
}
|
||||
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
|
||||
CommandBinding CopyCommandBinding = new CommandBinding(
|
||||
ApplicationCommands.Copy, CopyCommandExecuted, CopyCommandCanExecute );
|
||||
AssociatedObject.CommandBindings.Add( CopyCommandBinding );
|
||||
|
||||
CommandBinding CutCommandBinding = new CommandBinding(
|
||||
ApplicationCommands.Cut, CutCommandExecuted, CutCommandCanExecute );
|
||||
AssociatedObject.CommandBindings.Add( CutCommandBinding );
|
||||
|
||||
CommandBinding PasteCommandBinding = new CommandBinding( ApplicationCommands.Paste, PasteCommandExecuted,
|
||||
PasteCommandCanExecute );
|
||||
AssociatedObject.CommandBindings.Add( PasteCommandBinding );
|
||||
}
|
||||
|
||||
private void CopyCommandExecuted( object target, ExecutedRoutedEventArgs e )
|
||||
{
|
||||
CopyCommand?.Execute( CommandParameter );
|
||||
}
|
||||
|
||||
private void CopyCommandCanExecute( object target, CanExecuteRoutedEventArgs e )
|
||||
{
|
||||
e.CanExecute = true;
|
||||
e.Handled = true;
|
||||
}
|
||||
|
||||
private void CutCommandExecuted( object target, ExecutedRoutedEventArgs e )
|
||||
{
|
||||
}
|
||||
|
||||
private void CutCommandCanExecute( object target, CanExecuteRoutedEventArgs e )
|
||||
{
|
||||
}
|
||||
|
||||
private void PasteCommandExecuted( object target, ExecutedRoutedEventArgs e )
|
||||
{
|
||||
PasteCommand?.Execute( CommandParameter );
|
||||
}
|
||||
|
||||
private void PasteCommandCanExecute( object target, CanExecuteRoutedEventArgs e )
|
||||
{
|
||||
e.CanExecute = true;
|
||||
e.Handled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Interactivity;
|
||||
|
||||
namespace ClassicAssist.UI.Misc
|
||||
{
|
||||
public class CloseOnClickBehaviour : Behavior<Button>
|
||||
{
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
|
||||
AssociatedObject.Click += OnClick;
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
AssociatedObject.Click -= OnClick;
|
||||
}
|
||||
|
||||
private void OnClick( object sender, RoutedEventArgs e )
|
||||
{
|
||||
if ( !( sender is Button button ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Window window = Window.GetWindow( button );
|
||||
|
||||
window?.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interactivity;
|
||||
|
||||
namespace ClassicAssist.UI.Misc
|
||||
{
|
||||
public class ComboBoxBehavior : Behavior<ComboBox>
|
||||
{
|
||||
public static readonly DependencyProperty CommandBindingProperty =
|
||||
DependencyProperty.Register( "CommandBinding", typeof( ICommand ), typeof( ComboBoxBehavior ),
|
||||
new FrameworkPropertyMetadata( default( ICommand ), FrameworkPropertyMetadataOptions.None,
|
||||
PropertyChangedCallback ) );
|
||||
|
||||
public static readonly DependencyProperty CommandParameterProperty =
|
||||
DependencyProperty.Register( "CommandParameter", typeof( object ), typeof( ComboBoxBehavior ),
|
||||
new FrameworkPropertyMetadata( default, FrameworkPropertyMetadataOptions.None,
|
||||
PropertyChangedCallback ) );
|
||||
|
||||
public static readonly DependencyProperty OnlyUserTriggeredProperty =
|
||||
DependencyProperty.Register( "OnlyUserTriggered", typeof( bool ), typeof( ComboBoxBehavior ),
|
||||
new FrameworkPropertyMetadata( false, FrameworkPropertyMetadataOptions.None,
|
||||
PropertyChangedCallback ) );
|
||||
|
||||
private bool _userTriggered;
|
||||
|
||||
public ICommand CommandBinding
|
||||
{
|
||||
get => (ICommand) GetValue( CommandBindingProperty );
|
||||
set => SetValue( CommandBindingProperty, value );
|
||||
}
|
||||
|
||||
public object CommandParameter
|
||||
{
|
||||
get => GetValue( CommandParameterProperty );
|
||||
set => SetValue( CommandParameterProperty, value );
|
||||
}
|
||||
|
||||
public bool OnlyUserTriggered
|
||||
{
|
||||
get => (bool) GetValue( OnlyUserTriggeredProperty );
|
||||
set => SetValue( OnlyUserTriggeredProperty, value );
|
||||
}
|
||||
|
||||
private static void PropertyChangedCallback( DependencyObject d, DependencyPropertyChangedEventArgs e )
|
||||
{
|
||||
}
|
||||
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
|
||||
AssociatedObject.SelectionChanged += OnSelectionChanged;
|
||||
AssociatedObject.PreviewMouseDown += OnPreviewMouseDown;
|
||||
}
|
||||
|
||||
private void OnPreviewMouseDown( object sender, MouseButtonEventArgs e )
|
||||
{
|
||||
_userTriggered = true;
|
||||
}
|
||||
|
||||
private void OnSelectionChanged( object sender, SelectionChangedEventArgs e )
|
||||
{
|
||||
if ( OnlyUserTriggered && !_userTriggered )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
CommandBinding?.Execute( AssociatedObject.SelectedItem );
|
||||
_userTriggered = false;
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
AssociatedObject.SelectionChanged -= OnSelectionChanged;
|
||||
AssociatedObject.PreviewMouseDown -= OnPreviewMouseDown;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
using System;
|
||||
using System.Windows.Markup;
|
||||
|
||||
namespace ClassicAssist.UI.Misc
|
||||
{
|
||||
/*
|
||||
* https://brianlagunas.com/a-better-way-to-data-bind-enums-in-wpf/
|
||||
*/
|
||||
public class EnumBindingSourceExtension : MarkupExtension
|
||||
{
|
||||
private Type _enumType;
|
||||
|
||||
public EnumBindingSourceExtension()
|
||||
{
|
||||
}
|
||||
|
||||
public EnumBindingSourceExtension( Type enumType )
|
||||
{
|
||||
EnumType = enumType;
|
||||
}
|
||||
|
||||
public Type EnumType
|
||||
{
|
||||
get => _enumType;
|
||||
set
|
||||
{
|
||||
if ( value != _enumType )
|
||||
{
|
||||
if ( null != value )
|
||||
{
|
||||
Type enumType = Nullable.GetUnderlyingType( value ) ?? value;
|
||||
|
||||
if ( !enumType.IsEnum )
|
||||
{
|
||||
throw new ArgumentException( "Type must be for an Enum." );
|
||||
}
|
||||
}
|
||||
|
||||
_enumType = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override object ProvideValue( IServiceProvider serviceProvider )
|
||||
{
|
||||
if ( null == _enumType )
|
||||
{
|
||||
throw new InvalidOperationException( "The EnumType must be specified." );
|
||||
}
|
||||
|
||||
Type actualEnumType = Nullable.GetUnderlyingType( _enumType ) ?? _enumType;
|
||||
Array enumValues = Enum.GetValues( actualEnumType );
|
||||
|
||||
if ( actualEnumType == _enumType )
|
||||
{
|
||||
return enumValues;
|
||||
}
|
||||
|
||||
Array tempArray = Array.CreateInstance( actualEnumType, enumValues.Length + 1 );
|
||||
enumValues.CopyTo( tempArray, 1 );
|
||||
return tempArray;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using System.Collections.Specialized;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Interactivity;
|
||||
|
||||
namespace ClassicAssist.UI.Misc
|
||||
{
|
||||
public class ItemsControlAutoScrollBehaviour : Behavior<ItemsControl>
|
||||
{
|
||||
public static readonly DependencyProperty ScrollViewerProperty = DependencyProperty.Register( "ScrollViewer",
|
||||
typeof( ScrollViewer ), typeof( ItemsControlAutoScrollBehaviour ),
|
||||
new PropertyMetadata( default( ScrollViewer ) ) );
|
||||
|
||||
public ScrollViewer ScrollViewer
|
||||
{
|
||||
get => (ScrollViewer) GetValue( ScrollViewerProperty );
|
||||
set => SetValue( ScrollViewerProperty, value );
|
||||
}
|
||||
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
|
||||
( (INotifyCollectionChanged) AssociatedObject.Items ).CollectionChanged += OnCollectionChanged;
|
||||
}
|
||||
|
||||
private void OnCollectionChanged( object sender, NotifyCollectionChangedEventArgs e )
|
||||
{
|
||||
ScrollViewer?.ScrollToEnd();
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
base.OnDetaching();
|
||||
|
||||
( (INotifyCollectionChanged) AssociatedObject.Items ).CollectionChanged -= OnCollectionChanged;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Interactivity;
|
||||
|
||||
namespace ClassicAssist.UI.Misc
|
||||
{
|
||||
public class ItemsControlSelectNewEntryBehaviour : Behavior<ItemsControl>
|
||||
{
|
||||
public static readonly DependencyProperty SelectedItemProperty =
|
||||
DependencyProperty.Register( nameof( SelectedItem ), typeof( object ),
|
||||
typeof( ItemsControlSelectNewEntryBehaviour ),
|
||||
new FrameworkPropertyMetadata( default, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault ) );
|
||||
|
||||
public static readonly DependencyProperty TypeProperty = DependencyProperty.Register( nameof( Type ),
|
||||
typeof( Type ), typeof( ItemsControlSelectNewEntryBehaviour ),
|
||||
new FrameworkPropertyMetadata( null, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault ) );
|
||||
|
||||
public object SelectedItem
|
||||
{
|
||||
get => GetValue( SelectedItemProperty );
|
||||
set => SetValue( SelectedItemProperty, value );
|
||||
}
|
||||
|
||||
public Type Type
|
||||
{
|
||||
get => (Type) GetValue( TypeProperty );
|
||||
set => SetValue( TypeProperty, value );
|
||||
}
|
||||
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
|
||||
( (INotifyCollectionChanged) AssociatedObject.Items ).CollectionChanged += OnCollectionChanged;
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
base.OnDetaching();
|
||||
|
||||
( (INotifyCollectionChanged) AssociatedObject.Items ).CollectionChanged -= OnCollectionChanged;
|
||||
}
|
||||
|
||||
private void OnCollectionChanged( object sender, NotifyCollectionChangedEventArgs e )
|
||||
{
|
||||
if ( !( sender is ItemCollection ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( e.NewItems == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
object firstItem = e.NewItems[0];
|
||||
|
||||
if ( Type != null )
|
||||
{
|
||||
if ( firstItem.GetType() != Type )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
SelectedItem = firstItem;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interactivity;
|
||||
using ClassicAssist.UI.ViewModels;
|
||||
|
||||
namespace ClassicAssist.UI.Misc
|
||||
{
|
||||
public class ListViewDoubleClickBehaviour : Behavior<ListView>
|
||||
{
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
|
||||
AssociatedObject.MouseDoubleClick += OnMouseDoubleClick;
|
||||
}
|
||||
|
||||
private void OnMouseDoubleClick( object sender, MouseButtonEventArgs e )
|
||||
{
|
||||
ObjectInspectorViewModel i = (ObjectInspectorViewModel) ( (ListView) sender ).DataContext;
|
||||
|
||||
i.SelectedItem?.OnDoubleClick?.Invoke( i.SelectedItem );
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
base.OnDetaching();
|
||||
|
||||
AssociatedObject.MouseDoubleClick -= OnMouseDoubleClick;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Interactivity;
|
||||
|
||||
namespace ClassicAssist.UI.Misc
|
||||
{
|
||||
/*
|
||||
* https://stackoverflow.com/questions/8088595/synchronizing-multi-select-listbox-with-mvvm
|
||||
*/
|
||||
|
||||
public class ListViewMultiSelectionBehaviour : Behavior<ListView>
|
||||
{
|
||||
public static readonly DependencyProperty SelectedItemsProperty = DependencyProperty.Register( "SelectedItems",
|
||||
typeof( IList ), typeof( ListViewMultiSelectionBehaviour ),
|
||||
new UIPropertyMetadata( null, SelectedItemsChanged ) );
|
||||
|
||||
private bool _isUpdatingSource;
|
||||
|
||||
private bool _isUpdatingTarget;
|
||||
|
||||
public IList SelectedItems
|
||||
{
|
||||
get => (IList) GetValue( SelectedItemsProperty );
|
||||
set => SetValue( SelectedItemsProperty, value );
|
||||
}
|
||||
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
|
||||
if ( SelectedItems == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AssociatedObject.SelectedItems.Clear();
|
||||
|
||||
foreach ( object item in SelectedItems )
|
||||
{
|
||||
AssociatedObject.SelectedItems.Add( item );
|
||||
}
|
||||
|
||||
AssociatedObject.SelectionChanged += ListViewSelectionChanged;
|
||||
}
|
||||
|
||||
private static void SelectedItemsChanged( DependencyObject o, DependencyPropertyChangedEventArgs e )
|
||||
{
|
||||
if ( o == null || !( o is ListViewMultiSelectionBehaviour behavior ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
INotifyCollectionChanged oldValue = (INotifyCollectionChanged) e.OldValue;
|
||||
INotifyCollectionChanged newValue = (INotifyCollectionChanged) e.NewValue;
|
||||
|
||||
if ( oldValue != null )
|
||||
{
|
||||
oldValue.CollectionChanged -= behavior.SourceCollectionChanged;
|
||||
behavior.AssociatedObject.SelectionChanged -= behavior.ListViewSelectionChanged;
|
||||
}
|
||||
|
||||
if ( newValue == null || behavior.AssociatedObject == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
behavior.AssociatedObject.SelectedItems.Clear();
|
||||
|
||||
if ( newValue is IEnumerable items )
|
||||
{
|
||||
foreach ( object item in items )
|
||||
{
|
||||
behavior.AssociatedObject.SelectedItems.Add( item );
|
||||
}
|
||||
}
|
||||
|
||||
behavior.AssociatedObject.SelectionChanged += behavior.ListViewSelectionChanged;
|
||||
newValue.CollectionChanged += behavior.SourceCollectionChanged;
|
||||
}
|
||||
|
||||
private void SourceCollectionChanged( object sender, NotifyCollectionChangedEventArgs e )
|
||||
{
|
||||
if ( _isUpdatingSource )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_isUpdatingTarget = true;
|
||||
|
||||
if ( e.OldItems != null )
|
||||
{
|
||||
foreach ( object item in e.OldItems )
|
||||
{
|
||||
AssociatedObject.SelectedItems.Remove( item );
|
||||
}
|
||||
}
|
||||
|
||||
if ( e.NewItems != null )
|
||||
{
|
||||
foreach ( object item in e.NewItems )
|
||||
{
|
||||
AssociatedObject.SelectedItems.Add( item );
|
||||
}
|
||||
}
|
||||
|
||||
if ( e.Action == NotifyCollectionChangedAction.Reset )
|
||||
{
|
||||
AssociatedObject.SelectedItems.Clear();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_isUpdatingTarget = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void ListViewSelectionChanged( object sender, SelectionChangedEventArgs e )
|
||||
{
|
||||
if ( e.OriginalSource.GetType() != typeof( ListView ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( _isUpdatingTarget )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IList selectedItems = SelectedItems;
|
||||
|
||||
if ( selectedItems == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_isUpdatingSource = true;
|
||||
|
||||
foreach ( object item in e.RemovedItems )
|
||||
{
|
||||
selectedItems.Remove( item );
|
||||
}
|
||||
|
||||
foreach ( object item in e.AddedItems )
|
||||
{
|
||||
selectedItems.Add( item );
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_isUpdatingSource = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
using System.Windows;
|
||||
using System.Windows.Interactivity;
|
||||
using ClassicAssist.Shared;
|
||||
using ClassicAssist.Data;
|
||||
using Sentry;
|
||||
using Sentry.Protocol;
|
||||
|
||||
namespace ClassicAssist.UI.Misc
|
||||
{
|
||||
public class LoadOptionsOnWindowLoaded : Behavior<Window>
|
||||
{
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
AssociatedObject.Loaded += OnLoaded;
|
||||
AssociatedObject.Closing += OnClosing;
|
||||
}
|
||||
|
||||
private static void OnClosing( object sender, CancelEventArgs e )
|
||||
{
|
||||
Options.Save( Options.CurrentOptions );
|
||||
AssistantOptions.Save();
|
||||
}
|
||||
|
||||
private static void OnLoaded( object sender, RoutedEventArgs e )
|
||||
{
|
||||
AssistantOptions.OnWindowLoaded();
|
||||
SentrySdk.Init( new SentryOptions
|
||||
{
|
||||
Dsn = new Dsn( "https://7a7c44cd07e64058a3b434e1c86e4c02@o369765.ingest.sentry.io/5325425" ),
|
||||
BeforeSend = SentryBeforeSend
|
||||
} );
|
||||
}
|
||||
|
||||
private static SentryEvent SentryBeforeSend( SentryEvent args )
|
||||
{
|
||||
args.User = new User { Id = AssistantOptions.UserId };
|
||||
args.SetTag( "SessionId", AssistantOptions.SessionId );
|
||||
args.SetExtra( "PlayerName", Engine.Player?.Name ?? "Unknown" );
|
||||
args.SetExtra( "PlayerSerial", Engine.Player?.Serial ?? 0 );
|
||||
args.SetExtra( "Shard", Engine.CurrentShard?.Name ?? "Unknown" );
|
||||
args.SetExtra( "Connected", Engine.Connected );
|
||||
|
||||
return args;
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
AssociatedObject.Loaded -= OnLoaded;
|
||||
AssociatedObject.Closing -= OnClosing;
|
||||
base.OnDetaching();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,152 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Interactivity;
|
||||
|
||||
namespace ClassicAssist.UI.Misc
|
||||
{
|
||||
/*
|
||||
* https://stackoverflow.com/questions/8088595/synchronizing-multi-select-listbox-with-mvvm
|
||||
*/
|
||||
|
||||
public class MultiSelectionBehaviour : Behavior<ListBox>
|
||||
{
|
||||
public static readonly DependencyProperty SelectedItemsProperty = DependencyProperty.Register( "SelectedItems",
|
||||
typeof( IList ), typeof( MultiSelectionBehaviour ), new UIPropertyMetadata( null, SelectedItemsChanged ) );
|
||||
|
||||
private bool _isUpdatingSource;
|
||||
|
||||
private bool _isUpdatingTarget;
|
||||
|
||||
public IList SelectedItems
|
||||
{
|
||||
get => (IList) GetValue( SelectedItemsProperty );
|
||||
set => SetValue( SelectedItemsProperty, value );
|
||||
}
|
||||
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
|
||||
if ( SelectedItems == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AssociatedObject.SelectedItems.Clear();
|
||||
|
||||
foreach ( object item in SelectedItems )
|
||||
{
|
||||
AssociatedObject.SelectedItems.Add( item );
|
||||
}
|
||||
}
|
||||
|
||||
private static void SelectedItemsChanged( DependencyObject o, DependencyPropertyChangedEventArgs e )
|
||||
{
|
||||
if ( o == null || !( o is MultiSelectionBehaviour behavior ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
INotifyCollectionChanged oldValue = (INotifyCollectionChanged) e.OldValue;
|
||||
INotifyCollectionChanged newValue = (INotifyCollectionChanged) e.NewValue;
|
||||
|
||||
if ( oldValue != null )
|
||||
{
|
||||
oldValue.CollectionChanged -= behavior.SourceCollectionChanged;
|
||||
behavior.AssociatedObject.SelectionChanged -= behavior.ListBoxSelectionChanged;
|
||||
}
|
||||
|
||||
if ( newValue == null || behavior.AssociatedObject == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
behavior.AssociatedObject.SelectedItems.Clear();
|
||||
|
||||
if ( newValue is IEnumerable items )
|
||||
{
|
||||
foreach ( object item in items )
|
||||
{
|
||||
behavior.AssociatedObject.SelectedItems.Add( item );
|
||||
}
|
||||
}
|
||||
|
||||
behavior.AssociatedObject.SelectionChanged += behavior.ListBoxSelectionChanged;
|
||||
newValue.CollectionChanged += behavior.SourceCollectionChanged;
|
||||
}
|
||||
|
||||
private void SourceCollectionChanged( object sender, NotifyCollectionChangedEventArgs e )
|
||||
{
|
||||
if ( _isUpdatingSource )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_isUpdatingTarget = true;
|
||||
|
||||
if ( e.OldItems != null )
|
||||
{
|
||||
foreach ( object item in e.OldItems )
|
||||
{
|
||||
AssociatedObject.SelectedItems.Remove( item );
|
||||
}
|
||||
}
|
||||
|
||||
if ( e.NewItems != null )
|
||||
{
|
||||
foreach ( object item in e.NewItems )
|
||||
{
|
||||
AssociatedObject.SelectedItems.Add( item );
|
||||
}
|
||||
}
|
||||
|
||||
if ( e.Action == NotifyCollectionChangedAction.Reset )
|
||||
{
|
||||
AssociatedObject.SelectedItems.Clear();
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_isUpdatingTarget = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void ListBoxSelectionChanged( object sender, SelectionChangedEventArgs e )
|
||||
{
|
||||
if ( _isUpdatingTarget )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
IList selectedItems = SelectedItems;
|
||||
|
||||
if ( selectedItems == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
_isUpdatingSource = true;
|
||||
|
||||
foreach ( object item in e.RemovedItems )
|
||||
{
|
||||
selectedItems.Remove( item );
|
||||
}
|
||||
|
||||
foreach ( object item in e.AddedItems )
|
||||
{
|
||||
selectedItems.Add( item );
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_isUpdatingSource = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClassicAssist.UI.Misc
|
||||
{
|
||||
public class SkillsGridViewColumn : GridViewColumn
|
||||
{
|
||||
public enum Enums
|
||||
{
|
||||
Name,
|
||||
Value,
|
||||
Base,
|
||||
Delta,
|
||||
Cap,
|
||||
LockStatus
|
||||
}
|
||||
|
||||
public static readonly DependencyProperty SortFieldProperty = DependencyProperty.Register( "SortField",
|
||||
typeof( Enums ), typeof( SkillsGridViewColumn ), new UIPropertyMetadata( null ) );
|
||||
|
||||
public Enums SortField
|
||||
{
|
||||
get => (Enums) GetValue( SortFieldProperty );
|
||||
set => SetValue( SortFieldProperty, value );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace ClassicAssist.UI.Misc.ValueConverters
|
||||
{
|
||||
public class CellWidthValueConverter : IValueConverter
|
||||
{
|
||||
private double substractValue = 15;
|
||||
|
||||
public object Convert( object value, Type targetType, object parameter, CultureInfo culture )
|
||||
{
|
||||
if ( parameter != null )
|
||||
{
|
||||
substractValue = double.Parse( parameter.ToString() );
|
||||
}
|
||||
|
||||
double? val = (double?) value - substractValue;
|
||||
return val;
|
||||
}
|
||||
|
||||
public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture )
|
||||
{
|
||||
return (double?) value + substractValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace ClassicAssist.UI.Misc.ValueConverters
|
||||
{
|
||||
public class DateTimeToTimeSpanValueConverter : IValueConverter
|
||||
{
|
||||
public object Convert( object value, Type targetType, object parameter, CultureInfo culture )
|
||||
{
|
||||
return !( value is DateTime dt ) ? null : ( DateTime.Now - dt ).ToString();
|
||||
}
|
||||
|
||||
public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace ClassicAssist.UI.Misc.ValueConverters
|
||||
{
|
||||
public class EnumMatchToBooleanConverter : IValueConverter
|
||||
{
|
||||
public object Convert( object value, Type targetType, object parameter, CultureInfo culture )
|
||||
{
|
||||
if ( value == null || parameter == null )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
string checkValue = value.ToString();
|
||||
string targetValue = parameter.ToString();
|
||||
return checkValue.Equals( targetValue, StringComparison.InvariantCultureIgnoreCase );
|
||||
}
|
||||
|
||||
public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture )
|
||||
{
|
||||
if ( value == null || parameter == null )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
bool useValue = (bool) value;
|
||||
string targetValue = parameter.ToString();
|
||||
|
||||
if ( useValue )
|
||||
{
|
||||
return Enum.Parse( targetType, targetValue );
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace ClassicAssist.UI.Misc.ValueConverters
|
||||
{
|
||||
public class HexToIntValueConverter : IValueConverter
|
||||
{
|
||||
public object Convert( object value, Type targetType, object parameter, CultureInfo culture )
|
||||
{
|
||||
if ( value is string val && val.StartsWith( "0x" ) )
|
||||
{
|
||||
return System.Convert.ToInt32( val, 16 );
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture )
|
||||
{
|
||||
if ( value is string val && val.StartsWith( "0x" ) )
|
||||
{
|
||||
return System.Convert.ToInt32( val, 16 );
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace ClassicAssist.UI.Misc.ValueConverters
|
||||
{
|
||||
public class IntToHexStringValueConverter : IValueConverter
|
||||
{
|
||||
public object Convert( object value, Type targetType, object parameter, CultureInfo culture )
|
||||
{
|
||||
if ( value is int val )
|
||||
{
|
||||
return $"0x{val:x8}";
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace ClassicAssist.UI.Misc.ValueConverters
|
||||
{
|
||||
public class InverseBooleanConverter : IValueConverter
|
||||
{
|
||||
public object Convert( object value, Type targetType, object parameter, CultureInfo culture )
|
||||
{
|
||||
try
|
||||
{
|
||||
bool testValue = (bool) value;
|
||||
return !testValue; // or do whatever you need with this boolean
|
||||
}
|
||||
catch
|
||||
{
|
||||
return true;
|
||||
} // or false
|
||||
}
|
||||
|
||||
public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture )
|
||||
{
|
||||
return Convert( value, targetType, parameter, culture );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace ClassicAssist.UI.Misc.ValueConverters
|
||||
{
|
||||
public class JoinArrayValueConverter : IValueConverter
|
||||
{
|
||||
public object Convert( object value, Type targetType, object parameter, CultureInfo culture )
|
||||
{
|
||||
if ( !( value is string[] array ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return string.Join( (string) parameter ?? ", ", array );
|
||||
}
|
||||
|
||||
public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using ClassicAssist.Misc;
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UI.Misc.ValueConverters
|
||||
{
|
||||
public class LockStatusValueConverter : IValueConverter
|
||||
{
|
||||
public object Convert( object value, Type targetType, object parameter, CultureInfo culture )
|
||||
{
|
||||
if ( !( value is LockStatus ) )
|
||||
{
|
||||
return value;
|
||||
}
|
||||
|
||||
LockStatus lockStatus = (LockStatus) value;
|
||||
|
||||
switch ( lockStatus )
|
||||
{
|
||||
case LockStatus.Up:
|
||||
|
||||
return Properties.Resources.arrow_up.ToImageSource();
|
||||
case LockStatus.Down:
|
||||
|
||||
return Properties.Resources.arrow_down.ToImageSource();
|
||||
case LockStatus.Locked:
|
||||
|
||||
return Properties.Resources.padlock.ToImageSource();
|
||||
default:
|
||||
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace ClassicAssist.UI.Misc.ValueConverters
|
||||
{
|
||||
public class PriorityMultiValueConverter : IMultiValueConverter
|
||||
{
|
||||
//https://stackoverflow.com/questions/1915562/wpf-binding-fallbackvalue-set-to-binding
|
||||
public object Convert( object[] values, Type targetType, object parameter, CultureInfo culture )
|
||||
{
|
||||
return values.FirstOrDefault( o => o != null );
|
||||
}
|
||||
|
||||
public object[] ConvertBack( object value, Type[] targetTypes, object parameter, CultureInfo culture )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Windows.Data;
|
||||
using ClassicAssist.Data.Skills;
|
||||
using ClassicAssist.Misc;
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UI.Misc.ValueConverters
|
||||
{
|
||||
public class SetSkillLockData
|
||||
{
|
||||
public LockStatus LockStatus { get; set; }
|
||||
public IEnumerable<SkillEntry> SkillEntries { get; set; }
|
||||
}
|
||||
|
||||
public class SetSkillLockMultiValueConverter : IMultiValueConverter
|
||||
{
|
||||
public object Convert( object[] values, Type targetType, object parameter, CultureInfo culture )
|
||||
{
|
||||
IList items = (IList) ( (BindingProxy) values[0] ).Data;
|
||||
IEnumerable<SkillEntry> skills = items.Cast<SkillEntry>();
|
||||
|
||||
LockStatus lockStatus = (LockStatus) values[1];
|
||||
|
||||
return new SetSkillLockData { SkillEntries = skills, LockStatus = lockStatus };
|
||||
}
|
||||
|
||||
public object[] ConvertBack( object value, Type[] targetTypes, object parameter, CultureInfo culture )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using ClassicAssist.Shared;
|
||||
|
||||
namespace ClassicAssist.UI.Misc.ValueConverters
|
||||
{
|
||||
public class StringToResourceConverter : IValueConverter
|
||||
{
|
||||
public object Convert( object value, Type targetType, object parameter, CultureInfo culture )
|
||||
{
|
||||
if ( value is string )
|
||||
{
|
||||
if ( targetType.Equals( typeof( ImageSource ) ) )
|
||||
{
|
||||
return BitmapFrame.Create( Engine.GetResourceStream( (string) value ), BitmapCreateOptions.None,
|
||||
BitmapCacheOption.OnLoad );
|
||||
}
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Windows.Data;
|
||||
|
||||
namespace ClassicAssist.UI.Misc.ValueConverters
|
||||
{
|
||||
/*
|
||||
* https://stackoverflow.com/questions/2607490/is-there-a-way-to-chain-multiple-value-converters-in-xaml
|
||||
*/
|
||||
public class ValueConverterGroup : List<IValueConverter>, IValueConverter
|
||||
{
|
||||
#region IValueConverter Members
|
||||
|
||||
public object Convert( object value, Type targetType, object parameter, CultureInfo culture )
|
||||
{
|
||||
return this.Aggregate( value,
|
||||
( current, converter ) => converter.Convert( current, targetType, parameter, culture ) );
|
||||
}
|
||||
|
||||
public object ConvertBack( object value, Type targetType, object parameter, CultureInfo culture )
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
using ClassicAssist.Misc;
|
||||
using ClassicAssist.Shared.Resources;
|
||||
using MessageBoxButtons = ClassicAssist.Misc.MessageBoxButtons;
|
||||
using WMessageBox = System.Windows.Forms.MessageBox;
|
||||
using WMessageBoxButtons = System.Windows.Forms.MessageBoxButtons;
|
||||
|
||||
namespace ClassicAssist.UI.Misc
|
||||
{
|
||||
internal class WPFMessageBoxProvider : IMessageBoxProvider
|
||||
{
|
||||
public Task<MessageBoxResult> Show( string text, string caption = null,
|
||||
MessageBoxButtons buttons = MessageBoxButtons.OK, MessageBoxImage? icon = null )
|
||||
{
|
||||
if (string.IsNullOrEmpty( caption ))
|
||||
{
|
||||
caption = Strings.Error;
|
||||
}
|
||||
|
||||
DialogResult result = WMessageBox.Show( text, caption,
|
||||
buttons == MessageBoxButtons.YesNo ? WMessageBoxButtons.YesNo : WMessageBoxButtons.OK );
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case DialogResult.OK: return Task.FromResult( MessageBoxResult.OK );
|
||||
case DialogResult.Yes: return Task.FromResult( MessageBoxResult.Yes );
|
||||
default: return Task.FromResult( MessageBoxResult.No );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Interactivity;
|
||||
|
||||
namespace ClassicAssist.UI.Misc
|
||||
{
|
||||
public enum WindowCommand
|
||||
{
|
||||
Minimize,
|
||||
Maximize,
|
||||
Close
|
||||
}
|
||||
|
||||
public class WindowCommandBehaviour : Behavior<Button>
|
||||
{
|
||||
public static readonly DependencyProperty CommandProperty = DependencyProperty.Register( "Command",
|
||||
typeof( WindowCommand ), typeof( WindowCommandBehaviour ),
|
||||
new FrameworkPropertyMetadata( WindowCommand.Close ) );
|
||||
|
||||
public WindowCommand Command
|
||||
{
|
||||
get => (WindowCommand) GetValue( CommandProperty );
|
||||
set => SetValue( CommandProperty, value );
|
||||
}
|
||||
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
|
||||
AssociatedObject.Click += OnClick;
|
||||
}
|
||||
|
||||
private void OnClick( object sender, RoutedEventArgs e )
|
||||
{
|
||||
if ( !( sender is UIElement element ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Window window = Window.GetWindow( element );
|
||||
|
||||
if ( window == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( Command )
|
||||
{
|
||||
case WindowCommand.Minimize:
|
||||
{
|
||||
window.WindowState = WindowState.Minimized;
|
||||
break;
|
||||
}
|
||||
case WindowCommand.Maximize:
|
||||
{
|
||||
window.WindowState = window.WindowState == WindowState.Maximized
|
||||
? WindowState.Normal
|
||||
: WindowState.Maximized;
|
||||
|
||||
break;
|
||||
}
|
||||
case WindowCommand.Close:
|
||||
{
|
||||
window.Close();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
base.OnDetaching();
|
||||
|
||||
AssociatedObject.Click -= OnClick;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interactivity;
|
||||
|
||||
namespace ClassicAssist.UI.Misc
|
||||
{
|
||||
public class WindowMouseDownBehaviour : Behavior<UIElement>
|
||||
{
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
|
||||
AssociatedObject.MouseDown += OnMouseDown;
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
base.OnDetaching();
|
||||
|
||||
AssociatedObject.MouseDown -= OnMouseDown;
|
||||
}
|
||||
|
||||
private static void OnMouseDown( object sender, MouseButtonEventArgs e )
|
||||
{
|
||||
if ( !( sender is UIElement element ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( e.ChangedButton == MouseButton.Left )
|
||||
{
|
||||
Window.GetWindow( element )?.DragMove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Windows;
|
||||
using System.Windows.Interactivity;
|
||||
using ClassicAssist.Data;
|
||||
|
||||
namespace ClassicAssist.UI.Misc
|
||||
{
|
||||
public class WindowResizeBehaviour : Behavior<Window>
|
||||
{
|
||||
protected override void OnAttached()
|
||||
{
|
||||
base.OnAttached();
|
||||
|
||||
#if !DEVELOP
|
||||
AssociatedObject.Width = AssistantOptions.WindowWidth;
|
||||
AssociatedObject.Height = AssistantOptions.WindowHeight;
|
||||
#endif
|
||||
|
||||
AssociatedObject.SizeChanged += OnSizeChanged;
|
||||
AssistantOptions.OptionsLoaded += OnOptionsLoaded;
|
||||
}
|
||||
|
||||
private void OnOptionsLoaded( object sender, EventArgs e )
|
||||
{
|
||||
AssociatedObject.Width = AssistantOptions.WindowWidth;
|
||||
AssociatedObject.Height = AssistantOptions.WindowHeight;
|
||||
}
|
||||
|
||||
private static void OnSizeChanged( object sender, SizeChangedEventArgs e )
|
||||
{
|
||||
#if !DEVELOP
|
||||
AssistantOptions.WindowHeight = e.HeightChanged ? e.NewSize.Height : AssistantOptions.WindowHeight;
|
||||
AssistantOptions.WindowWidth = e.WidthChanged ? e.NewSize.Width : AssistantOptions.WindowWidth;
|
||||
#endif
|
||||
}
|
||||
|
||||
protected override void OnDetaching()
|
||||
{
|
||||
base.OnDetaching();
|
||||
|
||||
AssociatedObject.SizeChanged += OnSizeChanged;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Windows.Input;
|
||||
using ClassicAssist.Annotations;
|
||||
using ClassicAssist.Data.Autoloot;
|
||||
|
||||
namespace ClassicAssist.UI.Models
|
||||
{
|
||||
public class EntityCollectionFilter : INotifyPropertyChanged
|
||||
{
|
||||
private PropertyEntry _constraint;
|
||||
private AutolootOperator _operator = AutolootOperator.Equal;
|
||||
private int _value;
|
||||
|
||||
public PropertyEntry Constraint
|
||||
{
|
||||
get => _constraint;
|
||||
set => SetProperty( ref _constraint, value );
|
||||
}
|
||||
|
||||
public AutolootOperator Operator
|
||||
{
|
||||
get => _operator;
|
||||
set => SetProperty( ref _operator, value );
|
||||
}
|
||||
|
||||
public int Value
|
||||
{
|
||||
get => _value;
|
||||
set => SetProperty( ref _value, value );
|
||||
}
|
||||
|
||||
public event PropertyChangedEventHandler PropertyChanged;
|
||||
|
||||
[NotifyPropertyChangedInvocator]
|
||||
protected virtual void OnPropertyChanged( [CallerMemberName] string propertyName = null )
|
||||
{
|
||||
PropertyChanged?.Invoke( this, new PropertyChangedEventArgs( propertyName ) );
|
||||
}
|
||||
|
||||
// ReSharper disable once RedundantAssignment
|
||||
public virtual void SetProperty<T>( ref T obj, T value, [CallerMemberName] string propertyName = "" )
|
||||
{
|
||||
obj = value;
|
||||
OnPropertyChanged( propertyName );
|
||||
CommandManager.InvalidateRequerySuggested();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
namespace ClassicAssist.UI.Models
|
||||
{
|
||||
public enum EntityCollectionSortStyle
|
||||
{
|
||||
Name,
|
||||
Serial,
|
||||
Hue,
|
||||
ID,
|
||||
Quantity
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,336 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using ClassicAssist.Data.Macros;
|
||||
using ClassicAssist.Data.Macros.Commands;
|
||||
using ClassicAssist.Misc;
|
||||
using ClassicAssist.Shared.Resources;
|
||||
using ClassicAssist.UO;
|
||||
|
||||
namespace ClassicAssist.UI.ViewModels
|
||||
{
|
||||
public class TimerData
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public OffsetStopwatch Value { get; set; }
|
||||
}
|
||||
|
||||
public class ActiveObjectsViewModel : BaseViewModel
|
||||
{
|
||||
private ICommand _clearAllAliasesCommand;
|
||||
private ICommand _clearAllListsCommand;
|
||||
private ICommand _clearIgnoreListCommand;
|
||||
private ObservableCollection<int> _ignoreEntries = new ObservableCollection<int>();
|
||||
private ICommand _refreshAliasesCommand;
|
||||
private ICommand _refreshIgnoreListCommand;
|
||||
private ICommand _refreshListsCommand;
|
||||
private ICommand _refreshTimersCommand;
|
||||
private ICommand _removeAliasCommand;
|
||||
private ICommand _removeIgnoreEntryCommand;
|
||||
private ICommand _removeInstanceAliasCommand;
|
||||
private ICommand _removeListCommand;
|
||||
private AliasEntry _selectedAlias;
|
||||
private int _selectedIgnoreEntry;
|
||||
private InstanceAliasEntry _selectedInstanceAlias;
|
||||
private ListEntry _selectedList;
|
||||
private TimerData _selectedTimer;
|
||||
private ICommand _setAliasCommand;
|
||||
private ObservableCollection<TimerData> _timers = new ObservableCollection<TimerData>();
|
||||
|
||||
public ActiveObjectsViewModel()
|
||||
{
|
||||
RefreshAliases();
|
||||
RefreshInstanceAliases();
|
||||
RefreshLists();
|
||||
RefreshTimers();
|
||||
RefreshIgnoreList();
|
||||
}
|
||||
|
||||
public ObservableCollection<AliasEntry> Aliases { get; set; } = new ObservableCollection<AliasEntry>();
|
||||
|
||||
public ICommand ClearAllAliasesCommand =>
|
||||
_clearAllAliasesCommand ?? ( _clearAllAliasesCommand = new RelayCommand( ClearAllAliases, o => true ) );
|
||||
|
||||
public ICommand ClearAllListsCommand =>
|
||||
_clearAllListsCommand ?? ( _clearAllListsCommand = new RelayCommand( ClearAllLists, o => true ) );
|
||||
|
||||
public ICommand ClearIgnoreListCommand =>
|
||||
_clearIgnoreListCommand ?? ( _clearIgnoreListCommand = new RelayCommand( ClearIgnoreList, o => true ) );
|
||||
|
||||
public ObservableCollection<int> IgnoreEntries
|
||||
{
|
||||
get => _ignoreEntries;
|
||||
set => SetProperty( ref _ignoreEntries, value );
|
||||
}
|
||||
|
||||
public ObservableCollection<InstanceAliasEntry> InstanceAliases { get; set; } =
|
||||
new ObservableCollection<InstanceAliasEntry>();
|
||||
|
||||
public ObservableCollection<ListEntry> Lists { get; set; } = new ObservableCollection<ListEntry>();
|
||||
|
||||
public ICommand RefreshAliasesCommand =>
|
||||
_refreshAliasesCommand ?? ( _refreshAliasesCommand = new RelayCommand( o => RefreshAliases(), o => true ) );
|
||||
|
||||
public ICommand RefreshIgnoreListCommand =>
|
||||
_refreshIgnoreListCommand ??
|
||||
( _refreshIgnoreListCommand = new RelayCommand( o => RefreshIgnoreList(), o => true ) );
|
||||
|
||||
public ICommand RefreshListsCommand =>
|
||||
_refreshListsCommand ?? ( _refreshListsCommand = new RelayCommand( o => RefreshLists(), o => true ) );
|
||||
|
||||
public ICommand RefreshTimersCommand =>
|
||||
_refreshTimersCommand ?? ( _refreshTimersCommand = new RelayCommand( o => RefreshTimers(), o => true ) );
|
||||
|
||||
public ICommand RemoveAliasCommand =>
|
||||
_removeAliasCommand ??
|
||||
( _removeAliasCommand = new RelayCommand( RemoveAlias, o => SelectedAlias != null ) );
|
||||
|
||||
public ICommand RemoveIgnoreEntryCommand =>
|
||||
_removeIgnoreEntryCommand ??
|
||||
( _removeIgnoreEntryCommand = new RelayCommand( RemoveIgnoreEntry, o => true ) );
|
||||
|
||||
public ICommand RemoveInstanceAliasCommand =>
|
||||
_removeInstanceAliasCommand ?? ( _removeInstanceAliasCommand =
|
||||
new RelayCommand( RemoveInstanceAlias, o => SelectedInstanceAlias != null ) );
|
||||
|
||||
public ICommand RemoveListCommand =>
|
||||
_removeListCommand ?? ( _removeListCommand = new RelayCommand( RemoveList, o => SelectedList != null ) );
|
||||
|
||||
public AliasEntry SelectedAlias
|
||||
{
|
||||
get => _selectedAlias;
|
||||
set => SetProperty( ref _selectedAlias, value );
|
||||
}
|
||||
|
||||
public int SelectedIgnoreEntry
|
||||
{
|
||||
get => _selectedIgnoreEntry;
|
||||
set => SetProperty( ref _selectedIgnoreEntry, value );
|
||||
}
|
||||
|
||||
public InstanceAliasEntry SelectedInstanceAlias
|
||||
{
|
||||
get => _selectedInstanceAlias;
|
||||
set => SetProperty( ref _selectedInstanceAlias, value );
|
||||
}
|
||||
|
||||
public ListEntry SelectedList
|
||||
{
|
||||
get => _selectedList;
|
||||
set => SetProperty( ref _selectedList, value );
|
||||
}
|
||||
|
||||
public TimerData SelectedTimer
|
||||
{
|
||||
get => _selectedTimer;
|
||||
set => SetProperty( ref _selectedTimer, value );
|
||||
}
|
||||
|
||||
public ICommand SetAliasCommand =>
|
||||
_setAliasCommand ?? ( _setAliasCommand = new RelayCommandAsync( SetAlias, o => o != null ) );
|
||||
|
||||
public ObservableCollection<TimerData> Timers
|
||||
{
|
||||
get => _timers;
|
||||
set => SetProperty( ref _timers, value );
|
||||
}
|
||||
|
||||
private void RefreshInstanceAliases()
|
||||
{
|
||||
InstanceAliases.Clear();
|
||||
|
||||
MacroManager manager = MacroManager.GetInstance();
|
||||
|
||||
foreach ( MacroEntry entry in manager.Items )
|
||||
{
|
||||
foreach ( KeyValuePair<string, int> alias in entry.Aliases )
|
||||
{
|
||||
InstanceAliases.Add( new InstanceAliasEntry
|
||||
{
|
||||
Macro = entry, Name = alias.Key, Serial = alias.Value
|
||||
} );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveInstanceAlias( object obj )
|
||||
{
|
||||
if ( !( obj is InstanceAliasEntry entry ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
entry.Macro.Aliases.Remove( entry.Name );
|
||||
|
||||
RefreshInstanceAliases();
|
||||
}
|
||||
|
||||
private void ClearIgnoreList( object obj )
|
||||
{
|
||||
ObjectCommands.ClearIgnoreList();
|
||||
|
||||
RefreshIgnoreList();
|
||||
}
|
||||
|
||||
private void RemoveIgnoreEntry( object obj )
|
||||
{
|
||||
if ( !( obj is int serial ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ObjectCommands.IgnoreList.Remove( serial );
|
||||
|
||||
RefreshIgnoreList();
|
||||
}
|
||||
|
||||
private void RefreshIgnoreList()
|
||||
{
|
||||
IgnoreEntries.Clear();
|
||||
|
||||
foreach ( int serial in ObjectCommands.IgnoreList )
|
||||
{
|
||||
IgnoreEntries.Add( serial );
|
||||
}
|
||||
}
|
||||
|
||||
private void RefreshTimers()
|
||||
{
|
||||
Dictionary<string, OffsetStopwatch> timers = TimerCommands.GetAllTimers();
|
||||
|
||||
if ( timers == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Timers.Clear();
|
||||
|
||||
foreach ( KeyValuePair<string, OffsetStopwatch> timer in timers )
|
||||
{
|
||||
Timers.Add( new TimerData { Name = timer.Key, Value = timer.Value } );
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveList( object obj )
|
||||
{
|
||||
if ( !( obj is ListEntry entry ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ListCommands.RemoveList( entry.Name );
|
||||
Lists.Remove( entry );
|
||||
}
|
||||
|
||||
private void ClearAllLists( object obj )
|
||||
{
|
||||
string[] lists = ListCommands.GetAllLists().Select( l => l.Key ).ToArray();
|
||||
|
||||
for ( int i = 0; i < lists.Count(); i++ )
|
||||
{
|
||||
ListCommands.RemoveList( lists[i] );
|
||||
}
|
||||
|
||||
RefreshLists();
|
||||
}
|
||||
|
||||
private void RefreshLists()
|
||||
{
|
||||
Lists.Clear();
|
||||
|
||||
foreach ( KeyValuePair<string, List<int>> list in ListCommands.GetAllLists() )
|
||||
{
|
||||
Lists.Add( new ListEntry { Name = list.Key, Serials = list.Value.ToArray() } );
|
||||
}
|
||||
}
|
||||
|
||||
private void RemoveAlias( object obj )
|
||||
{
|
||||
if ( !( obj is AliasEntry entry ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AliasCommands.UnsetAlias( entry.Name );
|
||||
Aliases.Remove( entry );
|
||||
}
|
||||
|
||||
public void RefreshAliases()
|
||||
{
|
||||
Aliases.Clear();
|
||||
|
||||
foreach ( KeyValuePair<string, int> alias in AliasCommands.GetAllAliases() )
|
||||
{
|
||||
Aliases.AddSorted( new AliasEntry { Name = alias.Key, Serial = alias.Value } );
|
||||
}
|
||||
}
|
||||
|
||||
private void ClearAllAliases( object obj )
|
||||
{
|
||||
string[] aliases = AliasCommands.GetAllAliases().Select( a => a.Key ).ToArray();
|
||||
|
||||
// ReSharper disable once ForCanBeConvertedToForeach
|
||||
for ( int i = 0; i < aliases.Length; i++ )
|
||||
{
|
||||
AliasCommands.UnsetAlias( aliases[i] );
|
||||
}
|
||||
|
||||
RefreshAliases();
|
||||
}
|
||||
|
||||
private static async Task SetAlias( object arg )
|
||||
{
|
||||
if ( !( arg is AliasEntry entry ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
int serial =
|
||||
await Shared.UO.Commands.GetTargeSerialAsync( string.Format( Strings.Target_object___0_____, entry.Name ) );
|
||||
|
||||
if ( serial == 0 )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
AliasCommands.SetAlias( entry.Name, serial );
|
||||
}
|
||||
|
||||
public class InstanceAliasEntry
|
||||
{
|
||||
public MacroEntry Macro { get; set; }
|
||||
public string Name { get; set; }
|
||||
public int Serial { get; set; }
|
||||
}
|
||||
|
||||
public class AliasEntry : IComparable<AliasEntry>
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public int Serial { get; set; }
|
||||
|
||||
public int CompareTo( AliasEntry other )
|
||||
{
|
||||
if ( ReferenceEquals( this, other ) )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( ReferenceEquals( null, other ) )
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
return string.Compare( Name, other.Name, StringComparison.InvariantCultureIgnoreCase );
|
||||
}
|
||||
}
|
||||
|
||||
public class ListEntry
|
||||
{
|
||||
public string Name { get; set; }
|
||||
public int[] Serials { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,260 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using ClassicAssist.Shared;
|
||||
using ClassicAssist.Data.Chat;
|
||||
using ClassicAssist.Data.Macros.Commands;
|
||||
using ClassicAssist.Misc;
|
||||
using ClassicAssist.Shared.Resources;
|
||||
using ClassicAssist.Shared.UO;
|
||||
|
||||
namespace ClassicAssist.UI.ViewModels
|
||||
{
|
||||
public class ChatViewModel : BaseViewModel
|
||||
{
|
||||
private readonly SolidColorBrush _defaultBrush =
|
||||
new SolidColorBrush( Color.FromArgb( 0xff, 0xcc, 0xcc, 0xcc ) );
|
||||
|
||||
private readonly SolidColorBrush _enemyBrush = new SolidColorBrush( Colors.Orange );
|
||||
|
||||
private readonly SolidColorBrush _friendBrush = new SolidColorBrush( Colors.LimeGreen );
|
||||
|
||||
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
|
||||
private readonly ChatManager _manager;
|
||||
private ICommand _changeChannelCommand;
|
||||
private ObservableCollection<string> _channels = new ObservableCollection<string>();
|
||||
private string _currentChannel;
|
||||
private ObservableCollection<ChatMessage> _messages = new ObservableCollection<ChatMessage>();
|
||||
private string _selectedChannel;
|
||||
private string _title;
|
||||
private ICommand _toggleOptionCommand;
|
||||
private bool _topmost = true;
|
||||
private ObservableCollection<ChatUser> _users = new ObservableCollection<ChatUser>();
|
||||
|
||||
public ChatViewModel()
|
||||
{
|
||||
_manager = ChatManager.GetInstance();
|
||||
|
||||
_manager.UserJoinedEvent += OnUserJoined;
|
||||
_manager.UserLeftEvent += OnUserLeft;
|
||||
_manager.ClearUsersEvent += OnClearUsers;
|
||||
_manager.JoinedChatChannelEvent += OnJoinedChatChannel;
|
||||
_manager.LeftChatChannelEvent += OnLeftChatChannel;
|
||||
Engine.DisconnectedEvent += () => OnLeftChatChannel( string.Empty );
|
||||
_manager.ChannelCreatedEvent += OnChannelCreated;
|
||||
_manager.ChannelRemovedEvent += OnChannelRemoved;
|
||||
|
||||
if ( !string.IsNullOrEmpty( _manager.CurrentChannel ) )
|
||||
{
|
||||
OnJoinedChatChannel( _manager.CurrentChannel );
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateTitle( Strings.Chat );
|
||||
}
|
||||
|
||||
foreach ( string user in _manager.Users )
|
||||
{
|
||||
//TODO2
|
||||
Users.AddSorted( new ChatUser { Username = user/*, Colour = GetUserColour( user )*/ } );
|
||||
}
|
||||
|
||||
foreach ( string channel in _manager.Channels )
|
||||
{
|
||||
OnChannelCreated( channel );
|
||||
}
|
||||
|
||||
//foreach ( ChatMessage message in _manager.Messages )
|
||||
//{
|
||||
// Messages.Add( message );
|
||||
//}
|
||||
|
||||
_manager.ChatMessageEvent += OnChatMessage;
|
||||
}
|
||||
|
||||
public ICommand ChangeChannelCommand =>
|
||||
_changeChannelCommand ??
|
||||
( _changeChannelCommand = new RelayCommand( ChangeChannel, o => Channels.Count != 0 ) );
|
||||
|
||||
public ObservableCollection<string> Channels
|
||||
{
|
||||
get => _channels;
|
||||
set => SetProperty( ref _channels, value );
|
||||
}
|
||||
|
||||
public string CurrentChannel
|
||||
{
|
||||
get => _currentChannel;
|
||||
set => SetProperty( ref _currentChannel, value );
|
||||
}
|
||||
|
||||
public ObservableCollection<ChatMessage> Messages
|
||||
{
|
||||
get => _messages;
|
||||
set => SetProperty( ref _messages, value );
|
||||
}
|
||||
|
||||
public string SelectedChannel
|
||||
{
|
||||
get => _selectedChannel;
|
||||
set => SetProperty( ref _selectedChannel, value );
|
||||
}
|
||||
|
||||
public string Title
|
||||
{
|
||||
get => _title;
|
||||
set => SetProperty( ref _title, value );
|
||||
}
|
||||
|
||||
public ICommand ToggleOptionCommand =>
|
||||
_toggleOptionCommand ?? ( _toggleOptionCommand = new RelayCommand( ToggleOption, o => true ) );
|
||||
|
||||
public bool Topmost
|
||||
{
|
||||
get => _topmost;
|
||||
set => SetProperty( ref _topmost, value );
|
||||
}
|
||||
|
||||
public ObservableCollection<ChatUser> Users
|
||||
{
|
||||
get => _users;
|
||||
set => SetProperty( ref _users, value );
|
||||
}
|
||||
|
||||
private static void ToggleOption( object obj )
|
||||
{
|
||||
}
|
||||
|
||||
private void ChangeChannel( object obj )
|
||||
{
|
||||
if ( !( obj is string channel ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_dispatcher.Invoke( () => { Commands.JoinChatChannel( channel ); } );
|
||||
}
|
||||
|
||||
private void OnChannelRemoved( string channel )
|
||||
{
|
||||
_dispatcher.Invoke( () => { Channels.Remove( channel ); } );
|
||||
}
|
||||
|
||||
private void OnChannelCreated( string channel )
|
||||
{
|
||||
_dispatcher.Invoke( () => { Channels.Add( channel ); } );
|
||||
}
|
||||
|
||||
private void OnChatMessage( string username, string channel, string message )
|
||||
{
|
||||
_dispatcher.Invoke( () => Messages.Add( new ChatMessage
|
||||
{
|
||||
//TODO2
|
||||
Username = username,
|
||||
Channel = channel,
|
||||
Text = message/*, Colour = GetUserColour( username )*/
|
||||
} ) );
|
||||
}
|
||||
|
||||
private void OnLeftChatChannel( string channel )
|
||||
{
|
||||
_dispatcher.Invoke( () =>
|
||||
{
|
||||
Users.Clear();
|
||||
CurrentChannel = null;
|
||||
SelectedChannel = null;
|
||||
UpdateTitle( string.Empty );
|
||||
} );
|
||||
}
|
||||
|
||||
private void UpdateTitle( string channel )
|
||||
{
|
||||
if ( string.IsNullOrEmpty( channel ) )
|
||||
{
|
||||
Title = Strings.Chat;
|
||||
return;
|
||||
}
|
||||
|
||||
Title = $"{Strings.Chat} - {channel}";
|
||||
}
|
||||
|
||||
private void OnJoinedChatChannel( string channel )
|
||||
{
|
||||
_dispatcher.Invoke( () =>
|
||||
{
|
||||
CurrentChannel = channel;
|
||||
SelectedChannel = channel;
|
||||
UpdateTitle( channel );
|
||||
} );
|
||||
}
|
||||
|
||||
private void OnClearUsers()
|
||||
{
|
||||
_dispatcher.Invoke( () => Users.Clear() );
|
||||
}
|
||||
|
||||
private void OnUserLeft( string username, string channel )
|
||||
{
|
||||
_dispatcher.Invoke( () => { Users.Remove( Users.FirstOrDefault( u => u.Username == username ) ); } );
|
||||
}
|
||||
|
||||
private void OnUserJoined( string username, string channel )
|
||||
{
|
||||
_dispatcher.Invoke( () =>
|
||||
{
|
||||
//TODO2
|
||||
ChatUser user = new ChatUser { Username = username/*, Colour = GetUserColour( username )*/ };
|
||||
|
||||
Users.AddSorted( user );
|
||||
} );
|
||||
}
|
||||
|
||||
private SolidColorBrush GetUserColour( string username )
|
||||
{
|
||||
try
|
||||
{
|
||||
Match matches = Regex.Match( username, @"<(.*)>\s*(.*)" );
|
||||
|
||||
if ( !matches.Success )
|
||||
{
|
||||
return _defaultBrush;
|
||||
}
|
||||
|
||||
int serial = int.Parse( matches.Groups[1].Value );
|
||||
|
||||
if ( serial == Engine.Player?.Serial || MobileCommands.InFriendList( serial ) )
|
||||
{
|
||||
return _friendBrush;
|
||||
}
|
||||
|
||||
return serial == AliasCommands.GetAlias( "enemy" ) ? _enemyBrush : _defaultBrush;
|
||||
}
|
||||
catch ( Exception )
|
||||
{
|
||||
return _defaultBrush;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
#region License
|
||||
|
||||
// Copyright (C) 2020 Reetus
|
||||
//
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
#endregion
|
||||
|
||||
using System;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using ClassicAssist.Shared;
|
||||
using ClassicAssist.Data;
|
||||
using ClassicAssist.Shared.Resources;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace ClassicAssist.UI.ViewModels.Debug
|
||||
{
|
||||
public class DebugAssembliesViewModel : BaseViewModel
|
||||
{
|
||||
private ObservableCollection<Assembly> _items = new ObservableCollection<Assembly>();
|
||||
private ICommand _loadCommand;
|
||||
private ICommand _removeCommand;
|
||||
private ICommand _saveCommand;
|
||||
|
||||
public DebugAssembliesViewModel()
|
||||
{
|
||||
if ( AssistantOptions.Assemblies == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ( string assemblyName in AssistantOptions.Assemblies )
|
||||
{
|
||||
Assembly assembly = LoadAssembly( assemblyName );
|
||||
|
||||
if ( assembly != null )
|
||||
{
|
||||
Items.Add( assembly );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<Assembly> Items
|
||||
{
|
||||
get => _items;
|
||||
set => SetProperty( ref _items, value );
|
||||
}
|
||||
|
||||
public ICommand LoadCommand => _loadCommand ?? ( _loadCommand = new RelayCommandAsync( Load, o => true ) );
|
||||
|
||||
public ICommand RemoveCommand =>
|
||||
_removeCommand ?? ( _removeCommand = new RelayCommandAsync( Remove, o => true ) );
|
||||
|
||||
public ICommand SaveCommand => _saveCommand ?? ( _saveCommand = new RelayCommandAsync( Save, o => true ) );
|
||||
|
||||
public Assembly SelectedItem { get; set; }
|
||||
|
||||
private async Task Load( object arg )
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog
|
||||
{
|
||||
InitialDirectory = Engine.StartupPath, Filter = "DLL Files|*.dll", CheckFileExists = true
|
||||
};
|
||||
|
||||
bool? result = ofd.ShowDialog();
|
||||
|
||||
if ( result.HasValue && result.Value )
|
||||
{
|
||||
try
|
||||
{
|
||||
Assembly assembly = LoadAssembly( ofd.FileName );
|
||||
|
||||
if ( assembly != null )
|
||||
{
|
||||
await _dispatcher.InvokeAsync( () => Items.Add( assembly ) );
|
||||
}
|
||||
}
|
||||
catch ( Exception e )
|
||||
{
|
||||
MessageBox.Show( string.Format( Strings.Error_loading_assembly___0_, e.Message ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static Assembly LoadAssembly( string fileName )
|
||||
{
|
||||
if ( !File.Exists( fileName ) )
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return Assembly.LoadFile( fileName );
|
||||
}
|
||||
|
||||
private async Task Remove( object arg )
|
||||
{
|
||||
if ( !( arg is Assembly assembly ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
await _dispatcher.InvokeAsync( () => Items.Remove( assembly ) );
|
||||
}
|
||||
|
||||
private async Task Save( object arg )
|
||||
{
|
||||
AssistantOptions.Assemblies = Items.Select( a => a.Location ).ToArray();
|
||||
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,620 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media.Imaging;
|
||||
using ClassicAssist.Shared;
|
||||
using ClassicAssist.Data.Autoloot;
|
||||
using ClassicAssist.Data.Macros.Commands;
|
||||
using ClassicAssist.Misc;
|
||||
using ClassicAssist.Shared.Resources;
|
||||
using ClassicAssist.UI.Models;
|
||||
using ClassicAssist.UI.Views;
|
||||
using ClassicAssist.UO;
|
||||
using ClassicAssist.UO.Data;
|
||||
using ClassicAssist.UO.Network;
|
||||
using ClassicAssist.UO.Network.Packets;
|
||||
using ClassicAssist.UO.Objects;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace ClassicAssist.UI.ViewModels
|
||||
{
|
||||
public class EntityCollectionViewerViewModel : BaseViewModel
|
||||
{
|
||||
private ICommand _applyFiltersCommand;
|
||||
private ICommand _cancelActionCommand;
|
||||
private CancellationTokenSource _cancellationToken;
|
||||
private ICommand _changeSortStyleCommand;
|
||||
private ItemCollection _collection;
|
||||
private ICommand _contextContextMenuRequestCommand;
|
||||
private ICommand _contextMoveToBackpackCommand;
|
||||
private ICommand _contextMoveToContainerCommand;
|
||||
private ICommand _contextUseItemCommand;
|
||||
private ObservableCollection<EntityCollectionData> _entities;
|
||||
private ICommand _equipItemCommand;
|
||||
private IEnumerable<EntityCollectionFilter> _filters;
|
||||
private bool _isPerformingAction;
|
||||
private ICommand _itemDoubleClickCommand;
|
||||
private ICommand _refreshCommand;
|
||||
|
||||
private ObservableCollection<EntityCollectionData> _selectedItems =
|
||||
new ObservableCollection<EntityCollectionData>();
|
||||
|
||||
private bool _showProperties;
|
||||
|
||||
private IComparer<Entity> _sorter = new IDThenSerialComparer();
|
||||
private string _statusLabel;
|
||||
private ICommand _togglePropertiesCommand;
|
||||
private bool _topmost;
|
||||
|
||||
public EntityCollectionViewerViewModel()
|
||||
{
|
||||
_collection = new ItemCollection( 0 );
|
||||
|
||||
for ( int i = 0; i < 5; i++ )
|
||||
{
|
||||
_collection.Add( new Item( i + 1 ) { ID = 100 + i } );
|
||||
}
|
||||
|
||||
_collection.Add( new Item( 6 ) { ID = 106, Hue = 2413 } );
|
||||
|
||||
Entities = new ObservableCollection<EntityCollectionData>( _collection.ToEntityCollectionData( _sorter ) );
|
||||
}
|
||||
|
||||
public EntityCollectionViewerViewModel( ItemCollection collection )
|
||||
{
|
||||
_collection = collection;
|
||||
|
||||
Entities = new ObservableCollection<EntityCollectionData>( collection.ToEntityCollectionData( _sorter ) );
|
||||
|
||||
SelectedItems.CollectionChanged += ( sender, args ) =>
|
||||
{
|
||||
if ( !( sender is ObservableCollection<EntityCollectionData> ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
UpdateStatusLabel();
|
||||
};
|
||||
|
||||
UpdateStatusLabel();
|
||||
}
|
||||
|
||||
public ICommand ApplyFiltersCommand =>
|
||||
_applyFiltersCommand ?? ( _applyFiltersCommand = new RelayCommand( ApplyFilters, o => true ) );
|
||||
|
||||
public ICommand CancelActionCommand =>
|
||||
_cancelActionCommand ?? ( _cancelActionCommand = new RelayCommandAsync( CancelAction,
|
||||
o => _cancellationToken != null ) );
|
||||
|
||||
public ICommand ChangeSortStyleCommand =>
|
||||
_changeSortStyleCommand ?? ( _changeSortStyleCommand = new RelayCommand( ChangeSortStyle, o => true ) );
|
||||
|
||||
public ICommand ContextContextMenuRequestCommand =>
|
||||
_contextContextMenuRequestCommand ?? ( _contextContextMenuRequestCommand =
|
||||
new RelayCommand( ContextMenuRequest, o => SelectedItems.Count > 0 ) );
|
||||
|
||||
public ICommand ContextMoveToBackpackCommand =>
|
||||
_contextMoveToBackpackCommand ?? ( _contextMoveToBackpackCommand =
|
||||
new RelayCommandAsync( ContextMoveToBackpack, o => SelectedItems != null && !IsPerformingAction ) );
|
||||
|
||||
public ICommand ContextMoveToContainerCommand =>
|
||||
_contextMoveToContainerCommand ?? ( _contextMoveToContainerCommand =
|
||||
new RelayCommandAsync( ContextMoveToContainer, o => SelectedItems != null && !IsPerformingAction ) );
|
||||
|
||||
public ICommand ContextUseItemCommand =>
|
||||
_contextUseItemCommand ?? ( _contextUseItemCommand =
|
||||
new RelayCommandAsync( ContextUseItem, o => SelectedItems != null && !IsPerformingAction ) );
|
||||
|
||||
public ObservableCollection<EntityCollectionData> Entities
|
||||
{
|
||||
get => _entities;
|
||||
set => SetProperty( ref _entities, value );
|
||||
}
|
||||
|
||||
public ICommand EquipItemCommand =>
|
||||
_equipItemCommand ?? ( _equipItemCommand = new RelayCommand( EquipItem, o => SelectedItems != null ) );
|
||||
|
||||
public bool IsPerformingAction
|
||||
{
|
||||
get => _isPerformingAction;
|
||||
set => SetProperty( ref _isPerformingAction, value );
|
||||
}
|
||||
|
||||
public ICommand ItemDoubleClickCommand =>
|
||||
_itemDoubleClickCommand ?? ( _itemDoubleClickCommand = new RelayCommand( ItemDoubleClick, o => true ) );
|
||||
|
||||
public static Lazy<Dictionary<int, int>> MountIDEntries { get; set; } =
|
||||
new Lazy<Dictionary<int, int>>( LoadMountIDEntries );
|
||||
|
||||
public ICommand RefreshCommand =>
|
||||
_refreshCommand ?? ( _refreshCommand = new RelayCommand( Refresh, o => _collection?.Serial != 0 ) );
|
||||
|
||||
public ObservableCollection<EntityCollectionData> SelectedItems
|
||||
{
|
||||
get => _selectedItems;
|
||||
set => SetProperty( ref _selectedItems, value );
|
||||
}
|
||||
|
||||
public bool ShowProperties
|
||||
{
|
||||
get => _showProperties;
|
||||
set => SetProperty( ref _showProperties, value );
|
||||
}
|
||||
|
||||
public static Lazy<int[]> ShrinkEntries { get; set; } = new Lazy<int[]>( LoadShrinkTable );
|
||||
|
||||
public string StatusLabel
|
||||
{
|
||||
get => _statusLabel;
|
||||
set => SetProperty( ref _statusLabel, value );
|
||||
}
|
||||
|
||||
public ICommand TogglePropertiesCommand =>
|
||||
_togglePropertiesCommand ?? ( _togglePropertiesCommand = new RelayCommand( ToggleProperties, o => true ) );
|
||||
|
||||
public bool Topmost
|
||||
{
|
||||
get => _topmost;
|
||||
set => SetProperty( ref _topmost, value );
|
||||
}
|
||||
|
||||
private static Dictionary<int, int> LoadMountIDEntries()
|
||||
{
|
||||
Dictionary<int, int> entries = new Dictionary<int, int>();
|
||||
|
||||
string fileName = Path.Combine( Engine.StartupPath, "Data", "MountID.json" );
|
||||
|
||||
if ( !File.Exists( fileName ) )
|
||||
{
|
||||
return entries;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
entries = JsonConvert.DeserializeObject<Dictionary<int, int>>( File.ReadAllText( fileName ) );
|
||||
}
|
||||
catch ( Exception )
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
|
||||
return entries;
|
||||
}
|
||||
|
||||
private static int[] LoadShrinkTable()
|
||||
{
|
||||
int[] table = new int[ushort.MaxValue];
|
||||
|
||||
using ( StringReader reader = new StringReader( Properties.Resources.Shrink ) )
|
||||
{
|
||||
string line;
|
||||
|
||||
while ( ( line = reader.ReadLine() ) != null )
|
||||
{
|
||||
if ( line.Length == 0 || line.StartsWith( "#" ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
string[] split = line.Split( '\t' );
|
||||
|
||||
if ( split.Length < 2 )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
int body = Convert.ToInt32( split[0] );
|
||||
int item = Convert.ToInt32( split[1], 16 );
|
||||
|
||||
if ( body >= 0 && body < table.Length )
|
||||
{
|
||||
table[body] = item;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return table;
|
||||
}
|
||||
|
||||
private void EquipItem( object obj )
|
||||
{
|
||||
foreach ( EntityCollectionData item in SelectedItems )
|
||||
{
|
||||
StaticTile td = TileData.GetStaticTile( item.Entity.ID );
|
||||
|
||||
if ( !td.Flags.HasFlag( TileFlags.Wearable ) )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
Layer layer = (Layer) td.Quality;
|
||||
|
||||
if ( layer == Layer.Invalid )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( item.Entity is Item equipItem )
|
||||
{
|
||||
Shared.UO.Commands.EquipItem( equipItem, layer );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void ApplyFilters( object obj )
|
||||
{
|
||||
if ( !( obj is IEnumerable<EntityCollectionFilter> list ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_filters = list;
|
||||
|
||||
Entities.Clear();
|
||||
|
||||
Entities = new ObservableCollection<EntityCollectionData>( _collection.Filter( _filters )
|
||||
.ToEntityCollectionData( _sorter ) );
|
||||
|
||||
UpdateStatusLabel();
|
||||
}
|
||||
|
||||
private void ChangeSortStyle( object obj )
|
||||
{
|
||||
if ( !( obj is EntityCollectionSortStyle val ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( val )
|
||||
{
|
||||
case EntityCollectionSortStyle.Name:
|
||||
_sorter = new NameThenSerialComparer();
|
||||
|
||||
break;
|
||||
|
||||
case EntityCollectionSortStyle.Serial:
|
||||
_sorter = new SerialComparer();
|
||||
|
||||
break;
|
||||
|
||||
case EntityCollectionSortStyle.Hue:
|
||||
_sorter = new HueThenAmountComparer();
|
||||
|
||||
break;
|
||||
|
||||
case EntityCollectionSortStyle.ID:
|
||||
_sorter = new IDThenSerialComparer();
|
||||
|
||||
break;
|
||||
|
||||
case EntityCollectionSortStyle.Quantity:
|
||||
_sorter = new QuantityThenSerialComparer();
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
|
||||
Entities = new ObservableCollection<EntityCollectionData>( _collection.ToEntityCollectionData( _sorter ) );
|
||||
}
|
||||
|
||||
private void UpdateStatusLabel()
|
||||
{
|
||||
StatusLabel = string.Format( Strings._0__items___1__selected___2__total_amount, Entities.Count,
|
||||
SelectedItems?.Count ?? 0,
|
||||
SelectedItems?.Select( i => i.Entity ).Where( i => i is Item ).Cast<Item>().Sum( i => i.Count ) );
|
||||
}
|
||||
|
||||
private void Refresh( object obj )
|
||||
{
|
||||
ItemCollection collection = new ItemCollection( _collection.Serial );
|
||||
|
||||
Entity entity = Engine.Items.GetItem( _collection.Serial ) ??
|
||||
(Entity) Engine.Mobiles.GetMobile( _collection.Serial );
|
||||
|
||||
if ( entity == null )
|
||||
{
|
||||
Shared.UO.Commands.SystemMessage( Strings.Cannot_find_item___ );
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( entity )
|
||||
{
|
||||
case Item item:
|
||||
if ( item.Container == null )
|
||||
{
|
||||
Shared.UO.Commands.WaitForContainerContents( item.Serial, 1000 );
|
||||
}
|
||||
|
||||
collection = item.Container;
|
||||
break;
|
||||
case Mobile mobile:
|
||||
collection = new ItemCollection( entity.Serial ) { mobile.GetEquippedItems() };
|
||||
break;
|
||||
}
|
||||
|
||||
if ( collection == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_collection = collection;
|
||||
|
||||
Entities = new ObservableCollection<EntityCollectionData>( _collection.ToEntityCollectionData( _sorter ) );
|
||||
}
|
||||
|
||||
private async Task ContextUseItem( object arg )
|
||||
{
|
||||
_cancellationToken = new CancellationTokenSource();
|
||||
|
||||
try
|
||||
{
|
||||
IsPerformingAction = true;
|
||||
|
||||
await Task.Run( () =>
|
||||
{
|
||||
int[] items = SelectedItems.Select( i => i.Entity.Serial ).ToArray();
|
||||
|
||||
foreach ( int item in items )
|
||||
{
|
||||
ObjectCommands.UseObject( item );
|
||||
|
||||
if ( _cancellationToken.Token.IsCancellationRequested )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsPerformingAction = false;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ContextMoveToContainer( object arg )
|
||||
{
|
||||
_cancellationToken = new CancellationTokenSource();
|
||||
|
||||
int serial = 0;
|
||||
|
||||
if ( arg is int s )
|
||||
{
|
||||
serial = s;
|
||||
}
|
||||
|
||||
if ( serial == 0 )
|
||||
{
|
||||
serial = await Shared.UO.Commands.GetTargeSerialAsync( Strings.Target_container___ );
|
||||
}
|
||||
|
||||
if ( serial == 0 )
|
||||
{
|
||||
Shared.UO.Commands.SystemMessage( Strings.Invalid_container___ );
|
||||
return;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
IsPerformingAction = true;
|
||||
|
||||
int[] items = SelectedItems.Select( i => i.Entity.Serial ).ToArray();
|
||||
|
||||
foreach ( int item in items )
|
||||
{
|
||||
await ActionPacketQueue.EnqueueDragDrop( item, -1, serial );
|
||||
|
||||
if ( _cancellationToken.Token.IsCancellationRequested )
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsPerformingAction = false;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ContextMoveToBackpack( object arg )
|
||||
{
|
||||
await ContextMoveToContainer( Engine.Player.Backpack.Serial );
|
||||
}
|
||||
|
||||
private async Task CancelAction( object arg )
|
||||
{
|
||||
_cancellationToken?.Cancel();
|
||||
|
||||
await Task.CompletedTask;
|
||||
}
|
||||
|
||||
private void ToggleProperties( object obj )
|
||||
{
|
||||
if ( !( obj is bool showProperties ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ShowProperties = showProperties;
|
||||
}
|
||||
|
||||
private static void ItemDoubleClick( object obj )
|
||||
{
|
||||
if ( !( obj is EntityCollectionData ecd ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
ObjectInspectorWindow window =
|
||||
new ObjectInspectorWindow { DataContext = new ObjectInspectorViewModel( ecd.Entity ) };
|
||||
|
||||
window.ShowDialog();
|
||||
}
|
||||
|
||||
private void ContextMenuRequest( object obj )
|
||||
{
|
||||
int[] items = SelectedItems.Select( i => i.Entity.Serial ).ToArray();
|
||||
|
||||
foreach ( int serial in items )
|
||||
{
|
||||
Engine.SendPacketToServer( new ContextMenuRequest( serial ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class EntityCollectionData
|
||||
{
|
||||
public BitmapSource Bitmap
|
||||
{
|
||||
get
|
||||
{
|
||||
BitmapSource result = Art.GetStatic( Entity.ID, Entity.Hue ).ToBitmapSource();
|
||||
|
||||
if ( !( Entity is Item item ) || item.Layer != Layer.Mount )
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
if ( !( EntityCollectionViewerViewModel.MountIDEntries.Value?.ContainsKey( Entity.ID ) ?? false ) )
|
||||
{
|
||||
return result;
|
||||
}
|
||||
|
||||
int id = (int) EntityCollectionViewerViewModel.MountIDEntries.Value?[Entity.ID];
|
||||
|
||||
result = Art.GetStatic( id, Entity.Hue ).ToBitmapSource();
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
public Entity Entity { get; set; }
|
||||
public string FullName => GetProperties( Entity );
|
||||
public string Name => GetName( Entity );
|
||||
|
||||
private static string GetProperties( Entity entity )
|
||||
{
|
||||
return entity.Properties == null
|
||||
? GetName( entity )
|
||||
: entity.Properties.Aggregate( "",
|
||||
( current, entityProperty ) => current + entityProperty.Text + "\r\n" ).TrimTrailingNewLine();
|
||||
}
|
||||
|
||||
private static string GetName( Entity entity )
|
||||
{
|
||||
if ( !( entity is Item item ) || item.Layer != Layer.Mount )
|
||||
{
|
||||
return entity.Name;
|
||||
}
|
||||
|
||||
if ( !( EntityCollectionViewerViewModel.MountIDEntries.Value?.ContainsKey( entity.ID ) ?? false ) )
|
||||
{
|
||||
return entity.Name;
|
||||
}
|
||||
|
||||
int id = (int) EntityCollectionViewerViewModel.MountIDEntries.Value?[entity.ID];
|
||||
|
||||
if ( id == 0 )
|
||||
{
|
||||
return entity.Name;
|
||||
}
|
||||
|
||||
StaticTile tileData = TileData.GetStaticTile( id );
|
||||
|
||||
return !string.IsNullOrEmpty( tileData.Name ) ? tileData.Name : entity.Name;
|
||||
}
|
||||
}
|
||||
|
||||
public static class ExtensionMethods
|
||||
{
|
||||
public static ItemCollection Filter( this ItemCollection collection,
|
||||
IEnumerable<EntityCollectionFilter> filterList )
|
||||
{
|
||||
ItemCollection newCollection = new ItemCollection( collection.Serial );
|
||||
|
||||
IEnumerable<Predicate<Item>> predicates = FiltersToPredicates( filterList ).ToList();
|
||||
|
||||
if ( !predicates.Any() )
|
||||
{
|
||||
return collection;
|
||||
}
|
||||
|
||||
foreach ( Item item in collection.GetItems() )
|
||||
{
|
||||
if ( predicates.All( p => p( item ) ) )
|
||||
{
|
||||
newCollection.Add( item );
|
||||
}
|
||||
}
|
||||
|
||||
return newCollection;
|
||||
}
|
||||
|
||||
private static IEnumerable<Predicate<Item>> FiltersToPredicates(
|
||||
IEnumerable<EntityCollectionFilter> filterList )
|
||||
{
|
||||
List<Predicate<Item>> predicates = new List<Predicate<Item>>();
|
||||
|
||||
foreach ( EntityCollectionFilter filter in filterList )
|
||||
{
|
||||
PropertyEntry constraint = filter.Constraint;
|
||||
|
||||
switch ( constraint.ConstraintType )
|
||||
{
|
||||
case PropertyType.Properties:
|
||||
{
|
||||
predicates.Add( i => i.Properties != null && constraint.Clilocs.Any( cliloc =>
|
||||
i.Properties.Any( p => AutolootHelpers.MatchProperty( p, cliloc,
|
||||
constraint, filter.Operator, filter.Value ) ) ) );
|
||||
|
||||
break;
|
||||
}
|
||||
case PropertyType.Object:
|
||||
{
|
||||
predicates.Add( i =>
|
||||
AutolootHelpers.ItemHasObjectProperty( i, constraint.Name ) && AutolootHelpers.Operation(
|
||||
filter.Operator, AutolootHelpers.GetItemObjectPropertyValue<int>( i, constraint.Name ),
|
||||
filter.Value ) );
|
||||
break;
|
||||
}
|
||||
default:
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
}
|
||||
|
||||
return predicates;
|
||||
}
|
||||
|
||||
public static string TrimTrailingNewLine( this string s )
|
||||
{
|
||||
return s.TrimEnd( '\r', '\n' );
|
||||
}
|
||||
|
||||
public static List<EntityCollectionData> ToEntityCollectionData( this ItemCollection itemCollection,
|
||||
IComparer<Entity> comparer )
|
||||
{
|
||||
if ( itemCollection == null )
|
||||
{
|
||||
return new List<EntityCollectionData>();
|
||||
}
|
||||
|
||||
Item[] items = itemCollection.GetItems();
|
||||
|
||||
IEnumerable<Item> noNames = items.Where( i => string.IsNullOrEmpty( i.Name ) );
|
||||
|
||||
foreach ( Item item in noNames )
|
||||
{
|
||||
item.Name = $"0x{item.Serial:x8}";
|
||||
}
|
||||
|
||||
return items.OrderBy( i => i, comparer ).Select( item => new EntityCollectionData { Entity = item } )
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Windows.Input;
|
||||
using ClassicAssist.Data.Filters;
|
||||
using ClassicAssist.UO.Data;
|
||||
|
||||
namespace ClassicAssist.UI.ViewModels.Filters
|
||||
{
|
||||
public class ClilocFilterConfigureViewModel : BaseViewModel
|
||||
{
|
||||
private ICommand _addItemCommand;
|
||||
private ObservableCollection<ClilocEntry> _allClilocs = new ObservableCollection<ClilocEntry>();
|
||||
private ObservableCollection<ClilocEntry> _filteredClilocs = new ObservableCollection<ClilocEntry>();
|
||||
private string _filterText;
|
||||
private ObservableCollection<FilterClilocEntry> _items = new ObservableCollection<FilterClilocEntry>();
|
||||
private ICommand _removeItemCommand;
|
||||
private ICommand _saveItemsCommand;
|
||||
private ClilocEntry _selectedClilocEntry;
|
||||
private FilterClilocEntry _selectedItem;
|
||||
|
||||
public ClilocFilterConfigureViewModel()
|
||||
{
|
||||
foreach ( KeyValuePair<int, string> kvp in Cliloc.GetItems() )
|
||||
{
|
||||
AllClilocs.Add( new ClilocEntry { Key = kvp.Key, Value = kvp.Value } );
|
||||
}
|
||||
|
||||
foreach ( KeyValuePair<int, string> filterFilter in ClilocFilter.Filters )
|
||||
{
|
||||
Items.Add( new FilterClilocEntry { Cliloc = filterFilter.Key, Replacement = filterFilter.Value } );
|
||||
}
|
||||
|
||||
UpdateEntries( _filterText );
|
||||
}
|
||||
|
||||
public ICommand AddItemCommand => _addItemCommand ?? ( _addItemCommand = new RelayCommand( AddItem ) );
|
||||
|
||||
public ObservableCollection<ClilocEntry> AllClilocs
|
||||
{
|
||||
get => _allClilocs;
|
||||
set => SetProperty( ref _allClilocs, value );
|
||||
}
|
||||
|
||||
public ObservableCollection<ClilocEntry> FilteredClilocs
|
||||
{
|
||||
get => _filteredClilocs;
|
||||
set => SetProperty( ref _filteredClilocs, value );
|
||||
}
|
||||
|
||||
public string FilterText
|
||||
{
|
||||
get => _filterText;
|
||||
set
|
||||
{
|
||||
SetProperty( ref _filterText, value );
|
||||
UpdateEntries( _filterText );
|
||||
}
|
||||
}
|
||||
|
||||
public ObservableCollection<FilterClilocEntry> Items
|
||||
{
|
||||
get => _items;
|
||||
set => SetProperty( ref _items, value );
|
||||
}
|
||||
|
||||
public ICommand RemoveItemCommand =>
|
||||
_removeItemCommand ?? ( _removeItemCommand = new RelayCommand( RemoveItem, o => SelectedItem != null ) );
|
||||
|
||||
public ICommand SaveItemsCommand =>
|
||||
_saveItemsCommand ?? ( _saveItemsCommand = new RelayCommand( SaveItems, o => true ) );
|
||||
|
||||
public ClilocEntry SelectedClilocEntry
|
||||
{
|
||||
get => _selectedClilocEntry;
|
||||
set => SetProperty( ref _selectedClilocEntry, value );
|
||||
}
|
||||
|
||||
public FilterClilocEntry SelectedItem
|
||||
{
|
||||
get => _selectedItem;
|
||||
set => SetProperty( ref _selectedItem, value );
|
||||
}
|
||||
|
||||
private void RemoveItem( object obj )
|
||||
{
|
||||
if ( !( obj is FilterClilocEntry entry ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Items.Remove( entry );
|
||||
}
|
||||
|
||||
private void SaveItems( object obj )
|
||||
{
|
||||
ClilocFilter.Filters.Clear();
|
||||
|
||||
foreach ( FilterClilocEntry entry in Items )
|
||||
{
|
||||
if ( !ClilocFilter.Filters.ContainsKey( entry.Cliloc ) )
|
||||
{
|
||||
ClilocFilter.Filters.Add( entry.Cliloc, entry.Replacement );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateEntries( string filterText )
|
||||
{
|
||||
IEnumerable<ClilocEntry> matches = AllClilocs.Where( m =>
|
||||
string.IsNullOrEmpty( filterText ) || m.Value.ToLower().Contains( filterText.ToLower() ) );
|
||||
FilteredClilocs.Clear();
|
||||
|
||||
foreach ( ClilocEntry clilocEntry in matches )
|
||||
{
|
||||
FilteredClilocs.Add( clilocEntry );
|
||||
}
|
||||
}
|
||||
|
||||
private void AddItem( object obj )
|
||||
{
|
||||
if ( !( obj is ClilocEntry clilocEntry ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( Items.Any( i => i.Cliloc == clilocEntry.Key ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Items.Add( new FilterClilocEntry { Cliloc = clilocEntry.Key, Replacement = clilocEntry.Value } );
|
||||
}
|
||||
|
||||
public class ClilocEntry
|
||||
{
|
||||
public int Key { get; set; }
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
public class FilterClilocEntry
|
||||
{
|
||||
public int Cliloc { get; set; }
|
||||
public string Original => UO.Data.Cliloc.GetProperty( Cliloc );
|
||||
public string Replacement { get; set; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,171 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Threading;
|
||||
using AnimatedGif;
|
||||
using ClassicAssist.Shared;
|
||||
using ClassicAssist.UI.Views;
|
||||
using Point = System.Drawing.Point;
|
||||
using Size = System.Drawing.Size;
|
||||
|
||||
namespace ClassicAssist.UI.ViewModels
|
||||
{
|
||||
public class GIFRecorderViewModel : BaseViewModel
|
||||
{
|
||||
private readonly GIFRecorderWindow _window;
|
||||
private bool _isRecording;
|
||||
private MemoryStream _lastStream;
|
||||
private ICommand _recordCommand;
|
||||
private ICommand _saveCommand;
|
||||
private CancellationTokenSource _token;
|
||||
|
||||
public GIFRecorderViewModel( GIFRecorderWindow window ) : this()
|
||||
{
|
||||
_window = window;
|
||||
}
|
||||
|
||||
public GIFRecorderViewModel()
|
||||
{
|
||||
}
|
||||
|
||||
public bool IsRecording
|
||||
{
|
||||
get => _isRecording;
|
||||
set => SetProperty( ref _isRecording, value );
|
||||
}
|
||||
|
||||
public MemoryStream LastStream
|
||||
{
|
||||
get => _lastStream;
|
||||
set => SetProperty( ref _lastStream, value );
|
||||
}
|
||||
|
||||
public ICommand RecordCommand => _recordCommand ?? ( _recordCommand = new RelayCommand( Record, o => true ) );
|
||||
|
||||
public ICommand SaveCommand => _saveCommand ?? ( _saveCommand = new RelayCommand( Save, o => !IsRecording ) );
|
||||
|
||||
private void Save( object obj )
|
||||
{
|
||||
if ( LastStream == null )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
string directory = Path.Combine( Engine.StartupPath ?? Environment.CurrentDirectory, "Screenshots" );
|
||||
|
||||
if ( !Directory.Exists( directory ) )
|
||||
{
|
||||
Directory.CreateDirectory( directory );
|
||||
}
|
||||
|
||||
DateTime now = DateTime.Now;
|
||||
|
||||
string fileName =
|
||||
$"ClassicAssist-{now.Year}-{now.Month}-{now.Day}-{now.Hour}-{now.Minute}-{now.Second}.gif";
|
||||
|
||||
string fullPath = Path.Combine( directory, fileName );
|
||||
|
||||
using ( FileStream fs = new FileStream( fullPath, FileMode.Create ) )
|
||||
{
|
||||
LastStream.WriteTo( fs );
|
||||
}
|
||||
|
||||
string args = $"/e, /select, \"{fullPath}\"";
|
||||
|
||||
ProcessStartInfo info = new ProcessStartInfo { FileName = "explorer", Arguments = args };
|
||||
Process.Start( info );
|
||||
}
|
||||
|
||||
private void Record( object obj )
|
||||
{
|
||||
if ( IsRecording )
|
||||
{
|
||||
_token.Cancel();
|
||||
}
|
||||
else
|
||||
{
|
||||
IsRecording = true;
|
||||
_token = new CancellationTokenSource();
|
||||
|
||||
Window w = Window.GetWindow( _window );
|
||||
WindowInteropHelper wih = new WindowInteropHelper( w ?? throw new InvalidOperationException() );
|
||||
|
||||
Task.Run( async () =>
|
||||
{
|
||||
try
|
||||
{
|
||||
TimeSpan frameInterval = TimeSpan.FromSeconds( 1.0 / 5 );
|
||||
MemoryStream ms = new MemoryStream();
|
||||
|
||||
using ( AnimatedGifCreator gif = new AnimatedGifCreator( ms, frameInterval.Milliseconds ) )
|
||||
{
|
||||
Rectangle rect = new Rectangle();
|
||||
_dispatcher.Invoke( () => GetWindowRect( wih.Handle, ref rect ) );
|
||||
|
||||
Bitmap bmp = new Bitmap( rect.Width - rect.Left - 10, rect.Height - rect.Top - 70 );
|
||||
|
||||
Stopwatch sw = new Stopwatch();
|
||||
sw.Start();
|
||||
|
||||
while ( true )
|
||||
{
|
||||
_dispatcher.Invoke( () => GetWindowRect( wih.Handle, ref rect ) );
|
||||
|
||||
using ( Graphics g = Graphics.FromImage( bmp ) )
|
||||
{
|
||||
g.CopyFromScreen( new Point( rect.Left + 5, rect.Top + 50 ), Point.Empty,
|
||||
new Size( bmp.Width, bmp.Height ) );
|
||||
}
|
||||
|
||||
await gif.AddFrameAsync( bmp, -1, GifQuality.Bit8 );
|
||||
|
||||
sw.Stop();
|
||||
|
||||
int wait = frameInterval.Milliseconds - (int) sw.ElapsedMilliseconds;
|
||||
|
||||
if ( wait > 0 )
|
||||
{
|
||||
await Task.Delay( wait );
|
||||
}
|
||||
|
||||
if ( _token.IsCancellationRequested )
|
||||
{
|
||||
return ms;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
_dispatcher.Invoke( () => IsRecording = false );
|
||||
}
|
||||
} ).ContinueWith( t =>
|
||||
{
|
||||
if ( !( t.Result is MemoryStream ms ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( LastStream != null )
|
||||
{
|
||||
LastStream.Dispose();
|
||||
LastStream = null;
|
||||
}
|
||||
|
||||
LastStream = ms;
|
||||
CommandManager.InvalidateRequerySuggested();
|
||||
} );
|
||||
}
|
||||
}
|
||||
|
||||
[DllImport( "user32.dll" )]
|
||||
private static extern IntPtr GetWindowRect( IntPtr hWnd, ref Rectangle rect );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Windows.Input;
|
||||
using ClassicAssist.Data.Macros;
|
||||
|
||||
namespace ClassicAssist.UI.ViewModels.Macros
|
||||
{
|
||||
public class CommandsData
|
||||
{
|
||||
public CommandsDisplayAttribute Attribute { get; set; }
|
||||
public string Category { get; set; }
|
||||
public bool IsExpanded { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Tooltip { get; set; }
|
||||
|
||||
public override string ToString()
|
||||
{
|
||||
return Name;
|
||||
}
|
||||
}
|
||||
|
||||
public class MacrosCommandViewModel : BaseViewModel
|
||||
{
|
||||
private readonly MacrosTabViewModel _macrosViewModel;
|
||||
private ICommand _insertCommand;
|
||||
private ObservableCollection<CommandsData> _items = new ObservableCollection<CommandsData>();
|
||||
private CommandsData _selectedItem;
|
||||
|
||||
public MacrosCommandViewModel( MacrosTabViewModel macros ) : this()
|
||||
{
|
||||
_macrosViewModel = macros;
|
||||
}
|
||||
|
||||
public MacrosCommandViewModel()
|
||||
{
|
||||
IEnumerable<Type> types = Assembly.GetExecutingAssembly().GetTypes().Where( t =>
|
||||
t.Namespace != null && t.Namespace.StartsWith( "ClassicAssist.Data.Macros.Commands" ) );
|
||||
|
||||
foreach ( Type type in types )
|
||||
{
|
||||
MemberInfo[] members = type.GetMembers( BindingFlags.Public | BindingFlags.Static );
|
||||
|
||||
foreach ( MemberInfo memberInfo in members )
|
||||
{
|
||||
CommandsDisplayAttribute attr = memberInfo.GetCustomAttribute<CommandsDisplayAttribute>();
|
||||
|
||||
if ( attr == null )
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
CommandsData entry = new CommandsData
|
||||
{
|
||||
Category = attr.Category,
|
||||
IsExpanded = false,
|
||||
Name = memberInfo.ToString(),
|
||||
Tooltip = attr.Description,
|
||||
Attribute = attr
|
||||
};
|
||||
|
||||
Items.Add( entry );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ICommand InsertCommand =>
|
||||
_insertCommand ?? ( _insertCommand = new RelayCommand( Insert, o => SelectedItem != null ) );
|
||||
|
||||
public ObservableCollection<CommandsData> Items
|
||||
{
|
||||
get => _items;
|
||||
set => SetProperty( ref _items, value );
|
||||
}
|
||||
|
||||
public CommandsData SelectedItem
|
||||
{
|
||||
get => _selectedItem;
|
||||
set => SetProperty( ref _selectedItem, value );
|
||||
}
|
||||
|
||||
private void Insert( object obj )
|
||||
{
|
||||
if ( !( obj is CommandsData cd ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( cd.Attribute != null )
|
||||
{
|
||||
//TODO UI
|
||||
//_macrosViewModel?.Document.Insert( _macrosViewModel.CaretPosition, cd.Attribute.InsertText );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
<UserControl x:Class="ClassicAssist.UI.Views.AboutControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ClassicAssist.UI.Views"
|
||||
xmlns:controls="clr-namespace:ClassicAssist.UI.Controls"
|
||||
xmlns:valueConverters1="clr-namespace:ClassicAssist.UI.Misc.ValueConverters"
|
||||
xmlns:r="clr-namespace:ClassicAssist.Shared.Resources;assembly=ClassicAssist.Shared"
|
||||
xmlns:viewModels="clr-namespace:ClassicAssist.UI.ViewModels;assembly=ClassicAssist.Shared"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="350" d:DesignWidth="600"
|
||||
d:DataContext="{d:DesignInstance {x:Type viewModels:AboutControlViewModel}, IsDesignTimeCreatable=True}">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../Resources/Icons.xaml" />
|
||||
<ResourceDictionary Source="../../Resources/ResourceDictionary.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<UserControl.DataContext>
|
||||
<viewModels:AboutControlViewModel />
|
||||
</UserControl.DataContext>
|
||||
<d:DesignerProperties.DesignStyle>
|
||||
<Style TargetType="UserControl">
|
||||
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
|
||||
</Style>
|
||||
</d:DesignerProperties.DesignStyle>
|
||||
<Grid>
|
||||
<Grid.Resources>
|
||||
<valueConverters1:IntToHexStringValueConverter x:Key="IntToHexStringValueConverter" />
|
||||
<valueConverters1:DateTimeToTimeSpanValueConverter x:Key="DateTimeToTimeSpanValueConverter" />
|
||||
<BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" />
|
||||
<Style TargetType="{x:Type GroupBox}" BasedOn="{StaticResource {x:Type GroupBox}}">
|
||||
<Setter Property="Margin" Value="5" />
|
||||
<Setter Property="Padding" Value="5" />
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<GroupBox Header="{x:Static r:Strings.Software}" Grid.Row="0" Grid.Column="0">
|
||||
<StackPanel>
|
||||
<DockPanel>
|
||||
<StackPanel DockPanel.Dock="Left">
|
||||
<Label Content="{x:Static r:Strings.Product_}" />
|
||||
<Label Content="{x:Static r:Strings.Version_}" />
|
||||
<Label Content="{x:Static r:Strings.Build_Date_}" />
|
||||
</StackPanel>
|
||||
<StackPanel DockPanel.Dock="Right">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="{x:Type Label}" BasedOn="{StaticResource {x:Type Label}}">
|
||||
<Setter Property="Margin" Value="10,0,0,0" />
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
<Label Content="{Binding Product}" />
|
||||
<Label Content="{Binding Version}" />
|
||||
<Label Content="{Binding BuildDate}" />
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
<Grid Margin="5">
|
||||
<TextBlock Text="{x:Static r:Strings.Made_For_Malo}" HorizontalAlignment="Center" FontWeight="Bold"
|
||||
MouseEnter="TextBlock_MouseEnter" MouseLeave="TextBlock_MouseLeave"
|
||||
TextDecorations="Underline" />
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Content="{x:Static r:Strings.Project_Homepage}" Command="{Binding LaunchHomepageCommand}"
|
||||
Grid.Column="0" Margin="0,0,5,0" />
|
||||
<Button Content="{x:Static r:Strings.Check_For_Updates}" Command="{Binding CheckForUpdatesCommand}"
|
||||
Grid.Column="1" Margin="5,0,0,0" />
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
<GroupBox Header="{x:Static r:Strings.World_Status}" Grid.Row="0" Grid.Column="1">
|
||||
<StackPanel>
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="Margin" Value="5" />
|
||||
<Setter Property="Width" Value="150" />
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
<DockPanel>
|
||||
<StackPanel DockPanel.Dock="Left">
|
||||
<Label Content="{x:Static r:Strings.Connected_}" />
|
||||
<Label Content="{x:Static r:Strings.Items_}" />
|
||||
<Label Content="{x:Static r:Strings.Mobiles_}" />
|
||||
<Label Content="{x:Static r:Strings.Latency_}" />
|
||||
</StackPanel>
|
||||
<StackPanel DockPanel.Dock="Right">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="{x:Type Label}" BasedOn="{StaticResource {x:Type Label}}">
|
||||
<Setter Property="Margin" Value="10,0,0,0" />
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
<Label
|
||||
Content="{Binding ConnectedTime, Converter={StaticResource DateTimeToTimeSpanValueConverter}}"
|
||||
Visibility="{Binding Connected, Converter={StaticResource BooleanToVisibilityConverter}}" />
|
||||
<Label Content="{Binding ItemCount}" />
|
||||
<Label Content="{Binding MobileCount}" />
|
||||
<Label Content="{Binding Latency}" ContentStringFormat="{}{0}ms" />
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
<Button Content="{x:Static r:Strings.Show_World_Items}" IsEnabled="{Binding Connected}"
|
||||
Command="{Binding ShowItemsCommand}" />
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
<GroupBox Header="{x:Static r:Strings.Misc}" Grid.Row="1" Grid.Column="0">
|
||||
<StackPanel Margin="10">
|
||||
<Button Width="50" Background="Transparent" BorderThickness="0" Command="{Binding OpenPayPalCommand}">
|
||||
<Image Source="{StaticResource PayPalIcon}" />
|
||||
</Button>
|
||||
<TextBlock
|
||||
Text="{x:Static r:Strings.Donating_helps_support_continued_development__your_support_is_appreciated_}"
|
||||
TextWrapping="Wrap" TextAlignment="Center" />
|
||||
</StackPanel>
|
||||
</GroupBox>
|
||||
<GroupBox Header="{x:Static r:Strings.Player}" Grid.Row="1" Grid.Column="1">
|
||||
<DockPanel>
|
||||
<StackPanel DockPanel.Dock="Left">
|
||||
<Label Content="{x:Static r:Strings.Shard_}" />
|
||||
<Label Content="{x:Static r:Strings.Features_}" />
|
||||
<Label Content="{x:Static r:Strings.Name_}" />
|
||||
<Label Content="{x:Static r:Strings.Serial_}" />
|
||||
<Label Content="{x:Static r:Strings.Last_Target_}" />
|
||||
<Label Content="{x:Static r:Strings.Status_}" />
|
||||
</StackPanel>
|
||||
<StackPanel DockPanel.Dock="Right">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="{x:Type Label}" BasedOn="{StaticResource {x:Type Label}}">
|
||||
<Setter Property="Margin" Value="10,0,0,0" />
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
<Label Content="{Binding ShardName}" />
|
||||
<Label Content="{Binding ShardFeatures}" />
|
||||
<Label Content="{Binding PlayerName}" />
|
||||
<Label Content="{Binding PlayerSerial, Converter={StaticResource IntToHexStringValueConverter}}" />
|
||||
<Label
|
||||
Content="{Binding LastTargetSerial, Converter={StaticResource IntToHexStringValueConverter}}" />
|
||||
<Label Content="{Binding PlayerStatus}" />
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,52 @@
|
||||
using System.Media;
|
||||
using System.Timers;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using ClassicAssist.Shared;
|
||||
|
||||
namespace ClassicAssist.UI.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for AboutControl.xaml
|
||||
/// </summary>
|
||||
public partial class AboutControl : UserControl
|
||||
{
|
||||
private Timer _timer;
|
||||
|
||||
public AboutControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void TextBlock_MouseEnter( object sender, MouseEventArgs e )
|
||||
{
|
||||
if ( !( sender is TextBlock textBlock ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
_timer = new Timer( 1000 );
|
||||
_timer.Elapsed += ( o, args ) =>
|
||||
{
|
||||
_timer.Stop();
|
||||
|
||||
if ( !textBlock.IsMouseOver )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
using ( SoundPlayer sound = new SoundPlayer( Engine.GetResourceStream( "kiss.wav" ) ) )
|
||||
{
|
||||
sound.Play();
|
||||
}
|
||||
};
|
||||
|
||||
_timer.Start();
|
||||
}
|
||||
|
||||
private void TextBlock_MouseLeave( object sender, MouseEventArgs e )
|
||||
{
|
||||
_timer?.Stop();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,255 @@
|
||||
<Window
|
||||
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:resources="clr-namespace:ClassicAssist.Shared.Resources;assembly=ClassicAssist.Shared"
|
||||
xmlns:viewModels="clr-namespace:ClassicAssist.UI.ViewModels"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:misc="clr-namespace:ClassicAssist.UI.Misc"
|
||||
xmlns:misc1="clr-namespace:ClassicAssist.Misc"
|
||||
xmlns:valueConverters="clr-namespace:ClassicAssist.UI.Misc.ValueConverters"
|
||||
x:Class="ClassicAssist.UI.Views.ActiveObjectsWindow"
|
||||
mc:Ignorable="d"
|
||||
Title="{x:Static resources:Strings.Active_Objects}" Height="350" Width="400">
|
||||
<Window.Resources>
|
||||
<valueConverters:IntToHexStringValueConverter x:Key="IntToHexStringValueConverter" />
|
||||
<misc1:BindingProxy x:Key="Proxy" Data="{Binding}" />
|
||||
</Window.Resources>
|
||||
<Window.DataContext>
|
||||
<viewModels:ActiveObjectsViewModel />
|
||||
</Window.DataContext>
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<TabControl>
|
||||
<TabItem Header="{x:Static resources:Strings.Aliases}">
|
||||
<TabControl>
|
||||
<TabItem Header="{x:Static resources:Strings.Global}">
|
||||
<Grid Margin="5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<ListView ItemsSource="{Binding Aliases}" SelectedItem="{Binding SelectedAlias}">
|
||||
<ListView.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{x:Static resources:Strings.Remove}"
|
||||
Command="{Binding Data.RemoveAliasCommand, Source={StaticResource Proxy}}"
|
||||
CommandParameter="{Binding SelectedAlias}" />
|
||||
<MenuItem Header="{x:Static resources:Strings.Set}" Command="{Binding Data.SetAliasCommand, Source={StaticResource Proxy}}"
|
||||
CommandParameter="{Binding SelectedAlias}" />
|
||||
</ContextMenu>
|
||||
</ListView.ContextMenu>
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Name}" Width="170"
|
||||
DisplayMemberBinding="{Binding Name}" />
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Serial}" Width="170"
|
||||
DisplayMemberBinding="{Binding Serial, Converter={StaticResource IntToHexStringValueConverter}}" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0, 10,0,0">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="{x:Type Button}">
|
||||
<Setter Property="Height" Value="25" />
|
||||
<Setter Property="Padding" Value="10,0,10,0" />
|
||||
<Setter Property="Margin" Value="0,0,10,0" />
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
<Button Content="{x:Static resources:Strings.Close}">
|
||||
<i:Interaction.Behaviors>
|
||||
<misc:CloseOnClickBehaviour />
|
||||
</i:Interaction.Behaviors>
|
||||
</Button>
|
||||
<Button Content="{x:Static resources:Strings.Refresh}"
|
||||
Command="{Binding RefreshAliasesCommand}" />
|
||||
<Button Content="{x:Static resources:Strings.Clear_All_Objects}"
|
||||
Command="{Binding ClearAllAliasesCommand}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="{x:Static resources:Strings.Instance}">
|
||||
<TabItem.Resources>
|
||||
<CollectionViewSource x:Key='src' Source="{Binding InstanceAliases}">
|
||||
<CollectionViewSource.GroupDescriptions>
|
||||
<PropertyGroupDescription PropertyName="Macro" />
|
||||
</CollectionViewSource.GroupDescriptions>
|
||||
</CollectionViewSource>
|
||||
</TabItem.Resources>
|
||||
<ListView ItemsSource="{Binding Source={StaticResource src}}"
|
||||
SelectedItem="{Binding SelectedInstanceAlias}" Margin="5">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Name}" Width="170"
|
||||
DisplayMemberBinding="{Binding Name}" />
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Serial}" Width="150"
|
||||
DisplayMemberBinding="{Binding Serial, Converter={StaticResource IntToHexStringValueConverter}}" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
<ListView.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{x:Static resources:Strings.Remove}"
|
||||
Command="{Binding Data.RemoveInstanceAliasCommand, Source={StaticResource Proxy}}"
|
||||
CommandParameter="{Binding SelectedInstanceAlias}" />
|
||||
</ContextMenu>
|
||||
</ListView.ContextMenu>
|
||||
<ListView.GroupStyle>
|
||||
<GroupStyle>
|
||||
<GroupStyle.ContainerStyle>
|
||||
<Style TargetType="{x:Type GroupItem}">
|
||||
<Setter Property="Margin" Value="0,0,0,5" />
|
||||
<Setter Property="Template">
|
||||
<Setter.Value>
|
||||
<ControlTemplate TargetType="{x:Type GroupItem}">
|
||||
<Expander IsExpanded="{Binding Items/IsExpanded}"
|
||||
BorderThickness="0,0,0,0">
|
||||
<Expander.Header>
|
||||
<DockPanel>
|
||||
<TextBlock FontSize="12" Text="{Binding Path=Name}"
|
||||
Margin="5,0,0,0" Width="100" />
|
||||
</DockPanel>
|
||||
</Expander.Header>
|
||||
<Expander.Content>
|
||||
<ItemsPresenter />
|
||||
</Expander.Content>
|
||||
</Expander>
|
||||
</ControlTemplate>
|
||||
</Setter.Value>
|
||||
</Setter>
|
||||
</Style>
|
||||
</GroupStyle.ContainerStyle>
|
||||
</GroupStyle>
|
||||
</ListView.GroupStyle>
|
||||
</ListView>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</TabItem>
|
||||
<TabItem Header="{x:Static resources:Strings.Lists}">
|
||||
<Grid Margin="5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<ListView ItemsSource="{Binding Lists}" SelectedItem="{Binding SelectedList}">
|
||||
<ListView.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{x:Static resources:Strings.Remove}"
|
||||
Command="{Binding Data.RemoveListCommand, Source={StaticResource Proxy}}"
|
||||
CommandParameter="{Binding Data.SelectedList, Source={StaticResource Proxy}}" />
|
||||
</ContextMenu>
|
||||
</ListView.ContextMenu>
|
||||
<ListView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Expander IsExpanded="False" Header="{Binding Name}">
|
||||
<ItemsControl ItemsSource="{Binding Serials}">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Mode=OneWay}" Margin="25,0,0,0" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
</ItemsControl>
|
||||
</Expander>
|
||||
</DataTemplate>
|
||||
</ListView.ItemTemplate>
|
||||
</ListView>
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0, 10,0,0">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="{x:Type Button}">
|
||||
<Setter Property="Height" Value="25" />
|
||||
<Setter Property="Padding" Value="10,0,10,0" />
|
||||
<Setter Property="Margin" Value="0,0,10,0" />
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
<Button Content="{x:Static resources:Strings.Close}">
|
||||
<i:Interaction.Behaviors>
|
||||
<misc:CloseOnClickBehaviour />
|
||||
</i:Interaction.Behaviors>
|
||||
</Button>
|
||||
<Button Content="{x:Static resources:Strings.Refresh}" Command="{Binding RefreshListsCommand}" />
|
||||
<Button Content="{x:Static resources:Strings.Clear_All_Objects}"
|
||||
Command="{Binding ClearAllListsCommand}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="{x:Static resources:Strings.Timers}">
|
||||
<Grid Margin="5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<ListView ItemsSource="{Binding Timers}" SelectedItem="{Binding SelectedTimer}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Name}" Width="170"
|
||||
DisplayMemberBinding="{Binding Name}" />
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Value}" Width="170"
|
||||
DisplayMemberBinding="{Binding Value, Converter={StaticResource IntToHexStringValueConverter}}" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0, 10,0,0">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="{x:Type Button}">
|
||||
<Setter Property="Height" Value="25" />
|
||||
<Setter Property="Padding" Value="10,0,10,0" />
|
||||
<Setter Property="Margin" Value="0,0,10,0" />
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
<Button Content="{x:Static resources:Strings.Close}">
|
||||
<i:Interaction.Behaviors>
|
||||
<misc:CloseOnClickBehaviour />
|
||||
</i:Interaction.Behaviors>
|
||||
</Button>
|
||||
<Button Content="{x:Static resources:Strings.Refresh}"
|
||||
Command="{Binding RefreshTimersCommand}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
<TabItem Header="{x:Static resources:Strings.Ignore_List}">
|
||||
<Grid Margin="5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<ListBox x:Name="listBox" ItemsSource="{Binding IgnoreEntries}"
|
||||
SelectedItem="{Binding SelectedIgnoreEntry}">
|
||||
<ListBox.ContextMenu>
|
||||
<ContextMenu>
|
||||
<MenuItem Header="{x:Static resources:Strings.Remove}"
|
||||
Command="{Binding Data.RemoveIgnoreEntryCommand, Source={StaticResource Proxy}}"
|
||||
CommandParameter="{Binding SelectedIgnoreEntry}" />
|
||||
</ContextMenu>
|
||||
</ListBox.ContextMenu>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding StringFormat={}0x{0:x}}" />
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<StackPanel Grid.Row="1" Orientation="Horizontal" Margin="0, 10,0,0">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="{x:Type Button}">
|
||||
<Setter Property="Height" Value="25" />
|
||||
<Setter Property="Padding" Value="10,0,10,0" />
|
||||
<Setter Property="Margin" Value="0,0,10,0" />
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
<Button Content="{x:Static resources:Strings.Close}">
|
||||
<i:Interaction.Behaviors>
|
||||
<misc:CloseOnClickBehaviour />
|
||||
</i:Interaction.Behaviors>
|
||||
</Button>
|
||||
<Button Content="{x:Static resources:Strings.Refresh}"
|
||||
Command="{Binding RefreshIgnoreListCommand}" />
|
||||
<Button Content="{x:Static resources:Strings.Clear_All}"
|
||||
Command="{Binding ClearIgnoreListCommand}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace ClassicAssist.UI.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ActiveObjectsWindow.xaml
|
||||
/// </summary>
|
||||
public partial class ActiveObjectsWindow : Window
|
||||
{
|
||||
public ActiveObjectsWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,188 @@
|
||||
<UserControl
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ClassicAssist.UI.Views.Agents"
|
||||
xmlns:resources="clr-namespace:ClassicAssist.Shared.Resources;assembly=ClassicAssist.Shared"
|
||||
xmlns:misc="clr-namespace:ClassicAssist.UI.Misc"
|
||||
xmlns:controls="clr-namespace:ClassicAssist.UI.Controls"
|
||||
xmlns:autoloot="clr-namespace:ClassicAssist.Data.Autoloot;assembly=ClassicAssist.Shared"
|
||||
xmlns:b="http://schemas.microsoft.com/xaml/behaviors"
|
||||
xmlns:ValueConverters="clr-namespace:ClassicAssist.UI.Misc.ValueConverters"
|
||||
xmlns:misc1="clr-namespace:ClassicAssist.Misc"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:agents="clr-namespace:ClassicAssist.Shared.UI.ViewModels.Agents;assembly=ClassicAssist.Shared"
|
||||
x:Class="ClassicAssist.UI.Views.Agents.AutolootTabControl"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="250" d:DesignWidth="600" x:Name="userControl">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../../Resources/ResourceDictionary.xaml" />
|
||||
<ResourceDictionary Source="../../../Resources/Icons.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<ValueConverters:CellWidthValueConverter x:Key="CellWidthValueConverter" />
|
||||
<misc1:BindingProxy x:Key="Proxy" Data="{Binding}" />
|
||||
<SolidColorBrush x:Key="ListBorder" Color="#828790" />
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<UserControl.DataContext>
|
||||
<agents:AutolootViewModel />
|
||||
</UserControl.DataContext>
|
||||
<Grid>
|
||||
<i:Interaction.Behaviors>
|
||||
<misc:ClipboardBehaviour CopyCommand="{Binding ClipboardCopyCommand}"
|
||||
PasteCommand="{Binding ClipboardPasteCommand}"
|
||||
CommandParameter="{Binding SelectedProperties}" />
|
||||
</i:Interaction.Behaviors>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="200" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Margin="10" Grid.Column="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<StackPanel Grid.Row="0">
|
||||
<CheckBox Content="{x:Static resources:Strings.Enabled}" IsChecked="{Binding Enabled}" />
|
||||
<CheckBox Content="{x:Static resources:Strings.Disable_inside_guardzone}"
|
||||
IsChecked="{Binding DisableInGuardzone}" />
|
||||
</StackPanel>
|
||||
<ListBox x:Name="listView" Grid.Row="1" Margin="0,10,0,10" ItemsSource="{Binding Items}"
|
||||
SelectedItem="{Binding SelectedItem}" HorizontalContentAlignment="Stretch">
|
||||
<ListBox.Resources>
|
||||
<Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource {x:Type TextBlock}}">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding Enabled}" Value="False">
|
||||
<Setter Property="TextDecorations" Value="Strikethrough"/>
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ListBox.Resources>
|
||||
<ListBox.InputBindings>
|
||||
<KeyBinding Key="Delete"
|
||||
Command="{Binding RemoveCommand}" CommandParameter="{Binding SelectedItem}" />
|
||||
</ListBox.InputBindings>
|
||||
|
||||
<i:Interaction.Behaviors>
|
||||
<misc:ItemsControlSelectNewEntryBehaviour SelectedItem="{Binding SelectedItem}"
|
||||
Type="{x:Type autoloot:AutolootEntry}" />
|
||||
</i:Interaction.Behaviors>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<controls:EditTextBlock Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
|
||||
Label="{Binding}" MinWidth="160" ShowIcon="True" />
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<StackPanel Grid.Row="2">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Content="{x:Static resources:Strings.Remove}" Grid.Column="0" Margin="0,0,5,0"
|
||||
Command="{Binding RemoveCommand}"
|
||||
CommandParameter="{Binding SelectedItem, ElementName=listView}" />
|
||||
<Button Content="{x:Static resources:Strings.Insert}" Grid.Column="1" Margin="5,0,0,0"
|
||||
Command="{Binding InsertCommand}">
|
||||
<Button.ContextMenu>
|
||||
<ContextMenu IsOpen="False">
|
||||
<MenuItem Header="{x:Static resources:Strings.Match_Any_ID}"
|
||||
Command="{Binding Source={StaticResource Proxy}, Path=Data.InsertMatchAnyCommand}" />
|
||||
</ContextMenu>
|
||||
</Button.ContextMenu>
|
||||
</Button>
|
||||
</Grid>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Content="{x:Static resources:Strings.Set_Container}" Margin="0,10,5,0"
|
||||
Command="{Binding SetContainerCommand}" Grid.Column="0" />
|
||||
<Image Source="{StaticResource configureIcon}" Height="16" Margin="5,10,0,0" Grid.Column="1"
|
||||
misc:ClickOpensContextMenuBehaviour.Enabled="True">
|
||||
<Image.ContextMenu>
|
||||
<ContextMenu IsOpen="False">
|
||||
<MenuItem Header="{x:Static resources:Strings.Reset_Container}"
|
||||
Command="{Binding Source={StaticResource Proxy}, Path=Data.ResetContainerCommand}" />
|
||||
<MenuItem Header="{x:Static resources:Strings.Define_Custom_Properties}"
|
||||
Command="{Binding Source={StaticResource Proxy}, Path=Data.DefineCustomPropertiesCommand}" />
|
||||
</ContextMenu>
|
||||
</Image.ContextMenu>
|
||||
</Image>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
<Grid Grid.Column="1" Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<ComboBox x:Name="comboBox" Grid.Row="0" ItemsSource="{Binding Constraints}" DisplayMemberPath="Name"
|
||||
SelectedIndex="0" />
|
||||
<CheckBox Content="{x:Static resources:Strings.Enabled}" Grid.Row="1" Margin="0,10,0,0"
|
||||
IsChecked="{Binding SelectedItem.Enabled}" />
|
||||
<ListView x:Name="listView1" Grid.Row="2" Margin="0,10,0,10"
|
||||
ItemsSource="{Binding SelectedItem.Constraints}" SelectedItem="{Binding SelectedProperty}">
|
||||
<i:Interaction.Behaviors>
|
||||
<misc:ListViewMultiSelectionBehaviour SelectedItems="{Binding SelectedProperties}" />
|
||||
</i:Interaction.Behaviors>
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Property}" Width="150"
|
||||
DisplayMemberBinding="{Binding Property.Name}" />
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Operator}" Width="75">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<ComboBox Width="50" SelectedItem="{Binding Operator}"
|
||||
ItemsSource="{Binding Source={misc:EnumBindingSource {x:Type autoloot:AutolootOperator}}}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Value}" Width="75" x:Name="ValueColumn">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<controls:EditTextBlock
|
||||
Text="{Binding Value, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
|
||||
MinWidth="40" ShowIcon="True"
|
||||
Width="{Binding Converter={StaticResource CellWidthValueConverter}, ConverterParameter=15, Path=Width, ElementName=ValueColumn, Mode=OneWay}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<StackPanel Grid.Row="3">
|
||||
<Grid Margin="0,0,0,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Content="{x:Static resources:Strings.Remove}" Grid.Column="0" Margin="0,0,5,0"
|
||||
Command="{Binding RemoveConstraintCommand}"
|
||||
CommandParameter="{Binding SelectedProperties}" />
|
||||
<Button Content="{x:Static resources:Strings.Insert}" Grid.Column="1" Margin="5,0,0,0"
|
||||
Command="{Binding InsertConstraintCommand}"
|
||||
CommandParameter="{Binding SelectedValue, ElementName=comboBox}" />
|
||||
</Grid>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<CheckBox Content="{x:Static resources:Strings.Rehue_matching_items}"
|
||||
IsChecked="{Binding SelectedItem.Rehue}" />
|
||||
<Button Margin="10,0,0,0" Command="{Binding SelectHueCommand}"
|
||||
CommandParameter="{Binding SelectedItem, ElementName=listView}">
|
||||
<Image Source="{StaticResource ColorWheelIcon}" Height="12" Width="12" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
<CheckBox Content="{x:Static resources:Strings.Autoloot_matching_items}"
|
||||
IsChecked="{Binding SelectedItem.Autoloot}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClassicAssist.UI.Views.Agents
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for AutolootTabControl.xaml
|
||||
/// </summary>
|
||||
public partial class AutolootTabControl : UserControl
|
||||
{
|
||||
public AutolootTabControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
<UserControl
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ClassicAssist.UI.Views.Agents"
|
||||
xmlns:resources="clr-namespace:ClassicAssist.Shared.Resources;assembly=ClassicAssist.Shared"
|
||||
xmlns:controls="clr-namespace:ClassicAssist.UI.Controls"
|
||||
xmlns:ValueConverters="clr-namespace:ClassicAssist.UI.Misc.ValueConverters"
|
||||
xmlns:agents="clr-namespace:ClassicAssist.Shared.UI.ViewModels.Agents;assembly=ClassicAssist.Shared"
|
||||
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
|
||||
x:Class="ClassicAssist.UI.Views.Agents.CountersTabControl"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="250" d:DesignWidth="500">
|
||||
<d:DesignerProperties.DesignStyle>
|
||||
<Style TargetType="UserControl">
|
||||
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
|
||||
</Style>
|
||||
</d:DesignerProperties.DesignStyle>
|
||||
<UserControl.DataContext>
|
||||
<agents:CountersTabViewModel />
|
||||
</UserControl.DataContext>
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../../Resources/ResourceDictionary.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.Resources>
|
||||
<ValueConverters:CellWidthValueConverter x:Key="CellWidthValueConverter" />
|
||||
</Grid.Resources>
|
||||
<ListView Grid.Row="0" Margin="10" ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Name}" Width="150" x:Name="NameColumn">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<controls:EditTextBlock
|
||||
Width="{Binding ActualWidth, Converter={StaticResource CellWidthValueConverter}, ConverterParameter=15, ElementName=NameColumn, Mode=OneWay}"
|
||||
Text="{Binding Name}" ShowIcon="True" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Graphic}" Width="100"
|
||||
DisplayMemberBinding="{Binding Graphic, StringFormat={}0x{0:x}}" />
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Color}" Width="75" x:Name="ColorColumn">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<controls:EditTextBlock
|
||||
Width="{Binding ActualWidth, Converter={StaticResource CellWidthValueConverter}, ConverterParameter=15, ElementName=ColorColumn, Mode=OneWay}"
|
||||
Text="{Binding Color, Mode=TwoWay, UpdateSourceTrigger=LostFocus}" ShowIcon="True" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Count}" Width="75"
|
||||
DisplayMemberBinding="{Binding Count}" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<DockPanel Grid.Row="1" Margin="10,0,10,10">
|
||||
<CheckBox IsChecked="{Binding Warn}">
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<TextBlock Text="{x:Static resources:Strings.Warn_when_counter_amount_below_}" />
|
||||
<xctk:IntegerUpDown Minimum="0" Value="{Binding WarnAmount}" UpdateValueOnEnterKey="True" />
|
||||
</StackPanel>
|
||||
</CheckBox>
|
||||
</DockPanel>
|
||||
<DockPanel Grid.Row="2" Margin="10,0,10,10">
|
||||
<DockPanel.Resources>
|
||||
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="Width" Value="70" />
|
||||
<Setter Property="Height" Value="25" />
|
||||
</Style>
|
||||
</DockPanel.Resources>
|
||||
<Button Content="{x:Static resources:Strings.Remove}" HorizontalAlignment="Left" Margin="0,0,10,0"
|
||||
Command="{Binding RemoveEntryCommand}" CommandParameter="{Binding SelectedItem}" />
|
||||
<Button Content="{x:Static resources:Strings.Insert}" HorizontalAlignment="Left"
|
||||
Command="{Binding InsertEntryCommand}" />
|
||||
<Button Content="{x:Static resources:Strings.Recount}" HorizontalAlignment="Right"
|
||||
Command="{Binding RecountCommand}" />
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClassicAssist.UI.Views.Agents
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for CountersTabControl.xaml
|
||||
/// </summary>
|
||||
public partial class CountersTabControl : UserControl
|
||||
{
|
||||
public CountersTabControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
<UserControl
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:controls1="clr-namespace:ClassicAssist.UI.Controls"
|
||||
xmlns:viewModels="clr-namespace:ClassicAssist.UI.ViewModels"
|
||||
xmlns:resources="clr-namespace:ClassicAssist.Shared.Resources;assembly=ClassicAssist.Shared"
|
||||
xmlns:valueConverters="clr-namespace:ClassicAssist.UI.Misc.ValueConverters"
|
||||
xmlns:misc="clr-namespace:ClassicAssist.Misc"
|
||||
xmlns:dress="clr-namespace:ClassicAssist.Data.Dress;assembly=ClassicAssist.Shared"
|
||||
xmlns:misc1="clr-namespace:ClassicAssist.UI.Misc"
|
||||
xmlns:agents="clr-namespace:ClassicAssist.Shared.UI.ViewModels.Agents;assembly=ClassicAssist.Shared"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
x:Class="ClassicAssist.UI.Views.Agents.DressTabControl"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="500" Margin="0">
|
||||
<d:DesignerProperties.DesignStyle>
|
||||
<Style TargetType="UserControl">
|
||||
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
|
||||
</Style>
|
||||
</d:DesignerProperties.DesignStyle>
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../../Resources/ResourceDictionary.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<misc:BindingProxy Data="{Binding}" x:Key="Proxy" />
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<UserControl.DataContext>
|
||||
<agents:DressTabViewModel />
|
||||
</UserControl.DataContext>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150" />
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="120" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Margin="5" Grid.Column="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.Resources>
|
||||
<valueConverters:CellWidthValueConverter x:Key="CellWidthValueConverter" />
|
||||
</Grid.Resources>
|
||||
<CheckBox IsChecked="{Binding MoveConflictingItems}" Grid.Row="0">
|
||||
<TextBlock Text="{x:Static resources:Strings.Move_conflicting_items}" TextWrapping="Wrap" />
|
||||
</CheckBox>
|
||||
<CheckBox Content="{x:Static resources:Strings.Use_UO3D_Packets}"
|
||||
IsChecked="{Binding UseUO3DPackets}" Grid.Row="1"
|
||||
ToolTip="{x:Static resources:Strings.Requires_Server_Support}" />
|
||||
<ListBox x:Name="listBox1" Grid.Row="2" Margin="0,5" ItemsSource="{Binding Items}"
|
||||
SelectedItem="{Binding SelectedItem}" SelectedIndex="0">
|
||||
<ListBox.InputBindings>
|
||||
<KeyBinding Key="Delete"
|
||||
Command="{Binding RemoveDressEntryCommand}" CommandParameter="{Binding SelectedItem}" />
|
||||
</ListBox.InputBindings>
|
||||
|
||||
<i:Interaction.Behaviors>
|
||||
<misc1:ItemsControlSelectNewEntryBehaviour SelectedItem="{Binding SelectedItem}"
|
||||
Type="{x:Type dress:DressAgentEntry}" />
|
||||
</i:Interaction.Behaviors>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<controls1:EditTextBlock Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
|
||||
Width="{Binding ActualWidth, Converter={StaticResource CellWidthValueConverter}, ElementName=listBox1, Mode=OneWay}" />
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<Grid Grid.Row="3">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="10" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Content="{x:Static resources:Strings.Remove}" Grid.Column="0"
|
||||
Command="{Binding RemoveDressEntryCommand, Mode=OneWay}"
|
||||
CommandParameter="{Binding SelectedItem}" />
|
||||
<Button Content="{x:Static resources:Strings.New}" Grid.Column="2"
|
||||
Command="{Binding NewDressEntryCommand, Mode=OneWay}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid Margin="5" Grid.Column="1">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<ListBox x:Name="listBox" Grid.Row="0" Margin="0,0,0,5" ItemsSource="{Binding SelectedItem.Items}"
|
||||
SelectedItem="{Binding SelectedDressItem}" DisplayMemberPath="Name">
|
||||
<ListBox.ContextMenu>
|
||||
<ContextMenu>
|
||||
<ContextMenu.Resources>
|
||||
<Style TargetType="MenuItem">
|
||||
<Style.Triggers>
|
||||
<DataTrigger Binding="{Binding SelectedDressItem.Type}"
|
||||
Value="{x:Static dress:DressAgentItemType.ID}">
|
||||
<Setter Property="IsChecked" Value="True" />
|
||||
</DataTrigger>
|
||||
<DataTrigger Binding="{Binding SelectedDressItem.Type}"
|
||||
Value="{x:Static dress:DressAgentItemType.Serial}">
|
||||
<Setter Property="IsChecked" Value="False" />
|
||||
</DataTrigger>
|
||||
</Style.Triggers>
|
||||
</Style>
|
||||
</ContextMenu.Resources>
|
||||
<MenuItem Header="{x:Static resources:Strings.Dress_Type}" IsCheckable="True"
|
||||
Command="{Binding Data.ChangeDressTypeCommand, Source={StaticResource Proxy}}"
|
||||
CommandParameter="{Binding SelectedDressItem}" />
|
||||
</ContextMenu>
|
||||
</ListBox.ContextMenu>
|
||||
</ListBox>
|
||||
<Button Content="{x:Static resources:Strings.Set_Undress_Container}" Grid.Row="1"
|
||||
Command="{Binding SetUndressContainerCommand, Mode=OneWay}"
|
||||
CommandParameter="{Binding SelectedItem}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
<Grid Margin="5" Grid.Column="2">
|
||||
<Grid.Resources>
|
||||
<!--<BooleanToVisibilityConverter x:Key="BoolToVisibilityValueConverter"/>-->
|
||||
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="Margin" Value="0,0,5,5" />
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Button Content="{x:Static resources:Strings.Dress}" Grid.Row="0"
|
||||
Command="{Binding DressAllItemsCommand, Mode=OneWay}" CommandParameter="{Binding SelectedItem}" />
|
||||
<Button Content="{x:Static resources:Strings.Undress}" Grid.Row="1"
|
||||
Command="{Binding UndressItemsCommand}" CommandParameter="{Binding SelectedItem}" />
|
||||
<Button Content="{x:Static resources:Strings.Undress_All}" Grid.Row="2"
|
||||
Command="{Binding UndressAllItemsCommand}" />
|
||||
<Button Content="{x:Static resources:Strings.Import}" Grid.Row="3"
|
||||
Command="{Binding ImportItemsCommand, Mode=OneWay}" CommandParameter="{Binding SelectedItem}" />
|
||||
<Button Content="{x:Static resources:Strings.New_Item}" Grid.Row="4"
|
||||
Command="{Binding AddDressItemCommand, Mode=OneWay}" CommandParameter="{Binding SelectedItem}" />
|
||||
<Button Content="{x:Static resources:Strings.Remove}" Grid.Row="5"
|
||||
Command="{Binding RemoveDressItemCommand, Mode=OneWay}"
|
||||
CommandParameter="{Binding SelectedItem, ElementName=listBox}" />
|
||||
<Button Content="{x:Static resources:Strings.Clear_All}" Grid.Row="6" Margin="0,10,5,0" Height="25"
|
||||
Command="{Binding ClearDressItemsCommand}" CommandParameter="{Binding SelectedItem}" />
|
||||
<Grid Grid.Row="7" Margin="0,40,0,0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
</Grid>
|
||||
</Grid>
|
||||
<!--<dress:TextBoxKeys ShortcutChanged="{Binding ShortcutChangedCommand}"/>-->
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClassicAssist.UI.Views.Agents
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for DressTabControl.xaml
|
||||
/// </summary>
|
||||
public partial class DressTabControl : UserControl
|
||||
{
|
||||
public DressTabControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<UserControl x:Class="ClassicAssist.UI.Views.Agents.FriendsTabControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ClassicAssist.UI.Views.Agents"
|
||||
xmlns:resources="clr-namespace:ClassicAssist.Shared.Resources;assembly=ClassicAssist.Shared"
|
||||
xmlns:agents="clr-namespace:ClassicAssist.Shared.UI.ViewModels.Agents;assembly=ClassicAssist.Shared"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="300" d:DesignWidth="500">
|
||||
<d:DesignerProperties.DesignStyle>
|
||||
<Style TargetType="UserControl">
|
||||
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
|
||||
</Style>
|
||||
</d:DesignerProperties.DesignStyle>
|
||||
<UserControl.DataContext>
|
||||
<agents:FriendsTabViewModel />
|
||||
</UserControl.DataContext>
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../../Resources/ResourceDictionary.xaml" />
|
||||
<ResourceDictionary Source="../../../Resources/Icons.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Column="0" Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<ListBox Grid.Row="0" ItemsSource="{Binding Options.Friends}" SelectedItem="{Binding SelectedItem}" />
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button Content="{x:Static resources:Strings.Insert}" Grid.Column="0" Margin="0,5,5,5"
|
||||
Command="{Binding AddFriendCommand}" />
|
||||
<Button Content="{x:Static resources:Strings.Remove}" Grid.Column="1" Margin="5,5,0,5"
|
||||
Command="{Binding RemoveFriendCommand}" CommandParameter="{Binding SelectedItem}" />
|
||||
</Grid>
|
||||
</Grid>
|
||||
<StackPanel Grid.Column="1" Margin="0,10,10,10">
|
||||
<CheckBox Content="{x:Static resources:Strings.Include_party_members}"
|
||||
IsChecked="{Binding Options.IncludePartyMembersInFriends}" />
|
||||
<CheckBox Content="{x:Static resources:Strings.Prevent_attacking_friends_in_war_mode}"
|
||||
IsChecked="{Binding Options.PreventAttackingFriendsInWarMode}" />
|
||||
<CheckBox Content="{x:Static resources:Strings.Prevent_targeting_friends_with_Harmful_spells}"
|
||||
IsChecked="{Binding Options.PreventTargetingFriendsWithHarmful}" />
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<CheckBox Content="{x:Static resources:Strings.Rehue_friends}"
|
||||
IsChecked="{Binding Options.CurrentOptions.RehueFriends}" Command="{Binding ChangeRehueOption}" />
|
||||
<Button Margin="10,0,0,0" Command="{Binding SelectHueCommand}" CommandParameter="{Binding Options.CurrentOptions.RehueFriendsHue}">
|
||||
<Image Source="{StaticResource ColorWheelIcon}" Height="12" Width="12" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClassicAssist.UI.Views.Agents
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for FriendsTabControl.xaml
|
||||
/// </summary>
|
||||
public partial class FriendsTabControl : UserControl
|
||||
{
|
||||
public FriendsTabControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,146 @@
|
||||
<UserControl
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ClassicAssist.UI.Views.Agents"
|
||||
xmlns:resources="clr-namespace:ClassicAssist.Shared.Resources;assembly=ClassicAssist.Shared"
|
||||
xmlns:controls="clr-namespace:ClassicAssist.UI.Controls"
|
||||
xmlns:agents="clr-namespace:ClassicAssist.Shared.UI.ViewModels.Agents;assembly=ClassicAssist.Shared"
|
||||
xmlns:valueConverters="clr-namespace:ClassicAssist.UI.Misc.ValueConverters"
|
||||
xmlns:organizer="clr-namespace:ClassicAssist.Data.Organizer;assembly=ClassicAssist.Shared"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:misc="clr-namespace:ClassicAssist.UI.Misc"
|
||||
x:Name="userControl" x:Class="ClassicAssist.UI.Views.Agents.OrganizerTabControl"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="250" d:DesignWidth="500">
|
||||
<d:DesignerProperties.DesignStyle>
|
||||
<Style TargetType="UserControl">
|
||||
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
|
||||
</Style>
|
||||
</d:DesignerProperties.DesignStyle>
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../../Resources/ResourceDictionary.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<UserControl.DataContext>
|
||||
<agents:OrganizerTabViewModel />
|
||||
</UserControl.DataContext>
|
||||
<Grid>
|
||||
<Grid.Resources>
|
||||
<valueConverters:CellWidthValueConverter x:Key="CellWidthValueConverter" />
|
||||
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="Margin" Value="5" />
|
||||
<Setter Property="Height" Value="25" />
|
||||
<Setter Property="Padding" Value="10,0,10,0" />
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="150" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Column="0" Margin="5">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.Resources>
|
||||
<valueConverters:CellWidthValueConverter x:Key="CellWidthValueConverter" />
|
||||
</Grid.Resources>
|
||||
<controls:StretchyWrapPanel Grid.Row="0" Orientation="Horizontal">
|
||||
<Button Content="{Binding PlayStopButtonText}"
|
||||
Command="{Binding OrganizeCommand}" CommandParameter="{Binding SelectedItem}" />
|
||||
<StackPanel Margin="5">
|
||||
<CheckBox Content="{x:Static resources:Strings.Stack}" IsChecked="{Binding SelectedItem.Stack}" />
|
||||
</StackPanel>
|
||||
</controls:StretchyWrapPanel>
|
||||
<Grid Grid.Row="1">
|
||||
<ListBox x:Name="listBox" ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}">
|
||||
<ListBox.InputBindings>
|
||||
<KeyBinding Key="Delete"
|
||||
Command="{Binding RemoveItemCommand}" CommandParameter="{Binding SelectedItem}" />
|
||||
</ListBox.InputBindings>
|
||||
<i:Interaction.Behaviors>
|
||||
<misc:ItemsControlSelectNewEntryBehaviour SelectedItem="{Binding SelectedItem}"
|
||||
Type="{x:Type organizer:OrganizerEntry}" />
|
||||
</i:Interaction.Behaviors>
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<controls:EditTextBlock
|
||||
Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
|
||||
Width="{Binding ActualWidth, Converter={StaticResource CellWidthValueConverter}, Mode=OneWay, RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListBox}}}" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
</Grid>
|
||||
<StackPanel Grid.Row="2" Margin="0,10,0,0">
|
||||
<CheckBox Content="{x:Static resources:Strings.Complete}" IsChecked="{Binding SelectedItem.Complete}" />
|
||||
</StackPanel>
|
||||
<DockPanel Grid.Row="3" Margin="0,10,0,0">
|
||||
<Button Content="{x:Static resources:Strings.Remove}" HorizontalAlignment="Left" Margin="0"
|
||||
Command="{Binding RemoveOrganizerAgentEntryCommand}" CommandParameter="{Binding SelectedItem}" />
|
||||
<Button Content="{x:Static resources:Strings.New}" HorizontalAlignment="Right" Margin="0"
|
||||
Command="{Binding NewOrganizerEntryCommand}" />
|
||||
</DockPanel>
|
||||
</Grid>
|
||||
<Grid Grid.Column="1">
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<ListView x:Name="itemsListView" Margin="5" Grid.Row="0" ItemsSource="{Binding SelectedItem.Items}" SelectedItem="{Binding SelectedOrganizerItem}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Item}" Width="120"
|
||||
DisplayMemberBinding="{Binding Item}" />
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Graphic}" Width="100"
|
||||
DisplayMemberBinding="{Binding ID, StringFormat={}0x{0:x}}" />
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Color}" Width="80"
|
||||
x:Name="HueColumn">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<controls:EditTextBlock
|
||||
Text="{Binding Hue, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
|
||||
Width="{Binding ActualWidth, Converter={StaticResource CellWidthValueConverter}, ConverterParameter=15, ElementName=HueColumn, Mode=OneWay}"
|
||||
ShowIcon="True" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Amount}" Width="80"
|
||||
x:Name="AmountColumn">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<Grid>
|
||||
<controls:EditTextBlock
|
||||
Text="{Binding Amount, Mode=TwoWay, UpdateSourceTrigger=LostFocus}"
|
||||
Width="{Binding ActualWidth, Converter={StaticResource CellWidthValueConverter}, ConverterParameter=15, ElementName=AmountColumn, Mode=OneWay}"
|
||||
ShowIcon="True" />
|
||||
</Grid>
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1">
|
||||
<Button Content="{x:Static resources:Strings.Set_Containers}"
|
||||
Command="{Binding SetContainersCommand}" CommandParameter="{Binding SelectedItem}" />
|
||||
<Button Content="{x:Static resources:Strings.Remove}" Command="{Binding RemoveItemCommand}"
|
||||
CommandParameter="{Binding SelectedItem, ElementName=itemsListView}" />
|
||||
<Button Content="{x:Static resources:Strings.Insert}" Command="{Binding InsertItemCommand}"
|
||||
CommandParameter="{Binding SelectedItem}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClassicAssist.UI.Views.Agents
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for OrganizerTabControl.xaml
|
||||
/// </summary>
|
||||
public partial class OrganizerTabControl : UserControl
|
||||
{
|
||||
public OrganizerTabControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<UserControl x:Class="ClassicAssist.UI.Views.Agents.ScavengerTabControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ClassicAssist.UI.Views.Agents"
|
||||
xmlns:resources="clr-namespace:ClassicAssist.Shared.Resources;assembly=ClassicAssist.Shared"
|
||||
xmlns:agents="clr-namespace:ClassicAssist.Shared.UI.ViewModels.Agents;assembly=ClassicAssist.Shared"
|
||||
xmlns:valueConverters="clr-namespace:ClassicAssist.UI.Misc.ValueConverters"
|
||||
xmlns:controls="clr-namespace:ClassicAssist.UI.Controls"
|
||||
mc:Ignorable="d"
|
||||
d:DesignWidth="493" d:DesignHeight="400">
|
||||
<d:DesignerProperties.DesignStyle>
|
||||
<Style TargetType="UserControl">
|
||||
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
|
||||
</Style>
|
||||
</d:DesignerProperties.DesignStyle>
|
||||
<UserControl.DataContext>
|
||||
<agents:ScavengerTabViewModel />
|
||||
</UserControl.DataContext>
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../../Resources/DarkTheme.xaml" />
|
||||
<ResourceDictionary Source="../../../Resources/ResourceDictionary.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.Resources>
|
||||
<valueConverters:CellWidthValueConverter x:Key="CellWidthValueConverter" />
|
||||
</Grid.Resources>
|
||||
<StackPanel Grid.Column="0" Margin="10,10,0,10">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="Margin" Value="0,5,0,0" />
|
||||
<Setter Property="Padding" Value="20,0,20,0" />
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
<CheckBox Content="{x:Static resources:Strings.Enabled}" IsChecked="{Binding Enabled}" />
|
||||
<Button Content="{x:Static resources:Strings.Insert}" Command="{Binding InsertCommand}" />
|
||||
<Button Content="{x:Static resources:Strings.Remove}" Command="{Binding RemoveCommand}"
|
||||
CommandParameter="{Binding SelectedItem, ElementName=ListView}" />
|
||||
<Button Content="{x:Static resources:Strings.Clear_All}" Command="{Binding ClearAllCommand}" />
|
||||
<Button Content="{x:Static resources:Strings.Set_Container}" Command="{Binding SetContainerCommand}" />
|
||||
</StackPanel>
|
||||
<ListView x:Name="ListView" Grid.Column="1" Margin="10"
|
||||
ItemsSource="{Binding Items, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
SelectedItem="{Binding SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Foreground="Black">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="✓">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox IsChecked="{Binding Enabled}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Name}" DisplayMemberBinding="{Binding Name}"
|
||||
Width="150" />
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Graphic}"
|
||||
DisplayMemberBinding="{Binding Graphic, StringFormat=0x\{0:x\}}" Width="75" />
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Color}" Width="75" x:Name="HueColumn">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<controls:EditTextBlock Text="{Binding Hue}" TabIndex="0"
|
||||
Width="{Binding Width, ConverterParameter=15, Converter={StaticResource CellWidthValueConverter}, ElementName=HueColumn}"
|
||||
ShowIcon="True" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClassicAssist.UI.Views.Agents
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ScavengerTabControl.xaml
|
||||
/// </summary>
|
||||
public partial class ScavengerTabControl : UserControl
|
||||
{
|
||||
public ScavengerTabControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
<UserControl
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:resources="clr-namespace:ClassicAssist.Shared.Resources;assembly=ClassicAssist.Shared"
|
||||
xmlns:agents="clr-namespace:ClassicAssist.Shared.UI.ViewModels.Agents;assembly=ClassicAssist.Shared"
|
||||
xmlns:ValueConverters="clr-namespace:ClassicAssist.UI.Misc.ValueConverters"
|
||||
xmlns:controls="clr-namespace:ClassicAssist.UI.Controls"
|
||||
x:Class="ClassicAssist.UI.Views.Agents.VendorBuyTabControl"
|
||||
mc:Ignorable="d"
|
||||
d:DesignWidth="493" d:DesignHeight="400">
|
||||
<d:DesignerProperties.DesignStyle>
|
||||
<Style TargetType="UserControl">
|
||||
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
|
||||
</Style>
|
||||
</d:DesignerProperties.DesignStyle>
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../../Resources/DarkTheme.xaml" />
|
||||
<ResourceDictionary Source="../../../Resources/ResourceDictionary.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<ValueConverters:HexToIntValueConverter x:Key="HexToIntValueConverter" />
|
||||
<ValueConverters:CellWidthValueConverter x:Key="CellWidthValueConverter" />
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<UserControl.DataContext>
|
||||
<agents:VendorBuyTabViewModel />
|
||||
</UserControl.DataContext>
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<DockPanel Grid.Row="0" Margin="0,0,0,10">
|
||||
<DockPanel.Resources>
|
||||
<Style TargetType="{x:Type CheckBox}" BasedOn="{StaticResource {x:Type CheckBox}}">
|
||||
<Setter Property="Margin" Value="0,0,20,0" />
|
||||
</Style>
|
||||
</DockPanel.Resources>
|
||||
<CheckBox Content="{x:Static resources:Strings.Enabled}" IsChecked="{Binding Enabled}" />
|
||||
<CheckBox IsChecked="{Binding IncludeBackpackAmount}"
|
||||
Content="{x:Static resources:Strings.Include_Backpack_Amount}" />
|
||||
</DockPanel>
|
||||
<ListView x:Name="ListView" Grid.Row="1"
|
||||
ItemsSource="{Binding Items, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
SelectedItem="{Binding SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Foreground="Black">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="✓">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox IsChecked="{Binding Enabled}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Graphic}" Width="70" x:Name="ItemIDColumn">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<controls:EditTextBlock
|
||||
Text="{Binding Graphic, Converter={StaticResource HexToIntValueConverter}, StringFormat=0x\{0:x\}}"
|
||||
TabIndex="1"
|
||||
Width="{Binding Width, ConverterParameter=15, Converter={StaticResource CellWidthValueConverter}, ElementName=ItemIDColumn}"
|
||||
ShowIcon="True" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Name}" DisplayMemberBinding="{Binding Name}"
|
||||
Width="100" />
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Color}" Width="70" x:Name="HueColumn">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<controls:EditTextBlock Text="{Binding Hue}" TabIndex="0"
|
||||
Width="{Binding Width, ConverterParameter=15, Converter={StaticResource CellWidthValueConverter}, ElementName=HueColumn}"
|
||||
ShowIcon="True" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Amount}" x:Name="AmountColumn" Width="70">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<controls:EditTextBlock Text="{Binding Amount}" TabIndex="1"
|
||||
Width="{Binding Width, ConverterParameter=15, Converter={StaticResource CellWidthValueConverter}, ElementName=AmountColumn}"
|
||||
ShowIcon="True" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Max_Price}" Width="70" x:Name="MaxPriceColumn">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<controls:EditTextBlock Text="{Binding MaxPrice}" TabIndex="2"
|
||||
Width="{Binding Width, ConverterParameter=15, Converter={StaticResource CellWidthValueConverter}, ElementName=MaxPriceColumn}"
|
||||
ShowIcon="True" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="2">
|
||||
<Button Content="{x:Static resources:Strings.Insert}" MinWidth="80"
|
||||
Command="{Binding InsertCommand, Mode=OneWay}" Margin="0,10,10,10" />
|
||||
<Button Content="{x:Static resources:Strings.Remove}" MinWidth="80"
|
||||
Command="{Binding RemoveCommand, Mode=OneWay}" Margin="0,10"
|
||||
CommandParameter="{Binding SelectedItem, ElementName=ListView}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClassicAssist.UI.Views.Agents
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for VendorBuyTabControl.xaml
|
||||
/// </summary>
|
||||
public partial class VendorBuyTabControl : UserControl
|
||||
{
|
||||
public VendorBuyTabControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
<UserControl x:Class="ClassicAssist.UI.Views.Agents.VendorSellTabControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ClassicAssist.UI.Views.Agents"
|
||||
xmlns:agents="clr-namespace:ClassicAssist.Shared.UI.ViewModels.Agents;assembly=ClassicAssist.Shared"
|
||||
xmlns:resources="clr-namespace:ClassicAssist.Shared.Resources;assembly=ClassicAssist.Shared"
|
||||
xmlns:controls="clr-namespace:ClassicAssist.UI.Controls"
|
||||
xmlns:valueConverters="clr-namespace:ClassicAssist.UI.Misc.ValueConverters"
|
||||
mc:Ignorable="d"
|
||||
d:DesignWidth="493" d:DesignHeight="400">
|
||||
<d:DesignerProperties.DesignStyle>
|
||||
<Style TargetType="UserControl">
|
||||
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}" />
|
||||
</Style>
|
||||
</d:DesignerProperties.DesignStyle>
|
||||
<UserControl.DataContext>
|
||||
<agents:VendorSellTabViewModel />
|
||||
</UserControl.DataContext>
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../../Resources/DarkTheme.xaml" />
|
||||
<ResourceDictionary Source="../../../Resources/ResourceDictionary.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<valueConverters:CellWidthValueConverter x:Key="CellWidthValueConverter" />
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<ListView x:Name="ListView" Margin="5" Grid.Row="0"
|
||||
ItemsSource="{Binding Items, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
SelectedItem="{Binding SelectedItem, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Foreground="Black" Grid.IsSharedSizeScope="True">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="✓">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox IsChecked="{Binding Enabled}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Graphic}"
|
||||
DisplayMemberBinding="{Binding Graphic, StringFormat={}0x{0:x}}" Width="50" />
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Name}" DisplayMemberBinding="{Binding Name}"
|
||||
Width="150" />
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Color}" Width="70" x:Name="HueColumn">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<controls:EditTextBlock Text="{Binding Hue}" TabIndex="0"
|
||||
Width="{Binding Path=Width, ElementName=HueColumn, Converter={StaticResource CellWidthValueConverter}, ConverterParameter=15}"
|
||||
ShowIcon="True" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Amount}" Width="70" x:Name="AmountColumn">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<controls:EditTextBlock Text="{Binding Amount}" TabIndex="0"
|
||||
Width="{Binding Path=Width, ElementName=AmountColumn, Converter={StaticResource CellWidthValueConverter}, ConverterParameter=15}"
|
||||
ShowIcon="True" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Min_Price}" Width="100" x:Name="MinPriceColumn">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<controls:EditTextBlock Text="{Binding MinPrice}" TabIndex="2"
|
||||
Width="{Binding Path=Width, ElementName=MinPriceColumn, Converter={StaticResource CellWidthValueConverter}, ConverterParameter=15}"
|
||||
ShowIcon="True" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="Margin" Value="5,5,5,5" />
|
||||
<Setter Property="Padding" Value="10,0,10,0" />
|
||||
<Setter Property="MinWidth" Value="80" />
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
<Button Content="{x:Static resources:Strings.Insert}" Command="{Binding InsertCommand}"
|
||||
CommandParameter="{Binding SelectedItem, ElementName=ListView}" />
|
||||
<Button Content="{x:Static resources:Strings.Remove}" Command="{Binding RemoveCommand}"
|
||||
CommandParameter="{Binding SelectedItem, ElementName=ListView}" />
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClassicAssist.UI.Views.Agents
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for VendorSellTabControl.xaml
|
||||
/// </summary>
|
||||
public partial class VendorSellTabControl : UserControl
|
||||
{
|
||||
public VendorSellTabControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<UserControl x:Class="ClassicAssist.UI.Views.AgentsTabControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ClassicAssist.UI.Views"
|
||||
xmlns:resources="clr-namespace:ClassicAssist.Shared.Resources;assembly=ClassicAssist.Shared"
|
||||
xmlns:agents="clr-namespace:ClassicAssist.UI.Views.Agents"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<TabControl Margin="5">
|
||||
<TabItem Header="{x:Static resources:Strings.Organizer}">
|
||||
<agents:OrganizerTabControl />
|
||||
</TabItem>
|
||||
<TabItem Header="{x:Static resources:Strings.Dress}">
|
||||
<agents:DressTabControl />
|
||||
</TabItem>
|
||||
<TabItem Header="{x:Static resources:Strings.Counters}">
|
||||
<agents:CountersTabControl />
|
||||
</TabItem>
|
||||
<TabItem Header="{x:Static resources:Strings.Friends}">
|
||||
<agents:FriendsTabControl />
|
||||
</TabItem>
|
||||
<TabItem Header="{x:Static resources:Strings.Vendor_Buy}">
|
||||
<agents:VendorBuyTabControl />
|
||||
</TabItem>
|
||||
<TabItem Header="{x:Static resources:Strings.Vendor_Sell}">
|
||||
<agents:VendorSellTabControl />
|
||||
</TabItem>
|
||||
<TabItem Header="{x:Static resources:Strings.Scavenger}">
|
||||
<agents:ScavengerTabControl />
|
||||
</TabItem>
|
||||
<TabItem Header="{x:Static resources:Strings.Autoloot}">
|
||||
<agents:AutolootTabControl />
|
||||
</TabItem>
|
||||
</TabControl>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClassicAssist.UI.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for AgentsTabControl.xaml
|
||||
/// </summary>
|
||||
public partial class AgentsTabControl : UserControl
|
||||
{
|
||||
public AgentsTabControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<Window x:Class="ClassicAssist.UI.Views.Autoloot.ClilocSelectionWindow"
|
||||
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:ClassicAssist.UI.Views.Autoloot"
|
||||
xmlns:resources="clr-namespace:ClassicAssist.Shared.Resources;assembly=ClassicAssist.Shared"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:misc="clr-namespace:ClassicAssist.UI.Misc"
|
||||
xmlns:autoloot="clr-namespace:ClassicAssist.Shared.UI.ViewModels.Autoloot;assembly=ClassicAssist.Shared"
|
||||
mc:Ignorable="d"
|
||||
Title="{x:Static resources:Strings.Choose_by_Cliloc}" Height="350" Width="600"
|
||||
Background="{DynamicResource ThemeWindowBackgroundBrush}" Topmost="True">
|
||||
<Window.DataContext>
|
||||
<autoloot:ClilocSelectionViewModel />
|
||||
</Window.DataContext>
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../../Resources/Icons.xaml" />
|
||||
<ResourceDictionary Source="../../../Resources/ResourceDictionary.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<Grid Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="150" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Column="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBox Grid.Row="0" Text="{Binding FilterText, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<ListView Grid.Row="1" Margin="0,10,0,0" ItemsSource="{Binding FilteredClilocs}"
|
||||
SelectedItem="{Binding SelectedCliloc}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Property}" Width="300"
|
||||
DisplayMemberBinding="{Binding Value}" />
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Cliloc}" Width="80"
|
||||
DisplayMemberBinding="{Binding Key}" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</Grid>
|
||||
<StackPanel Grid.Column="1">
|
||||
<Button Content="{x:Static resources:Strings.OK}" Margin="10,0,0,10" Command="{Binding OKCommand}">
|
||||
<i:Interaction.Behaviors>
|
||||
<misc:CloseOnClickBehaviour />
|
||||
</i:Interaction.Behaviors>
|
||||
</Button>
|
||||
<Button Content="{x:Static resources:Strings.Cancel}" Margin="10,0,0,10">
|
||||
<i:Interaction.Behaviors>
|
||||
<misc:CloseOnClickBehaviour />
|
||||
</i:Interaction.Behaviors>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace ClassicAssist.UI.Views.Autoloot
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ClilocSelectedWindow.xaml
|
||||
/// </summary>
|
||||
public partial class ClilocSelectionWindow : Window
|
||||
{
|
||||
public ClilocSelectionWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
<Window x:Class="ClassicAssist.UI.Views.Autoloot.CustomPropertiesWindow"
|
||||
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:ClassicAssist.UI.Views.Autoloot"
|
||||
xmlns:resources="clr-namespace:ClassicAssist.Shared.Resources;assembly=ClassicAssist.Shared"
|
||||
xmlns:misc="clr-namespace:ClassicAssist.UI.Misc"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:autoloot="clr-namespace:ClassicAssist.Shared.UI.ViewModels.Autoloot;assembly=ClassicAssist.Shared"
|
||||
mc:Ignorable="d"
|
||||
Title="{x:Static resources:Strings.Define_Custom_Properties}" Height="350" Width="650"
|
||||
Background="{DynamicResource ThemeWindowBackgroundBrush}" Topmost="True">
|
||||
<Window.DataContext>
|
||||
<autoloot:CustomPropertiesViewModel />
|
||||
</Window.DataContext>
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../../Resources/Icons.xaml" />
|
||||
<ResourceDictionary Source="../../../Resources/ResourceDictionary.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="150" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListView x:Name="listView1" Grid.Column="0" Margin="10"
|
||||
ItemsSource="{Binding Properties}" SelectedItem="{Binding SelectedProperty}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Property}" Width="200"
|
||||
DisplayMemberBinding="{Binding Name}" />
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Cliloc}" Width="100"
|
||||
DisplayMemberBinding="{Binding Cliloc}" />
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Arguments}" Width="75" x:Name="ValueColumn">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox IsChecked="{Binding Arguments}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
<Grid Grid.Column="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.Resources>
|
||||
<Style TargetType="Button" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="Margin" Value="0,10, 10, 0" />
|
||||
</Style>
|
||||
</Grid.Resources>
|
||||
<StackPanel Grid.Row="0">
|
||||
<Button Content="{x:Static resources:Strings.Choose_from_Item}"
|
||||
Command="{Binding ChooseFromItemCommand}" />
|
||||
<Button Content="{x:Static resources:Strings.Choose_by_Cliloc}"
|
||||
Command="{Binding ChooseFromClilocCommand}" />
|
||||
<Button Content="{x:Static resources:Strings.Remove}" Command="{Binding RemoveCommand}" />
|
||||
</StackPanel>
|
||||
<StackPanel Grid.Row="1" Margin="0,0,0,10">
|
||||
<Button Content="{x:Static resources:Strings.Save}" Command="{Binding SaveCommand}">
|
||||
<i:Interaction.Behaviors>
|
||||
<misc:CloseOnClickBehaviour />
|
||||
</i:Interaction.Behaviors>
|
||||
</Button>
|
||||
<Button Content="{x:Static resources:Strings.Cancel}">
|
||||
<i:Interaction.Behaviors>
|
||||
<misc:CloseOnClickBehaviour />
|
||||
</i:Interaction.Behaviors>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace ClassicAssist.UI.Views.Autoloot
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for CustomPropertiesWindow.xaml
|
||||
/// </summary>
|
||||
public partial class CustomPropertiesWindow : Window
|
||||
{
|
||||
public CustomPropertiesWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
<Window x:Class="ClassicAssist.UI.Views.Autoloot.PropertySelectionWindow"
|
||||
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:ClassicAssist.UI.Views.Autoloot"
|
||||
xmlns:resources="clr-namespace:ClassicAssist.Shared.Resources;assembly=ClassicAssist.Shared"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:misc="clr-namespace:ClassicAssist.UI.Misc"
|
||||
xmlns:autoloot="clr-namespace:ClassicAssist.Shared.UI.ViewModels.Autoloot;assembly=ClassicAssist.Shared"
|
||||
mc:Ignorable="d"
|
||||
Title="{x:Static resources:Strings.Choose_from_Item}" Height="250" Width="400"
|
||||
Background="{DynamicResource ThemeWindowBackgroundBrush}" Topmost="True">
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../../Resources/Icons.xaml" />
|
||||
<ResourceDictionary Source="../../../Resources/ResourceDictionary.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<Window.DataContext>
|
||||
<autoloot:PropertySelectionViewModel />
|
||||
</Window.DataContext>
|
||||
<Grid Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="100" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox Grid.Column="0" ItemsSource="{Binding Properties}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<StackPanel Orientation="Horizontal">
|
||||
<CheckBox IsChecked="{Binding Selected}" />
|
||||
<Label Content="{Binding Name}" />
|
||||
</StackPanel>
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<StackPanel Grid.Column="1">
|
||||
<Button Content="{x:Static resources:Strings.OK}" Margin="10,0,0,10" Command="{Binding OKCommand}">
|
||||
<i:Interaction.Behaviors>
|
||||
<misc:CloseOnClickBehaviour />
|
||||
</i:Interaction.Behaviors>
|
||||
</Button>
|
||||
<Button Content="{x:Static resources:Strings.Cancel}" Margin="10,0,0,10">
|
||||
<i:Interaction.Behaviors>
|
||||
<misc:CloseOnClickBehaviour />
|
||||
</i:Interaction.Behaviors>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace ClassicAssist.UI.Views.Autoloot
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for PropertySelectionWindow.xaml
|
||||
/// </summary>
|
||||
public partial class PropertySelectionWindow : Window
|
||||
{
|
||||
public PropertySelectionWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
<Window x:Name="window" x:Class="ClassicAssist.UI.Views.ChatWindow"
|
||||
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:viewModels="clr-namespace:ClassicAssist.UI.ViewModels"
|
||||
xmlns:resources="clr-namespace:ClassicAssist.Shared.Resources;assembly=ClassicAssist.Shared"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:misc="clr-namespace:ClassicAssist.UI.Misc"
|
||||
xmlns:controls="clr-namespace:ClassicAssist.UI.Controls"
|
||||
xmlns:misc1="clr-namespace:ClassicAssist.Misc"
|
||||
mc:Ignorable="d"
|
||||
Title="{Binding Title}" Height="350" Width="650" Background="{DynamicResource ThemeWindowBackgroundBrush}"
|
||||
Topmost="{Binding Topmost}" WindowStyle="None" ResizeMode="CanResizeWithGrip" AllowsTransparency="True">
|
||||
<Window.DataContext>
|
||||
<viewModels:ChatViewModel />
|
||||
</Window.DataContext>
|
||||
<Window.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../Resources/Icons.xaml" />
|
||||
<ResourceDictionary Source="../../Resources/ResourceDictionary.xaml" />
|
||||
<ResourceDictionary>
|
||||
<DrawingImage x:Key="PersonIcon">
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M-42,0 V512 H470 V-42 H0 Z">
|
||||
<DrawingGroup.Transform>
|
||||
<TranslateTransform X="42" Y="0" />
|
||||
</DrawingGroup.Transform>
|
||||
<GeometryDrawing Brush="#FFFFBB85"
|
||||
Geometry="F1 M512,512z M0,0z M333.671875,123.308594C333.671875,157.195312 321.519531,186.527344 297.546875,210.503906 273.574219,234.476562 244.238281,246.628906 210.351562,246.628906L210.292969,246.628906C176.449219,246.617188 147.132812,234.464844 123.160156,210.503906 99.183594,186.527344 87.035156,157.195312 87.035156,123.308594 87.035156,89.433594 99.183594,60.097656 123.160156,36.125 147.121094,12.160156 176.4375,0.011718799999997 210.292969,0L210.351562,0C244.226562,0 273.5625,12.152344 297.546875,36.125 321.519531,60.097656 333.671875,89.433594 333.671875,123.308594z M333.671875,123.308594" />
|
||||
<GeometryDrawing Brush="#FF6AA9FF"
|
||||
Geometry="F1 M512,512z M0,0z M427.167969,423.945312C427.167969,450.679688 418.664062,472.324219 401.914062,488.265625 385.359375,504.019531 363.464844,512 336.84375,512L90.3125,512C63.691406,512 41.796875,504.019531 25.253906,488.265625 8.492188,472.3125 0,450.671875 0,423.945312 0,413.664062 0.339844,403.492188 1.019531,393.710938 1.710938,383.710938 3.109375,372.828125 5.171875,361.347656 7.25,349.773438 9.921875,338.832031 13.121094,328.832031 16.441406,318.480469 20.933594,308.269531 26.492188,298.488281 32.265625,288.335938 39.046875,279.492188 46.648438,272.210938 54.617188,264.589844 64.359375,258.46875 75.621094,254.007812 86.84375,249.570312 99.285156,247.320312 112.597656,247.320312 117.820312,247.320312 122.878906,249.457031 132.628906,255.808594 138.730469,259.789062 145.761719,264.320312 153.523438,269.28125 160.226562,273.554688 169.304688,277.5625 180.527344,281.183594 190.390625,284.375 200.402344,286.15625 210.292969,286.464844 211.382812,286.503906 212.472656,286.523438 213.5625,286.523438 224.546875,286.523438 235.65625,284.722656 246.609375,281.183594 257.832031,277.5625 266.921875,273.554688 273.621094,269.28125 281.464844,264.269531 288.496094,259.742188 294.507812,255.820312 304.265625,249.457031 309.316406,247.320312 314.550781,247.320312 327.851562,247.320312 340.292969,249.570312 351.523438,254.007812 362.785156,258.46875 372.527344,264.601562 380.488281,272.210938 388.101562,279.492188 394.882812,288.335938 400.652344,298.488281 406.214844,308.277344 410.714844,318.480469 414.023438,328.820312 417.226562,338.832031 419.90625,349.773438 421.984375,361.355469 424.035156,372.847656 425.4375,383.730469 426.125,393.703125 426.816406,403.453125 427.15625,413.625 427.167969,423.945312z M427.167969,423.945312" />
|
||||
<GeometryDrawing Brush="#FFF5A86C"
|
||||
Geometry="F1 M512,512z M0,0z M210.351562,246.628906L210.292969,246.628906 210.292969,0 210.351562,0C244.226562,0 273.5625,12.152344 297.546875,36.125 321.519531,60.097656 333.671875,89.433594 333.671875,123.308594 333.671875,157.195312 321.519531,186.527344 297.546875,210.503906 273.574219,234.476562 244.238281,246.628906 210.351562,246.628906z M210.351562,246.628906" />
|
||||
<GeometryDrawing Brush="#FF2682FF"
|
||||
Geometry="F1 M512,512z M0,0z M427.167969,423.945312C427.167969,450.679688 418.664062,472.324219 401.914062,488.265625 385.359375,504.019531 363.464844,512 336.84375,512L210.292969,512 210.292969,286.464844C211.382812,286.503906 212.472656,286.523438 213.5625,286.523438 224.546875,286.523438 235.65625,284.722656 246.609375,281.183594 257.832031,277.5625 266.921875,273.554688 273.621094,269.28125 281.464844,264.269531 288.496094,259.742188 294.507812,255.820312 304.265625,249.457031 309.316406,247.320312 314.550781,247.320312 327.851562,247.320312 340.292969,249.570312 351.523438,254.007812 362.785156,258.46875 372.527344,264.601562 380.488281,272.210938 388.101562,279.492188 394.882812,288.335938 400.652344,298.488281 406.214844,308.277344 410.714844,318.480469 414.023438,328.820312 417.226562,338.832031 419.90625,349.773438 421.984375,361.355469 424.035156,372.847656 425.4375,383.730469 426.125,393.703125 426.816406,403.453125 427.15625,413.625 427.167969,423.945312z M427.167969,423.945312" />
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<misc1:BindingProxy x:Key="Proxy" Data="{Binding}" />
|
||||
</ResourceDictionary>
|
||||
</Window.Resources>
|
||||
<DockPanel>
|
||||
<controls:CustomWindowTitleControl DockPanel.Dock="Top" CustomTitle="{Binding Title, ElementName=window}"
|
||||
CanClose="True">
|
||||
<controls:CustomWindowTitleControl.AdditionalContent>
|
||||
<Image Source="{DynamicResource configureIcon}" misc:ClickOpensContextMenuBehaviour.Enabled="True"
|
||||
Width="16" HorizontalAlignment="Right" Margin="0,0,80,0">
|
||||
<Image.ContextMenu>
|
||||
<ContextMenu IsOpen="False">
|
||||
<MenuItem Header="{x:Static resources:Strings.Topmost}"
|
||||
Command="{Binding Source={StaticResource Proxy}, Path=Data.(viewModels:ChatViewModel.ToggleOptionCommand)}"
|
||||
IsCheckable="True" />
|
||||
</ContextMenu>
|
||||
</Image.ContextMenu>
|
||||
</Image>
|
||||
</controls:CustomWindowTitleControl.AdditionalContent>
|
||||
|
||||
</controls:CustomWindowTitleControl>
|
||||
|
||||
<Grid Margin="10" Background="{DynamicResource ThemeBackgroundBrush}">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="*" />
|
||||
<ColumnDefinition Width="3" />
|
||||
<ColumnDefinition Width="220" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid Grid.Column="0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<ScrollViewer x:Name="ScrollViewer" Grid.Row="0">
|
||||
<ItemsControl Background="{DynamicResource ThemeBackgroundBrush}"
|
||||
ItemsSource="{Binding Messages}" ScrollViewer.VerticalScrollBarVisibility="Visible">
|
||||
<ItemsControl.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding}" Margin="5" Foreground="{Binding Colour}"
|
||||
VerticalAlignment="Center" TextWrapping="WrapWithOverflow" />
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
<i:Interaction.Behaviors>
|
||||
<misc:ItemsControlAutoScrollBehaviour ScrollViewer="{Binding ElementName=ScrollViewer}" />
|
||||
</i:Interaction.Behaviors>
|
||||
</ItemsControl>
|
||||
</ScrollViewer>
|
||||
<TextBox Grid.Row="1" KeyDown="TextBox_KeyDown" />
|
||||
</Grid>
|
||||
<GridSplitter Grid.Column="1" ResizeDirection="Columns"
|
||||
ResizeBehavior="PreviousAndNext"
|
||||
HorizontalAlignment="Stretch" />
|
||||
<Grid Grid.Column="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<ListBox Background="{DynamicResource ThemeBackgroundBrush}" ItemsSource="{Binding Users}" Grid.Row="0">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding}" Foreground="{Binding Colour}" />
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<StackPanel Orientation="Horizontal" Margin="3">
|
||||
<Image Source="{DynamicResource PersonIcon}" Height="16" />
|
||||
<TextBlock Text="{Binding Users.Count, Mode=OneWay}" Margin="3,0,0,0" />
|
||||
</StackPanel>
|
||||
<ComboBox x:Name="comboBox" Grid.Column="1" ItemsSource="{Binding Channels}"
|
||||
SelectedItem="{Binding SelectedChannel}">
|
||||
<i:Interaction.Behaviors>
|
||||
<misc:ComboBoxBehavior CommandBinding="{Binding ChangeChannelCommand}"
|
||||
OnlyUserTriggered="True"
|
||||
CommandParameter="{Binding SelectedItem, ElementName=comboBox}" />
|
||||
</i:Interaction.Behaviors>
|
||||
</ComboBox>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Grid>
|
||||
</DockPanel>
|
||||
</Window>
|
||||
@@ -0,0 +1,36 @@
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Input;
|
||||
using ClassicAssist.Shared.UO;
|
||||
|
||||
namespace ClassicAssist.UI.Views
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for ChatWindow.xaml
|
||||
/// </summary>
|
||||
public partial class ChatWindow : Window
|
||||
{
|
||||
public ChatWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
//TODO Change to command
|
||||
private void TextBox_KeyDown( object sender, KeyEventArgs e )
|
||||
{
|
||||
if ( e.Key != Key.Return && e.Key != Key.Return )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if ( !( sender is TextBox textBox ) )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
Commands.ChatMsg( textBox.Text );
|
||||
e.Handled = true;
|
||||
textBox.Text = string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<UserControl x:Class="ClassicAssist.UI.Views.Debug.DebugAssembliesControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ClassicAssist.UI.Views.Debug"
|
||||
xmlns:debug="clr-namespace:ClassicAssist.UI.ViewModels.Debug"
|
||||
xmlns:resources="clr-namespace:ClassicAssist.Shared.Resources;assembly=ClassicAssist.Shared"
|
||||
mc:Ignorable="d" Background="White"
|
||||
d:DesignHeight="250" d:DesignWidth="300">
|
||||
<UserControl.DataContext>
|
||||
<debug:DebugAssembliesViewModel />
|
||||
</UserControl.DataContext>
|
||||
<Grid Margin="10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
<DockPanel Grid.Row="0">
|
||||
<TextBlock Text="{x:Static resources:Strings.Additional_assemblies_to_load_}" DockPanel.Dock="Top" />
|
||||
<ListView x:Name="listView" Margin="0,10,0,10" ItemsSource="{Binding Items}"
|
||||
SelectedItem="{Binding SelectedItem}">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Name}"
|
||||
Width="{Binding ActualWidth, ElementName=listView, Mode=OneWay}">
|
||||
<GridViewColumn.CellTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding}" ToolTip="{Binding Location, Mode=OneWay}" />
|
||||
</DataTemplate>
|
||||
</GridViewColumn.CellTemplate>
|
||||
</GridViewColumn>
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</DockPanel>
|
||||
<StackPanel Orientation="Horizontal" Grid.Row="1">
|
||||
<StackPanel.Resources>
|
||||
<Style TargetType="{x:Type Button}" BasedOn="{StaticResource {x:Type Button}}">
|
||||
<Setter Property="Padding" Value="20,2,20,2" />
|
||||
<Setter Property="Margin" Value="0,0,10,0" />
|
||||
</Style>
|
||||
</StackPanel.Resources>
|
||||
<Button Content="{x:Static resources:Strings.Load}" Command="{Binding LoadCommand}" />
|
||||
<Button Content="{x:Static resources:Strings.Remove}" Command="{Binding RemoveCommand}"
|
||||
CommandParameter="{Binding SelectedItem, ElementName=listView}" />
|
||||
<Button Content="{x:Static resources:Strings.Save}" Command="{Binding SaveCommand}" />
|
||||
</StackPanel>
|
||||
|
||||
</Grid>
|
||||
|
||||
</UserControl>
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClassicAssist.UI.Views.Debug
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for DebugAssembliesControl.xaml
|
||||
/// </summary>
|
||||
public partial class DebugAssembliesControl : UserControl
|
||||
{
|
||||
public DebugAssembliesControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
<UserControl x:Class="ClassicAssist.UI.Views.Debug.DebugAutolootControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ClassicAssist.UI.Views.Debug"
|
||||
xmlns:debug="clr-namespace:ClassicAssist.Shared.UI.ViewModels.Debug;assembly=ClassicAssist.Shared"
|
||||
xmlns:resources="clr-namespace:ClassicAssist.Shared.Resources;assembly=ClassicAssist.Shared"
|
||||
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
|
||||
xmlns:misc="clr-namespace:ClassicAssist.UI.Misc"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="400" d:DesignWidth="550">
|
||||
<d:DesignerProperties.DesignStyle>
|
||||
<Style TargetType="UserControl">
|
||||
<Setter Property="Background" Value="White" />
|
||||
</Style>
|
||||
</d:DesignerProperties.DesignStyle>
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../../Resources/Icons.xaml" />
|
||||
<ResourceDictionary Source="../Debug/DebugToolBarStyle.xaml" />
|
||||
<ResourceDictionary>
|
||||
<DrawingImage x:Key="RefreshIcon">
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V50 H50 V0 H0 Z">
|
||||
<DrawingGroup Opacity="1">
|
||||
<GeometryDrawing Brush="#FF000000"
|
||||
Geometry="F1 M50,50z M0,0z M25,5C14.351563,5 5.632813,13.378906 5.054688,23.890625 5.007813,24.609375 5.347656,25.296875 5.949219,25.695313 6.550781,26.089844 7.320313,26.132813 7.960938,25.804688 8.601563,25.476563 9.019531,24.828125 9.046875,24.109375 9.511719,15.675781 16.441406,9 25,9 29.585938,9 33.699219,10.925781 36.609375,14L34,14C33.277344,13.988281 32.609375,14.367188 32.246094,14.992188 31.878906,15.613281 31.878906,16.386719 32.246094,17.007813 32.609375,17.632813 33.277344,18.011719 34,18L40.261719,18C40.488281,18.039063,40.71875,18.039063,40.949219,18L44,18 44,8C44.007813,7.460938 43.796875,6.941406 43.414063,6.558594 43.03125,6.175781 42.511719,5.964844 41.96875,5.972656 40.867188,5.988281 39.984375,6.894531 40,8L40,11.777344C36.332031,7.621094,30.964844,5,25,5z M43.03125,23.972656C41.925781,23.925781 40.996094,24.785156 40.953125,25.890625 40.488281,34.324219 33.558594,41 25,41 20.414063,41 16.304688,39.074219 13.390625,36L16,36C16.722656,36.011719 17.390625,35.632813 17.753906,35.007813 18.121094,34.386719 18.121094,33.613281 17.753906,32.992188 17.390625,32.367188 16.722656,31.988281 16,32L9.71875,32C9.507813,31.96875,9.296875,31.96875,9.085938,32L6,32 6,42C5.988281,42.722656 6.367188,43.390625 6.992188,43.753906 7.613281,44.121094 8.386719,44.121094 9.007813,43.753906 9.632813,43.390625 10.011719,42.722656 10,42L10,38.222656C13.667969,42.378906 19.035156,45 25,45 35.648438,45 44.367188,36.621094 44.945313,26.109375 44.984375,25.570313 44.800781,25.039063 44.441406,24.636719 44.078125,24.234375 43.570313,23.996094 43.03125,23.972656z" />
|
||||
</DrawingGroup>
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
<DrawingImage x:Key="ContainerIcon">
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V512 H512 V0 H0 Z">
|
||||
<DrawingGroup.Transform>
|
||||
<TranslateTransform X="0" Y="0.00013560117804445326" />
|
||||
</DrawingGroup.Transform>
|
||||
<GeometryDrawing Brush="#FFC6C5CB"
|
||||
Geometry="F1 M512,512z M0,0z M234.536,85.605L22.362,208.103 22.362,363.766 49.45,379.507 261.624,257.008 261.624,101.346 234.536,85.605z M216.743,230.876L67.682,316.936 67.682,234.236 216.508,148.311 216.743,230.876z" />
|
||||
<DrawingGroup Opacity="1">
|
||||
<DrawingGroup Opacity="1">
|
||||
<GeometryDrawing Brush="#FFE0E0E2"
|
||||
Geometry="F1 M512,512z M0,0z M243.508,246.617L243.508,246.617 216.743,230.876 216.421,116.982 243.508,132.723z" />
|
||||
<GeometryDrawing Brush="#FFE0E0E2"
|
||||
Geometry="F1 M512,512z M0,0z M67.682,348.13L67.682,348.13 40.918,332.389 216.743,230.876 243.508,246.617z" />
|
||||
</DrawingGroup>
|
||||
<GeometryDrawing Brush="#FFD8D8DA"
|
||||
Geometry="F1 M512,512z M0,0z M49.449,379.508L49.449,379.508 22.362,363.765 22.362,208.103 49.449,223.845z" />
|
||||
<GeometryDrawing Brush="#FFE0E0E2"
|
||||
Geometry="F1 M512,512z M0,0z M49.449,223.845L49.449,223.845 22.362,208.103 234.536,85.605 261.623,101.346z" />
|
||||
<GeometryDrawing Brush="#FFC6C5CB"
|
||||
Geometry="F1 M512,512z M0,0z M49.449,223.845L261.623,101.346 261.623,257.008 49.449,379.508 49.449,223.845z M243.508,246.617L243.508,132.723 67.682,234.235 67.682,348.13 243.508,246.617" />
|
||||
</DrawingGroup>
|
||||
<GeometryDrawing Brush="#FFC6C5CB"
|
||||
Geometry="F1 M512,512z M0,0z M261.594,90.904C261.499,57.403 249.59,33.844 230.428,22.815 230.49,22.851 230.553,22.883 230.615,22.918L203.527,7.177C184.226,-4.04 157.511,-2.486 128.074,14.51 69.574,48.284 22.141,130.441 22.331,197.661L22.36,208.104 49.448,223.845 261.622,101.346 261.594,90.904z M215.835,75.483L215.835,75.483 75.351,156.591C89.108,113.677 119.698,71.643 155.22,51.135 172.683,41.053 188.979,37.555 202.704,39.777 209.741,48.512 214.376,60.543 215.835,75.483z" />
|
||||
<DrawingGroup Opacity="1">
|
||||
<DrawingGroup Opacity="1">
|
||||
<GeometryDrawing Brush="#FFE0E0E2"
|
||||
Geometry="F1 M512,512z M0,0z M190.656,29.321L217.744,45.062C231.523,53.07,240.744,68.929,242.924,91.224L215.836,75.483C213.657,53.189,204.436,37.329,190.656,29.321z" />
|
||||
<GeometryDrawing Brush="#FFE0E0E2"
|
||||
Geometry="F1 M512,512z M0,0z M68.03,192.199L68.03,192.199 40.943,176.456 215.835,75.483 242.923,91.224z" />
|
||||
</DrawingGroup>
|
||||
<GeometryDrawing Brush="#FFD8D8DA"
|
||||
Geometry="F1 M512,512z M0,0z M49.449,223.845L49.449,223.845 22.362,208.103 22.331,197.661 49.419,213.402z" />
|
||||
<GeometryDrawing Brush="#FFE0E0E2"
|
||||
Geometry="F1 M512,512z M0,0z M203.527,7.177L230.615,22.918C211.314,11.701,184.599,13.255,155.162,30.251L128.074,14.51C157.511,-2.486,184.226,-4.04,203.527,7.177z" />
|
||||
<GeometryDrawing Brush="#FFD8D8DA"
|
||||
Geometry="F1 M512,512z M0,0z M49.419,213.402L22.331,197.661C22.141,130.441,69.574,48.283,128.073,14.51L155.161,30.251C96.662,64.026,49.229,146.183,49.419,213.402z" />
|
||||
<GeometryDrawing Brush="#FFC6C5CB"
|
||||
Geometry="F1 M512,512z M0,0z M155.161,30.251C213.66,-3.524,261.403,23.684,261.594,90.903L261.623,101.346 49.449,223.845 49.42,213.402C49.229,146.183,96.662,64.026,155.161,30.251z M68.03,192.199L242.923,91.224C238.215,43.05 200.624,24.921 155.22,51.135 109.808,77.354 72.45,138.754 68.03,192.199" />
|
||||
</DrawingGroup>
|
||||
<GeometryDrawing Brush="#FFF18700"
|
||||
Geometry="F1 M512,512z M0,0z M253.127,117.946L253.127,117.946 59.128,229.951 59.51,364.73 284.857,495.91 478.856,383.903 478.856,249.125z" />
|
||||
<DrawingGroup Opacity="1">
|
||||
<DrawingGroup Opacity="1">
|
||||
<GeometryDrawing Brush="#FFFF9911"
|
||||
Geometry="F1 M512,512z M0,0z M284.857,495.91L284.857,495.91 59.51,364.73 59.128,229.951 284.857,361.131z" />
|
||||
<GeometryDrawing Brush="#FFFF9911"
|
||||
Geometry="F1 M512,512z M0,0z M284.857,361.131L284.857,361.131 59.128,229.951 253.127,117.946 478.856,249.125z" />
|
||||
</DrawingGroup>
|
||||
<GeometryDrawing Brush="#FFF18700"
|
||||
Geometry="F1 M512,512z M0,0z M478.856,249.125L478.856,249.125 478.856,383.903 284.857,495.91 284.857,361.131z" />
|
||||
</DrawingGroup>
|
||||
<GeometryDrawing Brush="#FFD8D8DA"
|
||||
Geometry="F1 M512,512z M0,0z M59.388,347.329L59.388,347.329 48.793,353.447 35.891,345.946 35.891,371.551 277.465,512 277.465,486.395 287.212,480.627z" />
|
||||
<GeometryDrawing Brush="#FFE0E0E2"
|
||||
Geometry="F1 M512,512z M0,0z M277.465,486.395L277.465,486.395 287.212,480.627 59.388,347.329 48.793,353.447z" />
|
||||
<GeometryDrawing Brush="#FFC6C5CB"
|
||||
Geometry="F1 M512,512z M0,0z M462.581,218.097L250.407,340.596 250.407,496.259 277.495,512 489.669,389.501 489.669,233.838 462.581,218.097z M444.789,363.368L295.729,449.428 295.729,366.728 444.555,280.803 444.789,363.368z" />
|
||||
<DrawingGroup Opacity="1">
|
||||
<GeometryDrawing Brush="#FFACABB1"
|
||||
Geometry="F1 M512,512z M0,0z M471.554,379.111L471.554,379.111 444.789,363.368 444.466,249.474 471.554,265.216z" />
|
||||
<DrawingGroup Opacity="1">
|
||||
<GeometryDrawing Brush="#FFD8D8DA"
|
||||
Geometry="F1 M512,512z M0,0z M295.729,480.623L295.729,480.623 268.965,464.881 444.789,363.368 471.554,379.111z" />
|
||||
<GeometryDrawing Brush="#FFD8D8DA"
|
||||
Geometry="F1 M512,512z M0,0z M277.495,512L277.495,512 250.407,496.259 250.407,340.596 277.495,356.337z" />
|
||||
</DrawingGroup>
|
||||
<GeometryDrawing Brush="#FFE0E0E2"
|
||||
Geometry="F1 M512,512z M0,0z M277.495,356.337L277.495,356.337 250.407,340.596 462.581,218.097 489.669,233.838z" />
|
||||
<GeometryDrawing Brush="#FFC6C5CB"
|
||||
Geometry="F1 M512,512z M0,0z M277.495,356.337L489.669,233.838 489.669,389.5 277.495,512 277.495,356.337z M471.554,379.111L471.554,265.216 295.729,366.729 295.729,480.623 471.554,379.111" />
|
||||
</DrawingGroup>
|
||||
<GeometryDrawing Brush="#FFF18700"
|
||||
Geometry="F1 M512,512z M0,0z M450.462,167.464C450.518,167.496,450.576,167.526,450.632,167.558L224.903,36.378C207.266,26.129 182.841,27.575 155.881,43.139 102.306,74.071 59.022,149.04 59.197,210.602L284.926,341.782 478.925,229.777C478.839,199.096,467.973,177.541,450.462,167.464z" />
|
||||
<DrawingGroup Opacity="1">
|
||||
<GeometryDrawing Brush="#FFFFA834"
|
||||
Geometry="F1 M512,512z M0,0z M224.903,36.378L450.632,167.558C432.995,157.309,408.57,158.755,381.61,174.319L155.881,43.14C182.841,27.575,207.266,26.129,224.903,36.378z" />
|
||||
<GeometryDrawing Brush="#FFFF9911"
|
||||
Geometry="F1 M512,512z M0,0z M284.927,341.783L59.197,210.603C59.023,149.041,102.306,74.071,155.881,43.14L381.61,174.32C328.035,205.251,284.752,280.221,284.927,341.783z" />
|
||||
<GeometryDrawing Brush="#FFF18700"
|
||||
Geometry="F1 M512,512z M0,0z M381.61,174.32C435.185,143.388,478.752,168.215,478.926,229.777L284.927,341.783C284.752,280.221,328.035,205.251,381.61,174.32z" />
|
||||
</DrawingGroup>
|
||||
<GeometryDrawing Brush="#FFD8D8DA"
|
||||
Geometry="F1 M512,512z M0,0z M287.863,328.139L287.863,328.139 60.039,194.841 49.951,200.666 35.891,192.492 35.891,243.702 277.465,384.151 277.465,332.943 278.639,333.605z" />
|
||||
<GeometryDrawing Brush="#FFE0E0E2"
|
||||
Geometry="F1 M512,512z M0,0z M278.639,333.605L278.639,333.605 287.863,328.139 60.039,194.841 49.968,200.657z" />
|
||||
<GeometryDrawing Brush="#FFC6C5CB"
|
||||
Geometry="F1 M512,512z M0,0z M489.64,223.397C489.545,189.896 477.636,166.336 458.474,155.308 458.536,155.344 458.599,155.376 458.66,155.411L431.572,139.67C412.271,128.453 385.556,130.007 356.119,147.003 297.62,180.777 250.187,262.934 250.378,330.153L250.407,340.596 277.495,356.337 489.669,233.838 489.64,223.397z M443.881,207.975L303.398,289.083C317.155,246.169 347.745,204.135 383.267,183.627 400.73,173.545 417.026,170.047 430.751,172.269 437.786,181.004 442.421,193.037 443.881,207.975z" />
|
||||
<DrawingGroup Opacity="1">
|
||||
<GeometryDrawing Brush="#FFACABB1"
|
||||
Geometry="F1 M512,512z M0,0z M418.702,161.814L445.79,177.555C459.569,185.563,468.79,201.422,470.97,223.717L443.882,207.976C441.703,185.681,432.481,169.821,418.702,161.814z" />
|
||||
<GeometryDrawing Brush="#FFD8D8DA"
|
||||
Geometry="F1 M512,512z M0,0z M296.076,324.691L296.076,324.691 268.989,308.95 443.881,207.975 470.969,223.717z" />
|
||||
<DrawingGroup Opacity="1">
|
||||
<GeometryDrawing Brush="#FFE0E0E2"
|
||||
Geometry="F1 M512,512z M0,0z M277.495,356.337L277.495,356.337 250.407,340.596 250.378,330.154 277.466,345.896z" />
|
||||
<GeometryDrawing Brush="#FFE0E0E2"
|
||||
Geometry="F1 M512,512z M0,0z M431.572,139.669L458.66,155.41C439.359,144.193,412.644,145.747,383.207,162.743L356.119,147.002C385.557,130.006,412.271,128.452,431.572,139.669z" />
|
||||
</DrawingGroup>
|
||||
<GeometryDrawing Brush="#FFD8D8DA"
|
||||
Geometry="F1 M512,512z M0,0z M277.466,345.896L250.378,330.155C250.188,262.936,297.62,180.777,356.119,147.004L383.207,162.745C324.708,196.518,277.275,278.675,277.466,345.896z" />
|
||||
<GeometryDrawing Brush="#FFC6C5CB"
|
||||
Geometry="F1 M512,512z M0,0z M383.207,162.743C441.706,128.968,489.449,156.176,489.64,223.395L489.669,233.838 277.495,356.337 277.466,345.894C277.275,278.675,324.708,196.518,383.207,162.743z M296.076,324.691L470.969,223.717C466.261,175.543 428.67,157.414 383.266,183.628 337.854,209.847 300.497,271.246 296.076,324.691" />
|
||||
</DrawingGroup>
|
||||
<DrawingGroup Opacity="1">
|
||||
<GeometryDrawing Brush="#FFD8D8DA"
|
||||
Geometry="F1 M512,512z M0,0z M277.465,384.151L277.465,384.151 35.891,243.702 35.891,192.492 277.465,332.942z" />
|
||||
<GeometryDrawing Brush="#FFD8D8DA"
|
||||
Geometry="F1 M512,512z M0,0z M277.465,512L277.465,512 35.891,371.551 35.891,345.946 277.465,486.395z" />
|
||||
</DrawingGroup>
|
||||
<DrawingGroup Opacity="1">
|
||||
<DrawingGroup Opacity="1">
|
||||
<GeometryDrawing Brush="#FF898890"
|
||||
Geometry="F1 M512,512z M0,0z M126.232,246.05L126.232,246.05 113.766,253.294 113.766,302.734 156.651,327.574 169.258,320.33 169.258,270.89z" />
|
||||
<GeometryDrawing Brush="#FF898890"
|
||||
Geometry="F1 M512,512z M0,0z M156.791,278.135L156.791,278.135 169.258,270.89 169.258,320.33 156.651,327.574z" />
|
||||
</DrawingGroup>
|
||||
<GeometryDrawing Brush="#FFC6C5CB"
|
||||
Geometry="F1 M512,512z M0,0z M113.766,253.294L113.766,253.294 126.232,246.05 169.258,270.89 156.791,278.135z" />
|
||||
<GeometryDrawing Brush="#FFACABB1"
|
||||
Geometry="F1 M512,512z M0,0z M156.791,278.135L156.791,278.135 156.651,327.574 113.766,302.734 113.766,253.294z" />
|
||||
</DrawingGroup>
|
||||
<GeometryDrawing Brush="#FF77767E"
|
||||
Geometry="F1 M512,512z M0,0z M134.399,277.238C130.349,274.9 127.05,276.773 127.037,281.426 127.028,284.73 128.674,288.545 131.079,291.315L131.05,301.748 137.601,305.53 137.63,295.097C140.035,295.103 141.698,293.199 141.707,289.896 141.721,285.242 138.449,279.575 134.399,277.238z" />
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
<DrawingImage x:Key="RemoveIcon">
|
||||
<DrawingImage.Drawing>
|
||||
<DrawingGroup ClipGeometry="M0,0 V512.001 H512.001 V0 H0 Z">
|
||||
<DrawingGroup Opacity="1">
|
||||
<DrawingGroup Opacity="1">
|
||||
<GeometryDrawing Brush="#FF000000"
|
||||
Geometry="F1 M512.001,512.001z M0,0z M294.111,256.001L504.109,46.003C514.632,35.479 514.632,18.417 504.109,7.894 493.585,-2.63 476.522,-2.63 465.999,7.894L256,217.892 46.002,7.894C35.478,-2.63 18.416,-2.63 7.893,7.894 -2.63,18.418 -2.631,35.48 7.893,46.003L217.891,256.001 7.893,465.999C-2.631,476.523 -2.631,493.585 7.893,504.108 18.417,514.632 35.479,514.631 46.002,504.108L256,294.11 465.997,504.108C476.521,514.632 493.584,514.631 504.107,504.108 514.63,493.584 514.63,476.522 504.107,465.999L294.111,256.001z" />
|
||||
</DrawingGroup>
|
||||
</DrawingGroup>
|
||||
</DrawingGroup>
|
||||
</DrawingImage.Drawing>
|
||||
</DrawingImage>
|
||||
</ResourceDictionary>
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<UserControl.DataContext>
|
||||
<debug:DebugAutolootViewModel />
|
||||
</UserControl.DataContext>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<ToolBar Style="{DynamicResource ToolBarStyle1}" Grid.Row="0">
|
||||
<Button ToolTip="Test Autoloot" Command="{Binding TestContainerCommand}">
|
||||
<Image Source="{StaticResource ContainerIcon}" Height="16" />
|
||||
</Button>
|
||||
<Button ToolTip="Retest Container" Command="{Binding RetestContainerCommand}">
|
||||
<Image Source="{StaticResource RefreshIcon}" Height="16" />
|
||||
</Button>
|
||||
<Button ToolTip="{x:Static resources:Strings.Clear}" Command="{Binding ClearResultsCommand}">
|
||||
<Image Source="{StaticResource RemoveIcon}" Height="11" />
|
||||
</Button>
|
||||
</ToolBar>
|
||||
<TextBox Grid.Row="1" VerticalScrollBarVisibility="Visible" Text="{Binding TestResults}">
|
||||
<i:Interaction.Behaviors>
|
||||
<misc:AutoScrollTextBoxBehaviour />
|
||||
</i:Interaction.Behaviors>
|
||||
</TextBox>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClassicAssist.UI.Views.Debug
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for DebugAutolootControl.xaml
|
||||
/// </summary>
|
||||
public partial class DebugAutolootControl : UserControl
|
||||
{
|
||||
public DebugAutolootControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<UserControl x:Class="ClassicAssist.UI.Views.Debug.DebugBuffIconsControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ClassicAssist.UI.Views.Debug"
|
||||
xmlns:debug="clr-namespace:ClassicAssist.Shared.UI.ViewModels.Debug;assembly=ClassicAssist.Shared"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="400" d:DesignWidth="550">
|
||||
<d:DesignerProperties.DesignStyle>
|
||||
<Style TargetType="UserControl">
|
||||
<Setter Property="Background" Value="White" />
|
||||
</Style>
|
||||
</d:DesignerProperties.DesignStyle>
|
||||
<UserControl.DataContext>
|
||||
<debug:DebugBuffIconsViewModel />
|
||||
</UserControl.DataContext>
|
||||
<Grid Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox Grid.Column="0" MinWidth="120" Margin="0,0,5,0" ItemsSource="{Binding Items}"
|
||||
SelectedItem="{Binding SelectedItem}" />
|
||||
<GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Stretch" />
|
||||
<ListBox Grid.Column="2" ItemsSource="{Binding Messages}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClassicAssist.UI.Views.Debug
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for DebugBuffIconsControl.xaml
|
||||
/// </summary>
|
||||
public partial class DebugBuffIconsControl : UserControl
|
||||
{
|
||||
public DebugBuffIconsControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<UserControl x:Class="ClassicAssist.UI.Views.Debug.DebugGumpControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ClassicAssist.UI.Views.Debug"
|
||||
xmlns:debug="clr-namespace:ClassicAssist.Shared.UI.ViewModels.Debug;assembly=ClassicAssist.Shared"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="400" d:DesignWidth="550">
|
||||
<d:DesignerProperties.DesignStyle>
|
||||
<Style TargetType="UserControl">
|
||||
<Setter Property="Background" Value="White" />
|
||||
</Style>
|
||||
</d:DesignerProperties.DesignStyle>
|
||||
<UserControl.DataContext>
|
||||
<debug:DebugGumpViewModel />
|
||||
</UserControl.DataContext>
|
||||
<Grid Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox Grid.Column="0" MinWidth="120" Margin="0,0,5,0" ItemsSource="{Binding Items}"
|
||||
SelectedItem="{Binding SelectedItem}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding ID, StringFormat={}0x{0:x8}}" />
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Stretch" />
|
||||
<TextBox Grid.Column="2" Text="{Binding Text}" VerticalScrollBarVisibility="Auto" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClassicAssist.UI.Views.Debug
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for DebugGumpControl.xaml
|
||||
/// </summary>
|
||||
public partial class DebugGumpControl : UserControl
|
||||
{
|
||||
public DebugGumpControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<UserControl x:Class="ClassicAssist.UI.Views.Debug.DebugJournalControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:debug="clr-namespace:ClassicAssist.Shared.UI.ViewModels.Debug;assembly=ClassicAssist.Shared"
|
||||
xmlns:misc="clr-namespace:ClassicAssist.UI.Misc"
|
||||
xmlns:resources="clr-namespace:ClassicAssist.Shared.Resources;assembly=ClassicAssist.Shared"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="400" d:DesignWidth="550">
|
||||
<d:DesignerProperties.DesignStyle>
|
||||
<Style TargetType="UserControl">
|
||||
<Setter Property="Background" Value="White" />
|
||||
</Style>
|
||||
</d:DesignerProperties.DesignStyle>
|
||||
<UserControl.DataContext>
|
||||
<debug:DebugJournalViewModel />
|
||||
</UserControl.DataContext>
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="DebugToolBarStyle.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<DockPanel>
|
||||
<ToolBar Margin="10,0,10,0" Style="{DynamicResource ToolBarStyle1}" DockPanel.Dock="Top">
|
||||
<Button Command="{Binding ClearCommand}" Margin="0,0,5,0">
|
||||
<Image Source="{StaticResource RemoveIcon}" Height="16"
|
||||
ToolTip="{x:Static resources:Strings.Clear_All}" />
|
||||
</Button>
|
||||
</ToolBar>
|
||||
<ListBox ItemsSource="{Binding Items}" Margin="10" misc:ListBoxBehavior.ScrollOnNewItem="True" />
|
||||
</DockPanel>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClassicAssist.UI.Views.Debug
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for DebugJournalControl.xaml
|
||||
/// </summary>
|
||||
public partial class DebugJournalControl : UserControl
|
||||
{
|
||||
public DebugJournalControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
<UserControl x:Class="ClassicAssist.UI.Views.Debug.DebugMenusControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ClassicAssist.UI.Views.Debug"
|
||||
xmlns:debug="clr-namespace:ClassicAssist.Shared.UI.ViewModels.Debug;assembly=ClassicAssist.Shared"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="400" d:DesignWidth="550">
|
||||
<d:DesignerProperties.DesignStyle>
|
||||
<Style TargetType="UserControl">
|
||||
<Setter Property="Background" Value="White" />
|
||||
</Style>
|
||||
</d:DesignerProperties.DesignStyle>
|
||||
<UserControl.DataContext>
|
||||
<debug:DebugMenusViewModel />
|
||||
</UserControl.DataContext>
|
||||
<Grid Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox Grid.Column="0" MinWidth="120" Margin="0,0,5,0" ItemsSource="{Binding Items}"
|
||||
SelectedItem="{Binding SelectedItem}">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding ID, StringFormat={}0x{0:x4}}" />
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
<GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Stretch" />
|
||||
<TextBox Grid.Column="2" Text="{Binding Text}" VerticalScrollBarVisibility="Auto" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClassicAssist.UI.Views.Debug
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for DebugMenusControl.xaml
|
||||
/// </summary>
|
||||
public partial class DebugMenusControl : UserControl
|
||||
{
|
||||
public DebugMenusControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<UserControl x:Class="ClassicAssist.UI.Views.Debug.DebugPropertiesControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ClassicAssist.UI.Views.Debug"
|
||||
xmlns:debug="clr-namespace:ClassicAssist.Shared.UI.ViewModels.Debug;assembly=ClassicAssist.Shared"
|
||||
xmlns:resources="clr-namespace:ClassicAssist.Shared.Resources;assembly=ClassicAssist.Shared"
|
||||
xmlns:valueConverters="clr-namespace:ClassicAssist.UI.Misc.ValueConverters"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="450" d:DesignWidth="800">
|
||||
<UserControl.Resources>
|
||||
<ResourceDictionary>
|
||||
<ResourceDictionary.MergedDictionaries>
|
||||
<ResourceDictionary Source="../../../Resources/Icons.xaml" />
|
||||
<ResourceDictionary Source="DebugToolBarStyle.xaml" />
|
||||
</ResourceDictionary.MergedDictionaries>
|
||||
<valueConverters:JoinArrayValueConverter x:Key="JoinArrayValueConverter" />
|
||||
</ResourceDictionary>
|
||||
</UserControl.Resources>
|
||||
<UserControl.DataContext>
|
||||
<debug:DebugPropertiesViewModel />
|
||||
</UserControl.DataContext>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<ToolBar Grid.Row="0" Style="{DynamicResource ToolBarStyle1}">
|
||||
<Button ToolTip="{x:Static resources:Strings.Target_object___}" Command="{Binding TargetCommand}">
|
||||
<Image Source="{StaticResource CrosshairIcon}" Height="16" />
|
||||
</Button>
|
||||
</ToolBar>
|
||||
<ListView Grid.Row="1" ItemsSource="{Binding Items}" Margin="5">
|
||||
<ListView.View>
|
||||
<GridView>
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Cliloc}" Width="75"
|
||||
DisplayMemberBinding="{Binding Cliloc}" />
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Name}" Width="250"
|
||||
DisplayMemberBinding="{Binding Text}" />
|
||||
<GridViewColumn Header="{x:Static resources:Strings.Arguments}" Width="175"
|
||||
DisplayMemberBinding="{Binding Arguments, Converter={StaticResource JoinArrayValueConverter}}" />
|
||||
</GridView>
|
||||
</ListView.View>
|
||||
</ListView>
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,13 @@
|
||||
namespace ClassicAssist.UI.Views.Debug
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for DebugPropertiesControl.xaml
|
||||
/// </summary>
|
||||
public partial class DebugPropertiesControl
|
||||
{
|
||||
public DebugPropertiesControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<UserControl x:Class="ClassicAssist.UI.Views.Debug.DebugSpecialMovesControl"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:local="clr-namespace:ClassicAssist.UI.Views.Debug"
|
||||
xmlns:debug="clr-namespace:ClassicAssist.Shared.UI.ViewModels.Debug;assembly=ClassicAssist.Shared"
|
||||
mc:Ignorable="d"
|
||||
d:DesignHeight="400" d:DesignWidth="550">
|
||||
<d:DesignerProperties.DesignStyle>
|
||||
<Style TargetType="UserControl">
|
||||
<Setter Property="Background" Value="White" />
|
||||
</Style>
|
||||
</d:DesignerProperties.DesignStyle>
|
||||
<UserControl.DataContext>
|
||||
<debug:DebugSpecialMovesViewModel />
|
||||
</UserControl.DataContext>
|
||||
<Grid Margin="10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="5" />
|
||||
<ColumnDefinition Width="*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<ListBox Grid.Column="0" MinWidth="120" Margin="0,0,5,0" ItemsSource="{Binding Items}"
|
||||
SelectedItem="{Binding SelectedItem}" />
|
||||
<GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Stretch" />
|
||||
<ListBox Grid.Column="2" ItemsSource="{Binding Messages}" />
|
||||
</Grid>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,15 @@
|
||||
using System.Windows.Controls;
|
||||
|
||||
namespace ClassicAssist.UI.Views.Debug
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for DebugSpecialMovesControl.xaml
|
||||
/// </summary>
|
||||
public partial class DebugSpecialMovesControl : UserControl
|
||||
{
|
||||
public DebugSpecialMovesControl()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user