Skip to content

Commit

Permalink
Fixes to view in landscape
Browse files Browse the repository at this point in the history
Fixes to view in landscape to not cut off the text input and send button
  • Loading branch information
Empyreal96 committed Jul 7, 2022
1 parent 867d8f8 commit 2ed8458
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
# Command Prompt for W10MEasily access 'Windows Command Prompt' on supported Windows Mobile devices, this makes use of Telnet to make the connection![](screenshots/1.png) ![](screenshots/2.png) ![](screenshots/3.png)## Requirements:- Windows 10 Mobile 14393 and up.- [CMD Injected](https://github.com/fadilfadz01/CMD.Injector) to the device.- Loopback connection enabled (details in-app)### Acknowledgements:- [BAstifan](https://github.com/basharast) for the TelnetClient class.- [Fadil Fadz](https://github.com/fadilfadz01) for CMD Injector and minor help with handling stout and sterr
# Command Prompt for W10MEasily access 'Windows Command Prompt' on supported Windows Mobile devices, this makes use of Telnet to make the connection![](screenshots/1.png) ![](screenshots/2.png) ![](screenshots/3.png)## Requirements:- Windows 10 Mobile 14393 and up.- [CMD Injected](https://github.com/fadilfadz01/CMD.Injector) to the device.- Loopback connection enabled (details in-app)## Notes:- Sometimes the session doesn't load properly, I'm trying to see why, but close and re-open. If this persists then reinstall the app- Only simple Scripts are supported, i.e no user input needed.- Some commands take ages, I am unsure why but looking at it### Acknowledgements:- [BAstifan](https://github.com/basharast) for the TelnetClient class.- [Fadil Fadz](https://github.com/fadilfadz01) for CMD Injector and minor help with handling stout and sterr
Expand Down
2 changes: 1 addition & 1 deletion src/Command Prompt.csproj.user
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<UapAppxPackageBuildMode>SideloadOnly</UapAppxPackageBuildMode>
<AppxShowAllApps>False</AppxShowAllApps>
<AppxBuildConfigurationSelection>arm</AppxBuildConfigurationSelection>
<PackageOptionalProjectsInIdeBuilds>False</PackageOptionalProjectsInIdeBuilds>
<PackageOptionalProjectsInIdeBuilds>True</PackageOptionalProjectsInIdeBuilds>
<Source>C:\Users\Empyreal96\Pictures\icons\w11_cmd_Icon8.png</Source>
<SmallTileSource>C:\Users\Empyreal96\Pictures\icons\w11_cmd_Icon8.png</SmallTileSource>
<MediumTileSource>C:\Users\Empyreal96\Pictures\icons\w11_cmd_Icon8.png</MediumTileSource>
Expand Down
10 changes: 5 additions & 5 deletions src/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
RequestedTheme="Default"
SizeChanged="Page_SizeChanged"
NavigationCacheMode="Required"

Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">
Expand All @@ -15,6 +16,7 @@
<Grid.RowDefinitions>
<RowDefinition Height="48"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="48"/>
</Grid.RowDefinitions>
<RelativePanel Grid.Row="0">
<Border x:Name="HeaderBorder"
Expand Down Expand Up @@ -53,15 +55,13 @@
</RelativePanel>
<RelativePanel Grid.Row="1">

<ScrollViewer x:Name="TextScroller" VerticalAlignment="Stretch" VerticalScrollMode="Enabled" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" HorizontalScrollMode="Enabled">

<TextBox x:Name="CMDtestText" IsReadOnly="True" FontFamily="Consolas" AcceptsReturn="True" ScrollViewer.VerticalScrollMode="Enabled" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ScrollViewer.HorizontalScrollMode="Enabled" RequestedTheme="Default" Height="400" Margin="5,10,5,0" Background="{x:Null}" FocusVisualSecondaryBrush="{x:Null}" BorderBrush="{x:Null}"/>
<TextBox x:Name="CMDtestText" RelativePanel.AlignLeftWithPanel="True" RelativePanel.AlignRightWithPanel="True" IsReadOnly="True" FontFamily="Consolas" AcceptsReturn="True" ScrollViewer.VerticalScrollMode="Enabled" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" ScrollViewer.HorizontalScrollMode="Enabled" RequestedTheme="Default" Height="240" Margin="5,10,5,0" Background="{x:Null}" FocusVisualSecondaryBrush="{x:Null}" BorderBrush="{x:Null}"/>


</ScrollViewer>

<TextBox x:Name="SendCommandText" RelativePanel.AlignLeftWithPanel="True" RelativePanel.Below="TextScroller" Margin="10,10,10,0" HorizontalAlignment="Stretch" RelativePanel.LeftOf="SendCommandBtn" RequestedTheme="Default" FontFamily="Consolas"/>
<Button x:Name="SendCommandBtn" Click="SendCommandBtn_Click" RelativePanel.AlignRightWithPanel="True" RelativePanel.Below="TextScroller" RequestedTheme="Default" Content="Send" Margin="0,10,5,0"/>
<TextBox x:Name="SendCommandText" RelativePanel.AlignLeftWithPanel="True" RelativePanel.Below="CMDtestText" Margin="10,10,10,0" HorizontalAlignment="Stretch" RelativePanel.LeftOf="SendCommandBtn" RequestedTheme="Default" FontFamily="Consolas"/>
<Button x:Name="SendCommandBtn" Click="SendCommandBtn_Click" RelativePanel.AlignRightWithPanel="True" RelativePanel.Below="CMDtestText" RequestedTheme="Default" Content="Send" Margin="0,10,5,0"/>

</RelativePanel>

Expand Down
34 changes: 28 additions & 6 deletions src/MainPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public MainPage()
HeaderBorder.Background = new SolidColorBrush(Colors.DimGray);
}



ApplicationData.Current.LocalFolder.CreateFileAsync("cmdstring.txt", CreationCollisionOption.ReplaceExisting);


Expand Down Expand Up @@ -151,7 +153,7 @@ private async void SendCommandBtn_Click(object sender, RoutedEventArgs e)
CMDtestText.Text = text.Remove(text.Length - 1);
CMDtestText.Text += $"{SendCommandText.Text}\n";
StorageFile tmp = await ApplicationData.Current.LocalFolder.GetFileAsync("cmdstring.txt");

string command = SendCommandText.Text;
if (command.Length != 0)
{
Expand Down Expand Up @@ -188,7 +190,7 @@ private async void SendCommandBtn_Click(object sender, RoutedEventArgs e)
}
catch (Exception ex)
{

Exceptions.ThrowFullError(ex);
ProgressBarControl(false);

Expand Down Expand Up @@ -245,7 +247,7 @@ private async void MenuFlyoutItem_Click_2(object sender, RoutedEventArgs e)
string results = File.ReadAllText($"{LocalPath}\\cmdstring.txt");
CMDtestText.Text += $"{results}\n\n";



await client.Send($"\"{storage.Path}\" > \"{LocalPath}\\cmdstring.txt\" 2>&1");
//string results2 = File.ReadAllText($"{LocalPath}\\cmdstring.txt");
Expand Down Expand Up @@ -325,17 +327,37 @@ private void ProgressBarControl(bool enable)
}
}



private void MenuFlyoutItem_Click_4(object sender, RoutedEventArgs e)
{
Exceptions.CustomMessage(
"Command Prompt v0.1.0 for Windows 10 Mobile:\n\n" +
"Command Prompt v0.1.4 for Windows 10 Mobile:\n\n" +
"- Thanks to Fadil Fadz for CMD Injector and some help with output formatting.\n" +
"- Thanks to BAstifan for the TelnetClient library\n\n" +
"Note: Only simple scripts are supported at this time, example is scripts with NO user input\n\n" +
"Any Issues? Submit an issue on \"https://github.com/empyreal96/mobile-cmd\""
) ;
);
}

private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
{
bool isInLandscapeMode =
Windows.UI.ViewManagement.ApplicationView.GetForCurrentView().Orientation ==
Windows.UI.ViewManagement.ApplicationViewOrientation.Landscape;

ApplicationData.Current.LocalSettings.Values["Orientation"] = isInLandscapeMode ?
"Landscape" : "Portrait";


if (isInLandscapeMode == true)
{
CMDtestText.Height = 240;

} else
{
CMDtestText.Height = 400;
}
}
}
}
2 changes: 1 addition & 1 deletion src/Package.appxmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<Identity
Name="WPCommandPrompt"
Publisher="CN=Empyreal96"
Version="0.1.0.0" />
Version="0.1.4.0" />

<mp:PhoneIdentity PhoneProductId="7c02d3dd-afe8-4c25-a609-a888b4adf4f7" PhonePublisherId="00000000-0000-0000-0000-000000000000"/>

Expand Down

0 comments on commit 2ed8458

Please sign in to comment.