Skip to content

Commit

Permalink
refactor ui
Browse files Browse the repository at this point in the history
  • Loading branch information
ikas-mc committed Mar 25, 2022
1 parent fa8afdd commit 237c5c9
Show file tree
Hide file tree
Showing 11 changed files with 1,183 additions and 197 deletions.
20 changes: 20 additions & 0 deletions ContextMenuCustom/ContextMenuCustomApp/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,41 @@
<Application.Resources>
<controls:XamlControlsResources>
<controls:XamlControlsResources.MergedDictionaries>
<ResourceDictionary Source="/Styles/Button.xaml" />
<ResourceDictionary>
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Light">
<Color x:Key="ContentBackGroundColor">#08000000</Color>
<Color x:Key="NavContentBackGroundColor">#40FFFFFF</Color>
<Color x:Key="NavContentBorderColor">#08000000</Color>
<SolidColorBrush x:Key="ContentBackGroundBrush" Color="{StaticResource ContentBackGroundColor}" />

<StaticResource x:Key="SettingItemBackgroundBrush" ResourceKey="CardBackgroundFillColorDefaultBrush" />
<StaticResource x:Key="SettingItemBorderBrush" ResourceKey="CardStrokeColorDefaultBrush" />
<StaticResource x:Key="SettingItemPrimaryForegroundBrush" ResourceKey="TextFillColorPrimaryBrush" />
<SolidColorBrush x:Key="InfoBarInformationalSeverityBackgroundBrush" Color="#FFd3e7f7" />
<Color x:Key="InfoBarInformationalSeverityIconBackground">#FF0063b1</Color>
<SolidColorBrush x:Key="SolidBackgroundBrush" Color="White" />
<Thickness x:Key="SettingItemBorderThickness">1</Thickness>
</ResourceDictionary>

<ResourceDictionary x:Key="Dark">
<Color x:Key="ContentBackGroundColor">#15000000</Color>
<Color x:Key="NavContentBackGroundColor">#2C3A3A3A</Color>
<Color x:Key="NavContentBorderColor">#19000000</Color>
<SolidColorBrush x:Key="ContentBackGroundBrush" Color="{StaticResource ContentBackGroundColor}" />

<StaticResource x:Key="SettingItemBackgroundBrush" ResourceKey="CardBackgroundFillColorDefaultBrush" />
<StaticResource x:Key="SettingItemBorderBrush" ResourceKey="CardStrokeColorDefaultBrush" />
<StaticResource x:Key="SettingItemPrimaryForegroundBrush" ResourceKey="TextFillColorPrimaryBrush" />
<SolidColorBrush x:Key="InfoBarInformationalSeverityBackgroundBrush" Color="#FF34424d" />
<Color x:Key="InfoBarInformationalSeverityIconBackground">#FF5fb2f2</Color>
<SolidColorBrush x:Key="SolidBackgroundBrush" Color="Black" />
<Thickness x:Key="SettingItemBorderThickness">1</Thickness>
</ResourceDictionary>



</ResourceDictionary.ThemeDictionaries>
</ResourceDictionary>
</controls:XamlControlsResources.MergedDictionaries>
Expand Down
10 changes: 5 additions & 5 deletions ContextMenuCustom/ContextMenuCustomApp/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ public App()
protected override void OnLaunched(LaunchActivatedEventArgs e)
{
//TODO check first run
ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.PreferredLaunchViewSize;
var size = new Size(800, 768);
ApplicationView.PreferredLaunchViewSize = size;
ApplicationView.GetForCurrentView().TryResizeView(size);
ApplicationView.PreferredLaunchWindowingMode = ApplicationViewWindowingMode.Auto;
//var size = new Size(800, 768);
//ApplicationView.PreferredLaunchViewSize = size;
//ApplicationView.GetForCurrentView().TryResizeView(size);

//TODO use shell
Frame rootFrame = Window.Current.Content as Frame;
Expand Down Expand Up @@ -70,7 +70,7 @@ protected override void OnActivated(IActivatedEventArgs args)
{
var arguments = commandLineActivatedEventArgs.Operation.Arguments;
MessageDialog dialog = new MessageDialog(arguments);
_=dialog.ShowAsync();
_ = dialog.ShowAsync();
}
}
}
Expand Down
48 changes: 48 additions & 0 deletions ContextMenuCustom/ContextMenuCustomApp/Common/Settings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Foundation.Collections;
using Windows.Storage;

namespace ContextMenuCustomApp.Common
{

public class Settings
{
private readonly static IPropertySet settings;

public readonly static Settings INS;
static Settings() {
settings = ApplicationData.Current.LocalSettings.CreateContainer("app-settings", ApplicationDataCreateDisposition.Always).Values;
INS = new Settings();
}

public bool CacheEnabled {
get {
return GetValue(nameof(CacheEnabled),false);
}
set {
SetValue(nameof(CacheEnabled), value);
}
}

private T GetValue<T>(string key,T defaultValue= default) {
if (settings[key] is T value) {
return value;
}

return defaultValue;
}


private T SetValue<T>(string key, T value)
{
settings[key] = value;
return value;
}


}
}
15 changes: 15 additions & 0 deletions ContextMenuCustom/ContextMenuCustomApp/ContextMenuCustomApp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
<RestoreProjectStyle>PackageReference</RestoreProjectStyle>
</PropertyGroup>
<ItemGroup>
<Compile Include="Common\Settings.cs" />
<Compile Include="View\Common\Alert.cs" />
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
Expand All @@ -99,6 +100,7 @@
<Compile Include="View\Common\MessageHelper.cs" />
<Compile Include="View\Common\PageMessageExt.cs" />
<Compile Include="View\Common\VisibilityConverter.cs" />
<Compile Include="View\Controls\SettingItem.cs" />
<Compile Include="View\Menu\MenuPage.xaml.cs">
<DependentUpon>MenuPage.xaml</DependentUpon>
</Compile>
Expand Down Expand Up @@ -134,6 +136,18 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Styles\Button.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="Themes\Generic.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="View\Controls\SettingItem.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
<Page Include="View\Menu\MenuPage.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
Expand All @@ -155,6 +169,7 @@
<ItemGroup>
<None Include="ContextMenuCustomPackage_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup />
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '14.0' ">
<VisualStudioVersion>14.0</VisualStudioVersion>
</PropertyGroup>
Expand Down
Loading

0 comments on commit 237c5c9

Please sign in to comment.