Skip to content
This repository has been archived by the owner on Jul 30, 2020. It is now read-only.

Commit

Permalink
Merge pull request #856 from Necrobot-Private/bug_fix/revert_draft_se…
Browse files Browse the repository at this point in the history
…arch_form

Temporarily revert search form causing blank selection line in WPF GUI.
  • Loading branch information
jjskuld authored Feb 15, 2017
2 parents d61a51e + 80f1025 commit f95e453
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 130 deletions.
56 changes: 8 additions & 48 deletions PoGo.Necrobot.Window/Controls/PokemonInventory.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:PoGo.Necrobot.Window"
xmlns:cv="clr-namespace:PoGo.Necrobot.Window.Converters"
xmlns:t="http://schemas.xceed.com/wpf/xaml/toolkit"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="900">
<Control.Resources>
Expand Down Expand Up @@ -57,48 +56,18 @@
</EventTrigger.Actions>
</EventTrigger>
</Button.Triggers>
<StackPanel Orientation="Horizontal" Visibility="Collapsed" >
<StackPanel Orientation="Horizontal" >
<Image Margin="5,0" Source="https://cdn3.iconfinder.com/data/icons/tango-icon-library/48/system-search-32.png" Width="20px"></Image>
<TextBlock Margin="5,0" Text="{Binding Source=FilterAndSearch, Converter={StaticResource I18NConveter}}"></TextBlock>

</StackPanel>


</Button>
<Popup Name="popSearchAndFilter" IsOpen="False" Placement="Mouse" >
<Grid Width="500" Height="399" Background="WhiteSmoke">
<Border BorderThickness="1,1,1,1" BorderBrush="BlueViolet">
<StackPanel Margin="20,20,20,20" >
<TextBlock Text="{Binding Source=SearchPokemonName, Converter={StaticResource I18NConveter}}"></TextBlock>
<TextBox Name="filterName" Text="{Binding Path=Filter.Name}"></TextBox>

<TextBlock Text="{Binding Source=SearchPokemonIV, Converter={StaticResource I18NConveter}}"></TextBlock>
<t:RangeSlider Minimum="0" Maximum="100" LowerValue="{Binding Path=Filter.MinIV}" HigherValue="{Binding Path=Filter.MaxIV}" ></t:RangeSlider>

<TextBlock Text="{Binding Source=SearchPokemonLevel, Converter={StaticResource I18NConveter}}"></TextBlock>
<t:RangeSlider Minimum="0" Maximum="50" LowerValue="{Binding Path=Filter.MinLevel}" HigherValue="{Binding Path=Filter.MaxLevel}" ></t:RangeSlider>

<TextBlock Text="{Binding Source=SearchPokemonCP, Converter={StaticResource I18NConveter}}"></TextBlock>
<t:RangeSlider Minimum="0" Maximum="5000" LowerValue="{Binding Path=Filter.MinCP}" HigherValue="{Binding Path=Filter.MaxCP}" ></t:RangeSlider>

<StackPanel Orientation="Horizontal">
<Button Content="{Binding Source=SearchButton, Converter={StaticResource I18NConveter}}" Name="applyFilter" Click="applyFilter_Click"></Button>
<Button Content="{Binding Source=SearchButton, Converter={StaticResource I18NConveter}}" Name="closeSearch">
<Button.Triggers>
<EventTrigger RoutedEvent="Button.Click">
<BeginStoryboard>
<Storyboard>
<BooleanAnimationUsingKeyFrames Storyboard.TargetName="popSearchAndFilter"
Storyboard.TargetProperty="IsOpen">
<DiscreteBooleanKeyFrame KeyTime="0:0:4" Value="False" />
</BooleanAnimationUsingKeyFrames>
</Storyboard>
</BeginStoryboard>

</EventTrigger>
</Button.Triggers>
</Button>
</StackPanel>
<Popup Name="popSearchAndFilter" IsOpen="False" Placement="Mouse" >
<Grid Width="500" Height="399">
<Border BorderThickness="1,1,1,1" BorderBrush="Black">
<StackPanel>
<TextBlock Text="test"/>
</StackPanel>
</Border>
</Grid>
Expand All @@ -124,17 +93,8 @@
<MenuItem Header="Set as Buddy" Click="mnuBuddy_Click" />
</ContextMenu>
</DataGrid.ContextMenu>
<DataGrid.RowStyle>
<Style TargetType="{x:Type DataGridRow}">
<Style.Triggers>
<DataTrigger Binding="{Binding Displayed}" Value="False">
<Setter Property="Visibility" Value="Collapsed"/>
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.RowStyle>

<DataGrid.Columns>

<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding PokemonId, Converter={StaticResource EnumToNumberConverter}}" Header="#" MinWidth="30" />

<DataGridTemplateColumn Header="" IsReadOnly="False" MinWidth="40">
Expand Down
7 changes: 0 additions & 7 deletions PoGo.Necrobot.Window/Controls/PokemonInventory.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -200,13 +200,6 @@ await SelectBuddyPokemonTask.Execute(
});
}

private void applyFilter_Click(object sender, RoutedEventArgs e)
{
var model = (PokemonListModel)this.DataContext;

model.ApplyFilter();
}

//ICommand transferPokemonCommand;
//public ICommand TransferPokemonCommand
//{
Expand Down
3 changes: 0 additions & 3 deletions PoGo.Necrobot.Window/Model/PokemonDataViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public PokemonDataViewModel(ISession session, PokemonData pokemon)
{
this.Session = session;
this.PokemonData = pokemon;
this.Displayed = true;
}

internal void UpdateWith(PokemonData item)
Expand Down Expand Up @@ -360,7 +359,5 @@ public string PowerupText
return "Upgrade";
}
}

public bool Displayed { get; set; }
}
}
52 changes: 5 additions & 47 deletions PoGo.Necrobot.Window/Model/PokemonListModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,51 +13,18 @@

namespace PoGo.Necrobot.Window.Model
{
public class PokemonViewFilter : ViewModelBase
{
public PokemonViewFilter() : base()
{
this.MaxCP = 3500;
this.MaxLevel = 50;
this.MaxIV = 100;
}

public string Name { get; set; }
public int MinIV { get; set; }

public int MaxIV { get; set; }
public int MinLevel { get; set; }
public int MaxLevel { get; set; }

public int MinCP { get; set; }
public int MaxCP { get; set; }

internal bool Check(PokemonDataViewModel item)
{
if(!string.IsNullOrEmpty(Name))
{
if (!Name.ToLower().Contains(item.PokemonId.ToString().ToLower())) return false;
}

if (item.IV < MinIV || item.IV > MaxIV) return false;
if (item.IV < MinLevel || item.IV > MaxLevel) return false;
if (item.IV < MinCP || item.IV > MaxCP) return false;
return true;
}
}
public class PokemonListModel : ViewModelBase
{
public PokemonListModel(ISession session)
{
Filter = new PokemonViewFilter();
this.Session = Session;
}

// Caches
public static LRUCache<ulong, string> LocationsCache = new LRUCache<ulong, string>(capacity: 500);

public ObservableCollection<PokemonDataViewModel> Pokemons { get; set; }
public PokemonViewFilter Filter { get; set; }

internal void Update(IEnumerable<PokemonData> pokemons)
{
foreach (var item in pokemons)
Expand Down Expand Up @@ -91,8 +58,8 @@ internal void Update(IEnumerable<PokemonData> pokemons)
modelsToRemove.Add(item);
}
}

foreach (var model in modelsToRemove)
foreach(var model in modelsToRemove)
{
Pokemons.Remove(model);
}
Expand Down Expand Up @@ -212,8 +179,8 @@ internal void Evolve(ulong pokemonId)
pkm.IsEvolving = true;
}
}


public void Powerup(ulong pokemonId)
{
var pkm = Pokemons.FirstOrDefault(x => x.Id == pokemonId);
Expand All @@ -223,14 +190,5 @@ public void Powerup(ulong pokemonId)
pkm.IsUpgrading = true;
}
}

internal void ApplyFilter()
{
foreach (var item in this.Pokemons)
{
item.Displayed = this.Filter.Check(item);
item.RaisePropertyChanged("Displayed");
}
}
}
}
24 changes: 0 additions & 24 deletions PoGo.Necrobot.Window/PoGo.Necrobot.Window.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -167,30 +167,6 @@
<HintPath>..\packages\WPFToolkit.3.5.50211.1\lib\WPFToolkit.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xceed.Wpf.AvalonDock, Version=3.0.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\Extended.Wpf.Toolkit.3.0\lib\net40\Xceed.Wpf.AvalonDock.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Aero, Version=3.0.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\Extended.Wpf.Toolkit.3.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Aero.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.Metro, Version=3.0.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\Extended.Wpf.Toolkit.3.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.Metro.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xceed.Wpf.AvalonDock.Themes.VS2010, Version=3.0.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\Extended.Wpf.Toolkit.3.0\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xceed.Wpf.DataGrid, Version=3.0.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\Extended.Wpf.Toolkit.3.0\lib\net40\Xceed.Wpf.DataGrid.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Xceed.Wpf.Toolkit, Version=3.0.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
<HintPath>..\packages\Extended.Wpf.Toolkit.3.0\lib\net40\Xceed.Wpf.Toolkit.dll</HintPath>
<Private>True</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
Expand Down
1 change: 0 additions & 1 deletion PoGo.Necrobot.Window/packages.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Extended.Wpf.Toolkit" version="3.0" targetFramework="net452" />
<package id="Fody" version="1.29.4" targetFramework="net452" developmentDependency="true" />
<package id="Geocoding.net" version="3.6.0" targetFramework="net452" />
<package id="GeoCoordinate.NetStandard1" version="1.0.0" targetFramework="net452" />
Expand Down

0 comments on commit f95e453

Please sign in to comment.