Skip to content

Commit

Permalink
Remember login
Browse files Browse the repository at this point in the history
  • Loading branch information
ColonelChocomel committed Apr 21, 2022
1 parent 643e45e commit bffab49
Show file tree
Hide file tree
Showing 5 changed files with 179 additions and 6 deletions.
14 changes: 14 additions & 0 deletions ACCBroadcaster/ACCBroadcaster.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.WindowsAppSDK" Version="1.0.2" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22000.197" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="6.0.0" />
<Manifest Include="$(ApplicationManifest)" />
</ItemGroup>

Expand All @@ -47,6 +48,19 @@
<ItemGroup>
<ProjectReference Include="D:\Program Files (x86)\Steam\steamapps\common\Assetto Corsa Competizione Dedicated Server\sdk\broadcasting\Sources\ksBroadcastingNetwork\ksBroadcastingNetwork.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Settings.Designer.cs">
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<AutoGen>True</AutoGen>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
</ItemGroup>
<ItemGroup>
<None Update="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<Page Update="Views\Broadcasting\SessionInfoView.xaml">
<Generator>MSBuild:Compile</Generator>
Expand Down
110 changes: 110 additions & 0 deletions ACCBroadcaster/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 27 additions & 0 deletions ACCBroadcaster/Properties/Settings.settings
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="ACCBroadcaster.Properties" GeneratedClassName="Settings">
<Profiles />
<Settings>
<Setting Name="IP" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="Port" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="DisplayName" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="ConnectionPw" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="CommandPw" Type="System.String" Scope="User">
<Value Profile="(Default)" />
</Setting>
<Setting Name="UpdateInterval" Type="System.Int32" Scope="User">
<Value Profile="(Default)">0</Value>
</Setting>
<Setting Name="LoginRemembered" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
</Settings>
</SettingsFile>
13 changes: 7 additions & 6 deletions ACCBroadcaster/Views/MainView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,13 @@
<Grid>
<StackPanel Grid.Row="0" Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBlock FontSize="32">ACC Broadcaster</TextBlock>
<TextBox Name="IP" Header="IP" Text="127.0.0.1"></TextBox>
<NumberBox Name="Port" Header="Port" Value="9000"></NumberBox>
<TextBox Name="DisplayName" Header="Display Name" Text="Your name"></TextBox>
<PasswordBox Name="ConnectionPW" Header="Connection password" Password="asd"></PasswordBox>
<NumberBox Name="UpdateInterval" Header="Update interval (ms)" Value="250"></NumberBox>
<PasswordBox Name="CommandPW" Header="Command password" Password=""></PasswordBox>
<TextBox Name="IP" Header="IP" Text="127.0.0.1"/>
<NumberBox Name="Port" Header="Port" Value="9000"/>
<TextBox Name="DisplayName" Header="Display Name"/>
<PasswordBox Name="ConnectionPW" Header="Connection password"/>
<NumberBox Name="UpdateInterval" Header="Update interval (ms)" Value="250"/>
<PasswordBox Name="CommandPW" Header="Command password"/>
<CheckBox Content="Remember login" Name="RememberLogin"/>
<Button x:Name="myButton" Click="myButton_Click">Connect</Button>
<TextBlock Name="ErrorTextBlock"></TextBlock>
</StackPanel>
Expand Down
21 changes: 21 additions & 0 deletions ACCBroadcaster/Views/MainView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using ACCBroadcaster.Properties;

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
Expand All @@ -30,6 +31,15 @@ public sealed partial class MainView : Page
public MainView()
{
this.InitializeComponent();
if (Settings.Default.LoginRemembered)
{
IP.Text = Settings.Default.IP;
Port.Value = Settings.Default.Port;
DisplayName.Text = Settings.Default.DisplayName;
ConnectionPW.Password = Settings.Default.ConnectionPw;
CommandPW.Password = Settings.Default.CommandPw;
UpdateInterval.Value = Settings.Default.UpdateInterval;
}
}

private void myButton_Click(object sender, RoutedEventArgs e)
Expand All @@ -40,6 +50,17 @@ private void myButton_Click(object sender, RoutedEventArgs e)
string connectionPw = ConnectionPW.Password;
string commandPw = CommandPW.Password;
int updateInterval = (int)UpdateInterval.Value;
if ((bool)RememberLogin.IsChecked)
{
Settings.Default.IP = ip;
Settings.Default.Port = port;
Settings.Default.DisplayName = displayName;
Settings.Default.ConnectionPw = connectionPw;
Settings.Default.CommandPw = commandPw;
Settings.Default.UpdateInterval = updateInterval;
Settings.Default.LoginRemembered = true;
Settings.Default.Save();
}
ACCService.Client = new ACCUdpRemoteClient(ip, port, displayName, connectionPw, commandPw, updateInterval);
ACCService.Client.MessageHandler.OnConnectionStateChanged += OnConnect;
}
Expand Down

0 comments on commit bffab49

Please sign in to comment.