|
|
|
@ -1,20 +1,64 @@ |
|
|
|
|
using log4net; |
|
|
|
|
using SparkClient.Model.Helper; |
|
|
|
|
using SparkClient.ViewModel.Configuration.SettingsPages; |
|
|
|
|
using System.Data; |
|
|
|
|
using System.Diagnostics; |
|
|
|
|
using System.Windows; |
|
|
|
|
using System.Windows.Input; |
|
|
|
|
|
|
|
|
|
using MessageBox = SparkClient.Views.Dialog.MessageBox; |
|
|
|
|
namespace SparkClient; |
|
|
|
|
|
|
|
|
|
public partial class LoginWindow : Window |
|
|
|
|
{ |
|
|
|
|
private static readonly ILog Logger = LogManager.GetLogger(typeof(LoginWindow)); |
|
|
|
|
public LoginWindow() |
|
|
|
|
{ |
|
|
|
|
InitializeComponent(); |
|
|
|
|
WindowStartupLocation = WindowStartupLocation.CenterScreen; |
|
|
|
|
AccountTextBox.Text = Settings.SelectValueByName("SAVE_ACCOUNT"); |
|
|
|
|
PasswordBox.Password = Settings.SelectValueByName("SAVE_PASSWORD"); |
|
|
|
|
checkCUDA(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void checkCUDA() |
|
|
|
|
{ |
|
|
|
|
try |
|
|
|
|
{ |
|
|
|
|
ProcessStartInfo startInfo = new ProcessStartInfo |
|
|
|
|
{ |
|
|
|
|
FileName = "nvcc", |
|
|
|
|
Arguments = "--version", |
|
|
|
|
RedirectStandardOutput = true, |
|
|
|
|
UseShellExecute = false, |
|
|
|
|
CreateNoWindow = true |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
using (Process process = new Process { StartInfo = startInfo }) |
|
|
|
|
{ |
|
|
|
|
process.Start(); |
|
|
|
|
string output = process.StandardOutput.ReadToEnd(); |
|
|
|
|
process.WaitForExit(); |
|
|
|
|
|
|
|
|
|
if (process.ExitCode == 0) |
|
|
|
|
{ |
|
|
|
|
Logger.Error("CUDA 已安装\n" + output); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
MessageBox messageBox = new MessageBox(); |
|
|
|
|
messageBox.Show(MultilingualHelper.getString("CUDANoInstall")); |
|
|
|
|
Logger.Error("CUDA 未安装"); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
catch (Exception ex) |
|
|
|
|
{ |
|
|
|
|
MessageBox messageBox = new MessageBox(); |
|
|
|
|
messageBox.Show(MultilingualHelper.getString("CUDANoInstall")); |
|
|
|
|
Logger.Error("CUDA 安装检测错误:"+ ex); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void Grid_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) |
|
|
|
|
{ |
|
|
|
|
if (e.ButtonState == MouseButtonState.Pressed) |
|
|
|
@ -48,7 +92,8 @@ public partial class LoginWindow : Window |
|
|
|
|
string passworddb = getPassword(account); |
|
|
|
|
if (string.IsNullOrEmpty(password) || !passworddb.Equals(passwordEnc)) |
|
|
|
|
{ |
|
|
|
|
MessageBox.Show(MultilingualHelper.getString("NoPassword")); |
|
|
|
|
MessageBox messageBox = new MessageBox(); |
|
|
|
|
messageBox.Show(MultilingualHelper.getString("NoPassword")); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
savePassword(); |
|
|
|
|