diff --git a/Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml b/Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml index 645e26995b..89790f7b84 100644 --- a/Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml +++ b/Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml @@ -5,7 +5,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:UserControls="clr-namespace:Amdocs.Ginger.UserControls" xmlns:Ginger="clr-namespace:Ginger" xmlns:GingerCore="clr-namespace:GingerCore;assembly=GingerCore" mc:Ignorable="d" Title="Loading Device..." Height="650" Width="350" - MinHeight="650" MinWidth="350" WindowStyle="ToolWindow" ResizeMode="CanResizeWithGrip" + MinHeight="650" MinWidth="350" WindowStyle="ThreeDBorderWindow" ResizeMode="CanMinimize" WindowStartupLocation="CenterScreen" Closing="Window_Closing" SizeChanged="Window_SizeChanged" Loaded="Window_Loaded" Topmost="False" KeyDown="Window_KeyDown"> @@ -123,75 +123,44 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - - + - - - - - - - - - - - - - - + + + + + + + + + + + - + diff --git a/Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs b/Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs index 78354152b5..667b0f7300 100644 --- a/Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs +++ b/Ginger/Ginger/Drivers/DriversWindows/MobileDriverWindow.xaml.cs @@ -243,10 +243,7 @@ await this.Dispatcher.InvokeAsync(async () => SetTitle(mDeviceGeneralInfo); AlloworDisableControls(true); xPinBtn_Click(null, null); - if (mDriver.GetDevicePlatformType() == eDevicePlatformType.Android) - { - AdjustWindowSize(imageSourceWidthPrecentage); - } + AdjustWindowSize(eImageChangeType.DoNotChange, true); }); } @@ -859,7 +856,7 @@ private void xOrientationBtn_Click(object sender, RoutedEventArgs e) } SetOrientationButton(); RefreshDeviceScreenshotAsync(); - AdjustWindowSize(imageSourceWidthPrecentage); + AdjustWindowSize(eImageChangeType.DoNotChange, true); needToAutoZoom = true; } catch (Exception ex) @@ -1204,9 +1201,6 @@ public void InitWindowLook() { this.Icon = ImageMakerControl.GetImageSource(eImageType.Ios); } - - this.Width = 350; - this.Height = 625; xMessageLbl.Content = "Connecting to Device..."; //Configurations & Metrics @@ -1281,10 +1275,6 @@ private void AlloworDisableControls(bool toAllow) xHomeBtn.IsEnabled = toAllow; xMenuBtn.IsEnabled = toAllow; - xVolumUpPnl.IsEnabled = toAllow; - xVolumDownPnl.IsEnabled = toAllow; - xLockPnl.IsEnabled = toAllow; - if (!toAllow) { //set LightGray brush from hex @@ -1757,30 +1747,51 @@ private void xExternalViewBtn_Click(object sender, RoutedEventArgs e) mDriver.OpenDeviceExternalView(); } - double imageSourceWidthPrecentage = 0.25; + enum eImageChangeType { Increase, Decrease, DoNotChange } private void xZoomInBtn_Click(object sender, RoutedEventArgs e) { - imageSourceWidthPrecentage += 0.05; - AdjustWindowSize(imageSourceWidthPrecentage); + AdjustWindowSize(eImageChangeType.Increase, false); } private void xZoomOutBtn_Click(object sender, RoutedEventArgs e) { - imageSourceWidthPrecentage -= 0.05; - AdjustWindowSize(imageSourceWidthPrecentage); + AdjustWindowSize(eImageChangeType.Decrease, false); } - private void AdjustWindowSize(double widthPrecentage) + private void AdjustWindowSize(eImageChangeType operationType, bool resetCanvasSize) { - if (xDeviceScreenshotImage.Source != null && widthPrecentage > 0.2 && widthPrecentage < 0.5) + if (xDeviceScreenshotImage.Source != null ) { double imageSourceHightWidthRatio = xDeviceScreenshotImage.Source.Height / xDeviceScreenshotImage.Source.Width; + if (resetCanvasSize) + { + if (mDriver.GetDevicePlatformType() == eDevicePlatformType.iOS) + { + xDeviceScreenshotCanvas.Width = xDeviceScreenshotImage.Source.Width * 0.5; + } + else + { + xDeviceScreenshotCanvas.Width = xDeviceScreenshotImage.Source.Width * 0.25; + } + } double previousCanasWidth = xDeviceScreenshotCanvas.ActualWidth; double previousCanasHeight = xDeviceScreenshotCanvas.ActualHeight; + double targetWidthRatio = xDeviceScreenshotImage.Source.Width / xDeviceScreenshotCanvas.Width; //Update canvas size - xDeviceScreenshotCanvas.Width = (xDeviceScreenshotImage.Source.Width * widthPrecentage); + switch (operationType) + { + case eImageChangeType.Increase: + xDeviceScreenshotCanvas.Width = (xDeviceScreenshotImage.Source.Width / targetWidthRatio) * (1.15); + break; + case eImageChangeType.Decrease: + xDeviceScreenshotCanvas.Width = (xDeviceScreenshotImage.Source.Width / targetWidthRatio) * (0.85); + break; + case eImageChangeType.DoNotChange: + xDeviceScreenshotCanvas.Width = (xDeviceScreenshotImage.Source.Width / targetWidthRatio) * (1); + break; + } xDeviceScreenshotCanvas.Height = xDeviceScreenshotCanvas.Width * imageSourceHightWidthRatio; //Update window size