diff --git a/Pixeval.sln.DotSettings b/Pixeval.sln.DotSettings new file mode 100644 index 00000000..77e3c871 --- /dev/null +++ b/Pixeval.sln.DotSettings @@ -0,0 +1,2 @@ + + True \ No newline at end of file diff --git a/src/Pixeval.Interchange/Program.cs b/src/Pixeval.Interchange/Program.cs index 5df64475..f4afeb7b 100644 --- a/src/Pixeval.Interchange/Program.cs +++ b/src/Pixeval.Interchange/Program.cs @@ -60,7 +60,6 @@ namespace Pixeval.Interchange } } } - private static bool PixevalInstanceRunning() { return Process.GetProcessesByName("Pixeval").Length > 0; diff --git a/src/Pixeval/App.xaml b/src/Pixeval/App.xaml index 45c9c496..fb4a756c 100644 --- a/src/Pixeval/App.xaml +++ b/src/Pixeval/App.xaml @@ -15,7 +15,8 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see .--> -.--> - - - - + + + + 2 + @@ -49,6 +49,7 @@ along with this program. If not, see .--> + - - + - + + ToolTip="{Binding Path=(i18N:AkaI18N.IllustBrowserViewInBrowser)}" /> - + ToolTip="{Binding Path=(i18N:AkaI18N.IllustBrowserDownload)}" /> - + ToolTip="{Binding Path=(i18N:AkaI18N.IllustBrowserPrivateBookmark)}" /> - - @@ -1681,14 +2276,20 @@ along with this program. If not, see .--> - - + diff --git a/src/Pixeval/UI/MainWindow.xaml.cs b/src/Pixeval/UI/MainWindow.xaml.cs index 7194a58d..c9d3f9b9 100644 --- a/src/Pixeval/UI/MainWindow.xaml.cs +++ b/src/Pixeval/UI/MainWindow.xaml.cs @@ -19,10 +19,8 @@ #endregion using System; -using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.ObjectModel; -using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; @@ -73,9 +71,6 @@ namespace Pixeval.UI IgnoreDuplicate = true }; - private readonly ConcurrentDictionary dataContextHolder = - new ConcurrentDictionary(); - public MainWindow() { Instance = this; @@ -85,9 +80,6 @@ namespace Pixeval.UI if (Dispatcher != null) Dispatcher.UnhandledException += Dispatcher_UnhandledException; - var property = DependencyPropertyDescriptor.FromProperty(ItemsControl.ItemsSourceProperty, typeof(ListBox)); - property?.AddValueChanged(ImageListView, (sender, args) => dataContextHolder.Clear()); - #pragma warning disable 4014 AcquireRecommendUser(); #pragma warning restore 4014 @@ -266,7 +258,6 @@ namespace Pixeval.UI private void RecommendIllustratorContainer_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { SetUserBrowserContext(sender.GetDataContext()); - OpenUserBrowser(); } private async void MainWindow_OnKeyDown(object sender, KeyEventArgs e) @@ -557,8 +548,8 @@ namespace Pixeval.UI if (dataContext != null && Uri.IsWellFormedUriString(dataContext.Thumbnail, UriKind.Absolute)) { - dataContextHolder.TryAdd(sender, dataContext); - await dataContext.LoadAndCacheThumbnailImageToControl(sender); + if(dataContext.Thumbnail != null && Uri.IsWellFormedUriString(dataContext.Thumbnail, UriKind.Absolute)) + SetImageSource(sender, await PixivIO.FromUrl(dataContext.Thumbnail)); } StartDoubleAnimationUseCubicEase(sender, "(Image.Opacity)", 0, 1, 800); @@ -568,13 +559,6 @@ namespace Pixeval.UI private void Thumbnail_OnUnloaded(object sender, RoutedEventArgs e) { - if (Settings.Global.UseCache) - if (dataContextHolder.TryGetValue(sender, out var illust)) - { - var bitmapImage = (BitmapImage) ((Image) sender).Source; - AppContext.DefaultCacheProvider.Attach(ref bitmapImage, illust); - } - ReleaseImage(sender); } @@ -641,7 +625,15 @@ namespace Pixeval.UI private void DownloadNowMenuItem_OnClick(object sender, RoutedEventArgs e) { - DownloadManager.EnqueueDownloadItem(sender.GetDataContext()); + DownloadOption option = null; + if (BrowsingUser() && IsAtUploadCheckerPosition()) + { + option = new DownloadOption + { + CreateNewWhenFromUser = Settings.Global.CreateNewFolderWhenDownloadFromUser + }; + } + DownloadManager.EnqueueDownloadItem(sender.GetDataContext(), option); MessageQueue.Enqueue(AkaI18N.QueuedDownload); } @@ -656,16 +648,28 @@ namespace Pixeval.UI if (fileDialog.ShowDialog() == CommonFileDialogResult.Ok) { - DownloadManager.EnqueueDownloadItem(sender.GetDataContext(), fileDialog.FileName); + DownloadManager.EnqueueDownloadItem(sender.GetDataContext(), new DownloadOption {RootDirectory = fileDialog.FileName}); MessageQueue.Enqueue(AkaI18N.QueuedDownload); } } - private void DownloadAllNowMenuItem_OnClick(object sender, RoutedEventArgs e) + private async void DownloadAllNowMenuItem_OnClick(object sender, RoutedEventArgs e) { - foreach (var illustration in GetImageSourceCopy()) - if (illustration != null) - DownloadManager.EnqueueDownloadItem(illustration); + DownloadOption option = null; + if (BrowsingUser() && IsAtUploadCheckerPosition()) + { + option = new DownloadOption + { + CreateNewWhenFromUser = Settings.Global.CreateNewFolderWhenDownloadFromUser + }; + } + + await Task.Run(() => + { + foreach (var illustration in GetImageSourceCopy()) + if (illustration != null) + DownloadManager.EnqueueDownloadItem(illustration, option); + }); MessageQueue.Enqueue(AkaI18N.QueuedAllToDownload); } @@ -673,6 +677,14 @@ namespace Pixeval.UI #region 用户预览 + private void Timeline_OnCompleted(object sender, EventArgs e) + { + UserBrowserPageScrollViewer.DataContext = null; + ReleaseImage(UserBanner); + ReleaseImage(UserBrowserUserAvatar); + ReleaseItemsSource(UserIllustsImageListView); + } + private async void PrivateFollow_OnClick(object sender, RoutedEventArgs e) { var usr = sender.GetDataContext(); @@ -829,14 +841,6 @@ namespace Pixeval.UI return CheckerSnackBar.HorizontalAlignment == HorizontalAlignment.Left && CheckerSnackBar.Width.Equals(120); } - private void BackToMainPageButton_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) - { - UserBrowserPageScrollViewer.DataContext = null; - ReleaseImage(UserBanner); - ReleaseImage(UserBrowserUserAvatar); - ReleaseItemsSource(UserIllustsImageListView); - } - private async void FollowButton_OnClick(object sender, RoutedEventArgs e) { var usr = sender.GetDataContext(); @@ -1170,12 +1174,7 @@ namespace Pixeval.UI public void OpenUserBrowser() { - this.GetResources("UserBrowserOpacityIncreaseAnimation").Begin(); - this.GetResources("UserBrowserScaleXIncreaseAnimation").Begin(); - this.GetResources("UserBrowserScaleYIncreaseAnimation").Begin(); - this.GetResources("ContentContainerOpacityIncreaseAnimation").Begin(); - this.GetResources("ContentContainerScaleXIncreaseAnimation").Begin(); - this.GetResources("ContentContainerScaleYIncreaseAnimation").Begin(); + this.GetResources("OpenUserBrowserAnimation").Begin(); } public async void OpenIllustBrowser(Illustration illustration, bool record = true) diff --git a/src/Pixeval/UI/SignIn.xaml b/src/Pixeval/UI/SignIn.xaml index cb29e637..f022c6cd 100644 --- a/src/Pixeval/UI/SignIn.xaml +++ b/src/Pixeval/UI/SignIn.xaml @@ -15,15 +15,11 @@ GNU Affero General Public License for more details. You should have received a copy of the GNU Affero General Public License along with this program. If not, see .--> - @@ -35,8 +31,7 @@ along with this program. If not, see .--> - @@ -50,16 +45,15 @@ along with this program. If not, see .--> + Watermark="{Binding Path=(i18N:AkaI18N.SignInAccount)}" /> + Watermark="{Binding Path=(i18N:AkaI18N.SignInPassword)}" /> .--> - - - - + + ToolTip="{Binding Path=(i18N:AkaI18N.TurnOnWebR18)}" /> diff --git a/src/Pixeval/UI/UserControls/PixevalSettingPage.xaml.cs b/src/Pixeval/UI/UserControls/PixevalSettingPage.xaml.cs index 256ab899..969213e2 100644 --- a/src/Pixeval/UI/UserControls/PixevalSettingPage.xaml.cs +++ b/src/Pixeval/UI/UserControls/PixevalSettingPage.xaml.cs @@ -21,15 +21,13 @@ using System; using System.Collections.Generic; using System.Windows; +using System.Windows.Controls; using System.Windows.Input; -using System.Windows.Media.Imaging; using Microsoft.WindowsAPICodePack.Dialogs; using Pixeval.Core; using Pixeval.Data.ViewModel; -using Pixeval.Objects.Caching; using Pixeval.Objects.Generic; using Pixeval.Objects.I18n; -using Pixeval.Objects.Primitive; using Pixeval.Persisting; namespace Pixeval.UI.UserControls @@ -84,20 +82,6 @@ namespace Pixeval.UI.UserControls Settings.Global.IncludeTag = new HashSet(text); } - private void ChangeCachingPolicyToggleButton_OnChecked(object sender, RoutedEventArgs e) - { - AppContext.DefaultCacheProvider.Clear(); - AppContext.DefaultCacheProvider = new FileCache(AppContext.CacheFolder, - image => image.ToStream(), - InternalIO.CreateBitmapImageFromStream); - } - - private void ChangeCachingPolicyToggleButton_OnUnchecked(object sender, RoutedEventArgs e) - { - AppContext.DefaultCacheProvider.Clear(); - AppContext.DefaultCacheProvider = MemoryCache.Shared; - } - private async void OpenWebApiR18Button_OnMouseLeftButtonDown(object sender, MouseButtonEventArgs e) { MainWindow.MessageQueue.Enqueue(AkaI18N.TryingToToggleR18Switch); @@ -105,5 +89,10 @@ namespace Pixeval.UI.UserControls ? AkaI18N.ToggleR18OnSuccess : AkaI18N.ToggleR18OnFailed); } + + private void CultureSelector_OnSelectionChanged(object sender, SelectionChangedEventArgs e) + { + AkaI18N.Reload((I18nOption) CultureSelector.SelectedItem); + } } } \ No newline at end of file diff --git a/src/Pixeval/UI/UserControls/SauceNAOHomePage.xaml b/src/Pixeval/UI/UserControls/SauceNAOHomePage.xaml index f439250b..48c2cb6c 100644 --- a/src/Pixeval/UI/UserControls/SauceNAOHomePage.xaml +++ b/src/Pixeval/UI/UserControls/SauceNAOHomePage.xaml @@ -37,13 +37,13 @@ along with this program. If not, see .--> - + diff --git a/src/pixeval-backend/.idea/workspace.xml b/src/pixeval-backend/.idea/workspace.xml index 15b4ba88..7f164012 100644 --- a/src/pixeval-backend/.idea/workspace.xml +++ b/src/pixeval-backend/.idea/workspace.xml @@ -20,33 +20,40 @@ - + + - - - - - - - - - - - - - + + + + - + + + + + + + + - + + + + + + + - + + + @@ -220,6 +227,8 @@ + + @@ -291,11 +300,11 @@ - + - +