Skip to content

Commit

Permalink
v0.1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
PaperHammer committed Apr 25, 2024
1 parent 1357616 commit ba960d7
Show file tree
Hide file tree
Showing 14 changed files with 94 additions and 53 deletions.
12 changes: 6 additions & 6 deletions src/SourceCode/VirtualPaper.Grpc.Client/UserSettingsClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ private SettingsData CreateGrpcSettings(ISettings settings)
IsUpdated = settings.IsUpdated,
IsAutoStart = settings.IsAutoStart,
IsFirstRun = settings.IsFirstRun,
SysTrayIcon = settings.SysTrayIcon,
//SysTrayIcon = settings.SysTrayIcon,

WallpaperDir = settings.WallpaperDir,

Expand Down Expand Up @@ -224,8 +224,8 @@ private SettingsData CreateGrpcSettings(ISettings settings)

ProcessTimerInterval = settings.ProcessTimerInterval,

WebDebugPort = settings.WebDebugPort,
IsCefDiskCache = settings.IsCefDiskCache,
//WebDebugPort = settings.WebDebugPort,
//IsCefDiskCache = settings.IsCefDiskCache,
};
}

Expand All @@ -242,7 +242,7 @@ private ISettings CreateSettingsFromGrpc(SettingsData settings)
ApplicationThemeBackground = (Common.AppThemeBackground)settings.ApplicationThemeBackground,
AppVersion = settings.AppVersion,
ApplicationThemeBackgroundPath = settings.ApplicationThemeBackgroundPath,
ThemeBundleVersion = settings.ThemeBundleVersion,
//ThemeBundleVersion = settings.ThemeBundleVersion,
Language = settings.Language,
IsUpdated = settings.IsUpdated,
IsAutoStart = settings.IsAutoStart,
Expand Down Expand Up @@ -291,8 +291,8 @@ private ISettings CreateSettingsFromGrpc(SettingsData settings)

ProcessTimerInterval = settings.ProcessTimerInterval,

WebDebugPort = settings.WebDebugPort,
IsCefDiskCache = settings.IsCefDiskCache,
//WebDebugPort = settings.WebDebugPort,
//IsCefDiskCache = settings.IsCefDiskCache,
};
}

Expand Down
22 changes: 11 additions & 11 deletions src/SourceCode/VirtualPaper.Models/Cores/Interfaces/ISettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public interface ISettings
bool IsUpdated { get; set; }
bool IsAutoStart { get; set; }
bool IsFirstRun { get; set; }
bool SysTrayIcon { get; }
//bool SysTrayIcon { get; }
#endregion

#region dirs
Expand Down Expand Up @@ -75,16 +75,16 @@ public interface ISettings
int ProcessTimerInterval { get; set; }
#endregion

#region others
string WebDebugPort { get; set; }
bool IsCefDiskCache { get; set; }
#endregion
//#region others
//string WebDebugPort { get; set; }
//bool IsCefDiskCache { get; set; }
//#endregion

#region
/// <summary>
/// wallpaper 版本
/// </summary>
int WallpaperBundleVersion { get; set; }
#endregion
//#region
///// <summary>
///// wallpaper 版本
///// </summary>
//int WallpaperBundleVersion { get; set; }
//#endregion
}
}
19 changes: 5 additions & 14 deletions src/SourceCode/VirtualPaper.Models/Cores/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ public class Settings : ISettings
public AppThemeBackground ApplicationThemeBackground { get; set; }
public string AppVersion { get; set; } = string.Empty;
public string ApplicationThemeBackgroundPath { get; set; } = string.Empty;
public int ThemeBundleVersion { get; set; }
//public int ThemeBundleVersion { get; set; }
public string Language { get; set; } = string.Empty;
public bool IsUpdated { get; set; }
public bool IsAutoStart { get; set; }
public bool IsFirstRun { get; set; }
public bool SysTrayIcon { get; } = true;
//public bool SysTrayIcon { get; } = true;
#endregion

#region dirs
Expand Down Expand Up @@ -59,15 +59,6 @@ public class Settings : ISettings
public int ProcessTimerInterval { get; set; }
#endregion

#region others
public string WebDebugPort { get; set; } = string.Empty;
public bool IsCefDiskCache { get; set; }
#endregion

#region
public int WallpaperBundleVersion { get; set; }
#endregion

public Settings()
{
WallpaperArrangement = WallpaperArrangement.Per;
Expand All @@ -84,8 +75,8 @@ public Settings()
MouseInputMovAlways = true;

WallpaperDir = Path.Combine(Constants.CommonPaths.AppDataDir, "Library");
WebDebugPort = string.Empty;
ThemeBundleVersion = -1;
//WebDebugPort = string.Empty;
//ThemeBundleVersion = -1;
WallpaperScaling = WallpaperScaler.fill;
ApplicationTheme = AppTheme.Dark;
RemoteDesktop = AppWpRunRulesEnum.Pause;
Expand All @@ -95,7 +86,7 @@ public Settings()
ApplicationThemeBackgroundPath = string.Empty;
ApplicationThemeBackground = AppThemeBackground.default_mica;

WallpaperBundleVersion = -1;
//WallpaperBundleVersion = -1;

try
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ private WpCustomize()
_userSettings = App.Services.GetRequiredService<IUserSettingsClient>();
_desktopWpControl = App.Services.GetRequiredService<IWallpaperControlClient>();
_monitorManager = App.Services.GetRequiredService<IMonitorManagerClient>();
_dispatcherQueue = DispatcherQueue.GetForCurrentThread() ?? DispatcherQueueController.CreateOnCurrentThread().DispatcherQueue;
//_dispatcherQueue = DispatcherQueue.GetForCurrentThread() ?? DispatcherQueueController.CreateOnCurrentThread().DispatcherQueue;
}

public WpCustomize(
Expand Down Expand Up @@ -126,7 +126,7 @@ private void GenerateUIElements()
Margin = _margin,
Minimum = (double)item.Value["Min"],
Maximum = (double)item.Value["Max"],
Value = (double)item.Value["Value"],
Value = (double)item.Value["Value"],
};
if (item.Value["Step"] != null && !string.IsNullOrWhiteSpace(item.Value["Step"].ToString()))
{
Expand All @@ -138,8 +138,7 @@ private void GenerateUIElements()
}
slider.ValueChanged += Slider_ValueChanged;
Slider_ValueChanged(slider);
//slider.GotFocus += Slider_GotFocus;
//slider.LostFocus += Slider_LostFocus;


obj = slider;
}
Expand Down Expand Up @@ -808,7 +807,7 @@ public void Dispose()
private readonly IUserSettingsClient _userSettings;
private readonly IWallpaperControlClient _desktopWpControl;
private readonly IMonitorManagerClient _monitorManager;
private readonly DispatcherQueue _dispatcherQueue;
//private readonly DispatcherQueue _dispatcherQueue;
private readonly object _restoreLock = new();
private EventHandler<DoubleValueChangedEventArgs> _doubleValueChanged;
private EventHandler<BoolValueChangedEventArgs> _boolValueChanged;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -290,18 +290,15 @@ internal async Task ApplyAsync(XamlRoot xamlRoot)
}
}

//internal void Cancel()
//{
// _cancellationTokenSourceForApply?.Cancel();
// _wpConfigViewModel?.Cancel();
//}


internal void TryNavPage(string tag)
{
IsLoading(true);

Page page;
if (tag == "WpConfig") page = GetTargetMonitorWallpaperInfo();
else if (tag == "Settings") page = InstanceUtil<Page>.TryGetInstanceByName("WpNavSettgins", "");
else page = InstanceUtil<Page>.TryGetInstanceByName(tag, "");

if (FramePage != page)
Expand Down
3 changes: 2 additions & 1 deletion src/SourceCode/VirtualPaper.UI/Views/WpSettings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@
x:Name="NavView"
PaneDisplayMode="Top"
SelectionFollowsFocus="Enabled"
IsBackButtonVisible="Collapsed"
IsBackButtonVisible="Collapsed"
IsSettingsVisible="False"
SelectedItem="{Binding SelectedNav, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
SelectionChanged="NavigationView_SelectionChanged"
MenuItemsSource="{Binding NavsMenuItems, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
Expand Down
10 changes: 6 additions & 4 deletions src/SourceCode/VirtualPaper.UI/Views/WpSettings.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,13 +95,15 @@ private void ListViewThuMonitors_SelectionChanged(object sender, SelectionChange
NavigationView sender,
NavigationViewSelectionChangedEventArgs args)
{
if (args.IsSettingsSelected == true)
string tag = args.SelectedItemContainer.Tag.ToString();

if (args.IsSettingsSelected == true) // Settgins
{
//NavView_Navigate(typeof(SettingsPage), args.RecommendedNavigationTransitionInfo);
_viewModel.TryNavPage(tag);
}
else if (args.SelectedItemContainer != null)
{
string tag = args.SelectedItemContainer.Tag.ToString();
{


_viewModel.TryNavPage(tag);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
HorizontalContentAlignment="Left"
VerticalContentAlignment="Center"
ItemsSource="{Binding LibraryWallpapers}"
SelectionMode="Extended"
SelectionMode="Single"
IsItemInvokedEnabled="True"
RightTapped="ItemsView_RightTapped"
ItemInvoked="ItemsView_ItemInvoked">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Page
x:Class="VirtualPaper.UI.Views.WpSettingsComponents.WpNavSettgins"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="using:VirtualPaper.UI.Views.WpSettingsComponents"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<Grid>

</Grid>
</Page>
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices.WindowsRuntime;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Controls.Primitives;
using Microsoft.UI.Xaml.Data;
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;

// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.

namespace VirtualPaper.UI.Views.WpSettingsComponents
{
/// <summary>
/// An empty page that can be used on its own or navigated to within a Frame.
/// </summary>
public sealed partial class WpNavSettgins : Page
{
public WpNavSettgins()
{
this.InitializeComponent();
}
}
}
4 changes: 4 additions & 0 deletions src/SourceCode/VirtualPaper.UI/VirtualPaper.UI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@
<None Remove="Views\WpSettings.xaml" />
<None Remove="Views\WpSettingsComponents\LibraryContents.xaml" />
<None Remove="Views\WpSettingsComponents\WpConfig.xaml" />
<None Remove="Views\WpSettingsComponents\WpNavSettgins.xaml" />
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -177,6 +178,9 @@
</Content>
</ItemGroup>
<ItemGroup>
<Page Update="Views\WpSettingsComponents\WpNavSettgins.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
<None Update="virtualpaper.ico">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
2 changes: 1 addition & 1 deletion src/SourceCode/VirtualPaper/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ public App()
//first run Setup-Wizard show..
if (userSetting.Settings.IsFirstRun)
{
Services.GetRequiredService<IUIRunnerService>().ShowUI();
//Services.GetRequiredService<IUIRunnerService>().ShowUI();
}

#region 事件绑定
Expand Down
3 changes: 2 additions & 1 deletion src/SourceCode/VirtualPaper/Cores/Tray/Systray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ IPlayback playbackMonitor
_notifyIcon.DoubleClick += (s, args) => uiRunner.ShowUI();
_notifyIcon.Icon = Properties.Icons.virtualpaper;
_notifyIcon.Text = "Virtual Paper";
_notifyIcon.Visible = userSettings.Settings.SysTrayIcon;
_notifyIcon.Visible = true;
//_notifyIcon.Visible = userSettings.Settings.SysTrayIcon;
_notifyIcon.ContextMenuStrip = new()
{
ForeColor = Color.AliceBlue,
Expand Down
8 changes: 4 additions & 4 deletions src/SourceCode/VirtualPaper/GrpcServers/UserSettingServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,10 @@ public override Task<SettingsData> GetSettings(Empty request, ServerCallContext
InputForward = (Grpc.Service.UserSetting.InputForwardMode)_userSetting.Settings.InputForward,
MouseInputMovAlways = _userSetting.Settings.MouseInputMovAlways,
WallpaperDir = _userSetting.Settings.WallpaperDir,
WebDebugPort = _userSetting.Settings.WebDebugPort,
//WebDebugPort = _userSetting.Settings.WebDebugPort,
IsAudioOnlyOnDesktop = _userSetting.Settings.IsAudioOnlyOnDesktop,
IsAutoStart = _userSetting.Settings.IsAutoStart,
IsCefDiskCache = _userSetting.Settings.IsCefDiskCache,
//IsCefDiskCache = _userSetting.Settings.IsCefDiskCache,
ApplicationTheme = (Grpc.Service.UserSetting.AppTheme)_userSetting.Settings.ApplicationTheme,
RemoteDesktopPause = (Grpc.Service.UserSetting.AppRulesEnum)_userSetting.Settings.RemoteDesktop,
PowerSaveModePause = (Grpc.Service.UserSetting.AppRulesEnum)_userSetting.Settings.PowerSaving,
Expand Down Expand Up @@ -159,9 +159,9 @@ public override Task<Empty> SetSettings(SettingsData request, ServerCallContext
_userSetting.Settings.InputForward = (Common.InputForwardMode)request.InputForward;
_userSetting.Settings.MouseInputMovAlways = request.MouseInputMovAlways;
_userSetting.Settings.WallpaperDir = request.WallpaperDir;
_userSetting.Settings.WebDebugPort = request.WebDebugPort;
//_userSetting.Settings.WebDebugPort = request.WebDebugPort;
_userSetting.Settings.IsAudioOnlyOnDesktop = request.IsAudioOnlyOnDesktop;
_userSetting.Settings.IsCefDiskCache = request.IsCefDiskCache;
//_userSetting.Settings.IsCefDiskCache = request.IsCefDiskCache;
_userSetting.Settings.ApplicationTheme = (Common.AppTheme)request.ApplicationTheme;
_userSetting.Settings.RemoteDesktop = (Common.AppWpRunRulesEnum)request.RemoteDesktopPause;
_userSetting.Settings.PowerSaving = (Common.AppWpRunRulesEnum)request.PowerSaveModePause;
Expand Down

0 comments on commit ba960d7

Please sign in to comment.