-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Replaced Material MessageBox with Homebrew Solution
MaterialMessageBox has too many bugs that can affect opening and closing of the patcher.
- Loading branch information
Showing
46 changed files
with
349 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
|
||
namespace SynthEBD | ||
{ | ||
public class MessageWindow | ||
{ | ||
public static void DisplayNotificationOK(string header, string text) | ||
{ | ||
var box = new VM_MessageWindowOK(header, text); | ||
box.Show(); | ||
} | ||
public static void DisplayNotificationOK(string header, ICollection<string> text, string separator) | ||
{ | ||
var box = new VM_MessageWindowOK(header, string.Join(separator, text)); | ||
box.Show(); | ||
} | ||
public static bool DisplayNotificationYesNo(string header, string text) | ||
{ | ||
var box = new VM_MessageWindowYesNo(header, text); | ||
box.Show(); | ||
|
||
return box.Result; | ||
} | ||
public static bool DisplayNotificationYesNo(string header, ICollection<string> text, string separator) | ||
{ | ||
var box = new VM_MessageWindowYesNo(header, string.Join(separator, text)); | ||
box.Show(); | ||
|
||
return box.Result; | ||
} | ||
} | ||
|
||
public class VM_MessageWindowOK : VM | ||
{ | ||
public VM_MessageWindowOK(string header, string text) | ||
{ | ||
Header = header; | ||
Text = text; | ||
_window = new(); | ||
|
||
OkCommand = new RelayCommand( | ||
canExecute: _ => true, | ||
execute: _ => | ||
{ | ||
_window.Close(); | ||
}); | ||
|
||
CopyTextCommand = new RelayCommand( | ||
canExecute: _ => true, | ||
execute: _ => | ||
{ | ||
Clipboard.SetText(Text); | ||
}); | ||
} | ||
|
||
public string Header { get; set; } | ||
public string Text { get; set; } | ||
private Window_MessageWindowOK _window { get; } | ||
public RelayCommand OkCommand { get; } | ||
public RelayCommand CopyTextCommand { get; } | ||
|
||
public void Show() | ||
{ | ||
_window.DataContext = this; | ||
_window.ShowDialog(); | ||
} | ||
} | ||
|
||
public class VM_MessageWindowYesNo : VM | ||
{ | ||
public VM_MessageWindowYesNo(string header, string text) | ||
{ | ||
Header = header; | ||
Text = text; | ||
_window = new(); | ||
|
||
YesCommand = new RelayCommand( | ||
canExecute: _ => true, | ||
execute: _ => | ||
{ | ||
Result = true; | ||
_window.Close(); | ||
}); | ||
|
||
NoCommand = new RelayCommand( | ||
canExecute: _ => true, | ||
execute: _ => | ||
{ | ||
Result = false; | ||
_window.Close(); | ||
}); | ||
|
||
CopyTextCommand = new RelayCommand( | ||
canExecute: _ => true, | ||
execute: _ => | ||
{ | ||
Clipboard.SetText(Text); | ||
}); | ||
} | ||
|
||
public string Header { get; set; } | ||
public string Text { get; set; } | ||
public bool Result { get; set; } | ||
private Window_MessageWindowYesNo _window { get; } | ||
public RelayCommand YesCommand { get; } | ||
public RelayCommand NoCommand { get; } | ||
public RelayCommand CopyTextCommand { get; } | ||
public void Show() | ||
{ | ||
_window.DataContext = this; | ||
_window.ShowDialog(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<Window x:Class="SynthEBD.Window_MessageWindowOK" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
d:DataContext="{d:DesignInstance Type=local:VM_MessageWindowOK}" | ||
xmlns:local="clr-namespace:SynthEBD" | ||
mc:Ignorable="d" | ||
Title="{Binding Header}" Height="450" Width="800"> | ||
<Grid> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="*"/> | ||
<RowDefinition Height="auto"/> | ||
</Grid.RowDefinitions> | ||
|
||
<ScrollViewer Grid.Row="0"> | ||
<TextBox Text="{Binding Path=Text, Mode=OneWay}" Foreground="White" Background="Transparent" BorderThickness="0" IsReadOnly="True" TextWrapping="Wrap" FontSize="12"/> | ||
</ScrollViewer> | ||
<StackPanel Grid.Row="1" Orientation="Horizontal"> | ||
<Button Foreground="Green" Content="OK" Command="{Binding OkCommand}" FontSize="18"/> | ||
<Button Foreground="White" FontSize="18" Content="Copy Message" Command="{Binding CopyTextCommand}" Margin="15 0 0 0"/> | ||
</StackPanel> | ||
</Grid> | ||
</Grid> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Shapes; | ||
|
||
namespace SynthEBD | ||
{ | ||
/// <summary> | ||
/// Interaction logic for Window_MessageWindowOK.xaml | ||
/// </summary> | ||
public partial class Window_MessageWindowOK : Window | ||
{ | ||
public Window_MessageWindowOK() | ||
{ | ||
InitializeComponent(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<Window x:Class="SynthEBD.Window_MessageWindowYesNo" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
d:DataContext="{d:DesignInstance Type=local:VM_MessageWindowYesNo}" | ||
xmlns:local="clr-namespace:SynthEBD" | ||
mc:Ignorable="d" | ||
Title="{Binding Header}" Height="450" Width="800"> | ||
<Grid> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="*"/> | ||
<RowDefinition Height="auto"/> | ||
</Grid.RowDefinitions> | ||
|
||
<ScrollViewer Grid.Row="0"> | ||
<TextBox Text="{Binding Path=Text, Mode=OneWay}" Foreground="White" Background="Transparent" BorderThickness="0" IsReadOnly="True" TextWrapping="Wrap" FontSize="12"/> | ||
</ScrollViewer> | ||
<StackPanel Grid.Row="1" Orientation="Horizontal"> | ||
<Button Foreground="Green" FontSize="18" Content="Yes" Command="{Binding YesCommand}"/> | ||
<Button Foreground="Firebrick" FontSize="18" Content="No" Command="{Binding NoCommand}" Margin="15 0 0 0"/> | ||
<Button Foreground="White" FontSize="18" Content="Copy Message" Command="{Binding CopyTextCommand}" Margin="15 0 0 0"/> | ||
</StackPanel> | ||
</Grid> | ||
</Grid> | ||
</Window> |
Oops, something went wrong.