Skip to content

Commit

Permalink
Converted item to a user control
Browse files Browse the repository at this point in the history
  • Loading branch information
ColinDabritz committed Oct 11, 2015
1 parent 5d6a7ef commit 17b690b
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 11 deletions.
14 changes: 14 additions & 0 deletions PoeItemAnalyzer/Controls/ItemDisplay.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<UserControl x:Class="PoeItemAnalyzer.Controls.ItemDisplay"
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:PoeItemAnalyzer.Controls"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<StackPanel>
<Border BorderThickness="1" BorderBrush="Black">
<TextBlock Text="{Binding RawItemText}" />
</Border>
</StackPanel>
</UserControl>
29 changes: 29 additions & 0 deletions PoeItemAnalyzer/Controls/ItemDisplay.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
using PoeItemAnalyzer.ViewModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace PoeItemAnalyzer.Controls
{
/// <summary>
/// Interaction logic for ItemDisplay.xaml
/// </summary>
public partial class ItemDisplay : UserControl
{
public ItemDisplay()
{
InitializeComponent();
}
}
}
19 changes: 8 additions & 11 deletions PoeItemAnalyzer/LogWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:PoeItemAnalyzer"
xmlns:control="clr-namespace:PoeItemAnalyzer.Controls"
mc:Ignorable="d"
Title="LogWindow" Height="750" Width="750">
<Grid Margin="10">
<ListBox Name="itemListbox">
<ListBox.ItemTemplate>
<DataTemplate>
<Border BorderThickness="1" BorderBrush="Black">
<TextBlock Text="{Binding RawItemText}" />
</Border>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
<ListBox Margin="10" Name="itemListbox">
<ListBox.ItemTemplate>
<DataTemplate>
<control:ItemDisplay ></control:ItemDisplay>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Window>
4 changes: 4 additions & 0 deletions PoeItemAnalyzer/LogWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ private void ClipboardChanged(object sender, EventArgs e)
{
if (Clipboard.ContainsText())
{
// TODO: Can apparently throw
// System.Runtime.InteropServices.COMException
// {"OpenClipboard Failed (Exception from HRESULT: 0x800401D0 (CLIPBRD_E_CANT_OPEN))"}
// was copying text real quick. Maybe this is the STA apartment thing?
var clippedText = Clipboard.GetText().Trim();

if(string.IsNullOrWhiteSpace(clippedText))
Expand Down
7 changes: 7 additions & 0 deletions PoeItemAnalyzer/PoeItemAnalyzer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,15 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Controls\ItemDisplay.xaml.cs">
<DependentUpon>ItemDisplay.xaml</DependentUpon>
</Compile>
<Compile Include="ViewModel\ItemLogViewModel.cs" />
<Compile Include="ViewModel\LootItemViewModel.cs" />
<Page Include="Controls\ItemDisplay.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="LogWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
Expand Down

0 comments on commit 17b690b

Please sign in to comment.