From 33cdee549743e7b920c8b76d30ab278d23fdf7a2 Mon Sep 17 00:00:00 2001 From: Frank Skare Date: Wed, 9 Dec 2020 09:56:51 +0100 Subject: [PATCH] show setup dialog on new startup location --- Changelog.md | 1 + mpv.net/Misc/App.cs | 20 ++++++++++++++++++++ mpv.net/Misc/Commands.cs | 2 +- mpv.net/WinForms/MainForm.cs | 1 + 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 2126936..f036d25 100644 --- a/Changelog.md +++ b/Changelog.md @@ -6,6 +6,7 @@ in order to support AviSynth portable mode. - New option global-media-keys (next, previous, play/pause, stop). - Improved setup dialog. +- Whenever there is a new startup location, the setup dialog is shown. - libmpv updated to shinshiro 2020-11-22. diff --git a/mpv.net/Misc/App.cs b/mpv.net/Misc/App.cs index c766b71..0e4733f 100644 --- a/mpv.net/Misc/App.cs +++ b/mpv.net/Misc/App.cs @@ -192,5 +192,25 @@ namespace mpvnet return false; } } + + public static void ShowSetup() + { + string path = RegistryHelp.GetString(RegistryHelp.ApplicationKey, "SetupDialog"); + + if (path != Folder.Startup) + { + if (Msg.ShowQuestion("Would you like to setup mpv.net for the current startup location?", + "Current startup location:\n\n" + Folder.Startup + "\n\n" + + "The setup allows to create a start menu shortcut, file associations and " + + "add mpv.net to the Path environment variable.\n\n" + + "Show setup dialog?") == MsgResult.OK) + + Commands.Execute("show-setup-dialog"); + else + Msg.Show("The setup dialog can be found in the context menu at:\n\nTools > Setup"); + + RegistryHelp.SetValue(RegistryHelp.ApplicationKey, "SetupDialog", Folder.Startup); + } + } } } diff --git a/mpv.net/Misc/Commands.cs b/mpv.net/Misc/Commands.cs index 8ca2e7e..33c18b3 100644 --- a/mpv.net/Misc/Commands.cs +++ b/mpv.net/Misc/Commands.cs @@ -17,7 +17,7 @@ namespace mpvnet { public class Commands { - public static void Execute(string id, string[] args) + public static void Execute(string id, string[] args = null) { switch (id) { diff --git a/mpv.net/WinForms/MainForm.cs b/mpv.net/WinForms/MainForm.cs index 27b63d5..cae1d14 100644 --- a/mpv.net/WinForms/MainForm.cs +++ b/mpv.net/WinForms/MainForm.cs @@ -814,6 +814,7 @@ namespace mpvnet core.LoadScripts(); Task.Run(() => App.Extension = new Extension()); ShownTickCount = Environment.TickCount; + App.ShowSetup(); } protected override void OnActivated(EventArgs e)