Skip to content
Permalink
Browse files

Remove unused code from initial version

  • Loading branch information...
Vogel612 committed Nov 25, 2017
1 parent fcf9d42 commit 7aac086833aa4738ef937e5b102cf0ff5c10b23b
@@ -25,15 +25,12 @@ private void OnStateChanged(object sender, ParserStateEventArgs e)
{
if (e.State == ParserState.Ready)
{
IsBusy = true;
ModuleMetrics = _analyst.ModuleMetrics(_state);
IsBusy = false;
}
}

public void FilterByName(object projects, string text)
{
throw new NotImplementedException();
}

public void Dispose()
{
_state.StateChanged -= OnStateChanged;
@@ -50,21 +47,6 @@ private set
}
}


//public CommandBase RefreshCommand { get; set; }


private bool _canSearch;
public bool CanSearch
{
get => _canSearch;
set
{
_canSearch = value;
OnPropertyChanged();
}
}

private bool _isBusy;
public bool IsBusy
{
@@ -40,122 +40,17 @@
</LinearGradientBrush>
<SolidColorBrush x:Key="{x:Static SystemColors.HighlightTextBrushKey}" Color="Black" />
<SolidColorBrush x:Key="{x:Static SystemColors.ControlTextBrushKey}" Color="Black" />

<Style x:Key="XButtonStyle" TargetType="Button">
<Setter Property="Background" Value="Transparent"/>
<Setter Property="Content" Value=""/>
<Setter Property="BorderThickness" Value="0"/>
<Setter Property="HorizontalContentAlignment" Value="Center"/>
<Setter Property="VerticalContentAlignment" Value="Center"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroup x:Name="CommonStates">
<VisualState x:Name="Normal"/>
<VisualState x:Name="MouseOver">
<Storyboard>
<ColorAnimation Duration="0" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" To="PaleGoldenrod"/>
<DoubleAnimation Duration="0" Storyboard.TargetName="BackgroundAnimation" Storyboard.TargetProperty="Opacity" To="1"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<ColorAnimation Duration="0" Storyboard.TargetName="Background" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" To="PaleGoldenrod"/>
<DoubleAnimation Duration="0" Storyboard.TargetName="BackgroundAnimation" Storyboard.TargetProperty="Opacity" To="1"/>
</Storyboard>
</VisualState>
</VisualStateGroup>
<VisualStateGroup x:Name="FocusStates">
<VisualState x:Name="Focused">
<Storyboard>
<DoubleAnimation Duration="0" Storyboard.TargetName="FocusVisualElement" Storyboard.TargetProperty="Opacity" To="1"/>
</Storyboard>
</VisualState>
<VisualState x:Name="Unfocused" />
</VisualStateGroup>
</VisualStateManager.VisualStateGroups>
<Border x:Name="Background" CornerRadius="3" Background="White" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}">
<Grid Background="{TemplateBinding Background}" Margin="1">
<Border Opacity="0" x:Name="BackgroundAnimation" Background="PaleGoldenrod" />
</Grid>
</Border>
<ContentPresenter
x:Name="contentPresenter"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"
VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"
Margin="{TemplateBinding Padding}"/>
<Rectangle x:Name="DisabledVisualElement" RadiusX="3" RadiusY="3" Fill="#FFFFFFFF" Opacity="0" IsHitTestVisible="false" />
<Rectangle x:Name="FocusVisualElement" RadiusX="2" RadiusY="2" Margin="1" Stroke="PaleGoldenrod" StrokeThickness="1" Opacity="0" IsHitTestVisible="false" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
</UserControl.Resources>

<Grid UseLayoutRounding="True">
<Grid.RowDefinitions>
<!--<RowDefinition Height="30"/>-->
<RowDefinition Height="20"/>
<RowDefinition Height="*" MinHeight="64" />
</Grid.RowDefinitions>

<!--<ToolBarTray Grid.Row="0" IsLocked="True">
<ToolBar Style="{DynamicResource ToolBarWithOverflowOnlyShowingWhenNeededStyle}">
<Button>
<Image Height="16" Source="../../Resources/arrow-circle-double.png">
<Image.Style>
<Style TargetType="Image">
<Style.Triggers>
<Trigger Property="IsEnabled" Value="False">
<Setter Property="Opacity" Value="0.3" />
</Trigger>
</Style.Triggers>
</Style>
</Image.Style>
</Image>
<Button.ToolTip>
<TextBlock Text="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=Refresh}" />
</Button.ToolTip>
</Button>
</ToolBar>
</ToolBarTray>-->

<Border Grid.Row="1"
BorderBrush="{StaticResource {x:Static SystemColors.ControlBrushKey}}"
BorderThickness="1">
<Grid>
<TextBox x:Name="SearchBox"
VerticalContentAlignment="Center"
IsEnabled="{Binding CanSearch}"
MinHeight="20"
PreviewKeyDown="SearchBox_OnPreviewKeyDown"
TextChanged="SearchBox_OnTextChanged" />

<Image Source="{StaticResource SearchImage}"
HorizontalAlignment="Right" VerticalAlignment="Center"
MaxHeight="16" Margin="0,0,1,0"
IsEnabled="{Binding CanSearch}"
Visibility="{Binding ElementName=SearchBox, Path=Text.Length, Converter={StaticResource StringHasValueToVisibility}}"
MouseDown="SearchIcon_OnMouseDown" />

<Button Style="{StaticResource XButtonStyle}"
HorizontalAlignment="Right" VerticalAlignment="Center"
Height="18" Width="18" Margin="0,1,1,0"
IsEnabled="{Binding CanSearch}"
Visibility="{Binding ElementName=SearchBox, Path=Text.Length, Converter={StaticResource StringHasNoValueToVisibility}}"
Click="ButtonBase_OnClick" />
</Grid>
</Border>
<controls:EmptyUIRefresh Grid.Row="2" />
<controls:EmptyUIRefresh Grid.Row="1" />

<DataGrid Grid.Row="2" ItemsSource="{Binding ModuleMetrics}" AutoGenerateColumns="False" IsReadOnly="True">
<DataGrid Grid.Row="1" ItemsSource="{Binding ModuleMetrics}" AutoGenerateColumns="False" IsReadOnly="True">
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding Path=ModuleName}" Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=SearchResults_ModuleName}" Width="*"/>
<DataGridTextColumn Binding="{Binding Path=Result.Lines}" Header="{Resx ResxName=Rubberduck.UI.RubberduckUI, Key=CodeMetrics_Lines}" Width="Auto" x:Name="LinesColumn"/>
@@ -16,33 +16,5 @@ public CodeMetricsControl()
}

private CodeMetricsViewModel ViewModel { get { return DataContext as CodeMetricsViewModel; } }
private void SearchBox_OnTextChanged(object sender, TextChangedEventArgs e)
{
ViewModel.FilterByName(ViewModel.ModuleMetrics, ((TextBox)sender).Text);
}

private void SearchIcon_OnMouseDown(object sender, MouseButtonEventArgs e)
{
SearchBox.Focus();
}

private void ButtonBase_OnClick(object sender, RoutedEventArgs e)
{
ClearSearchBox();
}

private void ClearSearchBox()
{
SearchBox.Text = string.Empty;
SearchBox.Focus();
}

private void SearchBox_OnPreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key == Key.Escape)
{
ClearSearchBox();
}
}
}
}

0 comments on commit 7aac086

Please sign in to comment.
You can’t perform that action at this time.