mirror of
https://github.com/Sarsoo/IF.Lastfm.git
synced 2024-10-17 07:13:09 +01:00
Probably shouldn't be checking in my Last.fm password... 😓
This commit is contained in:
parent
577beae9c5
commit
525810528b
@ -179,6 +179,23 @@
|
|||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
<TabItem Header="Sign in">
|
||||||
|
<Border Padding="28,10">
|
||||||
|
<StackPanel>
|
||||||
|
<TextBlock Style="{StaticResource SyroNormalFontStyle}"
|
||||||
|
Text="Username"
|
||||||
|
Margin="0,0,0,10" />
|
||||||
|
<TextBox Text="{Binding LastUsername, Mode=TwoWay}"
|
||||||
|
Margin="0,0,0,15" />
|
||||||
|
|
||||||
|
<TextBlock Style="{StaticResource SyroNormalFontStyle}"
|
||||||
|
Text="Password"
|
||||||
|
Margin="0,0,0,10" />
|
||||||
|
<TextBox Text="{Binding LastPassword, Mode=TwoWay}"
|
||||||
|
Margin="0,0,0,15" />
|
||||||
|
</StackPanel>
|
||||||
|
</Border>
|
||||||
|
</TabItem>
|
||||||
</TabControl>
|
</TabControl>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Page>
|
</Page>
|
@ -1,23 +1,19 @@
|
|||||||
using System;
|
using IF.Lastfm.Core.Api;
|
||||||
using System.Collections;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Collections.ObjectModel;
|
|
||||||
using System.Diagnostics;
|
|
||||||
using System.IO;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Security.AccessControl;
|
|
||||||
using IF.Lastfm.Core;
|
|
||||||
using IF.Lastfm.Core.Api;
|
|
||||||
using IF.Lastfm.Core.Api.Commands;
|
using IF.Lastfm.Core.Api.Commands;
|
||||||
using IF.Lastfm.Core.Api.Commands.UserApi;
|
|
||||||
using IF.Lastfm.Core.Api.Helpers;
|
using IF.Lastfm.Core.Api.Helpers;
|
||||||
using IF.Lastfm.Core.Objects;
|
using IF.Lastfm.Core.Objects;
|
||||||
using IF.Lastfm.Syro.Helpers;
|
using IF.Lastfm.Syro.Helpers;
|
||||||
using IF.Lastfm.Syro.Tools;
|
using IF.Lastfm.Syro.Tools;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Collections.ObjectModel;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Reflection;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace IF.Lastfm.Syro.ViewModels
|
namespace IF.Lastfm.Syro.ViewModels
|
||||||
{
|
{
|
||||||
@ -38,6 +34,8 @@ internal class MainViewModel : ViewModelBase
|
|||||||
private string _commandMethodName;
|
private string _commandMethodName;
|
||||||
private string _commandPageNumber;
|
private string _commandPageNumber;
|
||||||
private string _commandItemCount;
|
private string _commandItemCount;
|
||||||
|
private string _lastPassword;
|
||||||
|
private string _lastUsername;
|
||||||
private const string ReportFilename = "PROGRESS.md";
|
private const string ReportFilename = "PROGRESS.md";
|
||||||
|
|
||||||
#region Binding properties
|
#region Binding properties
|
||||||
@ -196,6 +194,28 @@ public string CommandItemCount
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string LastUsername
|
||||||
|
{
|
||||||
|
get { return _lastUsername; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == _lastUsername) return;
|
||||||
|
_lastUsername = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string LastPassword
|
||||||
|
{
|
||||||
|
get { return _lastPassword; }
|
||||||
|
set
|
||||||
|
{
|
||||||
|
if (value == _lastPassword) return;
|
||||||
|
_lastPassword = value;
|
||||||
|
OnPropertyChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public MainViewModel(ILastAuth lastAuth)
|
public MainViewModel(ILastAuth lastAuth)
|
||||||
@ -250,9 +270,10 @@ private async Task ExecuteSelectedCommand()
|
|||||||
var responseType = SelectedResponseType.MakeGenericType(SelectedLastObjectType);
|
var responseType = SelectedResponseType.MakeGenericType(SelectedLastObjectType);
|
||||||
var genericType = SelectedBaseCommandType.MakeGenericType(responseType);
|
var genericType = SelectedBaseCommandType.MakeGenericType(responseType);
|
||||||
|
|
||||||
if (!_lastAuth.Authenticated)
|
if (_lastAuth.UserSession.Username != LastUsername
|
||||||
|
&& SelectedBaseCommandType == typeof (DummyPostAsyncCommand<>))
|
||||||
{
|
{
|
||||||
await _lastAuth.GetSessionTokenAsync("tehrikkit", "#facedusk17a");
|
await _lastAuth.GetSessionTokenAsync(LastUsername, LastPassword);
|
||||||
}
|
}
|
||||||
|
|
||||||
var instance = Activator.CreateInstance(genericType, _lastAuth);
|
var instance = Activator.CreateInstance(genericType, _lastAuth);
|
||||||
|
Loading…
Reference in New Issue
Block a user