Skip to content

Commit

Permalink
Merge pull request #2 from raybbian/gui-updates
Browse files Browse the repository at this point in the history
GUI updates to layout to fill missing device info section
  • Loading branch information
raybbian authored Jul 14, 2024
2 parents cd5ae05 + fddc621 commit fe67f4f
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 46 deletions.
4 changes: 2 additions & 2 deletions Configurator/Configurator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<WindowsAppSDKSelfContained>true</WindowsAppSDKSelfContained>
</PropertyGroup>
<ItemGroup>
<None Remove="Device.xaml" />
<None Remove="DeviceControl.xaml" />
</ItemGroup>

<ItemGroup>
Expand Down Expand Up @@ -43,7 +43,7 @@
<ProjectCapability Include="Msix" />
</ItemGroup>
<ItemGroup>
<Page Update="Device.xaml">
<Page Update="DeviceControl.xaml">
<Generator>MSBuild:Compile</Generator>
</Page>
</ItemGroup>
Expand Down
67 changes: 35 additions & 32 deletions Configurator/Device.xaml → Configurator/DeviceControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,53 +8,56 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d">

<Grid x:Name="AppContent" Background="{ThemeResource LayerOnMicaBaseAltFillColorDefault}" Padding="12, 8, 12, 12" ColumnSpacing="18">
<Grid x:Name="AppContent" Background="{ThemeResource LayerOnMicaBaseAltFillColorDefault}" Padding="12, 8, 12, 12">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="5*"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Grid Grid.Column="0">
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="24"/>
<RowDefinition Height="32"/>
<RowDefinition Height="12"/>
<RowDefinition Height="24"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Style="{ThemeResource CaptionTextBlockStyle}" FontWeight="SemiBold">Device Info</TextBlock>
<TextBlock Style="{ThemeResource CaptionTextBlockStyle}" FontWeight="SemiBold" Grid.Row="1">Set Configuration</TextBlock>
<StackPanel Grid.Row="2" Orientation="Horizontal" x:Name="ConfigPanel">
<StackPanel.Resources>
<Style TargetType="ToggleButton">
<Style.Setters>
<Setter Property="CornerRadius" Value="0"/>
</Style.Setters>
</Style>
</StackPanel.Resources>
<ToggleButton
<TextBlock Style="{ThemeResource CaptionTextBlockStyle}" FontWeight="SemiBold" Grid.Row="0">Set Configuration</TextBlock>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto"/>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="auto"/>
</Grid.ColumnDefinitions>
<StackPanel Orientation="Horizontal" x:Name="ConfigPanel">
<StackPanel.Resources>
<Style TargetType="ToggleButton">
<Style.Setters>
<Setter Property="CornerRadius" Value="0"/>
</Style.Setters>
</Style>
</StackPanel.Resources>
<ToggleButton
CornerRadius="4, 0, 0, 4"
Content="1" />
<ToggleButton
<ToggleButton
Content="2" Grid.Column="1"/>
<ToggleButton
<ToggleButton
Content="3" Grid.Column="2"/>
<ToggleButton
<ToggleButton
Content="4" Grid.Column="3"/>
<ToggleButton
<ToggleButton
Content="5" Grid.Column="4"/>
<ToggleButton
<ToggleButton
Content="6" Grid.Column="5"/>
<ToggleButton
x:Name="LastConfigButton"
<ToggleButton
CornerRadius="0, 4, 4, 0"
Content="7" Grid.Column="6"/>
</StackPanel>
</Grid>
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="24"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<TextBlock Style="{ThemeResource CaptionTextBlockStyle}" FontWeight="SemiBold">Enabled Features</TextBlock>
<Grid x:Name="FeatureSelector" ColumnSpacing="12" VerticalAlignment="Stretch" Grid.Row="1" RowSpacing="8">
</StackPanel>
<Button Grid.Column="3" Style="{ThemeResource AccentButtonStyle}" Click="Button_Click">
<FontIcon Glyph="&#xE943;"/>
</Button>
</Grid>
<TextBlock Style="{ThemeResource CaptionTextBlockStyle}" FontWeight="SemiBold" Grid.Row="3">Enabled Features</TextBlock>
<Grid x:Name="FeatureSelector" ColumnSpacing="12" VerticalAlignment="Stretch" Grid.Row="4" RowSpacing="8">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="*"/>
Expand Down Expand Up @@ -88,7 +91,7 @@
<TextBlock Style="{ThemeResource CaptionTextBlockStyle}" Grid.Row="1" Grid.Column="0" TextAlignment="Center" HorizontalAlignment="Center">Photo Transfer</TextBlock>
</Grid>
<Grid Grid.Row="1" Grid.Column="1">
<TextBlock Style="{ThemeResource CaptionTextBlockStyle}" Grid.Row="1" Grid.Column="1" TextAlignment="Center" HorizontalAlignment="Center">Audio Streaming</TextBlock>
<TextBlock Style="{ThemeResource CaptionTextBlockStyle}" Grid.Row="1" Grid.Column="1" TextAlignment="Center" HorizontalAlignment="Center">Audio Interface</TextBlock>
</Grid>
<Grid Grid.Row="1" Grid.Column="2">
<TextBlock Style="{ThemeResource CaptionTextBlockStyle}" Grid.Row="1" Grid.Column="2" TextAlignment="Center" HorizontalAlignment="Center">iTunes USB</TextBlock>
Expand Down
18 changes: 14 additions & 4 deletions Configurator/Device.xaml.cs → Configurator/DeviceControl.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ public Device(int deviceIndex, Messenger parentMessenger)

foreach (ToggleButton child in ConfigPanel.Children)
{
child.Click += ConfigButton_Click;
if (child is ToggleButton configButton)
{
configButton.Click += ConfigButton_Click;
}
}
foreach (var child in FeatureSelector.Children)
{
Expand Down Expand Up @@ -71,10 +74,13 @@ private void ConfigButton_Click(object sender, RoutedEventArgs e)
button.IsChecked = true;
return;
}
foreach (ToggleButton child in ConfigPanel.Children)
foreach (var child in ConfigPanel.Children)
{
if (child.Equals(button)) continue;
child.IsChecked = false;
if (child is ToggleButton configButton)
{
if (configButton.Equals(button)) continue;
configButton.IsChecked = false;
}
}

int configNum = ConfigPanel.Children.IndexOf(button) + 1;
Expand Down Expand Up @@ -105,6 +111,10 @@ private void UpdateAvailableFeatures()
}
}
}
private void Button_Click(object sender, RoutedEventArgs e)
{
_ = Windows.System.Launcher.LaunchUriAsync(new Uri("https://github.com/raybbian/iUtils"));
}

private Messenger m_messenger;
private int m_deviceInd;
Expand Down
2 changes: 1 addition & 1 deletion Configurator/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
</ResourceDictionary>
</TabView.Resources>
<TabView.TabStripHeader>
<TextBlock x:Name="DragRegionHeader" Text="iUtils Configurator" VerticalAlignment="Center" Padding="16, 8, 8, 8" Style="{ThemeResource BaseTextBlockStyle}" />
<TextBlock x:Name="DragRegionHeader" Text="iUtils Config" VerticalAlignment="Center" Padding="16, 8, 8, 8" Style="{ThemeResource BaseTextBlockStyle}" />
</TabView.TabStripHeader>
<TabView.TabStripFooter>
<Grid x:Name="DragRegionFooter" MinWidth="36"/>
Expand Down
12 changes: 6 additions & 6 deletions Configurator/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,18 +84,18 @@ private void Canvas_Loaded(object sender, RoutedEventArgs e)
{
DisplayArea displayArea = DisplayArea.GetFromWindowId(m_appWindow.Id, DisplayAreaFallback.Nearest);
double scaleAdjustment = Canvas.XamlRoot.RasterizationScale;
int width = (int)Math.Round(576 * scaleAdjustment);
int height = (int)Math.Round(265 * scaleAdjustment);
int bottomPadding = (int)Math.Round(20 * scaleAdjustment);
int xCoord = (displayArea.WorkArea.Width - width) / 2;
int yCoord = (displayArea.WorkArea.Height - height - bottomPadding);
int width = (int)Math.Round(315 * scaleAdjustment);
int height = (int)Math.Round(315 * scaleAdjustment);
int padding = (int)Math.Round(20 * scaleAdjustment);
int xCoord = displayArea.WorkArea.Width - width - padding;
int yCoord = displayArea.WorkArea.Height - height - padding;
m_appWindow.MoveAndResize(new Windows.Graphics.RectInt32(xCoord, yCoord, width, height));
}

private void CreateNewDeviceTab(int index)
{
TabViewItem newItem = new TabViewItem();
newItem.Header = "Apple Device " + index;
newItem.Header = "Device " + (index + 1);
Device device = new Device(index, m_messenger);
newItem.Content = device;

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This is a collection of tools to chip away at Apple's walled garden, exposing an

## How Do I Use This?

Please see the alpha [releases](https://github.com/raybbian/iUtils/releases/tag/Alpha).
Please see the alpha [releases](https://github.com/raybbian/iUtils/releases/).

## Drivers

Expand Down

0 comments on commit fe67f4f

Please sign in to comment.