-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create draft PR for #699 * +TcoInput dialog +examples in docu --------- Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Peter Barancek <[email protected]>
- Loading branch information
1 parent
bfaf92a
commit d5d7913
Showing
38 changed files
with
951 additions
and
19 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
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
101 changes: 101 additions & 0 deletions
101
src/TcoCore/src/TcoCore.Wpf/TcoDialog/InputDialog/TcoInputDialogDialogView.xaml
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,101 @@ | ||
<local:TcoDialogBaseView | ||
x:Class="TcoCore.TcoInputDialogDialogView" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="clr-namespace:TcoCore" | ||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:tcocore="clr-namespace:TcoCore;assembly=TcoCoreConnector" | ||
xmlns:vortex="http://vortex.mts/xaml" | ||
xmlns:wv2="clr-namespace:Microsoft.Web.WebView2.Wpf;assembly=Microsoft.Web.WebView2.Wpf" | ||
|
||
xmlns:s="clr-namespace:TcOpen.Inxton.TcoCore.Wpf.Properties" | ||
Width="Auto" | ||
Height="Auto" | ||
mc:Ignorable="d" | ||
d:DesignHeight="450" | ||
d:DesignWidth="800" | ||
ResizeMode="NoResize" | ||
ShowInTaskbar="False" | ||
SizeToContent="WidthAndHeight" | ||
Title="InspectorDialogueWindow" | ||
Topmost="True" | ||
Closing="TcoDialogBaseView_Closing" | ||
WindowStartupLocation="CenterScreen" | ||
WindowStyle="None"> | ||
<d:Window.DataContext> | ||
<local:TcoInputDialogDialogViewModel /> | ||
</d:Window.DataContext> | ||
<Window.Background> | ||
<SolidColorBrush Color="White" Opacity="1" /> | ||
</Window.Background> | ||
<materialDesign:Card | ||
Margin="10" | ||
materialDesign:ShadowAssist.ShadowDepth="Depth5" | ||
materialDesign:ShadowAssist.ShadowEdges="Top,Bottom,Left,Right"> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="Auto" /> | ||
</Grid.RowDefinitions> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="20*" /> | ||
<ColumnDefinition Width="80*" /> | ||
</Grid.ColumnDefinitions> | ||
<materialDesign:PackIcon | ||
DataContext="{Binding Dialog._dialogType}" | ||
Margin="10" | ||
Grid.RowSpan="2" | ||
HorizontalAlignment="Center" | ||
VerticalAlignment="Center" | ||
Visibility="{Binding Synchron, Converter={local:DialogTypeVisibilityConverter}}" | ||
Foreground="{Binding Synchron, Converter={local:DialogTypeToColorConverter}}" | ||
Kind="{Binding Synchron, Converter={local:DialogTypeToIconConverter}}" | ||
Width="75" Height="75"/> | ||
<StackPanel Grid.Row="0" Grid.Column="1"> | ||
<StackPanel.Resources> | ||
<Style TargetType="TextBlock" BasedOn="{StaticResource MaterialDesignHeadline6TextBlock}"> | ||
<Setter Property="MinWidth" Value="250"></Setter> | ||
</Style> | ||
</StackPanel.Resources> | ||
<TextBlock | ||
Margin="0,10,10,10" | ||
HorizontalAlignment="Center" | ||
Style="{StaticResource MaterialDesignHeadline5TextBlock}" | ||
Text="{Binding Dialog._caption.Synchron}" /> | ||
<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}" /> | ||
<vortex:RenderableContentControl DataContext="{Binding Dialog._content}" PresentationType="ShadowControlSlim"></vortex:RenderableContentControl> | ||
<TextBlock | ||
Margin="0,10,10,10" | ||
HorizontalAlignment="Center" | ||
Style="{StaticResource MaterialDesignHeadline6TextBlock}" | ||
Text="{Binding Dialog._text.Synchron}" /> | ||
</StackPanel> | ||
<WrapPanel | ||
Grid.Row="1" | ||
Grid.Column="1" | ||
HorizontalAlignment="Center"> | ||
<WrapPanel.Resources> | ||
<Style BasedOn="{StaticResource MaterialDesignRaisedDarkButton}" TargetType="Button"> | ||
<Setter Property="Width" Value="250" /> | ||
<Setter Property="Margin" Value="10" /> | ||
</Style> | ||
</WrapPanel.Resources> | ||
<Button | ||
Command="{Binding YesCommand, Mode=OneWay}" | ||
Content="{x:Static s:strings.Yes}" | ||
Visibility="{Binding Dialog._hasYes.LastValue, Converter={local:DialogAnswerButtonVisibility}}" /> | ||
<Button | ||
Command="{Binding NoCommand, Mode=OneWay}" | ||
Content="{x:Static s:strings.No}" | ||
Visibility="{Binding Dialog._hasNo.LastValue, Converter={local:DialogAnswerButtonVisibility}}" /> | ||
|
||
<Button | ||
Command="{Binding OkCommand, Mode=OneWay}" | ||
Content="{x:Static s:strings.Ok}" | ||
Visibility="{Binding Dialog._hasOK.LastValue, Converter={local:DialogAnswerButtonVisibility}}" /> | ||
</WrapPanel> | ||
</Grid> | ||
</materialDesign:Card> | ||
</local:TcoDialogBaseView> |
40 changes: 40 additions & 0 deletions
40
src/TcoCore/src/TcoCore.Wpf/TcoDialog/InputDialog/TcoInputDialogDialogView.xaml.cs
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,40 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Globalization; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using System.Windows; | ||
using System.Windows.Controls; | ||
using System.Windows.Data; | ||
using System.Windows.Documents; | ||
using System.Windows.Input; | ||
using System.Windows.Markup; | ||
using System.Windows.Media; | ||
using System.Windows.Media.Imaging; | ||
using System.Windows.Navigation; | ||
using System.Windows.Shapes; | ||
|
||
namespace TcoCore | ||
{ | ||
/// <summary> | ||
/// Interaction logic for TcoDialogView.xaml | ||
/// </summary> | ||
public partial class TcoInputDialogDialogView | ||
{ | ||
public TcoInputDialogDialogView() : base() | ||
{ | ||
InitializeComponent(); | ||
} | ||
|
||
private void TcoDialogBaseView_Closing(object sender, System.ComponentModel.CancelEventArgs e) | ||
{ | ||
if (webView != null) | ||
{ | ||
webView.Dispose(); | ||
webView = null; | ||
} | ||
} | ||
} | ||
|
||
} |
102 changes: 102 additions & 0 deletions
102
src/TcoCore/src/TcoCore.Wpf/TcoDialog/InputDialog/TcoInputDialogDialogViewModel.cs
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,102 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
using TcOpen.Inxton.Input; | ||
using Vortex.Connector; | ||
using Vortex.Connector.ValueTypes; | ||
using Vortex.Presentation; | ||
|
||
namespace TcoCore | ||
{ | ||
public class TcoInputDialogDialogViewModel : TcoDialogBaseViewModel , IDisposable | ||
{ | ||
System.Windows.Threading.DispatcherTimer dispatcherTimer = new System.Windows.Threading.DispatcherTimer(); | ||
public TcoInputDialogDialogViewModel() : base() | ||
{ | ||
|
||
|
||
dispatcherTimer.Tick += new EventHandler(dispatcherTimer_Tick); | ||
dispatcherTimer.Interval = new TimeSpan(0, 0, 0, 0, 10); | ||
|
||
|
||
dispatcherTimer.Start(); | ||
|
||
|
||
|
||
OkCommand = new RelayCommand((a) => { Dialog._answer.Synchron = (short)eInputDialogAnswer.OK; FlushShadowToOnline(); this.Close(this, new EventArgs()); }, | ||
((b) => (bool)Dialog._hasOK.Synchron), | ||
() => TcOpen.Inxton.TcoAppDomain.Current.Logger.Information($"{nameof(TcoCore.TcoInputDialogDialogViewModel.OkCommand)} of {Dialog.HumanReadable} was executed @{{payload}}.", new { Dialog.Symbol })); | ||
|
||
YesCommand = new RelayCommand((a) => { Dialog._answer.Synchron = (short)eInputDialogAnswer.Yes; FlushShadowToOnline(); this.Close(this, new EventArgs()); }, | ||
(b) => Dialog._hasYes.Synchron, | ||
() => TcOpen.Inxton.TcoAppDomain.Current.Logger.Information($"{nameof(YesCommand)} of {Dialog.HumanReadable} was executed @{{payload}}.", new { Dialog.Symbol })); | ||
|
||
NoCommand = new RelayCommand((a) => { Dialog._answer.Synchron = (short)eInputDialogAnswer.No; this.Close(this, new EventArgs()); }, | ||
(b) => Dialog._hasNo.Synchron, | ||
() => TcOpen.Inxton.TcoAppDomain.Current.Logger.Information($"{nameof(NoCommand)} of {Dialog.HumanReadable} was executed @{{payload}}.", new { Dialog.Symbol })); | ||
|
||
|
||
|
||
|
||
} | ||
|
||
private void FlushShadowToOnline() | ||
{ | ||
try | ||
{ | ||
((dynamic)Dialog.GetConnector().IdentityProvider.GetVortexerByIdentity(Dialog._content.Identity.Synchron)).FlushShadowToOnline(); | ||
} | ||
catch (Exception msg) | ||
{ | ||
|
||
Console.WriteLine(msg); | ||
} | ||
|
||
} | ||
|
||
private void dispatcherTimer_Tick(object sender, EventArgs e) | ||
{ | ||
|
||
Dialog.Read(); | ||
|
||
|
||
if (Dialog._answer.LastValue != (short)eDialogAnswer.Invoked) | ||
{ | ||
this.Close(this, new EventArgs()); | ||
|
||
if (dispatcherTimer != null) | ||
{ | ||
dispatcherTimer.Stop(); // stop timer | ||
dispatcherTimer.Tick -= dispatcherTimer_Tick; | ||
} | ||
} | ||
|
||
|
||
|
||
} | ||
|
||
|
||
public void Dispose() | ||
{ | ||
if (dispatcherTimer != null) | ||
{ | ||
dispatcherTimer.Stop(); | ||
dispatcherTimer.Tick -= dispatcherTimer_Tick; | ||
|
||
} | ||
} | ||
|
||
public TcoInputDialog Dialog { get; private set; } = new TcoInputDialog(); | ||
public override object Model { get => Dialog; set => Dialog = (TcoInputDialog)value; } | ||
|
||
public RelayCommand OkCommand { get; } | ||
public RelayCommand YesCommand { get; } | ||
public RelayCommand NoCommand { get; } | ||
public PlainTcoInputDialog Plainer { get; private set; } = new PlainTcoInputDialog(); | ||
} | ||
|
||
|
||
} |
9 changes: 9 additions & 0 deletions
9
src/TcoCore/src/TcoCoreConnector/Properties/Localizations.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Oops, something went wrong.