Skip to content

Portable Tool for an Ideal Windows Setup

re + replacement of dialog windows

Greedekse223386e8230
diff --git a/.Source/GTweak/Utilities/Controls/SettingsRepository.cs b/.Source/GTweak/Utilities/Controls/SettingsRepository.cs
index dcc2de8b..f769320d 100644
--- a/.Source/GTweak/Utilities/Controls/SettingsRepository.cs
+++ b/.Source/GTweak/Utilities/Controls/SettingsRepository.cs
@@ -2,6 +2,7 @@
using GTweak.Utilities.Helpers.Managers;
using GTweak.Windows;
using Microsoft.Win32;
+using Ookii.Dialogs.Wpf;
using System;
using System.Collections.Generic;
using System.IO;
@@ -106,20 +107,19 @@ namespace GTweak.Utilities.Controls
new ViewNotification().Show("", "info", "export_warning_notification");
else
{
- SaveFileDialog saveFileDialog = new SaveFileDialog
+ VistaSaveFileDialog vistaSaveFileDialog = new VistaSaveFileDialog
{
FileName = "Config GTweak",
Filter = "(*.INI)|*.INI",
RestoreDirectory = true
};
- bool? isResultNormal = saveFileDialog.ShowDialog();
-
- if (isResultNormal != true) return;
+ if (vistaSaveFileDialog.ShowDialog() != true)
+ return;
try
{
- StoragePaths.Config = Path.GetDirectoryName(saveFileDialog.FileName) + @"\" + Path.GetFileNameWithoutExtension(saveFileDialog.FileName) + ".ini";
+ StoragePaths.Config = Path.Combine(Path.GetDirectoryName(vistaSaveFileDialog.FileName), Path.GetFileNameWithoutExtension(vistaSaveFileDialog.FileName) + ".ini");
if (File.Exists(StoragePaths.Config))
File.Delete(StoragePaths.Config);
@@ -138,22 +138,22 @@ namespace GTweak.Utilities.Controls
internal static void OpenFileConfig()
{
- OpenFileDialog openFileDialog = new OpenFileDialog
+ VistaOpenFileDialog vistaOpenFileDialog = new VistaOpenFileDialog
{
- Filter = "(*.INI)|*.INI"
+ Filter = "(*.INI)|*.INI",
+ RestoreDirectory = true,
};
- bool? isResultNormal = openFileDialog.ShowDialog();
-
- if (isResultNormal != true) return;
+ if (vistaOpenFileDialog.ShowDialog() == false)
+ return;
- StoragePaths.Config = openFileDialog.FileName;
+ StoragePaths.Config = vistaOpenFileDialog.FileName;
INIManager iniManager = new INIManager(StoragePaths.Config);
if (iniManager.GetKeysOrValue("GTweak", false).Contains("Greedeks") && iniManager.GetKeysOrValue("GTweak").Contains("Release"))
{
if (File.ReadLines(StoragePaths.Config).Any(line => line.Contains("TglButton")) || File.ReadLines(StoragePaths.Config).Any(line => line.Contains("Slider")))
- new ImportWindow(openFileDialog.SafeFileName).ShowDialog();
+ new ImportWindow(Path.GetFileName(vistaOpenFileDialog.FileName)).ShowDialog();
else
new ViewNotification().Show("", "info", "import_empty_notification");
}
diff --git a/.Source/GTweak/View/MoreView.xaml.cs b/.Source/GTweak/View/MoreView.xaml.cs
index 2ae335b3..d1608a99 100644
--- a/.Source/GTweak/View/MoreView.xaml.cs
+++ b/.Source/GTweak/View/MoreView.xaml.cs
@@ -60,55 +60,56 @@ namespace GTweak.View
private async void BtnCompression_ClickButton(object sender, EventArgs e)
{
VistaFolderBrowserDialog folderDialog = new VistaFolderBrowserDialog();
- if (folderDialog.ShowDialog() == true)
+
+ if (folderDialog.ShowDialog() == false)
+ return;
+
+ string selectedPath = folderDialog.SelectedPath;
+ if (await NTFSCompressor.IsSupportNtfs(selectedPath))
{
- string selectedPath = folderDialog.SelectedPath;
- if (await NTFSCompressor.IsSupportNtfs(selectedPath))
+ if ((new DirectoryInfo(selectedPath).Attributes & FileAttributes.Compressed) != FileAttributes.Compressed)
{
- if ((new DirectoryInfo(selectedPath).Attributes & FileAttributes.Compressed) != FileAttributes.Compressed)
+ BackgroundQueue backgroundQueue = new BackgroundQueue();
+ await backgroundQueue.QueueTask(delegate
{
- BackgroundQueue backgroundQueue = new BackgroundQueue();
- await backgroundQueue.QueueTask(delegate
- {
- try { NTFSCompressor.SetCompression(selectedPath, true); }
- catch { new ViewNotification().Show("", "warn", "error_compression_notification"); }
- });
- await backgroundQueue.QueueTask(delegate { new ViewNotification(500).Show("", "info", "succes_compression_notification"); });
- }
- else
- new ViewNotification().Show("", "info", "ready_compression_notification");
+ try { NTFSCompressor.SetCompression(selectedPath, true); }
+ catch { new ViewNotification().Show("", "warn", "error_compression_notification"); }
+ });
+ await backgroundQueue.QueueTask(delegate { new ViewNotification(500).Show("", "info", "succes_compression_notification"); });
}
else
- new ViewNotification().Show("", "warn", "notsupport_ntfs_notification");
-
+ new ViewNotification().Show("", "info", "ready_compression_notification");
}
+ else
+ new ViewNotification().Show("", "warn", "notsupport_ntfs_notification");
}
private async void BtnDecompression_ClickButton(object sender, EventArgs e)
{
VistaFolderBrowserDialog folderDialog = new VistaFolderBrowserDialog();
- if (folderDialog.ShowDialog() == true)
+
+ if (folderDialog.ShowDialog() == false)
+ return;
+
+ string selectedPath = folderDialog.SelectedPath;
+ if (await NTFSCompressor.IsSupportNtfs(selectedPath))
{
- string selectedPath = folderDialog.SelectedPath;
- if (await NTFSCompressor.IsSupportNtfs(selectedPath))
+ if ((new DirectoryInfo(selectedPath).Attributes & FileAttributes.Compressed) == FileAttributes.Compressed)
{
- if ((new DirectoryInfo(selectedPath).Attributes & FileAttributes.Compressed) == FileAttributes.Compressed)
+ BackgroundQueue backgroundQueue = new BackgroundQueue();
+ await backgroundQueue.QueueTask(delegate
{
- BackgroundQueue backgroundQueue = new BackgroundQueue();
- await backgroundQueue.QueueTask(delegate
- {
- try { NTFSCompressor.SetCompression(selectedPath, false); }
- catch { new ViewNotification().Show("", "warn", "error_compression_notification"); }
+ try { NTFSCompressor.SetCompression(selectedPath, false); }
+ catch { new ViewNotification().Show("", "warn", "error_compression_notification"); }
- });
- await backgroundQueue.QueueTask(delegate { new ViewNotification(500).Show("", "info", "succes_decompression_notification"); });
- }
- else
- new ViewNotification().Show("", "info", "ready_decompression_notification");
+ });
+ await backgroundQueue.QueueTask(delegate { new ViewNotification(500).Show("", "info", "succes_decompression_notification"); });
}
else
- new ViewNotification().Show("", "warn", "notsupport_ntfs_notification");
+ new ViewNotification().Show("", "info", "ready_decompression_notification");
}
+ else
+ new ViewNotification().Show("", "warn", "notsupport_ntfs_notification");
}
}
}