Skip to content

Commit

Permalink
[BUG]Fix Move to position in Single axis (#696)
Browse files Browse the repository at this point in the history
* Create draft PR for #695

* +TcoDialog and TcoInspectorsDialog webView dispose implemented
*single axis positioning via position table is fixed not necessary to press restore

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Peter Barancek <[email protected]>
  • Loading branch information
github-actions[bot] and peterbarancek authored Mar 15, 2024
1 parent 22255bb commit e3684de
Show file tree
Hide file tree
Showing 8 changed files with 39 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
SizeToContent="WidthAndHeight"
Title="InspectorDialogueWindow"
Topmost="True"
Closing="TcoDialogBaseView_Closing"
WindowStartupLocation="CenterScreen"
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf"
WindowStyle="None">
Expand Down Expand Up @@ -57,7 +58,7 @@
Style="{StaticResource MaterialDesignHeadline5TextBlock}"
Text="{Binding Dialog._caption.Synchron}" />

<wv2:WebView2 Visibility="{Binding Dialog._imageSource.Synchron,Converter={local:EmptyStringToVisibilityConverter} }" Height="{Binding Dialog._imageHeight.Cyclic}" Width="{Binding Dialog._imageWidth.Cyclic}" Source="{Binding Dialog._imageSource.Synchron ,Mode=OneWay}" />
<wv2:WebView2 x:Name="webView" Visibility="{Binding Dialog._imageSource.Synchron,Converter={local:EmptyStringToVisibilityConverter} }" Height="{Binding Dialog._imageHeight.Cyclic}" Width="{Binding Dialog._imageWidth.Cyclic}" Source="{Binding Dialog._imageSource.Synchron ,Mode=OneWay}" />

<TextBlock
Margin="0,10,10,10"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,13 @@ public TcoCustomizedDialogDialogView() : base()

}




private void TcoDialogBaseView_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if (webView != null)
{
webView.Dispose();
webView = null;
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
SizeToContent="WidthAndHeight"
Title="InspectorDialogueWindow"
Topmost="True"

Closing="TcoDialogBaseView_Closing"
WindowStartupLocation="CenterScreen"
WindowStyle="None">
<d:Window.DataContext>
Expand Down Expand Up @@ -59,7 +59,7 @@
HorizontalAlignment="Center"
Style="{StaticResource MaterialDesignHeadline5TextBlock}"
Text="{Binding Dialog._caption.Synchron}" />
<wv2:WebView2 Visibility="{Binding Dialog._imageSource.Synchron,Converter={local:EmptyStringToVisibilityConverter} }" Height="{Binding Dialog._imageHeight.Cyclic}" Width="{Binding Dialog._imageWidth.Cyclic}" Source="{Binding Dialog._imageSource.Synchron ,Mode=OneWay}" />
<wv2:WebView2 x:Name="webView" Visibility="{Binding Dialog._imageSource.Synchron,Converter={local:EmptyStringToVisibilityConverter} }" Height="{Binding Dialog._imageHeight.Cyclic}" Width="{Binding Dialog._imageWidth.Cyclic}" Source="{Binding Dialog._imageSource.Synchron ,Mode=OneWay}" />

<TextBlock
Margin="0,10,10,10"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,15 @@ public TcoDialogDialogView() : base()
{
InitializeComponent();
}

private void TcoDialogBaseView_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if (webView != null)
{
webView.Dispose();
webView = null;
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ private void MoveToPosition()
var answer = MessageBox.Show($"{strings.ResourceManager.GetString("AskMovePos")} {this.SelectedItem.HumanReadable.ToUpper()}?", strings.ResourceManager.GetString("Attention"), MessageBoxButton.YesNo, MessageBoxImage.Question);
if (answer == MessageBoxResult.Yes)
{
//
//restore before movements if necessary
Component._restoreTask._invokeRequest.Synchron = true;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,11 @@ private void MoveToPosition()
}
var answer = MessageBox.Show($"{strings.ResourceManager.GetString("AskMovePos")} {this.SelectedItem.HumanReadable.ToUpper()}?", strings.ResourceManager.GetString("Attention"), MessageBoxButton.YesNo, MessageBoxImage.Question);
if (answer == MessageBoxResult.Yes)

{
//restore before movements if necessary
Component._restoreTask._invokeRequest.Synchron = true;

this.Component._axis._moveAbsoluteTask._position.Synchron = SelectedItem.Axis1.Position.Synchron;
this.Component._axis._moveAbsoluteTask._velocity.Synchron = SelectedItem.Axis1.Velocity.Synchron;
this.Component._axis._moveAbsoluteTask._acceleration.Synchron = SelectedItem.Axis1.Acceleration.Synchron;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
Title="InspectorDialogueWindow"
Topmost="True"
x:Name="HostWindow"
Closing="HostWindow_Closing"
WindowStartupLocation="CenterScreen"
WindowStyle="None"
MouseLeftButtonDown="OnMouseLeftButtonDown"
Expand Down Expand Up @@ -113,7 +114,8 @@

Visibility="{Binding Dialog._source.Synchron,Converter={vortex:EmptyStringToVisibilityConverter} }"
MinHeight="{Binding Dialog._imageHeight.Cyclic}" MinWidth="{Binding Dialog._imageWidth.Cyclic}">
<wv2:WebView2
<wv2:WebView2
x:Name="webView"
Source="{Binding Dialog._source.Synchron ,Mode=OneWay}"></wv2:WebView2>

</ScrollViewer>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,14 @@ public void Dispose()
context.CloseRequestEventHandler -= (s, ev) => this.Close();
}
}

private void HostWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
if (webView != null)
{
webView.Dispose();
webView = null;
}
}
}
}

0 comments on commit e3684de

Please sign in to comment.