Skip to content

Commit 783e85f

Browse files
committed
Close BornToBeRoot#44, UI improved, some changes / bugfixes
1 parent 4af68ff commit 783e85f

44 files changed

Lines changed: 711 additions & 10800 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎Source/NETworkManager/App.xaml‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/Accents/BaseDark.xaml" />
1515
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/FlatButton.xaml" />
1616
<ResourceDictionary Source="pack://application:,,,/MahApps.Metro;component/Styles/FlatSlider.xaml" />
17-
<!-- Use Icons -->
18-
<ResourceDictionary Source="/Resources/Icons.xaml" />
1917
<!-- Localization -->
2018
<ResourceDictionary Source="/Resources/Localization/Resources.en-US.xaml" />
2119
<!-- Context menu (import berfore styles)-->
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
using System.Globalization;
3+
using System.Windows.Data;
4+
5+
namespace NETworkManager.Converters
6+
{
7+
public sealed class TimestampToStringConverter : IValueConverter
8+
{
9+
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
10+
{
11+
if (value == null)
12+
return string.Empty;
13+
14+
return ((DateTime)value).ToLongTimeString();
15+
}
16+
17+
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
18+
{
19+
throw new NotImplementedException();
20+
}
21+
}
22+
}

‎Source/NETworkManager/MainWindow.xaml‎

Lines changed: 80 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,16 @@
7979
<RowDefinition Height="Auto" />
8080
</Grid.RowDefinitions>
8181
<Grid Grid.Row="0">
82+
<Grid.Style>
83+
<Style TargetType="{x:Type Grid}">
84+
<Setter Property="Visibility" Value="Visible" />
85+
<Style.Triggers>
86+
<DataTrigger Binding="{Binding ElementName=contentControlSettings, Path=HasContent}" Value="True">
87+
<Setter Property="Visibility" Value="Collapsed" />
88+
</DataTrigger>
89+
</Style.Triggers>
90+
</Style>
91+
</Grid.Style>
8292
<!-- 1 = Search & ApplicationList, 2 = ApplicationView-->
8393
<Grid.ColumnDefinitions>
8494
<ColumnDefinition Width="Auto" />
@@ -295,7 +305,7 @@
295305
</ToggleButton>
296306
</Grid>
297307
</Border>
298-
<ScrollViewer Grid.Row="1" ManipulationBoundaryFeedback="ScrollViewer_ManipulationBoundaryFeedback" Style="{StaticResource ApplicationViewScrollViewer}">
308+
<ScrollViewer Grid.Row="1" ManipulationBoundaryFeedback="ScrollViewer_ManipulationBoundaryFeedback" Style="{StaticResource FadeOutScrollViewer}">
299309
<ListView ItemsSource="{Binding ApplicationViewCollection}" SelectedItem="{Binding SelectedApplicationViewInfo, Mode=TwoWay}" SelectionMode="Single" BorderThickness="0">
300310
<ListView.ItemTemplate>
301311
<DataTemplate>
@@ -318,15 +328,6 @@
318328
<DataTrigger Binding="{Binding Path=IsSelected,RelativeSource={RelativeSource AncestorType={x:Type ListViewItem}}}" Value="True" >
319329
<Setter Property="Fill" Value="{DynamicResource AccentColorBrush}" />
320330
</DataTrigger>
321-
<MultiDataTrigger>
322-
<MultiDataTrigger.Conditions>
323-
<Condition Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type Window}}, Path=DataContext.OpenApplicationList}" Value="False" />
324-
<Condition Binding="{Binding Path=IsMouseOver,RelativeSource={RelativeSource AncestorType={x:Type ListViewItem}}}" Value="True" />
325-
</MultiDataTrigger.Conditions>
326-
<MultiDataTrigger.Setters>
327-
<Setter Property="ToolTip" Value="{Binding TranslatedName}" />
328-
</MultiDataTrigger.Setters>
329-
</MultiDataTrigger>
330331
</Style.Triggers>
331332
</Style>
332333
</Rectangle.Style>
@@ -423,15 +424,15 @@
423424
<TextBlock Grid.Row="1" Style="{StaticResource HeaderTextBlock}" FontSize="18" Foreground="{DynamicResource GrayBrush3}" Text="{DynamicResource String_SearchedApplicationNotFound}" Margin="10,0" TextWrapping="Wrap" TextAlignment="Center" />
424425
</Grid>
425426
<Border Grid.Row="2" BorderBrush="{DynamicResource GrayBrush8}" BorderThickness="0,1,0,0" Background="Transparent">
426-
<Button Height="48" HorizontalContentAlignment="Stretch" Command="{Binding OpenSettingsCommand}" Focusable="False" Style="{StaticResource SettingsButton}">
427+
<Button Height="48" HorizontalContentAlignment="Stretch" Command="{Binding OpenSettingsCommand}" Style="{StaticResource SettingsButton}" Focusable="False">
427428
<Grid HorizontalAlignment="Left">
428429
<Grid.ColumnDefinitions>
429430
<ColumnDefinition Width="48" />
430431
<ColumnDefinition Width="*" />
431432
</Grid.ColumnDefinitions>
432433
<Rectangle Grid.Column="0" Width="24" Height="24">
433434
<Rectangle.OpacityMask>
434-
<VisualBrush Stretch="Uniform" Visual="{IconPacks:PackIconOcticons Kind=Settings}" />
435+
<VisualBrush Stretch="Uniform" Visual="{IconPacks:PackIconModern Kind=Settings}" />
435436
</Rectangle.OpacityMask>
436437
<Rectangle.Style>
437438
<Style TargetType="{x:Type Rectangle}">
@@ -503,13 +504,76 @@
503504
<ContentControl x:Name="contentControlApplication" Grid.Row="1" Focusable="False" />
504505
</Grid>
505506
</Grid>
507+
<Grid Grid.Row="0">
508+
<Grid.Style>
509+
<Style TargetType="{x:Type Grid}">
510+
<Setter Property="Visibility" Value="Collapsed" />
511+
<Style.Triggers>
512+
<DataTrigger Binding="{Binding ElementName=contentControlSettings, Path=HasContent}" Value="True">
513+
<Setter Property="Visibility" Value="Visible" />
514+
</DataTrigger>
515+
</Style.Triggers>
516+
</Style>
517+
</Grid.Style>
518+
<Grid>
519+
<Grid.RowDefinitions>
520+
<RowDefinition Height="Auto" />
521+
<RowDefinition Height="*" />
522+
</Grid.RowDefinitions>
523+
<Border Grid.Row="0" BorderBrush="{DynamicResource GrayBrush8}" BorderThickness="0,0,0,1" >
524+
<Grid>
525+
<Grid.ColumnDefinitions>
526+
<ColumnDefinition Width="Auto" />
527+
<ColumnDefinition Width="*" />
528+
</Grid.ColumnDefinitions>
529+
<Button Grid.Column="0" HorizontalAlignment="Right" Command="{Binding CloseSettingsCommand}" Style="{StaticResource CleanButton}" Margin="10">
530+
<Grid>
531+
<Grid.ColumnDefinitions>
532+
<ColumnDefinition Width="Auto" />
533+
<ColumnDefinition Width="*" />
534+
</Grid.ColumnDefinitions>
535+
<Rectangle Grid.Column="0" Width="24" Height="24">
536+
<Rectangle.OpacityMask>
537+
<VisualBrush Stretch="Uniform" Visual="{IconPacks:PackIconMaterialLight Kind=ArrowLeftCircle}" />
538+
</Rectangle.OpacityMask>
539+
<Rectangle.Style>
540+
<Style TargetType="{x:Type Rectangle}">
541+
<Setter Property="Fill" Value="{DynamicResource GrayBrush3}" />
542+
<Style.Triggers>
543+
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Button}}, Path=IsMouseOver}" Value="True">
544+
<Setter Property="Fill" Value="{DynamicResource GrayBrush5}" />
545+
</DataTrigger>
546+
</Style.Triggers>
547+
</Style>
548+
</Rectangle.Style>
549+
</Rectangle>
550+
<TextBlock Grid.Column="1" Text="{DynamicResource String_Back}" VerticalAlignment="Center" Margin="10,0,0,0">
551+
<TextBlock.Style>
552+
<Style TargetType="{x:Type TextBlock}" BasedOn="{StaticResource DefaultTextBlock}">
553+
<Setter Property="Foreground" Value="{DynamicResource GrayBrush3}" />
554+
<Style.Triggers>
555+
<DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type Button}}, Path=IsMouseOver}" Value="True">
556+
<Setter Property="Foreground" Value="{DynamicResource GrayBrush5}" />
557+
</DataTrigger>
558+
</Style.Triggers>
559+
</Style>
560+
</TextBlock.Style>
561+
</TextBlock>
562+
</Grid>
563+
</Button>
564+
<TextBlock Grid.Column="1" VerticalAlignment="Center" Height="48" TextAlignment="Center" Style="{StaticResource HeaderTextBlock}" Text="{DynamicResource String_Header_Settings}" Foreground="{DynamicResource GrayBrush3}" Margin="10,0" />
565+
</Grid>
566+
</Border>
567+
<ContentControl Grid.Row="1" x:Name="contentControlSettings" />
568+
</Grid>
569+
</Grid>
506570
<Border Grid.Row="1" BorderThickness="0,1,0,0" BorderBrush="{DynamicResource GrayBrush8}">
507571
<StatusBar Foreground="{DynamicResource GrayBrush3}">
508572
<StatusBarItem>
509-
<StackPanel Orientation="Horizontal">
510-
<TextBlock Text="{Binding Version}" Style="{StaticResource DefaultTextBlock}" Foreground="{DynamicResource GrayBrush3}" FontWeight="Bold" />
511-
<TextBlock Text="BETA" Style="{StaticResource DefaultTextBlock}" Foreground="{DynamicResource AccentColorBrush}" Margin="10,0,0,0" />
512-
</StackPanel>
573+
<StackPanel Orientation="Horizontal">
574+
<TextBlock Text="{Binding Version}" Style="{StaticResource DefaultTextBlock}" Foreground="{DynamicResource GrayBrush3}" FontWeight="Bold" />
575+
<TextBlock Text="BETA" Style="{StaticResource DefaultTextBlock}" Foreground="{DynamicResource AccentColorBrush}" Margin="10,0,0,0" />
576+
</StackPanel>
513577
</StatusBarItem>
514578
</StatusBar>
515579
</Border>

‎Source/NETworkManager/MainWindow.xaml.cs‎

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ private async void MetroWindowMain_Closing(object sender, CancelEventArgs e)
313313
WakeOnLANView wakeOnLANView;
314314
PingView pingView;
315315
TracerouteView tracerouteView;
316-
DNSLookupView dnsLookupView;
316+
DNSLookupView DNSLookupView;
317317
WikiView wikiView;
318318

319319
private ApplicationViewManager.Name? currentApplicationViewName = null;
@@ -368,10 +368,10 @@ private void ChangeApplicationView(ApplicationViewManager.Name name)
368368
contentControlApplication.Content = tracerouteView;
369369
break;
370370
case ApplicationViewManager.Name.DNSLookup:
371-
if (dnsLookupView == null)
372-
dnsLookupView = new DNSLookupView();
371+
if (DNSLookupView == null)
372+
DNSLookupView = new DNSLookupView();
373373

374-
contentControlApplication.Content = dnsLookupView;
374+
contentControlApplication.Content = DNSLookupView;
375375
break;
376376
case ApplicationViewManager.Name.Wiki:
377377
if (wikiView == null)
@@ -597,25 +597,25 @@ public ICommand OpenSettingsCommand
597597
get { return new RelayCommand(p => OpenSettingsAction()); }
598598
}
599599

600-
private async void OpenSettingsAction()
600+
private void OpenSettingsAction()
601601
{
602602
if (string.IsNullOrEmpty(_cultureCode))
603603
_cultureCode = SettingsManager.Current.Localization_CultureCode;
604604

605-
SettingsWindow settingsWindow = _isInTray ? new SettingsWindow() : new SettingsWindow(SelectedApplicationViewInfo.Name);
605+
ShowWindowAction();
606606

607-
if (_isInTray)
608-
{
609-
settingsWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
610-
}
611-
else
612-
{
613-
settingsWindow.Owner = this;
614-
MetroWindowMain.ShowOverlay();
615-
}
607+
contentControlSettings.Content = _isInTray ? new SettingsView() : new SettingsView(SelectedApplicationViewInfo.Name);
608+
}
609+
610+
public ICommand CloseSettingsCommand
611+
{
612+
get { return new RelayCommand(p => CloseSettingsAction()); }
613+
}
614+
615+
private async void CloseSettingsAction()
616+
{
617+
contentControlSettings.Content = null;
616618

617-
// Open settings window
618-
settingsWindow.ShowDialog();
619619

620620
// Enable/disable tray icon
621621
if (!_isInTray)
@@ -782,6 +782,6 @@ private void ScrollViewer_ManipulationBoundaryFeedback(object sender, Manipulati
782782
{
783783
e.Handled = true;
784784
}
785-
#endregion
785+
#endregion
786786
}
787787
}

0 commit comments

Comments
 (0)