Skip to content

Commit

Permalink
Added more functionality to Utilities.xaml
Browse files Browse the repository at this point in the history
  • Loading branch information
marcin-przywoski committed Nov 26, 2023
1 parent 49dfaf2 commit 109b2ef
Show file tree
Hide file tree
Showing 2 changed files with 134 additions and 153 deletions.
238 changes: 86 additions & 152 deletions ExportViewer.GUI/Views/Utilities.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,162 +6,96 @@
xmlns:local="clr-namespace:ExportViewer.GUI.Views"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:vm="clr-namespace:ExportViewer.GUI.ViewModels"
d:DesignHeight="450"
d:DesignWidth="800"
Background="{DynamicResource MaterialDesignPaper}"
FontFamily="{DynamicResource MaterialDesignFont}"
Style="{DynamicResource MaterialDesignRoot}"
TextElement.FontSize="13"
TextElement.FontWeight="Regular"
TextElement.Foreground="{DynamicResource MaterialDesignBody}"
TextOptions.TextFormattingMode="Ideal"
TextOptions.TextRenderingMode="Auto"
mc:Ignorable="d">

<UserControl.DataContext>
<vm:UtilitiesViewModel />
</UserControl.DataContext>

<Grid>
<DockPanel />
<materialDesign:Card>
<TabControl
materialDesign:NavigationRailAssist.ShowSelectionBackground="True"
SnapsToDevicePixels="True"
Style="{StaticResource MaterialDesignNavigationRailTabControl}"
TabStripPlacement="Left">
<TabItem>
<TabItem.Header>
<StackPanel Width="auto" Height="auto">
<materialDesign:PackIcon
Width="24"
Height="24"
HorizontalAlignment="Center"
Kind="Folder" />
<TextBlock HorizontalAlignment="Center" Text="All Files" />
</StackPanel>
</TabItem.Header>
<StackPanel Margin="16">
<TextBlock
Margin="0,0,0,8"
Style="{StaticResource MaterialDesignHeadline5TextBlock}"
Text="All Files" />
<TextBlock>
<Run Text="tab 1 content. Default look and behaviors." />
<LineBreak />
<LineBreak />
<Run FontStyle="Italic">
Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...
</Run>
</TextBlock>
</StackPanel>
</TabItem>
<TabItem>
<TabItem.Header>
<StackPanel Width="auto" Height="auto">
<materialDesign:PackIcon
Width="24"
Height="24"
HorizontalAlignment="Center"
Kind="ClockOutline" />
<TextBlock HorizontalAlignment="Center" Text="Recent" />
</StackPanel>
</TabItem.Header>
<StackPanel Margin="16">
<TextBlock
Margin="0,0,0,8"
Style="{StaticResource MaterialDesignHeadline5TextBlock}"
Text="Recent" />
<TextBlock>
<Run Text="tab 2 content. Default look and behaviors." />
<LineBreak />
<LineBreak />
<Run FontStyle="Italic">
Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit...
</Run>
</TextBlock>
</StackPanel>
</TabItem>
<TabItem>
<TabItem.Header>
<StackPanel Width="auto" Height="auto">
<materialDesign:PackIcon
Width="24"
Height="24"
HorizontalAlignment="Center"
Kind="Images" />
<TextBlock HorizontalAlignment="Center" Text="Utilities" />
</StackPanel>
</TabItem.Header>
<StackPanel Margin="16">
<TextBlock
Margin="0,0,0,8"
Style="{StaticResource MaterialDesignHeadline5TextBlock}"
Text="Metadata fix" />
<TextBox
x:Name="NameTextBox"
materialDesign:HintAssist.HelperText="Source location of the Facebook export"
materialDesign:HintAssist.Hint="Source">
<TextBox.Text>
<Binding Path="Name" UpdateSourceTrigger="PropertyChanged" />
</TextBox.Text>
</TextBox>
<TextBox
x:Name="NameTextBox2"
Margin="0,23,0,0"
materialDesign:HintAssist.HelperText="Destination of the media with fixed metadata"
materialDesign:HintAssist.Hint="Destination">
<TextBox.Text>
<Binding Path="Name" UpdateSourceTrigger="PropertyChanged" />
</TextBox.Text>
</TextBox>
<Button
Margin="0,28,0,0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Content="START"
IsEnabled="{Binding DataContext.ControlsEnabled, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}"
Style="{StaticResource MaterialDesignRaisedDarkButton}"
ToolTip="Resource name: MaterialDesignRaisedLightDarkButton" />
<TextBox
x:Name="OutputLog"
Grid.Row="4"
Grid.RowSpan="2"
Grid.Column="1"
Grid.ColumnSpan="7"
Height="200"
Margin="0,17,0,0"
materialDesign:HintAssist.Hint="Output from backend"
FontFamily="pack://application:,,,/Resources/RobotoMono/#Roboto Mono"
IsReadOnly="True"
Style="{StaticResource MaterialDesignOutlinedTextBox}"
Text=" "
TextWrapping="NoWrap" />
</StackPanel>
</TabItem>
<TabItem>
<TabItem.Header>
<StackPanel Width="auto" Height="auto">
<materialDesign:PackIcon
Width="24"
Height="24"
HorizontalAlignment="Center"
Kind="Gear" />
<TextBlock HorizontalAlignment="Center" Text="Settings" />
</StackPanel>
</TabItem.Header>
<StackPanel Margin="16">
<TextBlock
Margin="0,0,0,8"
Style="{StaticResource MaterialDesignHeadline5TextBlock}"
Text="Sounds" />
<TextBlock>
<Run Text="tab 4 content. Default look and behaviors." />
<LineBreak />
<LineBreak />
<Run FontStyle="Italic">
Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur,
adipisci velit...
</Run>
</TextBlock>
</StackPanel>
</TabItem>
</TabControl>
</materialDesign:Card>
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>

<TextBlock
Grid.ColumnSpan="5"
Margin="0,0,0,8"
Style="{StaticResource MaterialDesignHeadline5TextBlock}"
Text="Metadata fix" />
<TextBox
x:Name="SourceLocation"
Grid.Row="1"
Grid.ColumnSpan="14"
Margin="0,23,0,0"
materialDesign:HintAssist.HelperText="Source location of the Facebook export"
materialDesign:HintAssist.Hint="Source"
Text="{Binding Path=_utilitiesModel.SourcePath}">
<!--<TextBox.Text>
<Binding Path="{Binding Utilities.SourcePath}" UpdateSourceTrigger="PropertyChanged" />
</TextBox.Text>-->
</TextBox>
<TextBox
x:Name="DestinationLocation"
Grid.Row="2"
Grid.ColumnSpan="14"
Margin="0,23,0,0"
materialDesign:HintAssist.HelperText="Destination of the media with fixed metadata"
materialDesign:HintAssist.Hint="Destination">
<TextBox.Text>
<Binding Path="Name" UpdateSourceTrigger="PropertyChanged" />
</TextBox.Text>
</TextBox>
<Button
Grid.Row="4"
Grid.Column="6"
Grid.ColumnSpan="2"
Command="{Binding ShowSourceLocationCommand}"
Content="START"
IsEnabled="{Binding DataContext.ControlsEnabled, RelativeSource={RelativeSource FindAncestor, AncestorType=Window}}"
Style="{StaticResource MaterialDesignRaisedDarkButton}"
ToolTip="Resource name: MaterialDesignRaisedLightDarkButton" />
<TextBox
x:Name="OutputLog"
Grid.Row="6"
Grid.RowSpan="4"
Grid.Column="0"
Grid.ColumnSpan="14"
Height="200"
Panel.ZIndex="-1"
materialDesign:HintAssist.Hint="Output from backend"
FontFamily="pack://application:,,,/Resources/RobotoMono/#Roboto Mono"
IsReadOnly="True"
Style="{StaticResource MaterialDesignOutlinedTextBox}"
Text=" "
TextWrapping="NoWrap" />
</Grid>
</UserControl>
49 changes: 48 additions & 1 deletion ExportViewer.GUI/Views/Utilities.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,64 @@
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using ExportViewer.GUI.Interfaces;
using ExportViewer.GUI.ViewModels;

Check failure on line 14 in ExportViewer.GUI/Views/Utilities.xaml.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'ViewModels' does not exist in the namespace 'ExportViewer.GUI' (are you missing an assembly reference?)

Check failure on line 14 in ExportViewer.GUI/Views/Utilities.xaml.cs

View workflow job for this annotation

GitHub Actions / build

The type or namespace name 'ViewModels' does not exist in the namespace 'ExportViewer.GUI' (are you missing an assembly reference?)
using Microsoft.WindowsAPICodePack.Dialogs;

namespace ExportViewer.GUI.Views
{
/// <summary>
/// Interaction logic for Utilities.xaml
/// </summary>
public partial class Utilities : UserControl
public partial class Utilities : UserControl, IUtilities

Check failure on line 22 in ExportViewer.GUI/Views/Utilities.xaml.cs

View workflow job for this annotation

GitHub Actions / build

'Utilities' does not implement interface member 'IUtilities.SelectDestination(object, EventArgs)'

Check failure on line 22 in ExportViewer.GUI/Views/Utilities.xaml.cs

View workflow job for this annotation

GitHub Actions / build

'Utilities' does not implement interface member 'IUtilities.SelectSource(object, EventArgs)'

Check failure on line 22 in ExportViewer.GUI/Views/Utilities.xaml.cs

View workflow job for this annotation

GitHub Actions / build

'Utilities' does not implement interface member 'IUtilities.Start(object, EventArgs)'

Check failure on line 22 in ExportViewer.GUI/Views/Utilities.xaml.cs

View workflow job for this annotation

GitHub Actions / build

'Utilities' does not implement interface member 'IUtilities.SelectDestination(object, EventArgs)'

Check failure on line 22 in ExportViewer.GUI/Views/Utilities.xaml.cs

View workflow job for this annotation

GitHub Actions / build

'Utilities' does not implement interface member 'IUtilities.SelectSource(object, EventArgs)'

Check failure on line 22 in ExportViewer.GUI/Views/Utilities.xaml.cs

View workflow job for this annotation

GitHub Actions / build

'Utilities' does not implement interface member 'IUtilities.Start(object, EventArgs)'
{
public Utilities ()
{
InitializeComponent();

var utilitiesViewModel = DataContext as UtilitiesViewModel;

if (utilitiesViewModel != null)
utilitiesViewModel.Utilities = this;

}

public void SelectDestination()
{
CommonOpenFileDialog dialog = new CommonOpenFileDialog();
dialog.IsFolderPicker = true;

if (dialog.ShowDialog() == CommonFileDialogResult.Ok && dialog.FileName != null)
{
DestinationLocation.Text = dialog.FileName + "/";

}
}

public void SelectSource()
{
CommonOpenFileDialog dialog = new CommonOpenFileDialog();
dialog.IsFolderPicker = true;

if (dialog.ShowDialog() == CommonFileDialogResult.Ok && dialog.FileName != null)
{
SourceLocation.Text = dialog.FileName + "/";
}
}

public void ShowSourceLocation(string sourceLocation)
{
MessageBox.Show($"Source location is: {sourceLocation}");
}

public void Start()
{
throw new NotImplementedException();
}

private void StartButton_Click (object sender , RoutedEventArgs e)
{

}
}
}

0 comments on commit 109b2ef

Please sign in to comment.