Skip to content

Commit

Permalink
Committing auto-formatted code changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
mrbiggred authored and actions-user committed May 17, 2021
1 parent efb1148 commit 6077543
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 63 deletions.
2 changes: 1 addition & 1 deletion ExampleClient/Program.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using Avalonia;
using Avalonia.Controls.ApplicationLifetimes;
using Avalonia.ReactiveUI;
using System;

namespace ExampleClient
{
Expand Down
2 changes: 1 addition & 1 deletion ExampleClient/ViewLocator.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System;
using Avalonia.Controls;
using Avalonia.Controls.Templates;
using ExampleClient.ViewModels;
using System;

namespace ExampleClient
{
Expand Down
96 changes: 51 additions & 45 deletions ExampleClient/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,62 +2,68 @@
using Corgibytes.Freshli.Lib;
using ReactiveUI;

namespace ExampleClient.ViewModels {
/// <summary>
/// Allow developers to run Freshli Lib commands.
/// </summary>
public class MainWindowViewModel : ViewModelBase {
namespace ExampleClient.ViewModels
{
/// <summary>
/// The path to the Git repo to run Freshli against.
/// Allow developers to run Freshli Lib commands.
/// </summary>
public string GitPath { get; set; }
public class MainWindowViewModel : ViewModelBase
{
/// <summary>
/// The path to the Git repo to run Freshli against.
/// </summary>
public string GitPath { get; set; }

/// <summary>
/// Show the results from Freshli.
/// </summary>
public string Results {
get => _results;
set => this.RaiseAndSetIfChanged(ref _results, value);
}
private string _results;
/// <summary>
/// Show the results from Freshli.
/// </summary>
public string Results
{
get => _results;
set => this.RaiseAndSetIfChanged(ref _results, value);
}
private string _results;

/// <summary>
/// Close the window.
/// </summary>
public ReactiveCommand<Unit, Unit> CloseCommand { get; }
/// <summary>
/// Close the window.
/// </summary>
public ReactiveCommand<Unit, Unit> CloseCommand { get; }

/// <summary>
/// Run Freshli.
/// </summary>
public ReactiveCommand<Unit, Unit> OnRunFreshliClick { get; }
/// <summary>
/// Run Freshli.
/// </summary>
public ReactiveCommand<Unit, Unit> OnRunFreshliClick { get; }

/// <summary>
/// Initialize the view model.
/// </summary>
public MainWindowViewModel() {
_results = "";
/// <summary>
/// Initialize the view model.
/// </summary>
public MainWindowViewModel()
{
_results = "";

GitPath = "";
Results = "";
GitPath = "";
Results = "";

OnRunFreshliClick = ReactiveCommand.Create(RunFreshli);
CloseCommand = ReactiveCommand.Create(execute: () => { });
}
OnRunFreshliClick = ReactiveCommand.Create(RunFreshli);
CloseCommand = ReactiveCommand.Create(execute: () => { });
}

/// <summary>
/// Run Freshli and show the results to the user.
/// </summary>
private void RunFreshli() {
Results = $"Starting Freshli run for '{GitPath}'\n";
/// <summary>
/// Run Freshli and show the results to the user.
/// </summary>
private void RunFreshli()
{
Results = $"Starting Freshli run for '{GitPath}'\n";

var runner = new Runner();
var metricResults = runner.Run(GitPath);
var runner = new Runner();
var metricResults = runner.Run(GitPath);

foreach (var mr in metricResults) {
Results += mr.ToString();
}
foreach (var mr in metricResults)
{
Results += mr.ToString();
}

Results += "Finished!\n";
Results += "Finished!\n";
}
}
}
}
2 changes: 1 addition & 1 deletion ExampleClient/ViewModels/ViewModelBase.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using ReactiveUI;
using System;
using System.Collections.Generic;
using System.Text;
using ReactiveUI;

namespace ExampleClient.ViewModels
{
Expand Down
35 changes: 20 additions & 15 deletions ExampleClient/Views/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,31 +3,36 @@
using System.Reactive;
using Avalonia;
using Avalonia.Markup.Xaml;
using Avalonia.Reactive;
using Avalonia.ReactiveUI;
using ExampleClient.ViewModels;
using ReactiveUI;
using Avalonia.Reactive;


namespace ExampleClient.Views {
public class MainWindow : ReactiveWindow<MainWindowViewModel> {
namespace ExampleClient.Views
{
public class MainWindow : ReactiveWindow<MainWindowViewModel>
{

public MainWindow() {
InitializeComponent();
public MainWindow()
{
InitializeComponent();
#if DEBUG
this.AttachDevTools();
this.AttachDevTools();
#endif

// Close the Window when the close command is triggered.
this.WhenActivated(block: d => {
Debug.Assert(ViewModel != null, nameof(ViewModel) + " != null");
d(ViewModel.CloseCommand.Subscribe(onNext: (unit) => Close()));
// Close the Window when the close command is triggered.
this.WhenActivated(block: d =>
{
Debug.Assert(ViewModel != null, nameof(ViewModel) + " != null");
d(ViewModel.CloseCommand.Subscribe(onNext: (unit) => Close()));
}
);
}
);
}

private void InitializeComponent() {
AvaloniaXamlLoader.Load(this);
private void InitializeComponent()
{
AvaloniaXamlLoader.Load(this);
}
}
}
}

0 comments on commit 6077543

Please sign in to comment.