reworked start-size option

This commit is contained in:
Frank Skare
2021-05-10 13:11:39 +02:00
parent 18c8f5783b
commit 6f7f127279
10 changed files with 87 additions and 49 deletions

View File

@@ -18,7 +18,7 @@ namespace mpvnet
public static string DarkMode { get; set; } = "always";
public static string DarkTheme { get; set; } = "dark";
public static string LightTheme { get; set; } = "light";
public static string StartSize { get; set; } = "previous";
public static string StartSize { get; set; } = "previous-height";
public static bool RememberPosition { get; set; }
public static bool DebugMode { get; set; }
@@ -135,8 +135,8 @@ namespace mpvnet
{
if (RememberVolume)
{
core.set_property_int("volume", RegistryHelp.GetInt(RegPath, "Volume", 70));
core.set_property_string("mute", RegistryHelp.GetString(RegPath, "Mute", "no"));
core.set_property_int("volume", RegistryHelp.GetInt("Volume", 70));
core.set_property_string("mute", RegistryHelp.GetString("Mute", "no"));
}
}
@@ -196,7 +196,7 @@ namespace mpvnet
public static void ShowSetup()
{
int value = RegistryHelp.GetInt(RegistryHelp.ApplicationKey, Folder.Startup);
int value = RegistryHelp.GetInt(Folder.Startup);
if (value != 1)
{

View File

@@ -234,7 +234,7 @@ namespace mpvnet
public static void ExecuteMpvCommand() // deprecated 2019
{
InvokeOnMainThread(new Action(() => {
string command = VB.Interaction.InputBox("Enter a mpv command to be executed.", "Execute Command", RegistryHelp.GetString(App.RegPath, "RecentExecutedCommand"));
string command = VB.Interaction.InputBox("Enter a mpv command to be executed.", "Execute Command", RegistryHelp.GetString("RecentExecutedCommand"));
if (string.IsNullOrEmpty(command))
return;

View File

@@ -173,15 +173,15 @@ namespace mpvnet
regKey.SetValue(name, value);
}
public static string GetString(string path, string name, string defaultValue = "")
public static string GetString(string name, string defaultValue = "")
{
object value = GetValue(path, name, defaultValue);
object value = GetValue(ApplicationKey, name, defaultValue);
return !(value is string) ? defaultValue : value.ToString();
}
public static int GetInt(string path, string name, int defaultValue = 0)
public static int GetInt(string name, int defaultValue = 0)
{
object value = GetValue(path, name, defaultValue);
object value = GetValue(ApplicationKey, name, defaultValue);
return !(value is int) ? defaultValue : (int)value;
}
@@ -193,22 +193,18 @@ namespace mpvnet
public static void RemoveKey(string path)
{
try
{
try {
GetRootKey(path).DeleteSubKeyTree(path.Substring(5), false);
}
catch { }
} catch { }
}
public static void RemoveValue(string path, string name)
{
try
{
try {
using (RegistryKey regKey = GetRootKey(path).OpenSubKey(path.Substring(5), true))
if (regKey != null)
regKey.DeleteValue(name, false);
}
catch { }
} catch { }
}
static RegistryKey GetRootKey(string path)

View File

@@ -15,7 +15,7 @@ namespace mpvnet
{
public static void DailyCheck()
{
if (App.UpdateCheck && RegistryHelp.GetInt(RegistryHelp.ApplicationKey, "UpdateCheckLast")
if (App.UpdateCheck && RegistryHelp.GetInt("UpdateCheckLast")
!= DateTime.Now.DayOfYear)
CheckOnline();
@@ -44,7 +44,7 @@ namespace mpvnet
return;
}
if ((RegistryHelp.GetString(RegistryHelp.ApplicationKey, "UpdateCheckVersion")
if ((RegistryHelp.GetString("UpdateCheckVersion")
!= onlineVersion.ToString() || showUpToDateMessage) && Msg.ShowQuestion(
$"New version {onlineVersion} is available, update now?") == MsgResult.OK)
{