-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
43 changed files
with
1,274 additions
and
134 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<Application x:Class="Corathing.Dashboards.Sample.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="clr-namespace:Corathing.Dashboards.Sample" | ||
StartupUri="MainWindow.xaml"> | ||
<Application.Resources> | ||
|
||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System.Configuration; | ||
using System.Data; | ||
using System.Windows; | ||
|
||
namespace Corathing.Dashboards.Sample | ||
{ | ||
/// <summary> | ||
/// Interaction logic for App.xaml | ||
/// </summary> | ||
public partial class App : Application | ||
{ | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
using System.Windows; | ||
|
||
[assembly: ThemeInfo( | ||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located | ||
//(used if a resource is not found in the page, | ||
// or application resource dictionaries) | ||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located | ||
//(used if a resource is not found in the page, | ||
// app, or any theme specific resource dictionaries) | ||
)] |
17 changes: 17 additions & 0 deletions
17
src/Apps/Corathing.Dashboards.Sample/Corathing.Dashboards.Sample.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>WinExe</OutputType> | ||
<TargetFramework>net8.0-windows</TargetFramework> | ||
<Nullable>enable</Nullable> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<UseWPF>true</UseWPF> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\Shared\Corathing.Contracts\Corathing.Contracts.csproj" /> | ||
<ProjectReference Include="..\..\Shared\Corathing.Dashboards.WPF\Corathing.Dashboards.WPF.csproj" /> | ||
<ProjectReference Include="..\..\Shared\Corathing.Dashboards\Corathing.Dashboards.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<Window x:Class="Corathing.Dashboards.Sample.MainWindow" | ||
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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:local="clr-namespace:Corathing.Dashboards.Sample" | ||
xmlns:views="clr-namespace:Corathing.Dashboards.Sample.Views" | ||
mc:Ignorable="d" | ||
Title="MainWindow" Height="450" Width="800"> | ||
<views:DashboardView /> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System.Text; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Navigation; | ||
using System.Windows.Shapes; | ||
|
||
namespace Corathing.Dashboards.Sample | ||
{ | ||
/// <summary> | ||
/// Interaction logic for MainWindow.xaml | ||
/// </summary> | ||
public partial class MainWindow : Window | ||
{ | ||
public MainWindow() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
66 changes: 66 additions & 0 deletions
66
src/Apps/Corathing.Dashboards.Sample/ViewModels/DashboardViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.ComponentModel; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
using CommunityToolkit.Mvvm.ComponentModel; | ||
using CommunityToolkit.Mvvm.Input; | ||
|
||
using Corathing.Contracts.Bases; | ||
using Corathing.Dashboards.Sample.Widgets; | ||
using Corathing.Dashboards.WPF.Controls; | ||
|
||
namespace Corathing.Dashboards.Sample.ViewModels; | ||
|
||
public partial class DashboardViewModel : ObservableObject | ||
{ | ||
[ObservableProperty] | ||
private ObservableCollection<WidgetContext> _widgets; | ||
[ObservableProperty] | ||
private bool? _editMode; | ||
|
||
[RelayCommand] | ||
public void ToggleEditMode() | ||
{ | ||
EditMode = !EditMode; | ||
} | ||
|
||
[RelayCommand] | ||
public void AddWidget() | ||
{ | ||
Widgets.Add(new EmptyWidgetContext()); | ||
} | ||
|
||
[RelayCommand] | ||
public void RemoveWidget(WidgetHost host) | ||
{ | ||
var context = host.DataContext as WidgetContext; | ||
Widgets.Remove(context); | ||
} | ||
|
||
[RelayCommand] | ||
public void ConfigureWidget(WidgetHost host) | ||
{ | ||
var context = host.DataContext as WidgetContext; | ||
// Do Something | ||
} | ||
|
||
public DashboardViewModel() | ||
{ | ||
Widgets = new ObservableCollection<WidgetContext>(); | ||
EditMode = false; | ||
} | ||
|
||
protected override void OnPropertyChanged(PropertyChangedEventArgs e) | ||
{ | ||
base.OnPropertyChanged(e); | ||
|
||
foreach (var widget in Widgets) | ||
{ | ||
widget.EditMode = EditMode; | ||
} | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
src/Apps/Corathing.Dashboards.Sample/Views/DashboardView.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<Page x:Class="Corathing.Dashboards.Sample.Views.DashboardView" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="clr-namespace:Corathing.Dashboards.Sample.Views" | ||
xmlns:widgets="clr-namespace:Corathing.Dashboards.Sample.Widgets" | ||
xmlns:dashboardControl="clr-namespace:Corathing.Dashboards.WPF.Controls;assembly=Corathing.Dashboards.WPF" | ||
mc:Ignorable="d" | ||
d:DesignHeight="450" d:DesignWidth="800" | ||
Title="DashboardView"> | ||
<Page.Resources> | ||
<DataTemplate DataType="{x:Type widgets:EmptyWidgetContext}"> | ||
<widgets:EmptyWidget /> | ||
</DataTemplate> | ||
<Style TargetType="{x:Type dashboardControl:WidgetHost}"> | ||
<Setter Property="BorderBrush" | ||
Value="Black" /> | ||
<Setter Property="BorderThickness" | ||
Value="1" /> | ||
<Setter Property="Background" | ||
Value="#24242424" /> | ||
</Style> | ||
</Page.Resources> | ||
<Grid> | ||
<Border Margin="4" | ||
BorderBrush="Black" | ||
BorderThickness="1"> | ||
<dashboardControl:DashboardHost Margin="4" | ||
MaxNumColumns="10" | ||
EditMode="{Binding EditMode}" | ||
ItemsSource="{Binding Widgets}" /> | ||
</Border> | ||
<StackPanel HorizontalAlignment="Right" | ||
VerticalAlignment="Top" | ||
Orientation="Vertical" | ||
Margin="8"> | ||
<ToggleButton Content="Toggle Edit Mode" | ||
Command="{Binding ToggleEditModeCommand}" /> | ||
<Button Content="Create Widget from Button" | ||
Command="{Binding AddWidgetCommand}" /> | ||
</StackPanel> | ||
</Grid> | ||
</Page> |
33 changes: 33 additions & 0 deletions
33
src/Apps/Corathing.Dashboards.Sample/Views/DashboardView.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Navigation; | ||
using System.Windows.Shapes; | ||
|
||
using Corathing.Dashboards.Sample.ViewModels; | ||
|
||
namespace Corathing.Dashboards.Sample.Views | ||
{ | ||
/// <summary> | ||
/// Interaction logic for DashboardView.xaml | ||
/// </summary> | ||
public partial class DashboardView : Page | ||
{ | ||
public DashboardViewModel ViewModel; | ||
public DashboardView() | ||
{ | ||
InitializeComponent(); | ||
|
||
DataContext = ViewModel = new DashboardViewModel(); | ||
} | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
src/Apps/Corathing.Dashboards.Sample/Widgets/EmptyWidget.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<UserControl x:Class="Corathing.Dashboards.Sample.Widgets.EmptyWidget" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="clr-namespace:Corathing.Dashboards.Sample.Widgets" | ||
mc:Ignorable="d" | ||
d:DesignHeight="450" d:DesignWidth="800"> | ||
<Grid Background="#24242424"> | ||
<TextBlock Text="Widget from context" /> | ||
</Grid> | ||
</UserControl> |
38 changes: 38 additions & 0 deletions
38
src/Apps/Corathing.Dashboards.Sample/Widgets/EmptyWidget.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Navigation; | ||
using System.Windows.Shapes; | ||
|
||
using Corathing.Contracts.Bases; | ||
|
||
namespace Corathing.Dashboards.Sample.Widgets | ||
{ | ||
public partial class EmptyWidgetContext : WidgetContext | ||
{ | ||
public EmptyWidgetContext() | ||
{ | ||
WidgetTitle = "Empty Widget"; | ||
} | ||
} | ||
|
||
/// <summary> | ||
/// Interaction logic for WidgetFromContext.xaml | ||
/// </summary> | ||
public partial class EmptyWidget | ||
{ | ||
public EmptyWidget() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.