Skip to content

Commit

Permalink
feat: scaffold StatusBar and add to MainWindow
Browse files Browse the repository at this point in the history
  • Loading branch information
Per Kops committed May 28, 2024
1 parent e75f743 commit 6789a8c
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/Atc.Azure.IoT.Wpf.App/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public App()
})
.ConfigureServices((_, services) =>
{
services.AddSingleton<StatusBarViewModel>();
services.AddSingleton<IMainWindowViewModelBase, MainWindowViewModel>();
services.AddSingleton<MainWindow>();
})
Expand Down
1 change: 1 addition & 0 deletions src/Atc.Azure.IoT.Wpf.App/Atc.Azure.IoT.Wpf.App.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<PackageReference Include="Atc.Wpf" Version="2.0.505" />
<PackageReference Include="Atc.Wpf.Controls" Version="2.0.505" />
<PackageReference Include="Atc.Wpf.Theming" Version="2.0.505" />
<PackageReference Include="Fluent.Ribbon" Version="10.1.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="8.0.1" />
Expand Down
3 changes: 1 addition & 2 deletions src/Atc.Azure.IoT.Wpf.App/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
// Global using directives

global using System.ComponentModel;
global using System.IO;
global using System.Windows;
global using System.Windows.Input;
global using Atc.Azure.IoT.Wpf.App.UserControls;
global using Atc.Wpf.Mvvm;
global using ControlzEx.Theming;
global using Microsoft.Extensions.Configuration;
Expand Down
7 changes: 6 additions & 1 deletion src/Atc.Azure.IoT.Wpf.App/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:Atc.Azure.IoT.Wpf.App"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:userControls="clr-namespace:Atc.Azure.IoT.Wpf.App.UserControls"
Title="..:: Atc.Azure.IoT ::.."
Width="1920"
Height="1080"
Expand All @@ -16,5 +17,9 @@
WindowStartupLocation="CenterScreen"
WindowState="{Binding Path=WindowState}"
mc:Ignorable="d">
<Grid />
<atcTheming:BusyOverlay IsBusy="{Binding Path=IsBusy}">
<atcTheming:GridEx Rows="Auto,*,Auto">
<userControls:StatusBarView Grid.Row="2" DataContext="{Binding Path=StatusBarViewModel}" />
</atcTheming:GridEx>
</atcTheming:BusyOverlay>
</atcTheming:NiceWindow>
10 changes: 10 additions & 0 deletions src/Atc.Azure.IoT.Wpf.App/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,14 @@ public MainWindowViewModel()
// Dummy for XAML design view
}
#pragma warning restore CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider declaring as nullable.

public MainWindowViewModel(
StatusBarViewModel statusBarViewModel)
{
ArgumentNullException.ThrowIfNull(statusBarViewModel);

StatusBarViewModel = statusBarViewModel;
}

public StatusBarViewModel StatusBarViewModel { get; set; }
}
20 changes: 20 additions & 0 deletions src/Atc.Azure.IoT.Wpf.App/UserControls/StatusBarView.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<fluent:StatusBar
x:Class="Atc.Azure.IoT.Wpf.App.UserControls.StatusBarView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:fluent="urn:fluent-ribbon"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:userControls="clr-namespace:Atc.Azure.IoT.Wpf.App.UserControls"
d:DataContext="{d:DesignInstance Type=userControls:StatusBarViewModel}"
d:DesignHeight="25"
d:DesignWidth="600"
ContextMenu="{x:Null}"
mc:Ignorable="d">

<fluent:StatusBarItem Margin="10,0" HorizontalAlignment="Left">
<StackPanel Orientation="Horizontal">
<TextBlock>Hej</TextBlock>
</StackPanel>
</fluent:StatusBarItem>
</fluent:StatusBar>
12 changes: 12 additions & 0 deletions src/Atc.Azure.IoT.Wpf.App/UserControls/StatusBarView.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
namespace Atc.Azure.IoT.Wpf.App.UserControls;

/// <summary>
/// Interaction logic for StatusBarView.
/// </summary>
public partial class StatusBarView
{
public StatusBarView()
{
InitializeComponent();
}
}
5 changes: 5 additions & 0 deletions src/Atc.Azure.IoT.Wpf.App/UserControls/StatusBarViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
namespace Atc.Azure.IoT.Wpf.App.UserControls;

public class StatusBarViewModel : ViewModelBase
{
}

0 comments on commit 6789a8c

Please sign in to comment.