新增自定义弹框窗口

新增吐司提示
This commit is contained in:
rmbgame
2021-03-06 17:56:56 +08:00
parent c5a0864d99
commit 3a95b8b802
10 changed files with 148 additions and 79 deletions
@@ -42,6 +42,4 @@ namespace System.Application.Models
return $"{AppId} | {Name}";
}
}
}
@@ -5,66 +5,66 @@ using System.Linq;
namespace System.Application.Serialization
{
public class FileSettingsProvider : ISerializationProvider
{
private readonly string _path;
private readonly object _sync = new object();
private SortedDictionary<string, object> _settings = new SortedDictionary<string, object>();
public class FileSettingsProvider : ISerializationProvider
{
private readonly string _path;
private readonly object _sync = new object();
private SortedDictionary<string, object> _settings = new SortedDictionary<string, object>();
public bool IsLoaded { get; private set; }
public bool IsLoaded { get; private set; }
public FileSettingsProvider(string path)
{
this._path = path;
}
public FileSettingsProvider(string path)
{
this._path = path;
}
public void SetValue<T>(string key, T value)
{
lock (this._sync)
{
this._settings[key] = value;
}
}
public void SetValue<T>(string key, T value)
{
lock (this._sync)
{
this._settings[key] = value;
}
}
public bool TryGetValue<T>(string key, out T value)
{
lock (this._sync)
{
object obj;
if (this._settings.TryGetValue(key, out obj) && obj is T)
{
value = (T)obj;
return true;
}
}
public bool TryGetValue<T>(string key, out T value)
{
lock (this._sync)
{
object obj;
if (this._settings.TryGetValue(key, out obj) && obj is T)
{
value = (T)obj;
return true;
}
}
value = default(T);
return false;
}
value = default(T);
return false;
}
public bool RemoveValue(string key)
{
lock (this._sync)
{
return this._settings.Remove(key);
}
}
public bool RemoveValue(string key)
{
lock (this._sync)
{
return this._settings.Remove(key);
}
}
public void Save()
{
if (this._settings.Count == 0) return;
public void Save()
{
if (this._settings.Count == 0) return;
var dir = Path.GetDirectoryName(this._path);
if (dir == null) throw new DirectoryNotFoundException();
var dir = Path.GetDirectoryName(this._path);
if (dir == null) throw new DirectoryNotFoundException();
if (!Directory.Exists(dir))
{
Directory.CreateDirectory(dir);
}
if (!Directory.Exists(dir))
{
Directory.CreateDirectory(dir);
}
lock (this._sync)
{
lock (this._sync)
{
using var stream = new FileStream(this._path, FileMode.Create, FileAccess.ReadWrite);
if (stream.Position > 0)
{
@@ -74,12 +74,12 @@ namespace System.Application.Serialization
stream.Write(data, 0, data.Length);
//XamlServices.Save(stream, this._settings);
}
}
}
public void Load()
{
if (File.Exists(this._path))
{
public void Load()
{
if (File.Exists(this._path))
{
using var stream = new FileStream(this._path, FileMode.Open, FileAccess.Read);
lock (this._sync)
{
@@ -95,21 +95,21 @@ namespace System.Application.Serialization
: new SortedDictionary<string, object>(source);
}
}
else
{
lock (this._sync)
{
this._settings = new SortedDictionary<string, object>();
}
}
else
{
lock (this._sync)
{
this._settings = new SortedDictionary<string, object>();
}
}
this.IsLoaded = true;
}
this.IsLoaded = true;
}
event EventHandler ISerializationProvider.Reloaded
{
add { }
remove { }
}
}
event EventHandler ISerializationProvider.Reloaded
{
add { }
remove { }
}
}
}
@@ -95,8 +95,7 @@ namespace System.Application.Services.Implementation
else
{
toast.Show(SR.SteamInstallPathNotFound);
}
}
} }
public string GetLastLoginUserName() => platformService.GetLastSteamLoginUserName();
@@ -67,8 +67,4 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Folder Include="UI\ViewModels\Windows\" />
</ItemGroup>
</Project>
@@ -1,5 +1,6 @@
using ReactiveUI;
using System.Application.Models;
using System.Application.Models.Settings;
using System.Application.Services;
using System.Application.UI.Resx;
using System.Collections.Generic;
@@ -33,7 +34,6 @@ namespace System.Application.UI.ViewModels
internal async override Task Initialize()
{
SteamUsers = new ObservableCollection<SteamUser>(steamService.GetRememberUserList());
if (!SteamUsers.Any_Nullable())
{
@@ -64,7 +64,7 @@ namespace System.Application.UI.ViewModels
{
steamService.SetCurrentUser(accountName);
steamService.TryKillSteamProcess();
steamService.StartSteam();
steamService.StartSteam(SteamSettings.SteamStratParameter.Value);
}
}
@@ -0,0 +1,14 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace System.Application.UI.ViewModels.Windows
{
public class MessageWindow : WindowViewModel
{
public MessageWindow()
{
Title = "";
}
}
}