perf: LD Converter v1.2.0 - Ultra fluidity and responsiveness patch
This commit is contained in:
parent
24cfcf44e8
commit
921bd4fa3f
21 changed files with 676 additions and 410 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -3,6 +3,7 @@
|
||||||
[Oo]bj/
|
[Oo]bj/
|
||||||
[Ll]og/
|
[Ll]og/
|
||||||
[Ll]ogs/
|
[Ll]ogs/
|
||||||
|
*.zip
|
||||||
|
|
||||||
# Visual Studio / Rider / VS Code caches
|
# Visual Studio / Rider / VS Code caches
|
||||||
.vs/
|
.vs/
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -7,7 +7,7 @@
|
||||||
"targets": {
|
"targets": {
|
||||||
".NETCoreApp,Version=v8.0": {},
|
".NETCoreApp,Version=v8.0": {},
|
||||||
".NETCoreApp,Version=v8.0/win-x64": {
|
".NETCoreApp,Version=v8.0/win-x64": {
|
||||||
"LDConverter/1.1.0": {
|
"LDConverter/1.2.0": {
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"Donustur.Core": "1.0.0",
|
"Donustur.Core": "1.0.0",
|
||||||
"Donustur.Engine": "1.0.0"
|
"Donustur.Engine": "1.0.0"
|
||||||
|
|
@ -157,7 +157,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"libraries": {
|
"libraries": {
|
||||||
"LDConverter/1.1.0": {
|
"LDConverter/1.2.0": {
|
||||||
"type": "project",
|
"type": "project",
|
||||||
"serviceable": false,
|
"serviceable": false,
|
||||||
"sha512": ""
|
"sha512": ""
|
||||||
|
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
|
@ -92,8 +92,8 @@ public sealed class HistoryStore
|
||||||
{
|
{
|
||||||
_entries.RemoveRange(100, _entries.Count - 100);
|
_entries.RemoveRange(100, _entries.Count - 100);
|
||||||
}
|
}
|
||||||
SaveInternal();
|
|
||||||
}
|
}
|
||||||
|
SaveInternal();
|
||||||
Changed?.Invoke();
|
Changed?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -103,13 +103,10 @@ public sealed class HistoryStore
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
{
|
{
|
||||||
removed = _entries.RemoveAll(e => e.Id == id) > 0;
|
removed = _entries.RemoveAll(e => e.Id == id) > 0;
|
||||||
|
}
|
||||||
if (removed)
|
if (removed)
|
||||||
{
|
{
|
||||||
SaveInternal();
|
SaveInternal();
|
||||||
}
|
|
||||||
}
|
|
||||||
if (removed)
|
|
||||||
{
|
|
||||||
Changed?.Invoke();
|
Changed?.Invoke();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -119,12 +116,20 @@ public sealed class HistoryStore
|
||||||
lock (_lock)
|
lock (_lock)
|
||||||
{
|
{
|
||||||
_entries.Clear();
|
_entries.Clear();
|
||||||
SaveInternal();
|
|
||||||
}
|
}
|
||||||
|
SaveInternal();
|
||||||
Changed?.Invoke();
|
Changed?.Invoke();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveInternal()
|
private void SaveInternal()
|
||||||
|
{
|
||||||
|
List<HistoryEntry> snapshot;
|
||||||
|
lock (_lock)
|
||||||
|
{
|
||||||
|
snapshot = _entries.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -134,7 +139,7 @@ public sealed class HistoryStore
|
||||||
Directory.CreateDirectory(dir);
|
Directory.CreateDirectory(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
string json = JsonSerializer.Serialize(_entries, JsonOptions);
|
string json = JsonSerializer.Serialize(snapshot, JsonOptions);
|
||||||
string tmp = _filePath + ".tmp";
|
string tmp = _filePath + ".tmp";
|
||||||
File.WriteAllText(tmp, json);
|
File.WriteAllText(tmp, json);
|
||||||
File.Move(tmp, _filePath, overwrite: true);
|
File.Move(tmp, _filePath, overwrite: true);
|
||||||
|
|
@ -143,5 +148,6 @@ public sealed class HistoryStore
|
||||||
{
|
{
|
||||||
// Silently handle IO errors
|
// Silently handle IO errors
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -57,10 +57,14 @@ public sealed class PreferencesStore
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Save(AppPreferences preferences)
|
public void Save(AppPreferences preferences)
|
||||||
|
{
|
||||||
|
_current = preferences;
|
||||||
|
Changed?.Invoke(_current);
|
||||||
|
|
||||||
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
_current = preferences;
|
|
||||||
string dir = Path.GetDirectoryName(_filePath)!;
|
string dir = Path.GetDirectoryName(_filePath)!;
|
||||||
if (!Directory.Exists(dir))
|
if (!Directory.Exists(dir))
|
||||||
{
|
{
|
||||||
|
|
@ -71,12 +75,11 @@ public sealed class PreferencesStore
|
||||||
string tempFile = _filePath + ".tmp";
|
string tempFile = _filePath + ".tmp";
|
||||||
File.WriteAllText(tempFile, json);
|
File.WriteAllText(tempFile, json);
|
||||||
File.Move(tempFile, _filePath, overwrite: true);
|
File.Move(tempFile, _filePath, overwrite: true);
|
||||||
|
|
||||||
Changed?.Invoke(_current);
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
// Handle error silently
|
// Handle error silently
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@ public sealed class ConversionDispatcher
|
||||||
AppPreferences preferences,
|
AppPreferences preferences,
|
||||||
IProgress<double>? progress = null,
|
IProgress<double>? progress = null,
|
||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
|
{
|
||||||
|
return await Task.Run(async () =>
|
||||||
{
|
{
|
||||||
task.Status = ConversionTaskStatus.Running;
|
task.Status = ConversionTaskStatus.Running;
|
||||||
|
|
||||||
|
|
@ -275,6 +277,7 @@ public sealed class ConversionDispatcher
|
||||||
|
|
||||||
return new ConversionResult(false, Array.Empty<string>(), ex.Message, task.Duration);
|
return new ConversionResult(false, Array.Empty<string>(), ex.Message, task.Duration);
|
||||||
}
|
}
|
||||||
|
}, token);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string FormatFriendlyActionLabel(string action)
|
private static string FormatFriendlyActionLabel(string action)
|
||||||
|
|
|
||||||
|
|
@ -39,22 +39,40 @@ public static class ProcessRunner
|
||||||
using var process = new Process { StartInfo = psi, EnableRaisingEvents = true };
|
using var process = new Process { StartInfo = psi, EnableRaisingEvents = true };
|
||||||
var stdOut = new StringBuilder();
|
var stdOut = new StringBuilder();
|
||||||
var stdErr = new StringBuilder();
|
var stdErr = new StringBuilder();
|
||||||
|
long lastReportTicks = 0;
|
||||||
|
|
||||||
|
void ReportThrottled(string line)
|
||||||
|
{
|
||||||
|
if (outputProgress == null) return;
|
||||||
|
long now = Environment.TickCount64;
|
||||||
|
if (now - Interlocked.Read(ref lastReportTicks) >= 60) // En fazla ~16 FPS raporlama (WPF Dispatcher koruması)
|
||||||
|
{
|
||||||
|
Interlocked.Exchange(ref lastReportTicks, now);
|
||||||
|
outputProgress.Report(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
process.OutputDataReceived += (_, e) =>
|
process.OutputDataReceived += (_, e) =>
|
||||||
{
|
{
|
||||||
if (e.Data != null)
|
if (e.Data != null)
|
||||||
|
{
|
||||||
|
lock (stdOut)
|
||||||
{
|
{
|
||||||
stdOut.AppendLine(e.Data);
|
stdOut.AppendLine(e.Data);
|
||||||
outputProgress?.Report(e.Data);
|
}
|
||||||
|
ReportThrottled(e.Data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
process.ErrorDataReceived += (_, e) =>
|
process.ErrorDataReceived += (_, e) =>
|
||||||
{
|
{
|
||||||
if (e.Data != null)
|
if (e.Data != null)
|
||||||
|
{
|
||||||
|
lock (stdErr)
|
||||||
{
|
{
|
||||||
stdErr.AppendLine(e.Data);
|
stdErr.AppendLine(e.Data);
|
||||||
outputProgress?.Report(e.Data);
|
}
|
||||||
|
ReportThrottled(e.Data);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@ using System.Globalization;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Animation;
|
|
||||||
using Donustur.Core.Math;
|
using Donustur.Core.Math;
|
||||||
using Donustur.Core.Models;
|
using Donustur.Core.Models;
|
||||||
|
|
||||||
|
|
@ -75,11 +74,89 @@ public sealed class RadialWheelControl : Control
|
||||||
public double OuterRadius { get; set; } = 175.0;
|
public double OuterRadius { get; set; } = 175.0;
|
||||||
public double InnerRadius { get; set; } = 48.0;
|
public double InnerRadius { get; set; } = 48.0;
|
||||||
|
|
||||||
|
// --- Performans ve Akışkanlık İçin Dondurulmuş (Frozen) Grafik Nesneleri ---
|
||||||
|
private static readonly RadialGradientBrush GlowBrush;
|
||||||
|
private static readonly LinearGradientBrush ActiveSegmentBrush;
|
||||||
|
private static readonly Pen ActiveSegmentPen;
|
||||||
|
private static readonly SolidColorBrush DefaultSegmentBrush;
|
||||||
|
private static readonly Pen DefaultSegmentPen;
|
||||||
|
|
||||||
|
private static readonly RadialGradientBrush HubShadowBrush;
|
||||||
|
private static readonly SolidColorBrush HubFillBrush;
|
||||||
|
private static readonly Pen HubBorderPen;
|
||||||
|
|
||||||
|
private static readonly Typeface SegmentTypefaceRegular;
|
||||||
|
private static readonly Typeface SegmentTypefaceBold;
|
||||||
|
private static readonly Typeface HubTitleTypeface;
|
||||||
|
private static readonly Typeface HubSubtitleTypeface;
|
||||||
|
|
||||||
|
private static readonly SolidColorBrush TextWhiteBrush;
|
||||||
|
private static readonly SolidColorBrush TextNormalBrush;
|
||||||
|
private static readonly SolidColorBrush TextSubBrush;
|
||||||
|
|
||||||
static RadialWheelControl()
|
static RadialWheelControl()
|
||||||
{
|
{
|
||||||
DefaultStyleKeyProperty.OverrideMetadata(
|
DefaultStyleKeyProperty.OverrideMetadata(
|
||||||
typeof(RadialWheelControl),
|
typeof(RadialWheelControl),
|
||||||
new FrameworkPropertyMetadata(typeof(RadialWheelControl)));
|
new FrameworkPropertyMetadata(typeof(RadialWheelControl)));
|
||||||
|
|
||||||
|
// Arka plan parlaması (Glow)
|
||||||
|
GlowBrush = new RadialGradientBrush
|
||||||
|
{
|
||||||
|
GradientOrigin = new Point(0.5, 0.5),
|
||||||
|
Center = new Point(0.5, 0.5),
|
||||||
|
RadiusX = 0.5,
|
||||||
|
RadiusY = 0.5
|
||||||
|
};
|
||||||
|
GlowBrush.GradientStops.Add(new GradientStop(Color.FromArgb(40, 99, 102, 241), 0.3));
|
||||||
|
GlowBrush.GradientStops.Add(new GradientStop(Colors.Transparent, 1.0));
|
||||||
|
GlowBrush.Freeze();
|
||||||
|
|
||||||
|
// Aktif dilim fırçası ve kalemi
|
||||||
|
ActiveSegmentBrush = new LinearGradientBrush(
|
||||||
|
Color.FromRgb(99, 102, 241),
|
||||||
|
Color.FromRgb(14, 165, 233),
|
||||||
|
new Point(0, 0),
|
||||||
|
new Point(1, 1));
|
||||||
|
ActiveSegmentBrush.Freeze();
|
||||||
|
|
||||||
|
ActiveSegmentPen = new Pen(new SolidColorBrush(Color.FromArgb(220, 255, 255, 255)), 2.0);
|
||||||
|
ActiveSegmentPen.Brush.Freeze();
|
||||||
|
ActiveSegmentPen.Freeze();
|
||||||
|
|
||||||
|
// Varsayılan dilim fırçası ve kalemi
|
||||||
|
DefaultSegmentBrush = new SolidColorBrush(Color.FromArgb(200, 24, 27, 36));
|
||||||
|
DefaultSegmentBrush.Freeze();
|
||||||
|
|
||||||
|
DefaultSegmentPen = new Pen(new SolidColorBrush(Color.FromArgb(70, 255, 255, 255)), 1.0);
|
||||||
|
DefaultSegmentPen.Brush.Freeze();
|
||||||
|
DefaultSegmentPen.Freeze();
|
||||||
|
|
||||||
|
// Merkez gösterge (Hub)
|
||||||
|
HubShadowBrush = new RadialGradientBrush();
|
||||||
|
HubShadowBrush.GradientStops.Add(new GradientStop(Color.FromArgb(160, 0, 0, 0), 0.7));
|
||||||
|
HubShadowBrush.GradientStops.Add(new GradientStop(Colors.Transparent, 1.0));
|
||||||
|
HubShadowBrush.Freeze();
|
||||||
|
|
||||||
|
HubFillBrush = new SolidColorBrush(Color.FromRgb(18, 20, 28));
|
||||||
|
HubFillBrush.Freeze();
|
||||||
|
|
||||||
|
HubBorderPen = new Pen(new SolidColorBrush(Color.FromArgb(120, 99, 102, 241)), 2.0);
|
||||||
|
HubBorderPen.Brush.Freeze();
|
||||||
|
HubBorderPen.Freeze();
|
||||||
|
|
||||||
|
// Tipografiler
|
||||||
|
SegmentTypefaceRegular = new Typeface(new FontFamily("Segoe UI Variable Display, Segoe UI, Arial"), FontStyles.Normal, FontWeights.SemiBold, FontStretches.Normal);
|
||||||
|
SegmentTypefaceBold = new Typeface(new FontFamily("Segoe UI Variable Display, Segoe UI, Arial"), FontStyles.Normal, FontWeights.Bold, FontStretches.Normal);
|
||||||
|
HubTitleTypeface = new Typeface(new FontFamily("Segoe UI Variable Display, Segoe UI"), FontStyles.Normal, FontWeights.Bold, FontStretches.Normal);
|
||||||
|
HubSubtitleTypeface = new Typeface(new FontFamily("Segoe UI Variable Display, Segoe UI"), FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
|
||||||
|
|
||||||
|
// Metin fırçaları
|
||||||
|
TextWhiteBrush = Brushes.White;
|
||||||
|
TextNormalBrush = new SolidColorBrush(Color.FromRgb(220, 225, 235));
|
||||||
|
TextNormalBrush.Freeze();
|
||||||
|
TextSubBrush = new SolidColorBrush(Color.FromRgb(156, 163, 175));
|
||||||
|
TextSubBrush.Freeze();
|
||||||
}
|
}
|
||||||
|
|
||||||
public RadialWheelControl()
|
public RadialWheelControl()
|
||||||
|
|
@ -109,16 +186,7 @@ public sealed class RadialWheelControl : Control
|
||||||
double gapDegrees = total > 1 ? 2.5 : 0.0;
|
double gapDegrees = total > 1 ? 2.5 : 0.0;
|
||||||
|
|
||||||
// Arka plan parlaması (Glow)
|
// Arka plan parlaması (Glow)
|
||||||
var glowBrush = new RadialGradientBrush
|
dc.DrawEllipse(GlowBrush, null, new Point(centerX, centerY), OuterRadius + 10, OuterRadius + 10);
|
||||||
{
|
|
||||||
GradientOrigin = new Point(0.5, 0.5),
|
|
||||||
Center = new Point(0.5, 0.5),
|
|
||||||
RadiusX = 0.5,
|
|
||||||
RadiusY = 0.5
|
|
||||||
};
|
|
||||||
glowBrush.GradientStops.Add(new GradientStop(Color.FromArgb(40, 99, 102, 241), 0.3));
|
|
||||||
glowBrush.GradientStops.Add(new GradientStop(Colors.Transparent, 1.0));
|
|
||||||
dc.DrawEllipse(glowBrush, null, new Point(centerX, centerY), OuterRadius + 10, OuterRadius + 10);
|
|
||||||
|
|
||||||
// Dilimleri çiz
|
// Dilimleri çiz
|
||||||
for (int i = 0; i < total; i++)
|
for (int i = 0; i < total; i++)
|
||||||
|
|
@ -137,27 +205,8 @@ public sealed class RadialWheelControl : Control
|
||||||
InnerRadius, isHovered ? OuterRadius + 5 : OuterRadius,
|
InnerRadius, isHovered ? OuterRadius + 5 : OuterRadius,
|
||||||
startAngle, sweepAngle);
|
startAngle, sweepAngle);
|
||||||
|
|
||||||
Brush fillBrush;
|
Brush fillBrush = isHovered ? ActiveSegmentBrush : DefaultSegmentBrush;
|
||||||
Pen borderPen;
|
Pen borderPen = isHovered ? ActiveSegmentPen : DefaultSegmentPen;
|
||||||
|
|
||||||
if (isHovered)
|
|
||||||
{
|
|
||||||
// Vurgulu modern gradyan
|
|
||||||
var activeBrush = new LinearGradientBrush
|
|
||||||
{
|
|
||||||
StartPoint = new Point(0, 0),
|
|
||||||
EndPoint = new Point(1, 1)
|
|
||||||
};
|
|
||||||
activeBrush.GradientStops.Add(new GradientStop(Color.FromRgb(99, 102, 241), 0.0)); // Indigo
|
|
||||||
activeBrush.GradientStops.Add(new GradientStop(Color.FromRgb(14, 165, 233), 1.0)); // Sky blue
|
|
||||||
fillBrush = activeBrush;
|
|
||||||
borderPen = new Pen(new SolidColorBrush(Color.FromArgb(220, 255, 255, 255)), 2.0);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fillBrush = new SolidColorBrush(Color.FromArgb(200, 24, 27, 36));
|
|
||||||
borderPen = new Pen(new SolidColorBrush(Color.FromArgb(70, 255, 255, 255)), 1.0);
|
|
||||||
}
|
|
||||||
|
|
||||||
dc.DrawGeometry(fillBrush, borderPen, geom);
|
dc.DrawGeometry(fillBrush, borderPen, geom);
|
||||||
|
|
||||||
|
|
@ -174,10 +223,8 @@ public sealed class RadialWheelControl : Control
|
||||||
|
|
||||||
private void DrawSegmentLabel(DrawingContext dc, string text, double x, double y, bool isHovered)
|
private void DrawSegmentLabel(DrawingContext dc, string text, double x, double y, bool isHovered)
|
||||||
{
|
{
|
||||||
var typeface = new Typeface(new FontFamily("Segoe UI Variable Display, Segoe UI, Arial"),
|
var typeface = isHovered ? SegmentTypefaceBold : SegmentTypefaceRegular;
|
||||||
FontStyles.Normal,
|
var brush = isHovered ? TextWhiteBrush : TextNormalBrush;
|
||||||
isHovered ? FontWeights.Bold : FontWeights.SemiBold,
|
|
||||||
FontStretches.Normal);
|
|
||||||
|
|
||||||
var ft = new FormattedText(
|
var ft = new FormattedText(
|
||||||
text,
|
text,
|
||||||
|
|
@ -185,7 +232,7 @@ public sealed class RadialWheelControl : Control
|
||||||
FlowDirection.LeftToRight,
|
FlowDirection.LeftToRight,
|
||||||
typeface,
|
typeface,
|
||||||
isHovered ? 14 : 12.5,
|
isHovered ? 14 : 12.5,
|
||||||
isHovered ? Brushes.White : new SolidColorBrush(Color.FromRgb(220, 225, 235)),
|
brush,
|
||||||
1.0);
|
1.0);
|
||||||
|
|
||||||
dc.DrawText(ft, new Point(x - (ft.Width / 2.0), y - (ft.Height / 2.0)));
|
dc.DrawText(ft, new Point(x - (ft.Width / 2.0), y - (ft.Height / 2.0)));
|
||||||
|
|
@ -194,15 +241,10 @@ public sealed class RadialWheelControl : Control
|
||||||
private void DrawCenterHub(DrawingContext dc, double centerX, double centerY)
|
private void DrawCenterHub(DrawingContext dc, double centerX, double centerY)
|
||||||
{
|
{
|
||||||
// Merkez gölge
|
// Merkez gölge
|
||||||
var hubShadow = new RadialGradientBrush();
|
dc.DrawEllipse(HubShadowBrush, null, new Point(centerX, centerY), InnerRadius + 6, InnerRadius + 6);
|
||||||
hubShadow.GradientStops.Add(new GradientStop(Color.FromArgb(160, 0, 0, 0), 0.7));
|
|
||||||
hubShadow.GradientStops.Add(new GradientStop(Colors.Transparent, 1.0));
|
|
||||||
dc.DrawEllipse(hubShadow, null, new Point(centerX, centerY), InnerRadius + 6, InnerRadius + 6);
|
|
||||||
|
|
||||||
// Merkez arkaplan
|
// Merkez arkaplan
|
||||||
var hubFill = new SolidColorBrush(Color.FromRgb(18, 20, 28));
|
dc.DrawEllipse(HubFillBrush, HubBorderPen, new Point(centerX, centerY), InnerRadius, InnerRadius);
|
||||||
var hubPen = new Pen(new SolidColorBrush(Color.FromArgb(120, 99, 102, 241)), 2.0);
|
|
||||||
dc.DrawEllipse(hubFill, hubPen, new Point(centerX, centerY), InnerRadius, InnerRadius);
|
|
||||||
|
|
||||||
// Merkez metin
|
// Merkez metin
|
||||||
string centerTitle;
|
string centerTitle;
|
||||||
|
|
@ -220,26 +262,24 @@ public sealed class RadialWheelControl : Control
|
||||||
centerSubtitle = FileCount > 0 ? $"{FileCount} dosya" : "Bırakın";
|
centerSubtitle = FileCount > 0 ? $"{FileCount} dosya" : "Bırakın";
|
||||||
}
|
}
|
||||||
|
|
||||||
var typefaceBold = new Typeface(new FontFamily("Segoe UI Variable Display, Segoe UI"), FontStyles.Normal, FontWeights.Bold, FontStretches.Normal);
|
|
||||||
var titleFt = new FormattedText(
|
var titleFt = new FormattedText(
|
||||||
centerTitle,
|
centerTitle,
|
||||||
CultureInfo.CurrentUICulture,
|
CultureInfo.CurrentUICulture,
|
||||||
FlowDirection.LeftToRight,
|
FlowDirection.LeftToRight,
|
||||||
typefaceBold,
|
HubTitleTypeface,
|
||||||
11.0,
|
11.0,
|
||||||
Brushes.White,
|
TextWhiteBrush,
|
||||||
1.0);
|
1.0);
|
||||||
|
|
||||||
dc.DrawText(titleFt, new Point(centerX - (titleFt.Width / 2.0), centerY - 13));
|
dc.DrawText(titleFt, new Point(centerX - (titleFt.Width / 2.0), centerY - 13));
|
||||||
|
|
||||||
var typefaceRegular = new Typeface(new FontFamily("Segoe UI Variable Display, Segoe UI"), FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
|
|
||||||
var subFt = new FormattedText(
|
var subFt = new FormattedText(
|
||||||
centerSubtitle,
|
centerSubtitle,
|
||||||
CultureInfo.CurrentUICulture,
|
CultureInfo.CurrentUICulture,
|
||||||
FlowDirection.LeftToRight,
|
FlowDirection.LeftToRight,
|
||||||
typefaceRegular,
|
HubSubtitleTypeface,
|
||||||
9.5,
|
9.5,
|
||||||
new SolidColorBrush(Color.FromRgb(156, 163, 175)),
|
TextSubBrush,
|
||||||
1.0);
|
1.0);
|
||||||
|
|
||||||
dc.DrawText(subFt, new Point(centerX - (subFt.Width / 2.0), centerY + 3));
|
dc.DrawText(subFt, new Point(centerX - (subFt.Width / 2.0), centerY + 3));
|
||||||
|
|
@ -272,6 +312,7 @@ public sealed class RadialWheelControl : Control
|
||||||
|
|
||||||
var geom = new PathGeometry();
|
var geom = new PathGeometry();
|
||||||
geom.Figures.Add(figure);
|
geom.Figures.Add(figure);
|
||||||
|
geom.Freeze(); // GPU donanım hızlandırma ve sıfır GC tahsisi için dondur
|
||||||
return geom;
|
return geom;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
<AssemblyName>LDConverter</AssemblyName>
|
<AssemblyName>LDConverter</AssemblyName>
|
||||||
<Product>LD Converter</Product>
|
<Product>LD Converter</Product>
|
||||||
<Title>LD Converter</Title>
|
<Title>LD Converter</Title>
|
||||||
<Version>1.1.0</Version>
|
<Version>1.2.0</Version>
|
||||||
<ApplicationIcon>Assets\app.ico</ApplicationIcon>
|
<ApplicationIcon>Assets\app.ico</ApplicationIcon>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
|
|
|
||||||
|
|
@ -210,21 +210,37 @@ public partial class MainWindow : Window
|
||||||
EmptyPrompt.Visibility = Visibility.Collapsed;
|
EmptyPrompt.Visibility = Visibility.Collapsed;
|
||||||
SelectedFilesPanel.Visibility = Visibility.Visible;
|
SelectedFilesPanel.Visibility = Visibility.Visible;
|
||||||
|
|
||||||
long totalBytes = FileUtils.CalculateTotalBytes(_selectedFiles);
|
|
||||||
FilesCountLabel.Text = _selectedFiles.Count == 1
|
FilesCountLabel.Text = _selectedFiles.Count == 1
|
||||||
? Path.GetFileName(_selectedFiles[0].TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar))
|
? Path.GetFileName(_selectedFiles[0].TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar))
|
||||||
: $"{_selectedFiles.Count} öğe seçildi";
|
: $"{_selectedFiles.Count} öğe seçildi";
|
||||||
|
|
||||||
FilesSubLabel.Text = $"Toplam Boyut: {FileUtils.FormatBytes(totalBytes)}";
|
FilesSubLabel.Text = "Boyut hesaplanıyor...";
|
||||||
|
|
||||||
RenderSelectedFileItems();
|
RenderSelectedFileItems();
|
||||||
RebuildFormatChips();
|
RebuildFormatChips();
|
||||||
|
|
||||||
|
// Toplam boyutu arka planda hesaplayarak UI'ı anında akıcı tut
|
||||||
|
var filesToMeasure = _selectedFiles.ToList();
|
||||||
|
Task.Run(() =>
|
||||||
|
{
|
||||||
|
long totalBytes = FileUtils.CalculateTotalBytes(filesToMeasure);
|
||||||
|
Dispatcher.BeginInvoke(() =>
|
||||||
|
{
|
||||||
|
if (_selectedFiles.Count == filesToMeasure.Count)
|
||||||
|
{
|
||||||
|
FilesSubLabel.Text = $"Toplam Boyut: {FileUtils.FormatBytes(totalBytes)}";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RenderSelectedFileItems()
|
private void RenderSelectedFileItems()
|
||||||
{
|
{
|
||||||
SelectedFileItemsStack.Children.Clear();
|
SelectedFileItemsStack.Children.Clear();
|
||||||
foreach (var filePath in _selectedFiles)
|
int maxVisible = 25;
|
||||||
|
var displayItems = _selectedFiles.Take(maxVisible).ToList();
|
||||||
|
|
||||||
|
foreach (var filePath in displayItems)
|
||||||
{
|
{
|
||||||
var row = new Border
|
var row = new Border
|
||||||
{
|
{
|
||||||
|
|
@ -256,10 +272,27 @@ public partial class MainWindow : Window
|
||||||
DockPanel.SetDock(removeBtn, Dock.Right);
|
DockPanel.SetDock(removeBtn, Dock.Right);
|
||||||
dock.Children.Add(removeBtn);
|
dock.Children.Add(removeBtn);
|
||||||
|
|
||||||
long itemSize = FileUtils.CalculateTotalBytes(new[] { filePath });
|
bool isDir = Directory.Exists(filePath);
|
||||||
|
string sizeStr;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (!isDir && File.Exists(filePath))
|
||||||
|
{
|
||||||
|
sizeStr = FileUtils.FormatBytes(new FileInfo(filePath).Length);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sizeStr = "Klasör";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
sizeStr = "-";
|
||||||
|
}
|
||||||
|
|
||||||
var sizeText = new TextBlock
|
var sizeText = new TextBlock
|
||||||
{
|
{
|
||||||
Text = FileUtils.FormatBytes(itemSize),
|
Text = sizeStr,
|
||||||
FontSize = 11,
|
FontSize = 11,
|
||||||
Foreground = new SolidColorBrush(Color.FromRgb(107, 114, 128)),
|
Foreground = new SolidColorBrush(Color.FromRgb(107, 114, 128)),
|
||||||
VerticalAlignment = VerticalAlignment.Center,
|
VerticalAlignment = VerticalAlignment.Center,
|
||||||
|
|
@ -268,7 +301,6 @@ public partial class MainWindow : Window
|
||||||
DockPanel.SetDock(sizeText, Dock.Right);
|
DockPanel.SetDock(sizeText, Dock.Right);
|
||||||
dock.Children.Add(sizeText);
|
dock.Children.Add(sizeText);
|
||||||
|
|
||||||
bool isDir = Directory.Exists(filePath);
|
|
||||||
string displayName = Path.GetFileName(filePath.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar));
|
string displayName = Path.GetFileName(filePath.TrimEnd(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar));
|
||||||
var nameText = new TextBlock
|
var nameText = new TextBlock
|
||||||
{
|
{
|
||||||
|
|
@ -284,6 +316,26 @@ public partial class MainWindow : Window
|
||||||
row.Child = dock;
|
row.Child = dock;
|
||||||
SelectedFileItemsStack.Children.Add(row);
|
SelectedFileItemsStack.Children.Add(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_selectedFiles.Count > maxVisible)
|
||||||
|
{
|
||||||
|
var moreBadge = new Border
|
||||||
|
{
|
||||||
|
Background = new SolidColorBrush(Color.FromArgb(50, 99, 102, 241)),
|
||||||
|
CornerRadius = new CornerRadius(6),
|
||||||
|
Padding = new Thickness(10, 6, 10, 6),
|
||||||
|
Margin = new Thickness(0, 2, 0, 0),
|
||||||
|
HorizontalAlignment = HorizontalAlignment.Center
|
||||||
|
};
|
||||||
|
moreBadge.Child = new TextBlock
|
||||||
|
{
|
||||||
|
Text = $"+ {_selectedFiles.Count - maxVisible} dosya daha seçili",
|
||||||
|
FontSize = 11.5,
|
||||||
|
FontWeight = FontWeights.SemiBold,
|
||||||
|
Foreground = new SolidColorBrush(Color.FromRgb(165, 180, 252))
|
||||||
|
};
|
||||||
|
SelectedFileItemsStack.Children.Add(moreBadge);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RebuildFormatChips()
|
private void RebuildFormatChips()
|
||||||
|
|
@ -352,13 +404,10 @@ public partial class MainWindow : Window
|
||||||
CurrentTaskStatusLabel.Text = $"{_selectedTool.DisplayName} işleniyor...";
|
CurrentTaskStatusLabel.Text = $"{_selectedTool.DisplayName} işleniyor...";
|
||||||
|
|
||||||
var progress = new Progress<double>(val =>
|
var progress = new Progress<double>(val =>
|
||||||
{
|
|
||||||
Dispatcher.Invoke(() =>
|
|
||||||
{
|
{
|
||||||
MainProgressBar.Value = val;
|
MainProgressBar.Value = val;
|
||||||
CurrentTaskStatusLabel.Text = $"{_selectedTool.DisplayName} işleniyor (%{val:F0})...";
|
CurrentTaskStatusLabel.Text = $"{_selectedTool.DisplayName} işleniyor (%{val:F0})...";
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
var task = new ConversionTask
|
var task = new ConversionTask
|
||||||
{
|
{
|
||||||
|
|
@ -532,7 +581,7 @@ public partial class MainWindow : Window
|
||||||
};
|
};
|
||||||
|
|
||||||
string? firstOut = entry.OutputFiles.FirstOrDefault();
|
string? firstOut = entry.OutputFiles.FirstOrDefault();
|
||||||
if (!string.IsNullOrWhiteSpace(firstOut) && (File.Exists(firstOut) || Directory.Exists(firstOut)))
|
if (!string.IsNullOrWhiteSpace(firstOut))
|
||||||
{
|
{
|
||||||
var openFolderBtn = new Button
|
var openFolderBtn = new Button
|
||||||
{
|
{
|
||||||
|
|
@ -546,7 +595,17 @@ public partial class MainWindow : Window
|
||||||
BorderThickness = new Thickness(0)
|
BorderThickness = new Thickness(0)
|
||||||
};
|
};
|
||||||
string targetPath = firstOut;
|
string targetPath = firstOut;
|
||||||
openFolderBtn.Click += (_, _) => DesktopGeometry.RevealInExplorer(targetPath);
|
openFolderBtn.Click += (_, _) =>
|
||||||
|
{
|
||||||
|
if (File.Exists(targetPath) || Directory.Exists(targetPath))
|
||||||
|
{
|
||||||
|
DesktopGeometry.RevealInExplorer(targetPath);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
MessageBox.Show("Hedef dosya veya klasör artık mevcut değil.", "Bilgi", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
|
}
|
||||||
|
};
|
||||||
btnStack.Children.Add(openFolderBtn);
|
btnStack.Children.Add(openFolderBtn);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
using System.Threading;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
|
|
@ -19,6 +20,9 @@ public sealed class GlobalDragController : IDisposable
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
private static extern IntPtr GetForegroundWindow();
|
private static extern IntPtr GetForegroundWindow();
|
||||||
|
|
||||||
|
[DllImport("user32.dll")]
|
||||||
|
private static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
public struct POINT { public int X; public int Y; }
|
public struct POINT { public int X; public int Y; }
|
||||||
|
|
||||||
|
|
@ -31,32 +35,39 @@ public sealed class GlobalDragController : IDisposable
|
||||||
|
|
||||||
private readonly PreferencesStore _preferencesStore;
|
private readonly PreferencesStore _preferencesStore;
|
||||||
private readonly Action<ToolChoice, IReadOnlyList<string>> _onDropped;
|
private readonly Action<ToolChoice, IReadOnlyList<string>> _onDropped;
|
||||||
private readonly DispatcherTimer _pollTimer;
|
private readonly System.Threading.Timer _backgroundTimer;
|
||||||
|
|
||||||
private bool _isDragging;
|
private bool _isDragging;
|
||||||
private bool _suppressedForCurrentDrag;
|
private bool _suppressedForCurrentDrag;
|
||||||
private POINT _dragStartPos;
|
private POINT _dragStartPos;
|
||||||
private WheelWindow? _activeWheel;
|
private WheelWindow? _activeWheel;
|
||||||
|
private IntPtr _activeWheelHwnd = IntPtr.Zero;
|
||||||
|
private int _isDispatchingPos;
|
||||||
|
private bool _isDisposed;
|
||||||
|
|
||||||
public GlobalDragController(PreferencesStore preferencesStore, Action<ToolChoice, IReadOnlyList<string>> onDropped)
|
public GlobalDragController(PreferencesStore preferencesStore, Action<ToolChoice, IReadOnlyList<string>> onDropped)
|
||||||
{
|
{
|
||||||
_preferencesStore = preferencesStore;
|
_preferencesStore = preferencesStore;
|
||||||
_onDropped = onDropped;
|
_onDropped = onDropped;
|
||||||
|
|
||||||
// 30 ms (~33 FPS) sorgulama aralığı: CPU kullanımı %0.01 seviyesindedir.
|
// UI iş parçacığını asla meşgul etmeyen, arka plan iş parçacığı zamanlayıcısı (25ms ~ 40Hz)
|
||||||
_pollTimer = new DispatcherTimer { Interval = TimeSpan.FromMilliseconds(30) };
|
_backgroundTimer = new System.Threading.Timer(OnBackgroundTick, null, 25, 25);
|
||||||
_pollTimer.Tick += OnPollTick;
|
|
||||||
_pollTimer.Start();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPollTick(object? sender, EventArgs e)
|
private void OnBackgroundTick(object? state)
|
||||||
{
|
{
|
||||||
|
if (_isDisposed) return;
|
||||||
|
|
||||||
if (!_preferencesStore.Current.Enabled)
|
if (!_preferencesStore.Current.Enabled)
|
||||||
{
|
{
|
||||||
if (_activeWheel != null)
|
if (_activeWheel != null)
|
||||||
{
|
{
|
||||||
_activeWheel.CancelAndClose();
|
DispatchToUi(() =>
|
||||||
|
{
|
||||||
|
_activeWheel?.CancelAndClose();
|
||||||
_activeWheel = null;
|
_activeWheel = null;
|
||||||
|
_activeWheelHwnd = IntPtr.Zero;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
_isDragging = false;
|
_isDragging = false;
|
||||||
_suppressedForCurrentDrag = false;
|
_suppressedForCurrentDrag = false;
|
||||||
|
|
@ -70,8 +81,12 @@ public sealed class GlobalDragController : IDisposable
|
||||||
// Sağ tık veya ESC ile çarkı iptal et
|
// Sağ tık veya ESC ile çarkı iptal et
|
||||||
if (_activeWheel != null && (rightDown || escapeDown))
|
if (_activeWheel != null && (rightDown || escapeDown))
|
||||||
{
|
{
|
||||||
_activeWheel.CancelAndClose();
|
DispatchToUi(() =>
|
||||||
|
{
|
||||||
|
_activeWheel?.CancelAndClose();
|
||||||
_activeWheel = null;
|
_activeWheel = null;
|
||||||
|
_activeWheelHwnd = IntPtr.Zero;
|
||||||
|
});
|
||||||
_suppressedForCurrentDrag = true;
|
_suppressedForCurrentDrag = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -82,10 +97,17 @@ public sealed class GlobalDragController : IDisposable
|
||||||
{
|
{
|
||||||
_isDragging = false;
|
_isDragging = false;
|
||||||
_suppressedForCurrentDrag = false;
|
_suppressedForCurrentDrag = false;
|
||||||
|
if (_activeWheel != null)
|
||||||
|
{
|
||||||
|
DispatchToUi(() =>
|
||||||
|
{
|
||||||
if (_activeWheel != null)
|
if (_activeWheel != null)
|
||||||
{
|
{
|
||||||
_activeWheel.ExecuteSelectionAndClose();
|
_activeWheel.ExecuteSelectionAndClose();
|
||||||
_activeWheel = null;
|
_activeWheel = null;
|
||||||
|
_activeWheelHwnd = IntPtr.Zero;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
@ -97,7 +119,7 @@ public sealed class GlobalDragController : IDisposable
|
||||||
{
|
{
|
||||||
_dragStartPos = currentPoint;
|
_dragStartPos = currentPoint;
|
||||||
_isDragging = true;
|
_isDragging = true;
|
||||||
_suppressedForCurrentDrag = IsOwnWindowForeground();
|
_suppressedForCurrentDrag = IsOwnWindowForeground(_activeWheelHwnd);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -115,48 +137,62 @@ public sealed class GlobalDragController : IDisposable
|
||||||
|
|
||||||
if (modifierPressed && _activeWheel == null)
|
if (modifierPressed && _activeWheel == null)
|
||||||
{
|
{
|
||||||
OpenWheel(currentPoint);
|
DispatchToUi(() => OpenWheel(currentPoint));
|
||||||
}
|
}
|
||||||
else if (_activeWheel != null)
|
else if (_activeWheel != null)
|
||||||
{
|
{
|
||||||
|
var wheel = _activeWheel;
|
||||||
// Eğer çark açıldıktan 350ms sonra hâlâ geçerli bir dosya sürüklemesi (OLE FileDrop)
|
// Eğer çark açıldıktan 350ms sonra hâlâ geçerli bir dosya sürüklemesi (OLE FileDrop)
|
||||||
// algılanmadıysa (örneğin kullanıcı metin seçiyorsa), çarkı sessizce kapat.
|
// algılanmadıysa (örneğin kullanıcı metin seçiyorsa), çarkı sessizce kapat.
|
||||||
if (!_activeWheel.HasValidFileDrag &&
|
if (!wheel.HasValidFileDrag && (DateTime.UtcNow - wheel.OpenedAtUtc).TotalMilliseconds > 350)
|
||||||
(DateTime.UtcNow - _activeWheel.OpenedAtUtc).TotalMilliseconds > 350)
|
{
|
||||||
|
DispatchToUi(() =>
|
||||||
|
{
|
||||||
|
wheel.CancelAndClose();
|
||||||
|
if (_activeWheel == wheel)
|
||||||
{
|
{
|
||||||
_activeWheel.CancelAndClose();
|
|
||||||
_activeWheel = null;
|
_activeWheel = null;
|
||||||
|
_activeWheelHwnd = IntPtr.Zero;
|
||||||
|
}
|
||||||
|
});
|
||||||
_suppressedForCurrentDrag = true;
|
_suppressedForCurrentDrag = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
_activeWheel.UpdateMousePosition(new Point(currentPoint.X, currentPoint.Y));
|
// Fare konumu güncellemesini Dispatcher kuyruğunu şişirmeden (rate-limit) gönder
|
||||||
|
if (Interlocked.CompareExchange(ref _isDispatchingPos, 1, 0) == 0)
|
||||||
|
{
|
||||||
|
DispatchToUi(() =>
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
wheel.UpdateMousePosition(new Point(currentPoint.X, currentPoint.Y));
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Interlocked.Exchange(ref _isDispatchingPos, 0);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool IsOwnWindowForeground()
|
private static bool IsOwnWindowForeground(IntPtr activeWheelHwnd)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
IntPtr fg = GetForegroundWindow();
|
IntPtr fg = GetForegroundWindow();
|
||||||
if (fg == IntPtr.Zero || Application.Current == null) return false;
|
if (fg == IntPtr.Zero) return false;
|
||||||
|
if (activeWheelHwnd != IntPtr.Zero && fg == activeWheelHwnd) return false;
|
||||||
|
|
||||||
foreach (Window win in Application.Current.Windows)
|
GetWindowThreadProcessId(fg, out uint procId);
|
||||||
{
|
return procId == (uint)Environment.ProcessId;
|
||||||
if (win is WheelWindow) continue;
|
|
||||||
var hwnd = new WindowInteropHelper(win).Handle;
|
|
||||||
if (hwnd != IntPtr.Zero && hwnd == fg)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
// Hata durumunda engelleme
|
|
||||||
}
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private static bool CheckModifierPressed(string modifier)
|
private static bool CheckModifierPressed(string modifier)
|
||||||
{
|
{
|
||||||
|
|
@ -173,18 +209,53 @@ public sealed class GlobalDragController : IDisposable
|
||||||
|
|
||||||
private void OpenWheel(POINT screenPoint)
|
private void OpenWheel(POINT screenPoint)
|
||||||
{
|
{
|
||||||
|
if (_activeWheel != null) return;
|
||||||
|
|
||||||
var prefs = _preferencesStore.Current;
|
var prefs = _preferencesStore.Current;
|
||||||
_activeWheel = new WheelWindow(_onDropped, prefs.SoundEffectsEnabled, prefs.WheelScale);
|
var wheel = new WheelWindow(_onDropped, prefs.SoundEffectsEnabled, prefs.WheelScale);
|
||||||
|
_activeWheel = wheel;
|
||||||
|
|
||||||
// Çarkı farenin tam merkezine konumlandır
|
// Çarkı farenin tam merkezine konumlandır
|
||||||
DesktopGeometry.PlaceCentered(_activeWheel, screenPoint.X, screenPoint.Y);
|
DesktopGeometry.PlaceCentered(wheel, screenPoint.X, screenPoint.Y);
|
||||||
_activeWheel.Show();
|
wheel.Show();
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
_activeWheelHwnd = new WindowInteropHelper(wheel).Handle;
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
_activeWheelHwnd = IntPtr.Zero;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void DispatchToUi(Action action)
|
||||||
|
{
|
||||||
|
var app = Application.Current;
|
||||||
|
if (app == null || app.Dispatcher.HasShutdownStarted || app.Dispatcher.HasShutdownFinished) return;
|
||||||
|
|
||||||
|
if (app.Dispatcher.CheckAccess())
|
||||||
|
{
|
||||||
|
action();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
app.Dispatcher.BeginInvoke(DispatcherPriority.Normal, action);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
_pollTimer.Stop();
|
if (_isDisposed) return;
|
||||||
|
_isDisposed = true;
|
||||||
|
|
||||||
|
_backgroundTimer.Dispose();
|
||||||
|
|
||||||
|
DispatchToUi(() =>
|
||||||
|
{
|
||||||
_activeWheel?.CancelAndClose();
|
_activeWheel?.CancelAndClose();
|
||||||
_activeWheel = null;
|
_activeWheel = null;
|
||||||
|
_activeWheelHwnd = IntPtr.Zero;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@ public sealed class SingleInstance : IDisposable
|
||||||
string? msg = await reader.ReadLineAsync(_pipeCts.Token);
|
string? msg = await reader.ReadLineAsync(_pipeCts.Token);
|
||||||
if (string.IsNullOrWhiteSpace(msg)) continue;
|
if (string.IsNullOrWhiteSpace(msg)) continue;
|
||||||
|
|
||||||
System.Windows.Application.Current?.Dispatcher.Invoke(() =>
|
System.Windows.Application.Current?.Dispatcher.BeginInvoke(() =>
|
||||||
{
|
{
|
||||||
if (msg.StartsWith("FILES|", StringComparison.Ordinal))
|
if (msg.StartsWith("FILES|", StringComparison.Ordinal))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,8 @@ namespace Donustur.UI.Services;
|
||||||
public static class SoundFeedback
|
public static class SoundFeedback
|
||||||
{
|
{
|
||||||
public static void PlayTick()
|
public static void PlayTick()
|
||||||
|
{
|
||||||
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -12,9 +14,12 @@ public static class SoundFeedback
|
||||||
{
|
{
|
||||||
// Ses çalınamazsa sessizce geç
|
// Ses çalınamazsa sessizce geç
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void PlaySuccess()
|
public static void PlaySuccess()
|
||||||
|
{
|
||||||
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -24,5 +29,6 @@ public static class SoundFeedback
|
||||||
{
|
{
|
||||||
// Sessizce geç
|
// Sessizce geç
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,25 +55,46 @@ public partial class ProgressToastWindow : Window
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static readonly System.Windows.Media.SolidColorBrush CompletedGreenBrush;
|
||||||
|
|
||||||
|
static ProgressToastWindow()
|
||||||
|
{
|
||||||
|
CompletedGreenBrush = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(16, 185, 129));
|
||||||
|
CompletedGreenBrush.Freeze();
|
||||||
|
}
|
||||||
|
|
||||||
public void UpdateProgress(double percent, string? status = null)
|
public void UpdateProgress(double percent, string? status = null)
|
||||||
{
|
{
|
||||||
Dispatcher.Invoke(() =>
|
if (Dispatcher.HasShutdownStarted || Dispatcher.HasShutdownFinished) return;
|
||||||
|
|
||||||
|
void Apply()
|
||||||
{
|
{
|
||||||
ProgressBar.Value = percent;
|
ProgressBar.Value = percent;
|
||||||
if (!string.IsNullOrWhiteSpace(status))
|
if (!string.IsNullOrWhiteSpace(status))
|
||||||
{
|
{
|
||||||
StatusText.Text = status;
|
StatusText.Text = status;
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
if (Dispatcher.CheckAccess())
|
||||||
|
{
|
||||||
|
Apply();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)Apply);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetCompleted(IReadOnlyList<string> outputFiles, string? decodedText = null)
|
public void SetCompleted(IReadOnlyList<string> outputFiles, string? decodedText = null)
|
||||||
{
|
{
|
||||||
Dispatcher.Invoke(() =>
|
if (Dispatcher.HasShutdownStarted || Dispatcher.HasShutdownFinished) return;
|
||||||
|
|
||||||
|
void Apply()
|
||||||
{
|
{
|
||||||
_isCompletedOrFailed = true;
|
_isCompletedOrFailed = true;
|
||||||
ProgressBar.Value = 100;
|
ProgressBar.Value = 100;
|
||||||
ProgressBar.Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromRgb(16, 185, 129));
|
ProgressBar.Foreground = CompletedGreenBrush;
|
||||||
TitleText.Text = "✓ Dönüştürme Tamamlandı";
|
TitleText.Text = "✓ Dönüştürme Tamamlandı";
|
||||||
|
|
||||||
if (!string.IsNullOrWhiteSpace(decodedText))
|
if (!string.IsNullOrWhiteSpace(decodedText))
|
||||||
|
|
@ -97,12 +118,23 @@ public partial class ProgressToastWindow : Window
|
||||||
}
|
}
|
||||||
|
|
||||||
_autoCloseTimer.Start();
|
_autoCloseTimer.Start();
|
||||||
});
|
}
|
||||||
|
|
||||||
|
if (Dispatcher.CheckAccess())
|
||||||
|
{
|
||||||
|
Apply();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)Apply);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetFailed(string error)
|
public void SetFailed(string error)
|
||||||
{
|
{
|
||||||
Dispatcher.Invoke(() =>
|
if (Dispatcher.HasShutdownStarted || Dispatcher.HasShutdownFinished) return;
|
||||||
|
|
||||||
|
void Apply()
|
||||||
{
|
{
|
||||||
_isCompletedOrFailed = true;
|
_isCompletedOrFailed = true;
|
||||||
TitleText.Text = "✕ İşlem Tamamlanamadı";
|
TitleText.Text = "✕ İşlem Tamamlanamadı";
|
||||||
|
|
@ -110,7 +142,16 @@ public partial class ProgressToastWindow : Window
|
||||||
StatusText.Text = error;
|
StatusText.Text = error;
|
||||||
ProgressBar.Visibility = Visibility.Collapsed;
|
ProgressBar.Visibility = Visibility.Collapsed;
|
||||||
_autoCloseTimer.Start();
|
_autoCloseTimer.Start();
|
||||||
});
|
}
|
||||||
|
|
||||||
|
if (Dispatcher.CheckAccess())
|
||||||
|
{
|
||||||
|
Apply();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Dispatcher.BeginInvoke(DispatcherPriority.Normal, (Action)Apply);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnCloseClick(object sender, RoutedEventArgs e)
|
private void OnCloseClick(object sender, RoutedEventArgs e)
|
||||||
|
|
|
||||||
|
|
@ -66,11 +66,28 @@ public partial class SettingsWindow : Window
|
||||||
CustomFolderText.Text = prefs.CustomOutputDirectory;
|
CustomFolderText.Text = prefs.CustomOutputDirectory;
|
||||||
CustomFolderPanel.Visibility = OutputModeCombo.SelectedIndex == 2 ? Visibility.Visible : Visibility.Collapsed;
|
CustomFolderPanel.Visibility = OutputModeCombo.SelectedIndex == 2 ? Visibility.Visible : Visibility.Collapsed;
|
||||||
|
|
||||||
// Harici Motor Kontrolleri
|
// Harici Motor Kontrolleri (UI thread'i kilitlememesi için arka planda tara)
|
||||||
var officeEngine = new OfficeDocumentEngine(prefs.CustomLibreOfficePath);
|
LibreOfficeStatusText.Text = "ℹ Kontrol ediliyor...";
|
||||||
if (officeEngine.IsAvailable)
|
FfmpegStatusText.Text = "ℹ Kontrol ediliyor...";
|
||||||
|
NativeEnginesStatusText.Text = "✓ Magick.NET, PdfPig ve SharpCompress hazır";
|
||||||
|
|
||||||
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
LibreOfficeStatusText.Text = $"✓ Hazır ({officeEngine.ResolveSofficePath()})";
|
var officeEngine = new OfficeDocumentEngine(prefs.CustomLibreOfficePath);
|
||||||
|
bool officeAvailable = officeEngine.IsAvailable;
|
||||||
|
string? sofficePath = officeAvailable ? officeEngine.ResolveSofficePath() : null;
|
||||||
|
|
||||||
|
var mediaEngine = new MediaEngine(prefs.CustomFfmpegPath);
|
||||||
|
bool mediaAvailable = mediaEngine.IsAvailable;
|
||||||
|
string? ffmpegPath = mediaAvailable ? mediaEngine.ResolveFfmpegPath() : null;
|
||||||
|
|
||||||
|
string? sevenZip = ArchiveEngine.Resolve7ZipPath();
|
||||||
|
|
||||||
|
Dispatcher.BeginInvoke(() =>
|
||||||
|
{
|
||||||
|
if (officeAvailable)
|
||||||
|
{
|
||||||
|
LibreOfficeStatusText.Text = $"✓ Hazır ({sofficePath})";
|
||||||
LibreOfficeStatusText.Foreground = System.Windows.Media.Brushes.LightGreen;
|
LibreOfficeStatusText.Foreground = System.Windows.Media.Brushes.LightGreen;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -79,10 +96,9 @@ public partial class SettingsWindow : Window
|
||||||
LibreOfficeStatusText.Foreground = System.Windows.Media.Brushes.Khaki;
|
LibreOfficeStatusText.Foreground = System.Windows.Media.Brushes.Khaki;
|
||||||
}
|
}
|
||||||
|
|
||||||
var mediaEngine = new MediaEngine(prefs.CustomFfmpegPath);
|
if (mediaAvailable)
|
||||||
if (mediaEngine.IsAvailable)
|
|
||||||
{
|
{
|
||||||
FfmpegStatusText.Text = $"✓ Hazır ({mediaEngine.ResolveFfmpegPath()})";
|
FfmpegStatusText.Text = $"✓ Hazır ({ffmpegPath})";
|
||||||
FfmpegStatusText.Foreground = System.Windows.Media.Brushes.LightGreen;
|
FfmpegStatusText.Foreground = System.Windows.Media.Brushes.LightGreen;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
@ -91,10 +107,11 @@ public partial class SettingsWindow : Window
|
||||||
FfmpegStatusText.Foreground = System.Windows.Media.Brushes.IndianRed;
|
FfmpegStatusText.Foreground = System.Windows.Media.Brushes.IndianRed;
|
||||||
}
|
}
|
||||||
|
|
||||||
string? sevenZip = ArchiveEngine.Resolve7ZipPath();
|
|
||||||
NativeEnginesStatusText.Text = sevenZip != null
|
NativeEnginesStatusText.Text = sevenZip != null
|
||||||
? $"✓ Magick.NET, PdfPig, SharpCompress ve 7-Zip ({sevenZip}) hazır"
|
? $"✓ Magick.NET, PdfPig, SharpCompress ve 7-Zip ({sevenZip}) hazır"
|
||||||
: "✓ Magick.NET, PdfPig ve SharpCompress hazır (ZIP, TAR.GZ, Görsel, PDF, DOCX, QR)";
|
: "✓ Magick.NET, PdfPig ve SharpCompress hazır (ZIP, TAR.GZ, Görsel, PDF, DOCX, QR)";
|
||||||
|
});
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnScaleSliderChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
private void OnScaleSliderChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue