UWUVCI-AIO-WPF/UWUVCI AIO WPF/UI/Windows/Custom Message.xaml.cs

117 lines
3.5 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
using System.Diagnostics;
2020-04-17 17:15:27 +00:00
using System.IO;
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 UWUVCI_AIO_WPF.UI.Windows
{
/// <summary>
/// Interaktionslogik für Custom_Message.xaml
/// </summary>
public partial class Custom_Message : Window
{
string path;
2020-04-17 16:02:45 +00:00
bool reset = false;
public Custom_Message(string title, string message)
{
InitializeComponent();
2020-04-20 09:31:26 +00:00
dont.Visibility = Visibility.Hidden;
Title.Text = title;
Message.Content = message;
Folder.Visibility = Visibility.Hidden;
2020-04-17 16:02:45 +00:00
if (title.Contains("Resetting") || message.Contains("NUS format") || message.Contains("Folder contains Files or Subfolders, do you really want to use this") || message.Contains("If using Custom Bases"))
{
Reset.Visibility = Visibility.Visible;
if (title.Contains("Resetting"))
{
reset = true;
}
}
2020-04-20 09:31:26 +00:00
if(title.Equals("Image Warning"))
{
dont.Visibility = Visibility.Visible;
}
}
public Custom_Message(string title, string message, string Path)
{
InitializeComponent();
Title.Text = title;
Message.Content = message;
this.path = Path;
Folder.Visibility = Visibility.Visible;
}
private void Button_Click(object sender, RoutedEventArgs e)
{
2020-04-20 09:31:26 +00:00
if(dont.IsChecked == true)
{
Properties.Settings.Default.dont = true;
Properties.Settings.Default.Save();
}
this.Close();
}
private void Folder_Click(object sender, RoutedEventArgs e)
{
2020-04-20 00:35:31 +00:00
try
{
if (File.Exists(path)) path = new FileInfo(path).DirectoryName;
Process.Start(path);
this.Close();
}
catch (Exception)
{
Custom_Message cm = new Custom_Message("An Error occured", "An error occured opening the folder. Please make sure the Output Path exists.");
try
{
cm.Owner = (FindResource("mvm") as MainViewModel).mw;
}catch(Exception)
{
}
cm.ShowDialog();
2020-04-20 09:31:26 +00:00
if (dont.IsChecked == true)
{
Properties.Settings.Default.dont = true;
Properties.Settings.Default.Save();
}
2020-04-20 00:35:31 +00:00
this.Close();
}
2020-04-17 16:02:45 +00:00
}
private void Reset_Click(object sender, RoutedEventArgs e)
{
if (reset)
{
this.Close();
2020-04-17 16:02:45 +00:00
((MainViewModel)FindResource("mvm")).ResetTitleKeys();
}
else
{
((MainViewModel)FindResource("mvm")).choosefolder = true;
}
2020-04-20 09:31:26 +00:00
if (dont.IsChecked == true)
{
Properties.Settings.Default.dont = true;
Properties.Settings.Default.Save();
}
2020-04-17 16:02:45 +00:00
this.Close();
}
}
}