removal of TaskDialog usage...

This commit is contained in:
Frank Skare
2021-05-23 19:30:21 +02:00
parent 0b28770d1a
commit eaa8a3ca6c
59 changed files with 1035 additions and 7065 deletions

View File

@@ -6,7 +6,7 @@ using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Interop;
using static mpvnet.Core;
using static mpvnet.Global;
namespace mpvnet
{
@@ -107,7 +107,7 @@ namespace mpvnet
{
CommandItem item = ListView.SelectedItem as CommandItem;
Close();
core.command(item.Command);
Core.command(item.Command);
}
}

View File

@@ -11,8 +11,7 @@ using System.Windows.Input;
using DynamicGUI;
using static TaskDialog.Msg;
using static mpvnet.Core;
using static mpvnet.Global;
namespace mpvnet
{
@@ -28,11 +27,11 @@ namespace mpvnet
InitializeComponent();
DataContext = this;
SearchControl.SearchTextBox.TextChanged += SearchTextBox_TextChanged;
LoadConf(core.ConfPath);
LoadConf(Core.ConfPath);
LoadConf(App.ConfPath);
LoadSettings();
InitialContent = GetCompareString();
SearchControl.Text = RegistryHelp.GetString("ConfigEditorSearch");
SearchControl.Text = RegistryHelp.GetString("config-editor-search");
FilterListBox.SelectedItem = SearchControl.Text.TrimEnd(':');
}
@@ -69,14 +68,14 @@ namespace mpvnet
protected override void OnClosed(EventArgs e)
{
base.OnClosed(e);
RegistryHelp.SetValue(App.RegPath, "ConfigEditorSearch", SearchControl.Text);
RegistryHelp.SetValue("config-editor-search", SearchControl.Text);
if (InitialContent == GetCompareString())
return;
File.WriteAllText(core.ConfPath, GetContent("mpv"));
File.WriteAllText(Core.ConfPath, GetContent("mpv"));
File.WriteAllText(App.ConfPath, GetContent("mpvnet"));
MsgInfo("Changes will be available on next mpv.net startup.");
Msg.ShowInfo("Changes will be available on next startup.");
}
string GetCompareString()
@@ -291,25 +290,17 @@ namespace mpvnet
SearchControl.Text = e.AddedItems[0] + ":";
}
void OpenSettingsTextBlock_MouseUp(object sender, MouseButtonEventArgs e)
{
ProcessHelp.ShellExecute(Path.GetDirectoryName(core.ConfPath));
}
void OpenSettingsTextBlock_MouseUp(object sender, MouseButtonEventArgs e) =>
ProcessHelp.ShellExecute(Path.GetDirectoryName(Core.ConfPath));
void PreviewTextBlock_MouseUp(object sender, MouseButtonEventArgs e)
{
MsgInfo("mpv.conf Preview", GetContent("mpv"));
}
void PreviewTextBlock_MouseUp(object sender, MouseButtonEventArgs e) =>
Msg.ShowInfo("mpv.conf Preview", GetContent("mpv"));
void ShowManualTextBlock_MouseUp(object sender, MouseButtonEventArgs e)
{
void ShowManualTextBlock_MouseUp(object sender, MouseButtonEventArgs e) =>
ProcessHelp.ShellExecute("https://mpv.io/manual/master/");
}
void SupportTextBlock_MouseUp(object sender, MouseButtonEventArgs e)
{
void SupportTextBlock_MouseUp(object sender, MouseButtonEventArgs e) =>
ProcessHelp.ShellExecute("https://github.com/stax76/mpv.net#Support");
}
protected override void OnKeyDown(KeyEventArgs e)
{

View File

@@ -4,13 +4,12 @@ using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Interop;
using static mpvnet.Core;
using static mpvnet.Global;
namespace mpvnet
{
@@ -109,7 +108,7 @@ namespace mpvnet
void Execute()
{
if (ListView.SelectedItem != null)
core.LoadFiles(new[] { ListView.SelectedItem as string }, true, Keyboard.Modifiers == ModifierKeys.Control);
Core.LoadFiles(new[] { ListView.SelectedItem as string }, true, Keyboard.Modifiers == ModifierKeys.Control);
Keyboard.Focus(FilterTextBox);
}
@@ -142,7 +141,7 @@ namespace mpvnet
Everything_GetResultFullPathName(i, sb, (uint)sb.Capacity);
string ext = sb.ToString().Ext();
if (Core.AudioTypes.Contains(ext) || Core.VideoTypes.Contains(ext) || Core.ImageTypes.Contains(ext))
if (CorePlayer.AudioTypes.Contains(ext) || CorePlayer.VideoTypes.Contains(ext) || CorePlayer.ImageTypes.Contains(ext))
items.Add(sb.ToString());
if (items.Count > 100)

View File

@@ -8,8 +8,7 @@ using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using static mpvnet.Core;
using static TaskDialog.Msg;
using static mpvnet.Global;
namespace mpvnet
{
@@ -38,7 +37,9 @@ namespace mpvnet
if (SearchControl.SearchTextBox.Text == "?")
{
SearchControl.SearchTextBox.Text = "";
MsgInfo("Filtering", "Reduce the filter scope with:\n\ni input\n\nm menu\n\nc command\n\nIf only one character is entered input search is performed.");
Msg.ShowInfo("Filtering",
"Reduce the filter scope with:\n\ni input\n\nm menu\n\nc command\n\n" +
"If only one character is entered input search is performed.");
}
}
@@ -86,7 +87,7 @@ namespace mpvnet
foreach (CommandItem i in CommandItem.Items)
if (items.ContainsKey(i.Input) && i.Input != "")
MsgInfo($"Duplicate found:\n\n{i.Input}: {i.Path}\n\n{items[i.Input].Input}: {items[i.Input].Path}\n\nPlease note that you can chain multiple commands in the same line by using a semicolon as separator.", "Duplicate Found");
Msg.ShowInfo($"Duplicate found:\n\n{i.Input}: {i.Path}\n\n{items[i.Input].Input}: {items[i.Input].Path}\n\nPlease note that you can chain multiple commands in the same line by using a semicolon as separator.", "Duplicate Found");
else
items[i.Input] = i;
}
@@ -128,8 +129,8 @@ namespace mpvnet
if (InitialInputConfContent == GetInputConfContent())
return;
File.WriteAllText(core.InputConfPath, GetInputConfContent());
MsgInfo("Changes will be available on next mpv.net startup.");
File.WriteAllText(Core.InputConfPath, GetInputConfContent());
Msg.ShowInfo("Changes will be available on next startup.");
}
void DataGrid_PreviewCanExecute(object sender, CanExecuteRoutedEventArgs e)
@@ -137,7 +138,7 @@ namespace mpvnet
DataGrid grid = (DataGrid)sender;
if (e.Command == DataGrid.DeleteCommand)
if (Msg.ShowQuestion($"Confirm to delete: {(grid.SelectedItem as CommandItem).Input} ({(grid.SelectedItem as CommandItem).Path})") != MsgResult.OK)
if (Msg.ShowQuestion($"Confirm to delete: {(grid.SelectedItem as CommandItem).Input} ({(grid.SelectedItem as CommandItem).Path})") != System.Windows.Forms.DialogResult.OK)
e.Handled = true;
}

View File

@@ -8,7 +8,6 @@ using System.Windows;
using WinForms = System.Windows.Forms;
using static StockIcon;
using static TaskDialog.Msg;
namespace mpvnet
{
@@ -45,15 +44,16 @@ namespace mpvnet
proc.WaitForExit();
if (proc.ExitCode == 0)
MsgInfo("File associations successfully created.");
Msg.ShowInfo("File associations successfully created.");
else
Msg.ShowError("Error creating file associations.");
}
} catch {}
}
void AddVideo_Click(object sender, RoutedEventArgs e) => RegFileAssoc(Core.VideoTypes);
void AddAudio_Click(object sender, RoutedEventArgs e) => RegFileAssoc(Core.AudioTypes);
void AddImage_Click(object sender, RoutedEventArgs e) => RegFileAssoc(Core.ImageTypes);
void AddVideo_Click(object sender, RoutedEventArgs e) => RegFileAssoc(CorePlayer.VideoTypes);
void AddAudio_Click(object sender, RoutedEventArgs e) => RegFileAssoc(CorePlayer.AudioTypes);
void AddImage_Click(object sender, RoutedEventArgs e) => RegFileAssoc(CorePlayer.ImageTypes);
void RemoveFileAssociations_Click(object sender, RoutedEventArgs e)
{