Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[addon] Add links in dynamic and ComObj section #48

Merged
merged 5 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Kaenx.Creator/Classes/TextFilter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ public void Hide()
public void Show()
{
Query = _query;
view.Refresh();
if(view != null)
view.Refresh();
}
}
}
13 changes: 11 additions & 2 deletions Kaenx.Creator/Controls/ComObjectRefView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,16 @@
</HeaderedContentControl>

<HeaderedContentControl Header="{x:Static p:Resources.prop_como}">
<ComboBox IsEditable="true" ItemsSource="{Binding Module.ComObjects, ElementName=ViewControl}" DisplayMemberPath="Name" SelectedItem="{Binding ComObjectObject}" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<ComboBox IsEditable="true" ItemsSource="{Binding Module.ComObjects, ElementName=ViewControl}" DisplayMemberPath="Name" SelectedItem="{Binding ComObjectObject}" />
<TextBlock Grid.Column="1" VerticalAlignment="Center" Margin="10 0 0 4">
<Hyperlink ToolTip="{x:Static p:Resources.tcheck_tooltip}" NavigateUri="https://example.com" RequestNavigate="ComObjectHyperlink">&lt;--</Hyperlink>
</TextBlock>
</Grid>
</HeaderedContentControl>

<HeaderedContentControl Header="{x:Static p:Resources.tcom_para}" Visibility="{Binding Module.IsComObjectRefAuto, ElementName=ViewControl, Converter={StaticResource BoolToVis}, ConverterParameter=true}">
Expand All @@ -127,7 +136,7 @@
<CheckBox IsChecked="{Binding UseTextParameter}" VerticalAlignment="Center" />
<ComboBox Grid.Column="1" IsEnabled="{Binding UseTextParameter}" ItemsSource="{Binding Module.ParameterRefs, ElementName=ViewControl}" SelectedItem="{Binding ParameterRefObject, Mode=TwoWay}" DisplayMemberPath="Name" />
<TextBlock Grid.Column="2" VerticalAlignment="Center" Margin="10 0 0 4">
<Hyperlink ToolTip="{x:Static p:Resources.tcheck_tooltip}" NavigateUri="https://example.com" RequestNavigate="ClickCheckHyperlink">&lt;--</Hyperlink>
<Hyperlink ToolTip="{x:Static p:Resources.tcheck_tooltip}" NavigateUri="https://example.com" RequestNavigate="ComObjParaRefHyperlink">&lt;--</Hyperlink>
</TextBlock>
</Grid>
</HeaderedContentControl>
Expand Down
8 changes: 7 additions & 1 deletion Kaenx.Creator/Controls/ComObjectRefView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,12 +92,18 @@ private void ClickRemove(object sender, RoutedEventArgs e)
ClearHelper.ClearIDs(Module.Dynamics[0], cref);
}

private void ClickCheckHyperlink(object sender, RoutedEventArgs e)
private void ComObjParaRefHyperlink(object sender, RoutedEventArgs e)
{
Models.ComObjectRef com = (sender as System.Windows.Documents.Hyperlink).DataContext as Models.ComObjectRef;
MainWindow.Instance.GoToItem(com.ParameterRefObject, Module);
}

private void ComObjectHyperlink(object sender, RoutedEventArgs e)
{
Models.ComObjectRef com = (sender as System.Windows.Documents.Hyperlink).DataContext as Models.ComObjectRef;
MainWindow.Instance.GoToItem(com.ComObjectObject, Module);
}

private void ResetId(object sender, RoutedEventArgs e)
{
((sender as Button).DataContext as Models.ComObjectRef).Id = -1;
Expand Down
42 changes: 36 additions & 6 deletions Kaenx.Creator/Controls/DynamicView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,16 @@
<TextBox Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" />
</HeaderedContentControl>
<HeaderedContentControl Header="{x:Static p:Resources.tdyn_pararef}">
<ComboBox IsEditable="true" ItemsSource="{Binding Module.ParameterRefs, ElementName=ViewControl}" SelectedItem="{Binding ParameterRefObject}" DisplayMemberPath="Name" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<ComboBox IsEditable="true" ItemsSource="{Binding Module.ParameterRefs, ElementName=ViewControl}" SelectedItem="{Binding ParameterRefObject}" DisplayMemberPath="Name" />
<TextBlock Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="10 0 0 4">
<Hyperlink ToolTip="{x:Static p:Resources.tcheck_tooltip}" NavigateUri="https://example.com" RequestNavigate="DynParameterParaRefLink">&lt;--</Hyperlink>
</TextBlock>
</Grid>
</HeaderedContentControl>
<HeaderedContentControl Header="{x:Static p:Resources.tdyn_paraname}">
<TextBlock Text="{Binding ParameterRefObject.ParameterObject.Name}" />
Expand Down Expand Up @@ -166,7 +175,16 @@
<TextBox Text="{Binding Name, UpdateSourceTrigger=PropertyChanged}" />
</HeaderedContentControl>
<HeaderedContentControl Header="{x:Static p:Resources.tdyn_comref}">
<ComboBox IsEditable="true" ItemsSource="{Binding Module.ComObjectRefs, ElementName=ViewControl}" SelectedItem="{Binding ComObjectRefObject}" DisplayMemberPath="Name" />
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<ComboBox IsEditable="true" ItemsSource="{Binding Module.ComObjectRefs, ElementName=ViewControl}" SelectedItem="{Binding ComObjectRefObject}" DisplayMemberPath="Name" />
<TextBlock Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="10 0 0 4">
<Hyperlink ToolTip="{x:Static p:Resources.tcheck_tooltip}" NavigateUri="https://example.com" RequestNavigate="DyComObjectRefLink">&lt;--</Hyperlink>
</TextBlock>
</Grid>
</HeaderedContentControl>
<HeaderedContentControl Header="{x:Static p:Resources.tdyn_comname}">
<TextBlock Text="{Binding ComObjectRefObject.ComObjectObject.Name}" />
Expand Down Expand Up @@ -261,10 +279,13 @@
<Grid.ColumnDefinitions>
<ColumnDefinition Width="auto" />
<ColumnDefinition />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>

<CheckBox IsChecked="{Binding UseParameterRef}" VerticalAlignment="Center" />
<ComboBox Grid.Column="1" IsEditable="true" IsEnabled="{Binding UseParameterRef}" ItemsSource="{Binding Module.ParameterRefs, ElementName=ViewControl}" SelectedItem="{Binding ParameterRefObject, Mode=TwoWay}" DisplayMemberPath="Name" />
<ComboBox Grid.Column="1" IsEditable="true" IsEnabled="{Binding UseParameterRef}" ItemsSource="{Binding Module.ParameterRefs, ElementName=ViewControl}" SelectedItem="{Binding ParameterRefObject, Mode=TwoWay}" DisplayMemberPath="Name" />
<TextBlock Grid.Column="2" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="10 0 0 4">
<Hyperlink ToolTip="{x:Static p:Resources.tcheck_tooltip}" NavigateUri="https://example.com" RequestNavigate="DynBlockParaRefLink">&lt;--</Hyperlink>
</TextBlock>
</Grid>
</HeaderedContentControl>
<HeaderedContentControl Header="{x:Static p:Resources.tdyn_textpara}">
Expand Down Expand Up @@ -430,8 +451,17 @@
<HeaderedContentControl Header="{x:Static p:Resources.tdyn_pararef}">
<StackPanel>
<CheckBox Content="IsGlobal" IsChecked="{Binding IsGlobal}" Margin="0 3" />
<ComboBox Visibility="{Binding IsGlobal, Converter={StaticResource BoolToVis}, ConverterParameter=true}" IsEditable="true" ItemsSource="{Binding Module.ParameterRefs, ElementName=ViewControl}" SelectedItem="{Binding ParameterRefObject}" DisplayMemberPath="Name"/>
<ComboBox Visibility="{Binding IsGlobal, Converter={StaticResource BoolToVis}}" IsEditable="true" ItemsSource="{Binding Version.ParameterRefs, ElementName=ViewControl}" SelectedItem="{Binding ParameterRefObject}" DisplayMemberPath="Name"/>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition Width="auto" />
</Grid.ColumnDefinitions>
<ComboBox Grid.Column="0" Visibility="{Binding IsGlobal, Converter={StaticResource BoolToVis}, ConverterParameter=true}" IsEditable="true" ItemsSource="{Binding Module.ParameterRefs, ElementName=ViewControl}" SelectedItem="{Binding ParameterRefObject}" DisplayMemberPath="Name"/>
<ComboBox Grid.Column="0" Visibility="{Binding IsGlobal, Converter={StaticResource BoolToVis}}" IsEditable="true" ItemsSource="{Binding Version.ParameterRefs, ElementName=ViewControl}" SelectedItem="{Binding ParameterRefObject}" DisplayMemberPath="Name"/>
<TextBlock Grid.Column="1" HorizontalAlignment="Right" VerticalAlignment="Bottom" Margin="10 0 0 4">
<Hyperlink ToolTip="{x:Static p:Resources.tcheck_tooltip}" NavigateUri="https://example.com" RequestNavigate="DynChooseParaRefLink">&lt;--</Hyperlink>
</TextBlock>
</Grid>
</StackPanel>
</HeaderedContentControl>
</StackPanel>
Expand Down
24 changes: 24 additions & 0 deletions Kaenx.Creator/Controls/DynamicView.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,30 @@ private void ClickEditButtonFunction(object sender, RoutedEventArgs e)
item.Script = code.CodeNew;
}

private void DynChooseParaRefLink(object sender, RoutedEventArgs e)
{
Models.ParameterRef paraRef = ((sender as System.Windows.Documents.Hyperlink).DataContext as Models.Dynamic.DynChooseBlock).ParameterRefObject;
MainWindow.Instance.GoToItem(paraRef, Module);
}

private void DynBlockParaRefLink(object sender, RoutedEventArgs e)
{
Models.ParameterRef paraRef = ((sender as System.Windows.Documents.Hyperlink).DataContext as Models.Dynamic.DynParaBlock).ParameterRefObject;
MainWindow.Instance.GoToItem(paraRef, Module);
}

private void DynParameterParaRefLink(object sender, RoutedEventArgs e)
{
Models.ParameterRef paraRef = ((sender as System.Windows.Documents.Hyperlink).DataContext as Models.Dynamic.DynParameter).ParameterRefObject;
MainWindow.Instance.GoToItem(paraRef, Module);
}

private void DyComObjectRefLink(object sender, RoutedEventArgs e)
{
Models.ComObjectRef comRef = ((sender as System.Windows.Documents.Hyperlink).DataContext as Models.Dynamic.DynComObject).ComObjectRefObject;
MainWindow.Instance.GoToItem(comRef, Module);
}

Dictionary<string, List<string>> SubTypes = new Dictionary<string, List<string>>() {
{"DynamicMain",
new List<string>() {
Expand Down
4 changes: 2 additions & 2 deletions Kaenx.Creator/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ private async void AutoCheckUpdate()

public void GoToItem(object item, object module)
{
if(module != null)
if(module != null && module.GetType() == typeof(Kaenx.Creator.Models.Module))
{
VersionTabs.SelectedIndex = 7;
int index2 = item switch {
Expand All @@ -131,7 +131,7 @@ public void GoToItem(object item, object module)
Models.ParameterRef => 9,
Models.ComObject => 10,
Models.ComObjectRef => 11,
Models.Dynamic.IDynItems => 15,
Models.Dynamic.IDynItems => 16,
_ => -1
};

Expand Down