Skip to content

Commit ce75477

Browse files
author
Carl Chang
committed
bug fix
1 parent ab3ce47 commit ce75477

File tree

3 files changed

+14
-10
lines changed

3 files changed

+14
-10
lines changed

Helpers/Setting.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -194,8 +194,7 @@ public static void LoadConfigFromFile(string path = "config.ini") {
194194
LastWindowSize = ParseConfig(iniData, nameof(LastWindowSize), LastWindowSize);
195195
LastPath = ParseConfig(iniData, nameof(LastPath), LastPath);
196196
LiteMode = ParseConfig(iniData, nameof(LiteMode), LiteMode);
197-
198-
SlideAnimConfig = Newtonsoft.Json.JsonConvert.DeserializeObject<SlideAnimConfig>(iniData["App Config"][nameof(SlideAnimConfig)]);
197+
SlideAnimConfig = ParseConfig(iniData, nameof(SlideAnimConfig), SlideAnimConfig);
199198

200199
//parse custom commands
201200
CustomCommands = new ObservableCollection<ObservableObj>();
@@ -282,6 +281,9 @@ private static T ParseConfig<T>(IniData iniData, string key, T defaultVal) {
282281
TransitionSpeed ts;
283282
if (Enum.TryParse(value, out ts)) result = ts;
284283
break;
284+
case SlideAnimConfig _:
285+
result = Newtonsoft.Json.JsonConvert.DeserializeObject<SlideAnimConfig>(iniData["App Config"][nameof(SlideAnimConfig)]);
286+
break;
285287
}
286288
return (T)result;
287289
}

UserControls/Thumbnail.xaml.cs

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,13 @@ private async void cycleImageSource(object sender, EventArgs e) {
177177
await Task.Run(() => UpdateSourcePaths(objInfo));
178178
}
179179

180+
//wait to get image
181+
if (Interlocked.CompareExchange(ref workingThreads, 0, 0) >= MaxLoadThreads) {
182+
tn.cycleTimer.Interval = TimeSpan.FromMilliseconds(200);
183+
tn.cycleTimer.Start();
184+
return;
185+
}
186+
Interlocked.Increment(ref workingThreads);
180187
//get the next path index to use
181188
var cycle = false;
182189
if (tn.ObjectInfo.SourcePaths?.Length > 1) {
@@ -185,14 +192,6 @@ private async void cycleImageSource(object sender, EventArgs e) {
185192
}
186193
else
187194
tn.thumbIndex = 0;
188-
189-
//wait to get image
190-
if (Interlocked.CompareExchange(ref workingThreads, 0, 0) >= MaxLoadThreads) {
191-
tn.cycleTimer.Interval = TimeSpan.FromMilliseconds(200);
192-
tn.cycleTimer.Start();
193-
return;
194-
}
195-
Interlocked.Increment(ref workingThreads);
196195
tn.ThumbImageSource = await GetImageSourceAsync(tn.ObjectInfo, tn.thumbIndex, decodeSize: (SizeInt)Setting.ThumbnailSize);
197196
Interlocked.Decrement(ref workingThreads);
198197

ViewWindow.xaml.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,9 @@ private void ViewWindow_Loaded(object sender, RoutedEventArgs e) {
9797
Width = mainWin.lastViewWindowRect.Width;
9898
Height = mainWin.lastViewWindowRect.Height;
9999
}
100+
else {
101+
WindowState = WindowState.Maximized;
102+
}
100103
}
101104
if (Setting.ImmersionMode)
102105
Helpers.SwitchFullScreen(this, ref mainWin.lastViewWindowRect, true);

0 commit comments

Comments
 (0)