2020-04-17 03:28:14 +02:00
using System ;
using System.Collections.Generic ;
using System.Diagnostics ;
2020-04-17 19:15:27 +02:00
using System.IO ;
2020-04-17 03:28:14 +02:00
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 18:02:45 +02:00
bool reset = false ;
2020-04-29 01:40:54 +02:00
bool add = false ;
2020-04-17 03:28:14 +02:00
public Custom_Message ( string title , string message )
{
InitializeComponent ( ) ;
2020-04-20 11:31:26 +02:00
dont . Visibility = Visibility . Hidden ;
2020-04-17 03:28:14 +02:00
Title . Text = title ;
Message . Content = message ;
Folder . Visibility = Visibility . Hidden ;
2020-04-29 01:40:54 +02: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" ) | | title . Contains ( "Found additional Files" ) )
2020-04-17 18:02:45 +02:00
{
Reset . Visibility = Visibility . Visible ;
if ( title . Contains ( "Resetting" ) )
{
reset = true ;
}
2020-04-29 01:40:54 +02:00
if ( title . Contains ( "Found additional Files" ) )
{
add = true ;
Reset . Content = "Yes" ;
}
2020-04-17 18:02:45 +02:00
}
2020-04-20 11:31:26 +02:00
if ( title . Equals ( "Image Warning" ) )
{
dont . Visibility = Visibility . Visible ;
}
2020-04-17 03:28:14 +02:00
}
public Custom_Message ( string title , string message , string Path )
{
InitializeComponent ( ) ;
2020-04-21 04:05:19 +02:00
dont . Visibility = Visibility . Hidden ;
2020-04-17 03:28:14 +02:00
Title . Text = title ;
Message . Content = message ;
this . path = Path ;
Folder . Visibility = Visibility . Visible ;
2020-04-18 05:31:36 +02:00
2020-04-17 03:28:14 +02:00
}
private void Button_Click ( object sender , RoutedEventArgs e )
{
2020-04-20 11:31:26 +02:00
if ( dont . IsChecked = = true )
{
Properties . Settings . Default . dont = true ;
Properties . Settings . Default . Save ( ) ;
}
2020-04-17 03:28:14 +02:00
this . Close ( ) ;
}
private void Folder_Click ( object sender , RoutedEventArgs e )
{
2020-04-20 02:35:31 +02: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 11:31:26 +02:00
if ( dont . IsChecked = = true )
{
Properties . Settings . Default . dont = true ;
Properties . Settings . Default . Save ( ) ;
}
2020-04-20 02:35:31 +02:00
this . Close ( ) ;
}
2020-04-17 18:02:45 +02:00
}
private void Reset_Click ( object sender , RoutedEventArgs e )
{
if ( reset )
{
2020-04-20 00:53:34 +02:00
this . Close ( ) ;
2020-04-17 18:02:45 +02:00
( ( MainViewModel ) FindResource ( "mvm" ) ) . ResetTitleKeys ( ) ;
}
2020-04-29 01:40:54 +02:00
else if ( add )
{
( ( MainViewModel ) FindResource ( "mvm" ) ) . addi = true ;
}
2020-04-17 18:02:45 +02:00
else
{
( ( MainViewModel ) FindResource ( "mvm" ) ) . choosefolder = true ;
}
2020-04-20 11:31:26 +02:00
if ( dont . IsChecked = = true )
{
Properties . Settings . Default . dont = true ;
Properties . Settings . Default . Save ( ) ;
}
2020-04-17 18:02:45 +02:00
this . Close ( ) ;
2020-04-17 03:28:14 +02:00
}
}
}