Skip to content

Commit

Permalink
#38 Add credentials configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
hovrawl committed Sep 26, 2022
1 parent c91c6ba commit 9eec692
Show file tree
Hide file tree
Showing 35 changed files with 1,644 additions and 101 deletions.
5 changes: 2 additions & 3 deletions AvaloniaMisterDoctor/App.axaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
<Application xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:themes="clr-namespace:Material.Styles.Themes;assembly=Material.Styles"
xmlns:sty="using:FluentAvalonia.Styling"
x:Class="AvaloniaMisterDoctor.App">
<Application.Styles>
<FluentTheme Mode="Light"/>
<themes:MaterialTheme BaseTheme="Dark" PrimaryColor="Purple" SecondaryColor="Lime" />
<StyleInclude Source="avares://Material.Icons.Avalonia/App.xaml"></StyleInclude>
<sty:FluentAvaloniaTheme />

</Application.Styles>
</Application>
2 changes: 1 addition & 1 deletion AvaloniaMisterDoctor/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public override void OnFrameworkInitializationCompleted()
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
desktop.MainWindow = new MainWindow();
desktop.MainWindow = new Views.MainWindow();
}

base.OnFrameworkInitializationCompleted();
Expand Down
15 changes: 11 additions & 4 deletions AvaloniaMisterDoctor/AvaloniaMisterDoctor.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,23 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Avalonia" Version="0.10.16" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.14" />
<PackageReference Include="Avalonia.Desktop" Version="0.10.16" />
<!--Condition below is needed to remove Avalonia.Diagnostics package from build output in Release configuration.-->
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.14" />
<PackageReference Include="Material.Avalonia" Version="3.0.0-rc0.98-nightly" />
<PackageReference Include="Material.Icons.Avalonia" Version="1.1.10" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="0.10.16" />
<PackageReference Include="FluentAvaloniaUI" Version="1.4.1" />
<PackageReference Include="FluentIcons.Avalonia" Version="1.1.176" />
<PackageReference Include="MessageBox.Avalonia" Version="2.0.2" />
<PackageReference Include="XamlNameReferenceGenerator" Version="1.3.4" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EngineDoctor\EngineDoctor.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Views\MainWindow.axaml.cs">
<DependentUpon>MainWindow.axaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="xcopy &quot;$(ProjectDir)Dependencies\nounlist.txt&quot; &quot;$(TargetDir)&quot; /Y /I" />
</Target>
Expand Down
23 changes: 23 additions & 0 deletions AvaloniaMisterDoctor/Classes/FACommand.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
using System;
using System.Windows.Input;

namespace AvaloniaMisterDoctor.Classes;

public class FACommand: ICommand
{
public FACommand(Action<object> executeMethod)
{
_executeMethod = executeMethod;
}

public event EventHandler CanExecuteChanged;

public bool CanExecute(object parameter) => true;

public void Execute(object parameter)
{
_executeMethod.Invoke(parameter);
}

private Action<object> _executeMethod;
}
55 changes: 0 additions & 55 deletions AvaloniaMisterDoctor/MainWindow.axaml

This file was deleted.

24 changes: 0 additions & 24 deletions AvaloniaMisterDoctor/MainWindow.axaml.cs

This file was deleted.

43 changes: 43 additions & 0 deletions AvaloniaMisterDoctor/Services/NavigationService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
using System;
using Avalonia.Controls;
using FluentAvalonia.UI.Controls;

namespace AvaloniaMisterDoctor.Services;

public class NavigationService
{
public static NavigationService Instance { get; } = new NavigationService();

public void SetFrame(Frame f)
{
_frame = f;
}

public void SetOverlayHost(Panel p)
{
_overlayHost = p;
}

public void Navigate(Type t)
{
_frame.Navigate(t);
}

public void ShowControlDefinitionOverlay(Type targetType)
{
if (_overlayHost != null)
{
// (_overlayHost.Children[0] as ControlDefinitionOverlay).TargetType = targetType;
// (_overlayHost.Children[0] as ControlDefinitionOverlay).Show();
}
}

public void ClearOverlay()
{
_overlayHost?.Children.Clear();

}

private Frame _frame;
private Panel _overlayHost;
}
105 changes: 105 additions & 0 deletions AvaloniaMisterDoctor/ViewModels/CredentialsViewViewModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
using System;
using EngineDoctor;
using FluentAvalonia.UI.Controls;

namespace AvaloniaMisterDoctor.ViewModels;

public class CredentialsViewViewModel : ViewModelBase
{
private readonly ContentDialog dialog;

public CredentialsViewViewModel(ContentDialog dialog)
{
if (dialog is null)
{
throw new ArgumentNullException(nameof(dialog));
}

this.dialog = dialog;
dialog.Closed += DialogOnClosed;
}
private void DialogOnClosed(ContentDialog sender, ContentDialogClosedEventArgs args)
{
dialog.Closed -= DialogOnClosed;

if (!Engine.IsConnected) return;

var resultHint = new ContentDialog
{
Content = $"Successfully connected the Twitch Bot",
Title = "Connected",
PrimaryButtonText = "Awesome"
};

_ = resultHint.ShowAsync();

}

private string _username;

/// <summary>
/// Gets or sets the user input to check
/// </summary>
public string Username
{
get => _username;
set
{
if (RaiseAndSetIfChanged(ref _username, value))
{
//HandleUserInput();
}
}
}

private string _oauthToken;

/// <summary>
/// Gets or sets the user input to check
/// </summary>
public string OAuthToken
{
get => _oauthToken;
set
{
if (RaiseAndSetIfChanged(ref _oauthToken, value))
{
//HandleUserInput();
}
}
}

private string _channelName;

/// <summary>
/// Gets or sets the user input to check
/// </summary>
public string ChannelName
{
get => _channelName;
set
{
if (RaiseAndSetIfChanged(ref _channelName, value))
{
//HandleUserInput();
}
}
}

private string _botClientId;

/// <summary>
/// Gets or sets the user input to check
/// </summary>
public string BotClientId
{
get => _botClientId;
set
{
if (RaiseAndSetIfChanged(ref _botClientId, value))
{
//HandleUserInput();
}
}
}
}
Loading

0 comments on commit 9eec692

Please sign in to comment.