diff --git a/README.md b/README.md index edeb0d33..86e8ac82 100644 --- a/README.md +++ b/README.md @@ -35,10 +35,9 @@ Help translate lively to other languages: Eternal Light by VISUALDON -* Use external codec packs or internal windows codec. +* Powered by mpv and vlc player. * Play .mp4, mkv, webm, avi, mov etc * Hardware Acceleration support. -* Audio will mute when not on desktop. #### Webpages @@ -88,10 +87,10 @@ Help translate lively to other languages: - + @@ -17,7 +17,7 @@ - + @@ -29,4 +29,4 @@ - + \ No newline at end of file diff --git a/src/livelywpf/UserControls/livelysettings/SettingsPage.xaml b/src/livelywpf/UserControls/livelysettings/SettingsPage.xaml index 822bba1b..11f3135d 100644 --- a/src/livelywpf/UserControls/livelysettings/SettingsPage.xaml +++ b/src/livelywpf/UserControls/livelysettings/SettingsPage.xaml @@ -16,7 +16,7 @@ - + - + - + @@ -157,7 +158,7 @@ - + diff --git a/src/livelywpf/UserControls/livelysettings/SettingsPage.xaml.cs b/src/livelywpf/UserControls/livelysettings/SettingsPage.xaml.cs index a5072275..af7de652 100644 --- a/src/livelywpf/UserControls/livelysettings/SettingsPage.xaml.cs +++ b/src/livelywpf/UserControls/livelysettings/SettingsPage.xaml.cs @@ -26,6 +26,7 @@ public class LocalizeText public string TitleSettings { get; set; } //general + public string TextHelpTranslateLively { get; set; } public string TitleWindowsStart { get; set; } public string TipWindowsStart { get; set; } public string TitleLanguage { get; set; } diff --git a/src/livelywpf/livelywpf/App.xaml.cs b/src/livelywpf/livelywpf/App.xaml.cs index fe5e5284..df4d38bf 100644 --- a/src/livelywpf/livelywpf/App.xaml.cs +++ b/src/livelywpf/livelywpf/App.xaml.cs @@ -1,6 +1,4 @@ using System; -using System.Collections.Generic; -using System.Configuration; using System.Data; using System.Globalization; using System.IO; @@ -8,8 +6,6 @@ using System.Threading.Tasks; using System.Windows; using System.Reflection; -using System.Xml.Schema; -using Windows.ApplicationModel.VoiceCommands; namespace livelywpf { diff --git a/src/livelywpf/livelywpf/Cef/LivelyProperties/Page/LivelyPropertiesView.xaml.cs b/src/livelywpf/livelywpf/Cef/LivelyProperties/Page/LivelyPropertiesView.xaml.cs index ed068fed..511219b4 100644 --- a/src/livelywpf/livelywpf/Cef/LivelyProperties/Page/LivelyPropertiesView.xaml.cs +++ b/src/livelywpf/livelywpf/Cef/LivelyProperties/Page/LivelyPropertiesView.xaml.cs @@ -295,7 +295,7 @@ private void Slider_ValueChanged(object sender, Windows.UI.Xaml.Controls.Primiti { var item = (Windows.UI.Xaml.Controls.Slider)sender; - WallpaperSendMsg("lively-customise slider " + item.Name + " " + item.Value); + WallpaperSendMsg("lively:customise slider " + item.Name + " " + item.Value); livelyPropertyData[item.Name]["value"] = item.Value; UpdatePropertyFile(); } @@ -352,7 +352,7 @@ private void CmbBox_SelectionChanged1(object sender, Windows.UI.Xaml.Controls.Se { var item = (Windows.UI.Xaml.Controls.ComboBox)sender; var filePath = Path.Combine(livelyPropertyData[item.Name]["folder"].ToString(), item.SelectedItem.ToString()); //filename is unique. - WallpaperSendMsg("lively-customise folderDropdown " + item.Name + " " + "\"" + filePath + "\""); + WallpaperSendMsg("lively:customise folderDropdown " + item.Name + " " + "\"" + filePath + "\""); livelyPropertyData[item.Name]["value"] = item.SelectedItem.ToString(); UpdatePropertyFile(); } @@ -393,7 +393,7 @@ private void CmbBox_SelectionChanged(object sender, Windows.UI.Xaml.Controls.Sel { var item = (Windows.UI.Xaml.Controls.ComboBox)sender; //Form1.chromeBrowser.ExecuteScriptAsync("livelyPropertyListener", item.Name, item.SelectedIndex); - WallpaperSendMsg("lively-customise dropdown " + item.Name + " " + item.SelectedIndex); + WallpaperSendMsg("lively:customise dropdown " + item.Name + " " + item.SelectedIndex); livelyPropertyData[item.Name]["value"] = item.SelectedIndex; UpdatePropertyFile(); } @@ -437,7 +437,7 @@ private void Rectangle_Click(object sender, EventArgs e) { item.Fill = new SolidColorBrush(Color.FromArgb(colorDialog.Color.A, colorDialog.Color.R, colorDialog.Color.G, colorDialog.Color.B)); //Form1.chromeBrowser.ExecuteScriptAsync("livelyPropertyListener", item.Name, ToHexValue(colorDialog.Color)); - WallpaperSendMsg("lively-customise color " + item.Name + " " + ToHexValue(colorDialog.Color)); + WallpaperSendMsg("lively:customise color " + item.Name + " " + ToHexValue(colorDialog.Color)); livelyPropertyData[item.Name]["value"] = ToHexValue(colorDialog.Color); UpdatePropertyFile(); } @@ -463,7 +463,7 @@ private void DefaultBtn_Click(object sender, EventArgs e) { uiPanel.Children.Clear(); LoadUI(); - WallpaperSendMsg("lively-customise button lively_default_settings_reload 1"); + WallpaperSendMsg("lively:customise button lively_default_settings_reload 1"); } } @@ -473,7 +473,7 @@ private void Button_Click(object sender, EventArgs e) { var item = (Button)sender; //Form1.chromeBrowser.ExecuteScriptAsync("livelyPropertyListener", item.Name, true); - WallpaperSendMsg("lively-customise button " + item.Name + " " + true); + WallpaperSendMsg("lively:customise button " + item.Name + " " + true); } catch { } } @@ -488,8 +488,8 @@ private void Checkbox_CheckedChanged(object sender, EventArgs e) { var item = (CheckBox)sender; //Form1.chromeBrowser.ExecuteScriptAsync("livelyPropertyListener", item.Name, item.Checked); - WallpaperSendMsg("lively-customise checkbox " + item.Name + " " + (item.IsChecked == true)); - Debug.WriteLine("lively-customise " + item.Name + " " + (item.IsChecked == true)); + WallpaperSendMsg("lively:customise checkbox " + item.Name + " " + (item.IsChecked == true)); + Debug.WriteLine("lively:customise " + item.Name + " " + (item.IsChecked == true)); livelyPropertyData[item.Name]["value"] = item.IsChecked == true; UpdatePropertyFile(); } @@ -506,8 +506,8 @@ private void Textbox_TextChanged(object sender, EventArgs e) { var item = (TextBox)sender; //Form1.chromeBrowser.ExecuteScriptAsync("livelyPropertyListener", item.Name, item.Text); - WallpaperSendMsg("lively-customise textbox " + item.Name + " " + "\"" + item.Text + "\""); - Debug.WriteLine("lively-customise textbox " + item.Name + " " + "\"" + item.Text + "\""); + WallpaperSendMsg("lively:customise textbox " + item.Name + " " + "\"" + item.Text + "\""); + Debug.WriteLine("lively:customise textbox " + item.Name + " " + "\"" + item.Text + "\""); livelyPropertyData[item.Name]["value"] = item.Text; UpdatePropertyFile(); } diff --git a/src/livelywpf/livelywpf/Core/SetupDesktop.cs b/src/livelywpf/livelywpf/Core/SetupDesktop.cs index d32c9ba0..9de42115 100644 --- a/src/livelywpf/livelywpf/Core/SetupDesktop.cs +++ b/src/livelywpf/livelywpf/Core/SetupDesktop.cs @@ -322,7 +322,7 @@ private static async void SetupDesktop_WallpaperInitialized(object sender, Windo //Reload webpage, fix if the webpage code is not subscribed to window size changed event. if(reloadRequired) { - wallpaper.SendMessage("Reload"); + wallpaper.SendMessage("lively:reload"); } Wallpapers.Add(wallpaper); @@ -336,11 +336,11 @@ private static async void SetupDesktop_WallpaperInitialized(object sender, Windo } else { - Logger.Error("Core: Failed to launch wallpaper=>" + e.Msg); + Logger.Error("Core: Failed to launch wallpaper=>(No Exception thrown)" + e.Msg); } wallpaper.Terminate(); WallpaperChanged?.Invoke(null, null); - MessageBox.Show(e.Error.Message, Properties.Resources.TitleAppName); + MessageBox.Show(Properties.Resources.LivelyExceptionGeneral, Properties.Resources.TextError); } } catch(Exception ex) diff --git a/src/livelywpf/livelywpf/Core/Wallpapers/VideoPlayerMPVExt.cs b/src/livelywpf/livelywpf/Core/Wallpapers/VideoPlayerMPVExt.cs index ef785044..96001781 100644 --- a/src/livelywpf/livelywpf/Core/Wallpapers/VideoPlayerMPVExt.cs +++ b/src/livelywpf/livelywpf/Core/Wallpapers/VideoPlayerMPVExt.cs @@ -152,7 +152,6 @@ private void Proc_OutputDataReceived(object sender, DataReceivedEventArgs e) bool status = true; Exception error = null; string msg = null; - try { msg = "libMPVPlayer Handle:" + e.Data; diff --git a/src/livelywpf/livelywpf/Helpers/File/FileFilter.cs b/src/livelywpf/livelywpf/Helpers/File/FileFilter.cs index 6ac4d288..de589b65 100644 --- a/src/livelywpf/livelywpf/Helpers/File/FileFilter.cs +++ b/src/livelywpf/livelywpf/Helpers/File/FileFilter.cs @@ -90,6 +90,7 @@ public static string GetLivelySupportedFileDialogFilter(bool anyFile = false) filterString.Append("|"); } filterString.Remove(filterString.Length - 1, 1); + return filterString.ToString(); } } diff --git a/src/livelywpf/livelywpf/Program.cs b/src/livelywpf/livelywpf/Program.cs index 09db88f3..13138314 100644 --- a/src/livelywpf/livelywpf/Program.cs +++ b/src/livelywpf/livelywpf/Program.cs @@ -1,15 +1,9 @@ -using ICSharpCode.SharpZipLib.Zip; -using System; -using System.Collections.Generic; +using System; using System.Diagnostics; -using System.Globalization; using System.IO; -using System.Runtime.CompilerServices; using System.Text; using System.Threading; -using System.Threading.Tasks; using System.Windows; -using livelywpf.Core; namespace livelywpf { @@ -22,7 +16,7 @@ public class Program //Loaded from Settings.json (User configurable.) public static string WallpaperDir; public static readonly string AppDataDir = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "Lively Wallpaper"); - public static readonly bool IsMSIX = new DesktopBridge.Helpers().IsRunningAsUwp(); + public static readonly bool IsMSIX = false;//new DesktopBridge.Helpers().IsRunningAsUwp(); //todo: use singleton or something instead? public static SettingsViewModel SettingsVM; diff --git a/src/livelywpf/livelywpf/ViewModel/LibraryViewModel.cs b/src/livelywpf/livelywpf/ViewModel/LibraryViewModel.cs index 4b67b2fe..01da7f0b 100644 --- a/src/livelywpf/livelywpf/ViewModel/LibraryViewModel.cs +++ b/src/livelywpf/livelywpf/ViewModel/LibraryViewModel.cs @@ -214,7 +214,9 @@ await Task.Run(() => { //livelyinfo.json only contains the absolute filepath of the file; file is in different location. List files = new List(); - if (selection.LivelyInfo.Type == WallpaperType.video || selection.LivelyInfo.Type == WallpaperType.gif) + if (selection.LivelyInfo.Type == WallpaperType.video || + selection.LivelyInfo.Type == WallpaperType.gif || + selection.LivelyInfo.Type == WallpaperType.picture) { files.Add(selection.FilePath); } diff --git a/src/livelywpf/livelywpf/ViewModel/ScreenLayoutViewModel.cs b/src/livelywpf/livelywpf/ViewModel/ScreenLayoutViewModel.cs index 94ce1872..60218abf 100644 --- a/src/livelywpf/livelywpf/ViewModel/ScreenLayoutViewModel.cs +++ b/src/livelywpf/livelywpf/ViewModel/ScreenLayoutViewModel.cs @@ -207,7 +207,7 @@ private void UpdateLayout() } else { - List unsortedScreenItems = new List(); + var unsortedScreenItems = new List(); foreach (var item in ScreenHelper.GetScreen()) { string imgPath = null; @@ -220,14 +220,9 @@ private void UpdateLayout() livelyPropertyFilePath = x.GetLivelyPropertyCopyPath(); } }); - if(Program.SettingsVM.Settings.WallpaperArrangement == WallpaperArrangement.duplicate) - { - unsortedScreenItems.Add(new Model.ScreenLayoutModel(item, imgPath, livelyPropertyFilePath, item.DeviceNumber + '"')); - } - else - { - unsortedScreenItems.Add(new Model.ScreenLayoutModel(item, imgPath, livelyPropertyFilePath, item.DeviceNumber)); - } + unsortedScreenItems.Add((Program.SettingsVM.Settings.WallpaperArrangement == WallpaperArrangement.duplicate ? + new ScreenLayoutModel(item, imgPath, livelyPropertyFilePath, item.DeviceNumber + '"') : + new ScreenLayoutModel(item, imgPath, livelyPropertyFilePath, item.DeviceNumber))); } foreach (var item in unsortedScreenItems.OrderBy(x => x.Screen.Bounds.X).ToList()) @@ -248,7 +243,6 @@ private void UpdateLayout() private void UpdateWallpaper(WallpaperArrangement previous, WallpaperArrangement current) { - MessageBox.Show(previous + " " + current); var wallpapers = SetupDesktop.Wallpapers.ToList(); SetupDesktop.CloseAllWallpapers(); if (previous == WallpaperArrangement.per && current == WallpaperArrangement.span) diff --git a/src/livelywpf/livelywpf/Views/Dialogues/WallpaperPreviewWindow.xaml b/src/livelywpf/livelywpf/Views/Dialogues/WallpaperPreviewWindow.xaml index 59516581..ed9e8b43 100644 --- a/src/livelywpf/livelywpf/Views/Dialogues/WallpaperPreviewWindow.xaml +++ b/src/livelywpf/livelywpf/Views/Dialogues/WallpaperPreviewWindow.xaml @@ -2,20 +2,22 @@ xmlns:ui="http://schemas.modernwpf.com/2019" ui:WindowHelper.UseModernWindowStyle="True" ui:ThemeManager.IsThemeAware="True" - ui:TitleBar.IsIconVisible="True" + ui:TitleBar.IsIconVisible="True" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" + xmlns:p = "clr-namespace:livelywpf.Properties" mc:Ignorable="d" ResizeMode="NoResize" WindowStyle="ToolWindow" BorderBrush="{DynamicResource SystemControlHighlightAltListAccentHighBrush}" - Title="Preview" Height="740" Width="1280" + Title="{x:Static p:Resources.TextPreviewWallpaper}" + Height="737" Width="1280" Loaded="Window_Loaded" Closing="Window_Closing"> - + diff --git a/src/livelywpf/livelywpf/Views/Dialogues/WallpaperPreviewWindow.xaml.cs b/src/livelywpf/livelywpf/Views/Dialogues/WallpaperPreviewWindow.xaml.cs index 81911216..6b46dcd2 100644 --- a/src/livelywpf/livelywpf/Views/Dialogues/WallpaperPreviewWindow.xaml.cs +++ b/src/livelywpf/livelywpf/Views/Dialogues/WallpaperPreviewWindow.xaml.cs @@ -134,8 +134,16 @@ private void SetupDesktop_WallpaperInitialized(object sender, WindowInitializedA } else { - Logger.Error("Wallpaper Preview: Failed to launch wallpaper: " + e.Msg + "\n" + e.Error.ToString()); - MessageBox.Show(e.Error.Message, Properties.Resources.TitleAppName); + if (e.Error != null) + { + Logger.Error("Wallpaper Preview: Failed to launch wallpaper=>" + e.Msg + "\n" + e.Error); + } + else + { + Logger.Error("Wallpaper Preview: Failed to launch wallpaper=> (No Exception thrown)" + e.Msg); + } + MessageBox.Show(Properties.Resources.LivelyExceptionGeneral, Properties.Resources.TextError); + _ = this.Dispatcher.BeginInvoke(new Action(() => { this.Close(); })); diff --git a/src/livelywpf/livelywpf/Views/Main/AddWallpaperView.xaml.cs b/src/livelywpf/livelywpf/Views/Main/AddWallpaperView.xaml.cs index 62a2b3d9..bf3ca0e7 100644 --- a/src/livelywpf/livelywpf/Views/Main/AddWallpaperView.xaml.cs +++ b/src/livelywpf/livelywpf/Views/Main/AddWallpaperView.xaml.cs @@ -14,11 +14,12 @@ namespace livelywpf.Views /// public partial class AddWallpaperView : Page { + private readonly string fileDialogFilter; public AddWallpaperView() { InitializeComponent(); - //Load saved url. UrlText.Text = Program.SettingsVM.Settings.SavedURL; + fileDialogFilter = FileFilter.GetLivelySupportedFileDialogFilter(true); } private void FileBtn_Click(object sender, RoutedEventArgs e) @@ -29,7 +30,7 @@ private void FileBtn_Click(object sender, RoutedEventArgs e) CheckFileExists = true, CheckPathExists = true, }; - openFileDlg.Filter = FileFilter.GetLivelySupportedFileDialogFilter(true); + openFileDlg.Filter = fileDialogFilter; Nullable result = openFileDlg.ShowDialog(); if (result == true) diff --git a/src/livelywpf/livelywpf/Views/Main/SettingsView.xaml.cs b/src/livelywpf/livelywpf/Views/Main/SettingsView.xaml.cs index a8456ccb..12288f3e 100644 --- a/src/livelywpf/livelywpf/Views/Main/SettingsView.xaml.cs +++ b/src/livelywpf/livelywpf/Views/Main/SettingsView.xaml.cs @@ -50,6 +50,7 @@ private void SettingsPageHost_ChildChanged(object sender, EventArgs e) TextUIModeLite = Properties.Resources.TextUILite, TextUIModeNormal = Properties.Resources.TextUINormal, TitleWallpaperDirMoveExisting = Properties.Resources.TitleWallpaperDirMoveExisting, + TextHelpTranslateLively = Properties.Resources.TextHelpTranslate, //perf TitleWallpaperPlayback = Properties.Resources.TitleWallpaperPlayback, TitlePerfAppFullScreen = Properties.Resources.TitleAppFullScreen, diff --git a/src/livelywpf/livelywpf/Views/MainWindow.xaml b/src/livelywpf/livelywpf/Views/MainWindow.xaml index 0a42d400..b9cc86d2 100644 --- a/src/livelywpf/livelywpf/Views/MainWindow.xaml +++ b/src/livelywpf/livelywpf/Views/MainWindow.xaml @@ -11,7 +11,7 @@ xmlns:local="clr-namespace:livelywpf" xmlns:p = "clr-namespace:livelywpf.Properties" mc:Ignorable="d" - Height="720" Width="1200" + Height="740" Width="1200" Title="{x:Static p:Resources.TitleAppName}" Closing="Window_Closing" IsVisibleChanged="Window_IsVisibleChanged" @@ -28,18 +28,9 @@ - + - - diff --git a/src/livelywpf/livelywpf/Views/MainWindow.xaml.cs b/src/livelywpf/livelywpf/Views/MainWindow.xaml.cs index 584cf7f5..f7c51675 100644 --- a/src/livelywpf/livelywpf/Views/MainWindow.xaml.cs +++ b/src/livelywpf/livelywpf/Views/MainWindow.xaml.cs @@ -50,7 +50,7 @@ private void MyNavView_ChildChanged(object sender, EventArgs e) navView.MenuItems.Add(CreateMenu(Properties.Resources.TitleAddWallpaper, "add", "\uE710")); navView.MenuItems.Add(CreateMenu(Properties.Resources.TitleHelp, "help", "\uE897")); navView.MenuItems.Add(CreateMenu(Properties.Resources.TitleAbout, "about", "\uE90A")); - navView.MenuItems.Add(debugMenu = CreateMenu("Debug", "debug", "\uEBE8", Program.SettingsVM.Settings.DebugMenu)); + navView.MenuItems.Add(debugMenu = CreateMenu(Properties.Resources.TitleDebug, "debug", "\uEBE8", Program.SettingsVM.Settings.DebugMenu)); Program.SettingsVM.DebugMenuVisibilityChange += SettingsVM_DebugMenuVisibilityChange; navView.ItemInvoked += NavView_ItemInvoked; NavViewNavigate("library"); diff --git a/src/livelywpf/livelywpf/Views/Screen/ScreenLayoutView.xaml b/src/livelywpf/livelywpf/Views/Screen/ScreenLayoutView.xaml index 485b2ce9..4ca08cdc 100644 --- a/src/livelywpf/livelywpf/Views/Screen/ScreenLayoutView.xaml +++ b/src/livelywpf/livelywpf/Views/Screen/ScreenLayoutView.xaml @@ -20,7 +20,7 @@ - + diff --git a/src/livelywpf/livelywpf/WallpaperViews/VLCElement.xaml.cs b/src/livelywpf/livelywpf/WallpaperViews/VLCElement.xaml.cs index 53430b87..122db3c0 100644 --- a/src/livelywpf/livelywpf/WallpaperViews/VLCElement.xaml.cs +++ b/src/livelywpf/livelywpf/WallpaperViews/VLCElement.xaml.cs @@ -22,7 +22,7 @@ public partial class VLCElement : Window Media _media; string _filePath; bool _isStream; - //float vidPosition; + float vidPosition; //todo:https://code.videolan.org/videolan/LibVLCSharp/-/issues/136 //take screenshot and display static image when player.Stop() is called. @@ -104,20 +104,25 @@ private void _mediaPlayer_EndReached(object sender, EventArgs e) public void PausePlayer() { + if (_mediaPlayer == null) + return; + if (_mediaPlayer.IsPlaying && _mediaReady) { - //vidPosition = _mediaPlayer.Position; - //_mediaPlayer.Stop(); - _mediaPlayer.Pause(); + vidPosition = _mediaPlayer.Position; + _mediaPlayer.Stop(); } } public void PlayMedia() { + if (_mediaPlayer == null) + return; + if (_mediaReady && !_mediaPlayer.IsPlaying) { _mediaPlayer.Play(); - //_mediaPlayer.Position = vidPosition; + _mediaPlayer.Position = vidPosition; } } diff --git a/src/livelywpf/livelywpf/livelywpf.csproj b/src/livelywpf/livelywpf/livelywpf.csproj index 60017ea2..c5b9a907 100644 --- a/src/livelywpf/livelywpf/livelywpf.csproj +++ b/src/livelywpf/livelywpf/livelywpf.csproj @@ -10,7 +10,7 @@ livelywpf.Program appicon.ico 1.0.0 - 1.1.1.0 + 1.1.2.0 @@ -24,7 +24,6 @@ - @@ -33,7 +32,7 @@ - +