Message boxes are themed
This commit is contained in:
@@ -122,7 +122,7 @@ namespace mpvnet
|
||||
else
|
||||
{
|
||||
if (Msg.ShowQuestion("Create history.txt file in config folder?",
|
||||
"mpv.net will write the date, time and filename of opened files to it.") == DialogResult.OK)
|
||||
"mpv.net will write the date, time and filename of opened files to it.") == MessageBoxResult.OK)
|
||||
|
||||
File.WriteAllText(Core.ConfigFolder + "history.txt", "");
|
||||
}
|
||||
|
||||
@@ -1161,18 +1161,19 @@ namespace mpvnet
|
||||
|
||||
if (gb < 10)
|
||||
{
|
||||
DialogResult result = Msg.ShowQuestion("Click Yes for Blu-ray and No for DVD.",
|
||||
null, MessageBoxButtons.YesNoCancel);
|
||||
System.Windows.MessageBoxResult result =
|
||||
Msg.ShowQuestion("Click Yes for Blu-ray and No for DVD.",
|
||||
null, System.Windows.MessageBoxButton.YesNoCancel);
|
||||
|
||||
switch (result)
|
||||
{
|
||||
case DialogResult.Yes:
|
||||
case System.Windows.MessageBoxResult.Yes:
|
||||
Command("stop");
|
||||
Thread.Sleep(500);
|
||||
SetPropertyString("bluray-device", path);
|
||||
LoadFiles(new[] { @"bd://" }, false, false);
|
||||
break;
|
||||
case DialogResult.No:
|
||||
case System.Windows.MessageBoxResult.No:
|
||||
Command("stop");
|
||||
Thread.Sleep(500);
|
||||
SetPropertyString("dvd-device", path);
|
||||
|
||||
@@ -1,41 +1,50 @@
|
||||
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using System.Windows;
|
||||
|
||||
using WinForms = System.Windows.Forms;
|
||||
|
||||
using static mpvnet.Global;
|
||||
|
||||
using MsgBoxEx;
|
||||
|
||||
public class Msg
|
||||
{
|
||||
private static readonly string WindowTitle = WinForms.Application.ProductName;
|
||||
|
||||
public static void ShowInfo(object title, object content = null)
|
||||
{
|
||||
Show(title, content, MessageBoxIcon.Information);
|
||||
Show(title, content, MessageBoxImage.Information);
|
||||
}
|
||||
|
||||
public static void ShowError(object title, object content = null)
|
||||
{
|
||||
Show(title, content, MessageBoxIcon.Error);
|
||||
Show(title, content, MessageBoxImage.Error);
|
||||
}
|
||||
|
||||
public static void ShowWarning(object title, object content = null)
|
||||
{
|
||||
Show(title, content, MessageBoxIcon.Warning);
|
||||
Show(title, content, MessageBoxImage.Warning);
|
||||
}
|
||||
|
||||
public static DialogResult ShowQuestion(object title, object content = null,
|
||||
MessageBoxButtons buttons = MessageBoxButtons.OKCancel)
|
||||
public static MessageBoxResult ShowQuestion(object title, object content = null,
|
||||
MessageBoxButton buttons = MessageBoxButton.OKCancel)
|
||||
{
|
||||
return Show(title, content, MessageBoxIcon.Question, buttons);
|
||||
return Show(title, content, MessageBoxImage.Question, buttons);
|
||||
}
|
||||
|
||||
public static void ShowException(Exception exception)
|
||||
{
|
||||
Show(exception, null, MessageBoxIcon.Error);
|
||||
Show(exception, null, MessageBoxImage.Error);
|
||||
}
|
||||
|
||||
public static DialogResult Show(object title, object content, MessageBoxIcon icon,
|
||||
MessageBoxButtons buttons = MessageBoxButtons.OK)
|
||||
public static MessageBoxResult Show(
|
||||
object title,
|
||||
object content,
|
||||
MessageBoxImage img,
|
||||
MessageBoxButton buttons = MessageBoxButton.OK)
|
||||
{
|
||||
string msg = (title?.ToString().TrimEx() + BR2 + content?.ToString().TrimEx()).Trim();
|
||||
return MessageBox.Show(msg, Application.ProductName, buttons, icon);
|
||||
return MessageBoxEx.OpenMessageBox(null, msg, WindowTitle, buttons, img);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,8 @@ namespace mpvnet
|
||||
|
||||
if ((App.Settings.UpdateCheckVersion != onlineVersion.ToString() ||
|
||||
showUpToDateMessage) && Msg.ShowQuestion(
|
||||
$"New version {onlineVersion} is available, update now?") == DialogResult.OK)
|
||||
$"New version {onlineVersion} is available, update now?") ==
|
||||
System.Windows.MessageBoxResult.OK)
|
||||
{
|
||||
string url = $"https://github.com/stax76/mpv.net/releases/download/{onlineVersion}/mpv.net-{onlineVersion}-portable.zip";
|
||||
|
||||
|
||||
Reference in New Issue
Block a user