-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
544 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Application | ||
x:Class="Windows_Mobile.App" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:Windows_Mobile"> | ||
<Application.Resources> | ||
<ResourceDictionary> | ||
<ResourceDictionary.MergedDictionaries> | ||
<XamlControlsResources xmlns="using:Microsoft.UI.Xaml.Controls" /> | ||
<!-- Other merged dictionaries here --> | ||
</ResourceDictionary.MergedDictionaries> | ||
<!-- Other app resources here --> | ||
</ResourceDictionary> | ||
</Application.Resources> | ||
</Application> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
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; | ||
using Microsoft.UI.Xaml.Shapes; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Runtime.InteropServices.WindowsRuntime; | ||
using Windows.ApplicationModel; | ||
using Windows.ApplicationModel.Activation; | ||
using Windows.Foundation; | ||
using Windows.Foundation.Collections; | ||
|
||
// To learn more about WinUI, the WinUI project structure, | ||
// and more about our project templates, see: http://aka.ms/winui-project-info. | ||
|
||
namespace Windows_Mobile | ||
{ | ||
/// <summary> | ||
/// Provides application-specific behavior to supplement the default Application class. | ||
/// </summary> | ||
public partial class App : Application | ||
{ | ||
/// <summary> | ||
/// Initializes the singleton application object. This is the first line of authored code | ||
/// executed, and as such is the logical equivalent of main() or WinMain(). | ||
/// </summary> | ||
public App() | ||
{ | ||
this.InitializeComponent(); | ||
} | ||
|
||
/// <summary> | ||
/// Invoked when the application is launched. | ||
/// </summary> | ||
/// <param name="args">Details about the launch request and process.</param> | ||
protected override void OnLaunched(Microsoft.UI.Xaml.LaunchActivatedEventArgs args) | ||
{ | ||
m_window = new MainWindow(); | ||
m_window.Activate(); | ||
} | ||
|
||
private Window m_window; | ||
} | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Window | ||
x:Class="Windows_Mobile.MainWindow" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:Windows_Mobile" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:ui="using:CommunityToolkit.WinUI" | ||
mc:Ignorable="d"> | ||
|
||
<Grid> | ||
<Rectangle HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> | ||
<Rectangle.Fill> | ||
<ImageBrush Stretch="UniformToFill" x:Name="wallpaperImage" /> | ||
</Rectangle.Fill> | ||
</Rectangle> | ||
<StackPanel x:Name="startMenu" Margin="0,0,0,80" VerticalAlignment="Bottom" Translation="0,900,40" CornerRadius="8" Background="{ThemeResource AcrylicInAppFillColorBaseBrush}" BorderThickness="1" BorderBrush="{ThemeResource SystemControlBackgroundBaseLowRevealBorderBrush}" Height="800" Width="700"> | ||
<StackPanel.Shadow> | ||
<ThemeShadow /> | ||
</StackPanel.Shadow> | ||
<StackPanel Height="735" VerticalAlignment="Top" Background="{ThemeResource LayerOnMicaBaseAltFillColorSecondaryBrush}" BorderThickness="0,0,0,1" BorderBrush="{ThemeResource AccentControlElevationBorderBrush}"> | ||
<AutoSuggestBox Height="40" FontSize="15" VerticalContentAlignment="Center" PlaceholderText="Search apps" QueryIcon="Find" TextChanged="AutoSuggestBox_TextChanged" /> | ||
<ListView x:Name="apps" Height="695" SelectionChanged="apps_SelectionChanged" /> | ||
</StackPanel> | ||
<StackPanel.TranslationTransition> | ||
<Vector3Transition /> | ||
</StackPanel.TranslationTransition> | ||
</StackPanel> | ||
<Rectangle x:Name="taskViewBackground" Visibility="Collapsed" Opacity="0" HorizontalAlignment="Stretch" VerticalAlignment="Stretch"> | ||
<Rectangle.OpacityTransition> | ||
<ScalarTransition /> | ||
</Rectangle.OpacityTransition> | ||
<Rectangle.Fill> | ||
<AcrylicBrush TintColor="#F3F3F3" TintOpacity="0.0" FallbackColor="Transparent" /> | ||
</Rectangle.Fill> | ||
</Rectangle> | ||
<Grid Background="{ThemeResource AcrylicInAppFillColorBaseBrush}" BorderThickness="0,1,0,0" BorderBrush="{ThemeResource SystemControlBackgroundBaseLowRevealBorderBrush}" Height="70" HorizontalAlignment="Stretch" VerticalAlignment="Bottom"> | ||
<StackPanel Orientation="Horizontal" Spacing="4" HorizontalAlignment="Center" VerticalAlignment="Center"> | ||
<ToggleButton Click="StartMenu_Click" Background="Transparent" BorderThickness="0" ToolTipService.ToolTip="Start" Height="60" Width="60" Content="{ui:BitmapIcon Source=Assets/StartMenuIcon.png}"> | ||
<ToggleButton.Resources> | ||
<SolidColorBrush x:Key="ToggleButtonBackgroundChecked" Color="{ThemeResource ControlFillColorDefault}" /> | ||
<SolidColorBrush x:Key="ToggleButtonBackgroundCheckedPointerOver" Color="{ThemeResource ControlFillColorSecondary}" /> | ||
<SolidColorBrush x:Key="ToggleButtonBackgroundCheckedPressed" Color="{ThemeResource ControlFillColorTertiary}" /> | ||
</ToggleButton.Resources> | ||
</ToggleButton> | ||
<ToggleButton Click="TaskView_Click" Background="Transparent" BorderThickness="0" ToolTipService.ToolTip="Start" Height="60" Width="60" Content="{ui:FontIcon FontSize=38, Glyph=}"> | ||
<ToggleButton.Resources> | ||
<SolidColorBrush x:Key="ToggleButtonBackgroundChecked" Color="{ThemeResource ControlFillColorDefault}" /> | ||
<SolidColorBrush x:Key="ToggleButtonBackgroundCheckedPointerOver" Color="{ThemeResource ControlFillColorSecondary}" /> | ||
<SolidColorBrush x:Key="ToggleButtonBackgroundCheckedPressed" Color="{ThemeResource ControlFillColorTertiary}" /> | ||
<SolidColorBrush x:Key="ToggleButtonForegroundChecked" Color="{ThemeResource TextFillColorPrimary}" /> | ||
<SolidColorBrush x:Key="ToggleButtonForegroundCheckedPointerOver" Color="{ThemeResource TextFillColorPrimary}" /> | ||
<SolidColorBrush x:Key="ToggleButtonForegroundCheckedPressed" Color="{ThemeResource TextFillColorSecondary}" /> | ||
<SolidColorBrush x:Key="ToggleButtonForegroundCheckedDisabled" Color="{ThemeResource TextFillColorDisabled}" /> | ||
</ToggleButton.Resources> | ||
</ToggleButton> | ||
</StackPanel> | ||
</Grid> | ||
</Grid> | ||
</Window> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,240 @@ | ||
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.Media.Imaging; | ||
using Microsoft.UI.Xaml.Navigation; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.IO; | ||
using System.Linq; | ||
using System.Runtime.InteropServices.WindowsRuntime; | ||
using Windows.Foundation; | ||
using Windows.Foundation.Collections; | ||
using Windows.System; | ||
using System.Numerics; | ||
using Windows.Storage.Pickers.Provider; | ||
using System.IO.Enumeration; | ||
using Windows.Storage; | ||
using Windows.Devices.AllJoyn; | ||
using Windows.ApplicationModel.Contacts; | ||
using System.Collections.ObjectModel; | ||
using System.Text.RegularExpressions; | ||
using Windows.Networking; | ||
using System.Threading.Tasks; | ||
using Windows.ApplicationModel.Core; | ||
using System.IO.Packaging; | ||
using Windows.Management.Deployment; | ||
using System.Net.Http.Headers; | ||
using System.Security.Principal; | ||
using System.Xml.Linq; | ||
using Microsoft.Windows.ApplicationModel.DynamicDependency; | ||
using Microsoft.WindowsAPICodePack.Shell; | ||
using System.Runtime.InteropServices; | ||
using System.Windows.Interop; | ||
using System.Drawing.Imaging; | ||
using System.Drawing; | ||
|
||
// To learn more about WinUI, the WinUI project structure, | ||
// and more about our project templates, see: http://aka.ms/winui-project-info. | ||
|
||
namespace Windows_Mobile | ||
{ | ||
/// <summary> | ||
/// An empty window that can be used on its own or navigated to within a Frame. | ||
/// </summary> | ||
public sealed partial class MainWindow : Window | ||
{ | ||
public MainWindow() | ||
{ | ||
this.InitializeComponent(); | ||
|
||
Title = "Windows Mobile"; | ||
this.AppWindow.SetPresenter(Microsoft.UI.Windowing.AppWindowPresenterKind.FullScreen); | ||
|
||
wallpaperImage.ImageSource = new BitmapImage() { UriSource = new Uri("C:\\Users\\" + Environment.UserName + "\\AppData\\Roaming\\Microsoft\\Windows\\Themes\\TranscodedWallpaper") }; | ||
|
||
IndexStartMenuItems(); | ||
} | ||
|
||
private void IndexStartMenuItems() | ||
{ | ||
string userItemsDirectory = "C:\\Users\\" + Environment.UserName + "\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs"; | ||
|
||
IEnumerable<string> userStartMenuItems = Directory.EnumerateFiles(userItemsDirectory); | ||
string[] userStartMenuFolders = Directory.GetDirectories(userItemsDirectory); | ||
|
||
foreach (string folder in userStartMenuFolders) | ||
{ | ||
//Replace GetFiles with something that gets all files (including in subdirectories) | ||
string[] folderItems = Directory.GetFiles(folder); | ||
|
||
if (folderItems.Length == 1) | ||
{ | ||
foreach (string item in folderItems) | ||
{ | ||
userStartMenuItems = userStartMenuItems.Append(item); | ||
} | ||
} | ||
} | ||
|
||
foreach (string item in userStartMenuItems) | ||
{ | ||
if (!item.EndsWith(".ini")) | ||
{ | ||
FileInfo file = new FileInfo(item); | ||
|
||
string name = file.Name.Replace(file.Extension, string.Empty); | ||
|
||
allApps.Add(new TextBlock() { Text = name, Name = item, Tag = "Normal" }); | ||
} | ||
} | ||
|
||
|
||
string systemItemsDirectory = "C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs"; | ||
|
||
IEnumerable<string> systemStartMenuItems = Directory.EnumerateFiles(systemItemsDirectory); | ||
string[] systemStartMenuFolders = Directory.GetDirectories(systemItemsDirectory); | ||
|
||
foreach (string folder in systemStartMenuFolders) | ||
{ | ||
//Replace GetFiles with something that gets all files (including in subdirectories) | ||
string[] folderItems = Directory.GetFiles(folder); | ||
|
||
if (folderItems.Length == 1) | ||
{ | ||
foreach (string item in folderItems) | ||
{ | ||
systemStartMenuItems = systemStartMenuItems.Append(item); | ||
} | ||
} | ||
} | ||
|
||
foreach (string item in systemStartMenuItems) | ||
{ | ||
if (!item.EndsWith(".ini")) | ||
{ | ||
FileInfo file = new FileInfo(item); | ||
|
||
string name = file.Name.Replace(file.Extension, string.Empty); | ||
|
||
allApps.Add(new TextBlock() { Text = name, Name = item, Tag = "Normal" }); | ||
} | ||
} | ||
|
||
|
||
PackageManager packageManager = new PackageManager(); | ||
IEnumerable<Windows.ApplicationModel.Package> packages = packageManager.FindPackagesForUser(string.Empty); | ||
|
||
foreach (Windows.ApplicationModel.Package package in packages) | ||
{ | ||
if (!package.IsResourcePackage && !package.IsFramework && !package.IsStub && !package.IsBundle) | ||
{ | ||
IReadOnlyList<AppListEntry> appListEntries = package.GetAppListEntries(); | ||
|
||
foreach (AppListEntry appListEntry in appListEntries) | ||
{ | ||
allApps.Add(new TextBlock() { Text = appListEntry.DisplayInfo.DisplayName, Name = package.Id.Name, Tag = "Packaged" }); | ||
} | ||
} | ||
} | ||
|
||
|
||
var ordered = from item in allApps | ||
orderby item.Text.Substring(0, 1) | ||
select item; | ||
|
||
foreach (TextBlock item in ordered) | ||
{ | ||
apps.Items.Add(item); | ||
} | ||
} | ||
|
||
private void StartMenu_Click(object sender, RoutedEventArgs e) | ||
{ | ||
startMenu.Translation = startMenu.Translation == new Vector3(0, 900, 40) ? new Vector3(0, 0, 40) : new Vector3(0, 900, 40); | ||
} | ||
|
||
private void TaskView_Click(object sender, RoutedEventArgs e) | ||
{ | ||
if (taskViewBackground.Opacity == 1) | ||
{ | ||
taskViewBackground.Visibility = Visibility.Collapsed; | ||
taskViewBackground.Opacity = 0; | ||
} | ||
else | ||
{ | ||
taskViewBackground.Visibility = Visibility.Visible; | ||
taskViewBackground.Opacity = 1; | ||
} | ||
} | ||
|
||
private void apps_SelectionChanged(object sender, SelectionChangedEventArgs e) | ||
{ | ||
if (apps.SelectedItem is not null) | ||
{ | ||
TextBlock selectedItem = apps.SelectedItem as TextBlock; | ||
|
||
if (selectedItem.Tag as string == "Normal") | ||
{ | ||
Process.Start(new ProcessStartInfo(selectedItem.Name) { UseShellExecute = true }); | ||
} | ||
else | ||
{ | ||
PackageManager packageManager = new PackageManager(); | ||
IEnumerable<Windows.ApplicationModel.Package> packages = packageManager.FindPackagesForUser(string.Empty); | ||
|
||
foreach (Windows.ApplicationModel.Package package in packages) | ||
{ | ||
if (package.Id.Name == selectedItem.Name) | ||
{ | ||
IReadOnlyList<AppListEntry> appListEntries = package.GetAppListEntries(); | ||
|
||
foreach (AppListEntry appListEntry in appListEntries) | ||
{ | ||
appListEntry.LaunchAsync(); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
Collection<TextBlock> allApps = new(); | ||
|
||
private void AutoSuggestBox_TextChanged(AutoSuggestBox sender, AutoSuggestBoxTextChangedEventArgs args) | ||
{ | ||
var filteredUnordered = allApps.Where(textBlock => Filter(textBlock, sender.Text)); | ||
|
||
var filtered = from item in filteredUnordered | ||
orderby item.Text.Substring(0, 1) | ||
select item; | ||
|
||
for (int i = apps.Items.Count - 1; i >= 0; i--) | ||
{ | ||
var item = apps.Items[i]; | ||
|
||
if (!filtered.Contains(item)) | ||
{ | ||
apps.Items.Remove(item); | ||
} | ||
} | ||
|
||
foreach (TextBlock item in filtered) | ||
{ | ||
if (!apps.Items.Contains(item)) | ||
{ | ||
apps.Items.Add(item); | ||
} | ||
} | ||
} | ||
|
||
private bool Filter(TextBlock textBlock, string filter) | ||
{ | ||
return textBlock.Text.Contains(filter, StringComparison.InvariantCultureIgnoreCase); | ||
} | ||
} | ||
} |
Oops, something went wrong.