StarSim

StarSim.git
git clone git://git.lenczewski.org/StarSim.git
Log | Files | Refs | README | LICENSE

commit db021ef349798040b57ffacaedad13fa1df5da3c
parent 6230d472d88031a7c457030847b544644c6dc8b2
Author: Mikolaj Lenczewski <33129490+EnderRifter@users.noreply.github.com>
Date:   Sun,  4 Aug 2019 22:02:10 +0200

Setup basic GUI layout.
- All views have base layout completed, and their relevant view models have dependency injection and the base functionality (event handlers and common properties) implemented
- Database has been initially set up, and migrated such that it is in a useable state.
- User login functionality has been fully implemented
- Solution-wide code clean was performed

Diffstat:
MStarSim/StarSim/Contexts/SimulatorContextFactory.cs | 1+
MStarSim/StarSim/Migrations/20190619213251_InitialMigration.cs | 9++++-----
MStarSim/StarSim/Program.cs | 10++++++----
MStarSim/StarSimGui/App.xaml | 9+++++----
MStarSim/StarSimGui/App.xaml.cs | 3++-
MStarSim/StarSimGui/Contexts/SimulatorContextFactory.cs | 1+
MStarSim/StarSimGui/Migrations/20190801135345_InitialCreate.cs | 36++++++++++++++++++------------------
MStarSim/StarSimGui/Program.cs | 9++++++---
MStarSim/StarSimGui/ViewLocator.cs | 4+++-
MStarSim/StarSimGui/ViewModels/DatabaseViewModel.cs | 64+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
MStarSim/StarSimGui/ViewModels/MainWindowViewModel.cs | 63+++++++++++++++++++++++++++++++++++++++++++++++++++++++++------
MStarSim/StarSimGui/ViewModels/OverviewViewModel.cs | 64+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
MStarSim/StarSimGui/ViewModels/SimulationViewModel.cs | 64+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++-
MStarSim/StarSimGui/ViewModels/UserLoginViewModel.cs | 70++++++++++++++++++++++++++++++++++++++++++++++++++++------------------
MStarSim/StarSimGui/ViewModels/ViewModelBase.cs | 5+++--
MStarSim/StarSimGui/Views/Database.xaml | 6++++--
MStarSim/StarSimGui/Views/Database.xaml.cs | 6+++---
MStarSim/StarSimGui/Views/MainWindow.xaml.cs | 3++-
MStarSim/StarSimGui/Views/Overview.xaml | 14++++++++++++--
MStarSim/StarSimGui/Views/Overview.xaml.cs | 6+++---
MStarSim/StarSimGui/Views/Simulation.xaml | 6++++--
MStarSim/StarSimGui/Views/Simulation.xaml.cs | 6+++---
MStarSim/StarSimGui/Views/UserLogin.xaml | 38++++++++++++++++++++------------------
MStarSim/StarSimGui/Views/UserLogin.xaml.cs | 6+++---
MStarSim/StarSimGui/nuget.config | 5+++--
MStarSim/StarSimLib/Contexts/SimulatorContext.cs | 4++--
MStarSim/StarSimLib/Graphics/SimulationDrawer.cs | 8+++++---
MStarSim/StarSimLib/Physics/BodyGenerator.cs | 8+++++---
MStarSim/StarSimLib/Physics/BodyUpdater.cs | 5+++--
MStarSim/StarSimLib/Physics/OrbitGenerator.cs | 5+++--
MStarSim/StarSimLib/UI/IInputHandler.cs | 5+++--
MStarSim/StarSimLib/UI/SimulationInputHandler.cs | 6++++--
MStarSim/StarSimLib/UI/SimulationScreen.cs | 8+++++---
33 files changed, 434 insertions(+), 123 deletions(-)

diff --git a/StarSim/StarSim/Contexts/SimulatorContextFactory.cs b/StarSim/StarSim/Contexts/SimulatorContextFactory.cs @@ -1,5 +1,6 @@ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; + using StarSimLib.Contexts; namespace StarSim.Contexts diff --git a/StarSim/StarSim/Migrations/20190619213251_InitialMigration.cs b/StarSim/StarSim/Migrations/20190619213251_InitialMigration.cs @@ -4,14 +4,12 @@ namespace StarSim.Migrations { public partial class InitialMigration : Migration { - protected override void Up(MigrationBuilder migrationBuilder) + protected override void Down(MigrationBuilder migrationBuilder) { - } - protected override void Down(MigrationBuilder migrationBuilder) + protected override void Up(MigrationBuilder migrationBuilder) { - } } -} +} +\ No newline at end of file diff --git a/StarSim/StarSim/Program.cs b/StarSim/StarSim/Program.cs @@ -1,14 +1,16 @@ -using System; -using System.Collections.Generic; -using System.Text; -using SFML.Graphics; +using SFML.Graphics; using SFML.Window; + using StarSimLib; using StarSimLib.Contexts; using StarSimLib.Data_Structures; using StarSimLib.Physics; using StarSimLib.UI; +using System; +using System.Collections.Generic; +using System.Text; + namespace StarSim { /// <summary> diff --git a/StarSim/StarSimGui/App.xaml b/StarSim/StarSimGui/App.xaml @@ -3,11 +3,11 @@ xmlns:local="clr-namespace:StarSimGui" x:Class="StarSimGui.App"> <Application.DataTemplates> - <local:ViewLocator/> + <local:ViewLocator /> </Application.DataTemplates> <Application.Styles> - <StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml"/> - <StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseLight.xaml"/> + <StyleInclude Source="avares://Avalonia.Themes.Default/DefaultTheme.xaml" /> + <StyleInclude Source="avares://Avalonia.Themes.Default/Accents/BaseLight.xaml" /> </Application.Styles> -</Application> +</Application> +\ No newline at end of file diff --git a/StarSim/StarSimGui/App.xaml.cs b/StarSim/StarSimGui/App.xaml.cs @@ -10,4 +10,4 @@ namespace StarSimGui AvaloniaXamlLoader.Load(this); } } -} +} +\ No newline at end of file diff --git a/StarSim/StarSimGui/Contexts/SimulatorContextFactory.cs b/StarSim/StarSimGui/Contexts/SimulatorContextFactory.cs @@ -1,5 +1,6 @@ using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore.Design; + using StarSimLib.Contexts; namespace StarSimGui.Contexts diff --git a/StarSim/StarSimGui/Migrations/20190801135345_InitialCreate.cs b/StarSim/StarSimGui/Migrations/20190801135345_InitialCreate.cs @@ -1,10 +1,24 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Migrations; namespace StarSimGui.Migrations { public partial class InitialCreate : Migration { + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "BodyToSystemJoins"); + + migrationBuilder.DropTable( + name: "Bodies"); + + migrationBuilder.DropTable( + name: "Systems"); + + migrationBuilder.DropTable( + name: "Users"); + } + protected override void Up(MigrationBuilder migrationBuilder) { migrationBuilder.CreateTable( @@ -177,20 +191,5 @@ namespace StarSimGui.Migrations column: "Id", unique: true); } - - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "BodyToSystemJoins"); - - migrationBuilder.DropTable( - name: "Bodies"); - - migrationBuilder.DropTable( - name: "Systems"); - - migrationBuilder.DropTable( - name: "Users"); - } } -} +} +\ No newline at end of file diff --git a/StarSim/StarSimGui/Program.cs b/StarSim/StarSimGui/Program.cs @@ -1,10 +1,13 @@ -using System; -using Avalonia; +using Avalonia; using Avalonia.Logging.Serilog; -using StarSimLib.Cryptography; + using StarSimGui.ViewModels; using StarSimGui.Views; +using StarSimLib.Cryptography; + +using System; + namespace StarSimGui { /// <summary> diff --git a/StarSim/StarSimGui/ViewLocator.cs b/StarSim/StarSimGui/ViewLocator.cs @@ -1,8 +1,10 @@ -using System; using Avalonia.Controls; using Avalonia.Controls.Templates; + using StarSimGui.ViewModels; +using System; + namespace StarSimGui { public class ViewLocator : IDataTemplate diff --git a/StarSim/StarSimGui/ViewModels/DatabaseViewModel.cs b/StarSim/StarSimGui/ViewModels/DatabaseViewModel.cs @@ -1,9 +1,71 @@ -namespace StarSimGui.ViewModels +using ReactiveUI; +using StarSimLib.Contexts; +using StarSimLib.Models; + +namespace StarSimGui.ViewModels { /// <summary> /// Represents the database view. /// </summary> public class DatabaseViewModel : ViewModelBase { + /// <summary> + /// The program database. + /// </summary> + private readonly SimulatorContext dbContext; + + /// <summary> + /// The currently logged in user. + /// </summary> + private User currentUser; + + /// <summary> + /// Initialises a new instance of the <see cref="DatabaseViewModel"/> class. + /// </summary> + public DatabaseViewModel() : this(null) + { + } + + /// <summary> + /// Initialises a new instance of the <see cref="DatabaseViewModel"/> class. + /// </summary> + /// <param name="context">The <see cref="SimulatorContext"/> instance in which program data is stored.</param> + public DatabaseViewModel(SimulatorContext context) + { + dbContext = context; + } + + /// <summary> + /// The currently logged in user. + /// </summary> + public User CurrentUser + { + get + { + return currentUser; + } + set + { + currentUser = value; + this.RaisePropertyChanged(); + } + } + + /// <summary> + /// Handles the <see cref="UserLoginViewModel.LoggedIn"/> event. + /// </summary> + /// <param name="newUser">The user which logged in.</param> + public void HandleLogin(User newUser) + { + CurrentUser = newUser; + } + + /// <summary> + /// Handles the <see cref="UserLoginViewModel.LoggedOut"/> event. + /// </summary> + public void HandleLogout() + { + CurrentUser = null; + } } } \ No newline at end of file diff --git a/StarSim/StarSimGui/ViewModels/MainWindowViewModel.cs b/StarSim/StarSimGui/ViewModels/MainWindowViewModel.cs @@ -1,23 +1,43 @@ -using System; -using System.Collections.Generic; -using System.Text; +using ReactiveUI; using StarSimLib.Contexts; +using StarSimLib.Models; namespace StarSimGui.ViewModels { + /// <summary> + /// Represents the main view. + /// </summary> public class MainWindowViewModel : ViewModelBase { + /// <summary> + /// Backing field for the <see cref="CurrentUser"/> property. + /// </summary> + private User currentUser; + + /// <summary> + /// Initialises a new instance of the <see cref="MainWindowViewModel"/> class. + /// </summary> public MainWindowViewModel() { SimulatorContext = new SimulatorContext(); - DatabaseViewModel = new DatabaseViewModel(); + DatabaseViewModel = new DatabaseViewModel(SimulatorContext); - OverviewViewModel = new OverviewViewModel(); + OverviewViewModel = new OverviewViewModel(SimulatorContext); - SimulationViewModel = new SimulationViewModel(); + SimulationViewModel = new SimulationViewModel(SimulatorContext); UserLoginViewModel = new UserLoginViewModel(SimulatorContext); + + UserLoginViewModel.LoggedIn += user => CurrentUser = user; + UserLoginViewModel.LoggedIn += DatabaseViewModel.HandleLogin; + UserLoginViewModel.LoggedIn += OverviewViewModel.HandleLogin; + UserLoginViewModel.LoggedIn += SimulationViewModel.HandleLogin; + + UserLoginViewModel.LoggedOut += () => CurrentUser = null; + UserLoginViewModel.LoggedOut += DatabaseViewModel.HandleLogout; + UserLoginViewModel.LoggedOut += OverviewViewModel.HandleLogout; + UserLoginViewModel.LoggedOut += SimulationViewModel.HandleLogout; } /// <summary> @@ -25,9 +45,40 @@ namespace StarSimGui.ViewModels /// </summary> private SimulatorContext SimulatorContext { get; } + /// <summary> + /// The currently logged in user. + /// </summary> + public User CurrentUser + { + get + { + return currentUser; + } + set + { + currentUser = value; + this.RaisePropertyChanged(); + } + } + + /// <summary> + /// Represents the database view. + /// </summary> public DatabaseViewModel DatabaseViewModel { get; set; } + + /// <summary> + /// Represents the overview. + /// </summary> public OverviewViewModel OverviewViewModel { get; set; } + + /// <summary> + /// Represents the simulation view. + /// </summary> public SimulationViewModel SimulationViewModel { get; set; } + + /// <summary> + /// Represents the user login view. + /// </summary> public UserLoginViewModel UserLoginViewModel { get; set; } } } \ No newline at end of file diff --git a/StarSim/StarSimGui/ViewModels/OverviewViewModel.cs b/StarSim/StarSimGui/ViewModels/OverviewViewModel.cs @@ -1,9 +1,71 @@ -namespace StarSimGui.ViewModels +using ReactiveUI; +using StarSimLib.Contexts; +using StarSimLib.Models; + +namespace StarSimGui.ViewModels { /// <summary> /// Represents the overview. /// </summary> public class OverviewViewModel : ViewModelBase { + /// <summary> + /// The program database. + /// </summary> + private readonly SimulatorContext dbContext; + + /// <summary> + /// The currently logged in user. + /// </summary> + private User currentUser; + + /// <summary> + /// Initialises a new instance of the <see cref="OverviewViewModel"/> class. + /// </summary> + public OverviewViewModel() : this(null) + { + } + + /// <summary> + /// Initialises a new instance of the <see cref="OverviewViewModel"/> class. + /// </summary> + /// <param name="context">The <see cref="SimulatorContext"/> instance in which program data is stored.</param> + public OverviewViewModel(SimulatorContext context) + { + dbContext = context; + } + + /// <summary> + /// The currently logged in user. + /// </summary> + public User CurrentUser + { + get + { + return currentUser; + } + set + { + currentUser = value; + this.RaisePropertyChanged(); + } + } + + /// <summary> + /// Handles the <see cref="UserLoginViewModel.LoggedIn"/> event. + /// </summary> + /// <param name="newUser">The user which logged in.</param> + public void HandleLogin(User newUser) + { + CurrentUser = newUser; + } + + /// <summary> + /// Handles the <see cref="UserLoginViewModel.LoggedOut"/> event. + /// </summary> + public void HandleLogout() + { + CurrentUser = null; + } } } \ No newline at end of file diff --git a/StarSim/StarSimGui/ViewModels/SimulationViewModel.cs b/StarSim/StarSimGui/ViewModels/SimulationViewModel.cs @@ -1,9 +1,71 @@ -namespace StarSimGui.ViewModels +using ReactiveUI; +using StarSimLib.Contexts; +using StarSimLib.Models; + +namespace StarSimGui.ViewModels { /// <summary> /// Represents the simulation view. /// </summary> public class SimulationViewModel : ViewModelBase { + /// <summary> + /// The program database. + /// </summary> + private readonly SimulatorContext dbContext; + + /// <summary> + /// The currently logged in user. + /// </summary> + private User currentUser; + + /// <summary> + /// Initialises a new instance of the <see cref="SimulationViewModel"/> class. + /// </summary> + public SimulationViewModel() : this(null) + { + } + + /// <summary> + /// Initialises a new instance of the <see cref="SimulationViewModel"/> class. + /// </summary> + /// <param name="context">The <see cref="SimulatorContext"/> instance in which program data is stored.</param> + public SimulationViewModel(SimulatorContext context) + { + dbContext = context; + } + + /// <summary> + /// The currently logged in user. + /// </summary> + public User CurrentUser + { + get + { + return currentUser; + } + set + { + currentUser = value; + this.RaisePropertyChanged(); + } + } + + /// <summary> + /// Handles the <see cref="UserLoginViewModel.LoggedIn"/> event. + /// </summary> + /// <param name="newUser">The user which logged in.</param> + public void HandleLogin(User newUser) + { + CurrentUser = newUser; + } + + /// <summary> + /// Handles the <see cref="UserLoginViewModel.LoggedOut"/> event. + /// </summary> + public void HandleLogout() + { + CurrentUser = null; + } } } \ No newline at end of file diff --git a/StarSim/StarSimGui/ViewModels/UserLoginViewModel.cs b/StarSim/StarSimGui/ViewModels/UserLoginViewModel.cs @@ -1,12 +1,15 @@ -using System; -using System.Linq; -using System.Windows.Input; -using ReactiveUI; +using ReactiveUI; + using StarSimGui.Source; + using StarSimLib.Contexts; using StarSimLib.Cryptography; using StarSimLib.Models; +using System; +using System.Linq; +using System.Windows.Input; + namespace StarSimGui.ViewModels { /// <summary> @@ -58,14 +61,24 @@ namespace StarSimGui.ViewModels (username, password, isLoggedIn) => !string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password) && !isLoggedIn); - OnLoginCommand = ReactiveCommand.Create(OnLoginImpl, canLogin); + LoginCommand = ReactiveCommand.Create(LoginCommandImpl, canLogin); IObservable<bool> canLogout = this.WhenAnyValue(x => x.IsLoggedIn); - OnLogoutCommand = ReactiveCommand.Create(OnLogoutImpl, canLogout); + LogoutCommand = ReactiveCommand.Create(LogoutCommandImpl, canLogout); } /// <summary> + /// Invoked whenever a successful login is made. + /// </summary> + public event Action<User> LoggedIn; + + /// <summary> + /// Invoked whenever the currently logged in user logs out. + /// </summary> + public event Action LoggedOut; + + /// <summary> /// Whether the user is logged into the service. /// </summary> public bool IsLoggedIn @@ -74,7 +87,8 @@ namespace StarSimGui.ViewModels { return isLoggedIn; } - set + + private set { isLoggedIn = value; this.RaisePropertyChanged(); @@ -82,6 +96,11 @@ namespace StarSimGui.ViewModels } /// <summary> + /// Command invoked whenever the user tries to login. + /// </summary> + public ICommand LoginCommand { get; } + + /// <summary> /// Feedback about the last login attempt. /// </summary> public LoginAttemptResult LoginFeedback @@ -91,7 +110,7 @@ namespace StarSimGui.ViewModels return loginFeedback; } - set + private set { loginFeedback = value; this.RaisePropertyChanged(); @@ -99,14 +118,9 @@ namespace StarSimGui.ViewModels } /// <summary> - /// Command invoked whenever the user tries to login. - /// </summary> - public ICommand OnLoginCommand { get; } - - /// <summary> /// Command invoked whenever the user tries to logout. /// </summary> - public ICommand OnLogoutCommand { get; } + public ICommand LogoutCommand { get; } /// <summary> /// The password to attempt to login with. @@ -145,7 +159,7 @@ namespace StarSimGui.ViewModels /// <summary> /// Invoked whenever the user attempts to login with a <see cref="Username"/> and <see cref="Password"/>. /// </summary> - private void OnLoginImpl() + private void LoginCommandImpl() { try { @@ -175,21 +189,41 @@ namespace StarSimGui.ViewModels // if both the given username and password match, the user is logged in IsLoggedIn = true; - LoginFeedback = new LoginAttemptResult(LoginResult.Success, "Logged in successfully."); + LoginFeedback = new LoginAttemptResult(LoginResult.Success, "Logged in successfully"); + OnLoggedIn(tempUser); } catch (Exception) { - LoginFeedback = new LoginAttemptResult(LoginResult.Error, "Unexpected error occurred"); + // if any exception occurs during the login attempt, inform the user + LoginFeedback = new LoginAttemptResult(LoginResult.Error, "Unexpected error occurred. Please try again later"); } } /// <summary> /// Invoked whenever the user attempts to log out. /// </summary> - private void OnLogoutImpl() + private void LogoutCommandImpl() { IsLoggedIn = false; LoginFeedback = new LoginAttemptResult(); + OnLoggedOut(); + } + + /// <summary> + /// Invokes the <see cref="LoggedIn"/> event. + /// </summary> + /// <param name="user">The <see cref="User"/> who successfully logged in.</param> + private void OnLoggedIn(User user) + { + LoggedIn?.Invoke(user); + } + + /// <summary> + /// Invokes the <see cref="LoggedOut"/> event. + /// </summary> + private void OnLoggedOut() + { + LoggedOut?.Invoke(); } } } \ No newline at end of file diff --git a/StarSim/StarSimGui/ViewModels/ViewModelBase.cs b/StarSim/StarSimGui/ViewModels/ViewModelBase.cs @@ -1,5 +1,6 @@ -using System.ComponentModel; -using ReactiveUI; +using ReactiveUI; + +using System.ComponentModel; namespace StarSimGui.ViewModels { diff --git a/StarSim/StarSimGui/Views/Database.xaml b/StarSim/StarSimGui/Views/Database.xaml @@ -4,7 +4,7 @@ xmlns:v="clr-namespace:StarSimGui.Views;assembly=StarSimGui" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" + mc:Ignorable="d" x:Class="StarSimGui.Views.Database" Background="WhiteSmoke"> @@ -12,5 +12,7 @@ <vm:DatabaseViewModel /> </Design.DataContext> - <TextBlock Text="Database" HorizontalAlignment="Center" VerticalAlignment="Center" /> + <Border BorderBrush="Gray" BorderThickness="2" CornerRadius="2" Margin="2"> + <TextBlock Text="Database" HorizontalAlignment="Center" VerticalAlignment="Center" /> + </Border> </UserControl> \ No newline at end of file diff --git a/StarSim/StarSimGui/Views/Database.xaml.cs b/StarSim/StarSimGui/Views/Database.xaml.cs @@ -1,5 +1,4 @@ -using Avalonia; -using Avalonia.Controls; +using Avalonia.Controls; using Avalonia.Markup.Xaml; namespace StarSimGui.Views @@ -16,4 +15,4 @@ namespace StarSimGui.Views AvaloniaXamlLoader.Load(this); } } -} +} +\ No newline at end of file diff --git a/StarSim/StarSimGui/Views/MainWindow.xaml.cs b/StarSim/StarSimGui/Views/MainWindow.xaml.cs @@ -19,4 +19,4 @@ namespace StarSimGui.Views AvaloniaXamlLoader.Load(this); } } -} +} +\ No newline at end of file diff --git a/StarSim/StarSimGui/Views/Overview.xaml b/StarSim/StarSimGui/Views/Overview.xaml @@ -4,7 +4,7 @@ xmlns:v="clr-namespace:StarSimGui.Views;assembly=StarSimGui" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" + mc:Ignorable="d" x:Class="StarSimGui.Views.Overview" Background="WhiteSmoke"> @@ -12,5 +12,15 @@ <vm:OverviewViewModel /> </Design.DataContext> - <TextBlock Text="Overview" HorizontalAlignment="Center" VerticalAlignment="Center" /> + <Border BorderBrush="Gray" BorderThickness="2" CornerRadius="2" Margin="2"> + <Grid RowDefinitions="Auto,Auto,Auto" ColumnDefinitions="Auto,Auto,Auto"> + <Border BorderBrush="Beige" BorderThickness="2"> + <TextBlock>Hello World</TextBlock> + </Border> + + <Border BorderBrush="Beige" BorderThickness="2" Grid.Row="1" Grid.Column="1"> + <TextBlock>Hello World</TextBlock> + </Border> + </Grid> + </Border> </UserControl> \ No newline at end of file diff --git a/StarSim/StarSimGui/Views/Overview.xaml.cs b/StarSim/StarSimGui/Views/Overview.xaml.cs @@ -1,5 +1,4 @@ -using Avalonia; -using Avalonia.Controls; +using Avalonia.Controls; using Avalonia.Markup.Xaml; namespace StarSimGui.Views @@ -16,4 +15,4 @@ namespace StarSimGui.Views AvaloniaXamlLoader.Load(this); } } -} +} +\ No newline at end of file diff --git a/StarSim/StarSimGui/Views/Simulation.xaml b/StarSim/StarSimGui/Views/Simulation.xaml @@ -4,7 +4,7 @@ xmlns:v="clr-namespace:StarSimGui.Views;assembly=StarSimGui" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" - mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" + mc:Ignorable="d" x:Class="StarSimGui.Views.Simulation" Background="WhiteSmoke"> @@ -12,5 +12,7 @@ <vm:SimulationViewModel /> </Design.DataContext> - <TextBlock Text="Simulation" HorizontalAlignment="Center" VerticalAlignment="Center" /> + <Border BorderBrush="Gray" BorderThickness="2" CornerRadius="2" Margin="2"> + <TextBlock Text="Simulation" HorizontalAlignment="Center" VerticalAlignment="Center" /> + </Border> </UserControl> \ No newline at end of file diff --git a/StarSim/StarSimGui/Views/Simulation.xaml.cs b/StarSim/StarSimGui/Views/Simulation.xaml.cs @@ -1,5 +1,4 @@ -using Avalonia; -using Avalonia.Controls; +using Avalonia.Controls; using Avalonia.Markup.Xaml; namespace StarSimGui.Views @@ -16,4 +15,4 @@ namespace StarSimGui.Views AvaloniaXamlLoader.Load(this); } } -} +} +\ No newline at end of file diff --git a/StarSim/StarSimGui/Views/UserLogin.xaml b/StarSim/StarSimGui/Views/UserLogin.xaml @@ -13,24 +13,26 @@ <vm:UserLoginViewModel /> </Design.DataContext> - <StackPanel> - <StackPanel Margin="4" Orientation="Vertical"> - <TextBlock Text="Username:" HorizontalAlignment="Center" DockPanel.Dock="Top" /> - <TextBox Text="{Binding Username, Mode=TwoWay}" Width="200" HorizontalAlignment="Center" /> - <TextBlock Text="Password:" HorizontalAlignment="Center" DockPanel.Dock="Top" /> - <TextBox Text="{Binding Password, Mode=TwoWay}" Width="200" PasswordChar="*" HorizontalAlignment="Center" /> - </StackPanel> - <Separator Margin="2" /> - <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" DataContext="{Binding LoginFeedback}"> - <TextBlock Text="Error: " Foreground="Red" IsVisible="{Binding IsError}" /> - <TextBlock Text="{Binding Message}" Foreground="Red" IsVisible="{Binding IsError}" /> - <TextBlock Text="Login Successful!" Foreground="Green" IsVisible="{Binding IsSuccess}" /> - </StackPanel> - <Separator Margin="2" /> - <StackPanel Orientation="Vertical" Margin="4"> - <Button Command="{Binding OnLoginCommand}" Height="50">Login</Button> + <Border BorderBrush="Gray" BorderThickness="2" CornerRadius="2" Margin="2"> + <StackPanel> + <StackPanel Margin="4" Orientation="Vertical"> + <TextBlock Text="Username:" HorizontalAlignment="Center" DockPanel.Dock="Top" /> + <TextBox Text="{Binding Username, Mode=TwoWay}" Width="200" HorizontalAlignment="Center" /> + <TextBlock Text="Password:" HorizontalAlignment="Center" DockPanel.Dock="Top" /> + <TextBox Text="{Binding Password, Mode=TwoWay}" Width="200" PasswordChar="*" HorizontalAlignment="Center" /> + </StackPanel> + <Separator Margin="2" /> + <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" DataContext="{Binding LoginFeedback}"> + <TextBlock Text="Error: " Foreground="Red" IsVisible="{Binding IsError}" /> + <TextBlock Text="{Binding Message}" Foreground="Red" IsVisible="{Binding IsError}" /> + <TextBlock Text="Login Successful!" Foreground="Green" IsVisible="{Binding IsSuccess}" /> + </StackPanel> <Separator Margin="2" /> - <Button Command="{Binding OnLogoutCommand}" Height="50">Logout</Button> + <StackPanel Orientation="Vertical" Margin="4"> + <Button Command="{Binding LoginCommand}" Height="50">Login</Button> + <Separator Margin="2" /> + <Button Command="{Binding LogoutCommand}" Height="50">Logout</Button> + </StackPanel> </StackPanel> - </StackPanel> + </Border> </UserControl> \ No newline at end of file diff --git a/StarSim/StarSimGui/Views/UserLogin.xaml.cs b/StarSim/StarSimGui/Views/UserLogin.xaml.cs @@ -1,5 +1,4 @@ -using Avalonia; -using Avalonia.Controls; +using Avalonia.Controls; using Avalonia.Markup.Xaml; namespace StarSimGui.Views @@ -16,4 +15,4 @@ namespace StarSimGui.Views AvaloniaXamlLoader.Load(this); } } -} +} +\ No newline at end of file diff --git a/StarSim/StarSimGui/nuget.config b/StarSim/StarSimGui/nuget.config @@ -1,6 +1,6 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- +<!-- To use the Avalonia CI feed to get unstable packages, move this file to the root of your solution. --> @@ -8,4 +8,4 @@ <packageSources> <add key="AvaloniaCI" value="https://www.myget.org/F/avalonia-ci/api/v2" /> </packageSources> -</configuration> +</configuration> +\ No newline at end of file diff --git a/StarSim/StarSimLib/Contexts/SimulatorContext.cs b/StarSim/StarSimLib/Contexts/SimulatorContext.cs @@ -1,5 +1,5 @@ -using System.Security.Cryptography; -using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore; + using StarSimLib.Cryptography; using StarSimLib.Models; diff --git a/StarSim/StarSimLib/Graphics/SimulationDrawer.cs b/StarSim/StarSimLib/Graphics/SimulationDrawer.cs @@ -1,9 +1,11 @@ -using System; -using System.Collections.Generic; -using SFML.Graphics; +using SFML.Graphics; using SFML.System; + using StarSimLib.Data_Structures; +using System; +using System.Collections.Generic; + namespace StarSimLib.Graphics { /// <summary> diff --git a/StarSim/StarSimLib/Physics/BodyGenerator.cs b/StarSim/StarSimLib/Physics/BodyGenerator.cs @@ -1,9 +1,11 @@ -using System; -using System.Collections.Generic; -using SFML.Graphics; +using SFML.Graphics; using SFML.System; + using StarSimLib.Data_Structures; +using System; +using System.Collections.Generic; + namespace StarSimLib.Physics { /// <summary> diff --git a/StarSim/StarSimLib/Physics/BodyUpdater.cs b/StarSim/StarSimLib/Physics/BodyUpdater.cs @@ -1,7 +1,8 @@ -using System.Collections.Generic; +using StarSimLib.Data_Structures; + +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using StarSimLib.Data_Structures; namespace StarSimLib.Physics { diff --git a/StarSim/StarSimLib/Physics/OrbitGenerator.cs b/StarSim/StarSimLib/Physics/OrbitGenerator.cs @@ -1,5 +1,6 @@ -using System; -using StarSimLib.Data_Structures; +using StarSimLib.Data_Structures; + +using System; namespace StarSimLib.Physics { diff --git a/StarSim/StarSimLib/UI/IInputHandler.cs b/StarSim/StarSimLib/UI/IInputHandler.cs @@ -1,5 +1,6 @@ -using System; -using SFML.Window; +using SFML.Window; + +using System; namespace StarSimLib.UI { diff --git a/StarSim/StarSimLib/UI/SimulationInputHandler.cs b/StarSim/StarSimLib/UI/SimulationInputHandler.cs @@ -1,8 +1,10 @@ -using System; -using SFML.Window; +using SFML.Window; + using StarSimLib.Data_Structures; using StarSimLib.Graphics; +using System; + namespace StarSimLib.UI { /// <summary> diff --git a/StarSim/StarSimLib/UI/SimulationScreen.cs b/StarSim/StarSimLib/UI/SimulationScreen.cs @@ -1,10 +1,12 @@ -using System.Collections.Generic; -using System.Timers; -using SFML.Graphics; +using SFML.Graphics; + using StarSimLib.Data_Structures; using StarSimLib.Graphics; using StarSimLib.Physics; +using System.Collections.Generic; +using System.Timers; + namespace StarSimLib.UI { /// <summary>