mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-29 07:27:36 +08:00
new style
This commit is contained in:
@@ -15,11 +15,11 @@
|
||||
x:Class="System.Application.UI.Views.Controls.ToastMessage">
|
||||
<UserControl.Styles>
|
||||
<Style Selector="controls|ToastMessage">
|
||||
<Setter Property="Margin" Value="0 0 20 30" />
|
||||
<Setter Property="HorizontalAlignment" Value="Right" />
|
||||
<Setter Property="Margin" Value="0 0 0 20" />
|
||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||
<Setter Property="VerticalAlignment" Value="Bottom" />
|
||||
</Style>
|
||||
|
||||
|
||||
<Style Selector="controls|ToastMessage > Border">
|
||||
<Setter Property="CornerRadius" Value="4" />
|
||||
<Setter Property="BoxShadow" Value="{DynamicResource InfoBoxShadow}" />
|
||||
|
||||
+150
-143
@@ -16,151 +16,158 @@
|
||||
x:DataType="vm:ProxyScriptManagePageViewModel"
|
||||
x:CompileBindings="True"
|
||||
x:Class="System.Application.UI.Views.Pages.ProxyScriptManagePage">
|
||||
<DockPanel>
|
||||
<Border DockPanel.Dock="Top" Classes="paper" Background="{DynamicResource ThemeBrushKey}" Padding="10" Margin="20 0 20 10">
|
||||
<DockPanel>
|
||||
<StackPanel Orientation="Horizontal" Spacing="8" HorizontalAlignment="Left">
|
||||
<Button Background="Transparent" Cursor="Hand" Click="AddNewScriptButton_Click"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Import,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<PathIcon Width="16" Data="{StaticResource AddDrawing}" />
|
||||
</Button>
|
||||
<Button Background="Transparent" Cursor="Hand"
|
||||
Command="{ReflectionBinding RefreshScriptButton}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Refresh,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<PathIcon Width="16" Data="{StaticResource RefreshDrawing}" />
|
||||
</Button>
|
||||
<Button Background="Transparent" Cursor="Hand"
|
||||
Command="{Binding ScriptStoreCommand}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Shop,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<PathIcon Width="16" Data="{StaticResource JavaScriptDrawing}" />
|
||||
</Button>
|
||||
<ToggleSwitch
|
||||
Content="{ReflectionBinding Path=Res.Script_AutoUpdate,Mode=OneWay,Source={x:Static resx:R.Current}}"
|
||||
IsChecked="{Binding Source={x:Static ms:ProxySettings.IsAutoCheckScriptUpdate},Path=Value}"
|
||||
Margin="20 0">
|
||||
</ToggleSwitch>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Spacing="15" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<TextBox Watermark="{ReflectionBinding Path=Res.Search,Mode=OneWay,Source={x:Static resx:R.Current}}" Text="{CompiledBinding SearchText,Mode=TwoWay}" VerticalAlignment="Center" MinWidth="300">
|
||||
<TextBox.InnerLeftContent>
|
||||
<PathIcon Data="{StaticResource SearchDrawing}"
|
||||
Width="20" Height="20"
|
||||
Opacity="0.8"
|
||||
VerticalAlignment="Top" HorizontalAlignment="Left"
|
||||
Margin="15,8,0,0" />
|
||||
</TextBox.InnerLeftContent>
|
||||
</TextBox>
|
||||
<!--<TextBlock Text="{ReflectionBinding Path=Res.CommunityFix_EnableScriptService,Mode=OneWay,Source={x:Static resx:R.Current}}" VerticalAlignment="Center"></TextBlock>-->
|
||||
<ToggleSwitch Content="" OnContent="{ReflectionBinding Path=Res.CommunityFix_EnableScriptService,Mode=OneWay,Source={x:Static resx:R.Current}}" OffContent="{ReflectionBinding Path=Res.CommunityFix_EnableScriptService,Mode=OneWay,Source={x:Static resx:R.Current}}" IsChecked="{Binding Source={x:Static service:ProxyService.Current},Path=IsEnableScript}"></ToggleSwitch>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
<Panel>
|
||||
<TextBlock IsVisible="{Binding IsProxyScriptsEmpty}"
|
||||
Text="{ReflectionBinding Path=Res.ScriptConfig_ScriptEmptyTip,Mode=OneWay,Source={x:Static resx:R.Current}}"
|
||||
TextWrapping="WrapWithOverflow"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" Padding="{StaticResource ScrollMargin}">
|
||||
<ItemsRepeater Items="{Binding ProxyScripts}">
|
||||
<ItemsRepeater.Layout>
|
||||
<WrapLayout VerticalSpacing="20" HorizontalSpacing="20" Orientation="Horizontal"/>
|
||||
</ItemsRepeater.Layout>
|
||||
<ItemsRepeater.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border Width="450" Classes="paper" Background="{DynamicResource ThemeBrushKey}" Padding="20 10">
|
||||
<DockPanel>
|
||||
<Image Source="{Binding Icon}" DockPanel.Dock="Left"></Image>
|
||||
<StackPanel Spacing="8" DockPanel.Dock="Right">
|
||||
<DockPanel>
|
||||
<controls:ScrollingTextBlock
|
||||
Width="{Binding $parent.Width}"
|
||||
Text="{Binding Name,Mode=OneWay}"
|
||||
FontSize="16"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource HighlightForegroundBrushKey}"/>
|
||||
|
||||
<WrapPanel HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
Text="{Binding Author}"
|
||||
FontSize="14"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource HighlightForegroundBrushKey}"/>
|
||||
|
||||
<TextBlock Text=" / v" FontSize="14"></TextBlock>
|
||||
<TextBlock
|
||||
Text="{Binding Version}"
|
||||
FontSize="14"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource HighlightForegroundBrushKey}"/>
|
||||
</WrapPanel>
|
||||
</DockPanel>
|
||||
|
||||
<Separator Classes="Separator" Margin="0 0 0 5"></Separator>
|
||||
|
||||
<TextBlock
|
||||
Width="{Binding $parent.Width}"
|
||||
TextWrapping="WrapWithOverflow"
|
||||
Text="{Binding Description}"
|
||||
FontSize="12"
|
||||
Foreground="{DynamicResource HighlightForegroundBrushKey}"/>
|
||||
|
||||
|
||||
<StackPanel Orientation="Horizontal" Spacing="10" VerticalAlignment="Bottom">
|
||||
<ToggleSwitch OnContent="" OffContent="" IsChecked="{Binding Enable,Mode=TwoWay}">
|
||||
</ToggleSwitch>
|
||||
<Button Background="Transparent" Cursor="Hand"
|
||||
Command="{ReflectionBinding #u.DataContext.EditScriptItemButton}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Edit,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<PathIcon Width="20" Data="{StaticResource CodeDrawing}" />
|
||||
</Button>
|
||||
|
||||
<Button Background="Transparent" Cursor="Hand"
|
||||
Command="{ReflectionBinding #u.DataContext.RefreshScriptItemButton}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Refresh,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<DockPanel>
|
||||
<Border DockPanel.Dock="Top" Classes="paper" Background="{DynamicResource ThemeBrushKey}" Padding="10" Margin="20 0 20 10">
|
||||
<DockPanel>
|
||||
<StackPanel Orientation="Horizontal" Spacing="8" HorizontalAlignment="Left">
|
||||
<Button Background="Transparent" Cursor="Hand" Click="AddNewScriptButton_Click"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Import,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<PathIcon Width="16" Data="{StaticResource AddDrawing}" />
|
||||
</Button>
|
||||
<Button Background="Transparent" Cursor="Hand"
|
||||
Command="{ReflectionBinding RefreshScriptButton}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Refresh,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<PathIcon Width="16" Data="{StaticResource RefreshDrawing}" />
|
||||
</Button>
|
||||
</Button>
|
||||
<Button Background="Transparent" Cursor="Hand"
|
||||
Command="{Binding ScriptStoreCommand}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Shop,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<PathIcon Width="16" Data="{StaticResource JavaScriptDrawing}" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<Button Background="Transparent" Cursor="Hand"
|
||||
Command="{ReflectionBinding #u.DataContext.OpenHomeScriptItemButton}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Home,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<PathIcon Width="16" Data="{StaticResource HomeDrawing}" />
|
||||
</Button>
|
||||
<StackPanel Orientation="Horizontal" Spacing="15" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<TextBox Watermark="{ReflectionBinding Path=Res.Search,Mode=OneWay,Source={x:Static resx:R.Current}}" Text="{CompiledBinding SearchText,Mode=TwoWay}" VerticalAlignment="Center" MinWidth="300">
|
||||
<TextBox.InnerLeftContent>
|
||||
<PathIcon Data="{StaticResource SearchDrawing}"
|
||||
Width="20" Height="20"
|
||||
Opacity="0.8"
|
||||
VerticalAlignment="Top" HorizontalAlignment="Left"
|
||||
Margin="15,8,0,0" />
|
||||
</TextBox.InnerLeftContent>
|
||||
</TextBox>
|
||||
<!--<TextBlock Text="{ReflectionBinding Path=Res.CommunityFix_EnableScriptService,Mode=OneWay,Source={x:Static resx:R.Current}}" VerticalAlignment="Center"></TextBlock>-->
|
||||
<ToggleSwitch Content="" OnContent="{ReflectionBinding Path=Res.CommunityFix_EnableScriptService,Mode=OneWay,Source={x:Static resx:R.Current}}" OffContent="{ReflectionBinding Path=Res.CommunityFix_EnableScriptService,Mode=OneWay,Source={x:Static resx:R.Current}}" IsChecked="{Binding Source={x:Static service:ProxyService.Current},Path=IsEnableScript}"></ToggleSwitch>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
<Panel>
|
||||
<TextBlock IsVisible="{Binding IsProxyScriptsEmpty}"
|
||||
Text="{ReflectionBinding Path=Res.ScriptConfig_ScriptEmptyTip,Mode=OneWay,Source={x:Static resx:R.Current}}"
|
||||
TextWrapping="WrapWithOverflow"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" Padding="{StaticResource ScrollMargin}">
|
||||
<ItemsRepeater Items="{Binding ProxyScripts}">
|
||||
<ItemsRepeater.Layout>
|
||||
<WrapLayout VerticalSpacing="20" HorizontalSpacing="20" Orientation="Horizontal"/>
|
||||
</ItemsRepeater.Layout>
|
||||
<ItemsRepeater.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border Width="450" Classes="paper" Background="{DynamicResource ThemeBrushKey}" Padding="20 10">
|
||||
<DockPanel>
|
||||
<Image Source="{Binding Icon}" DockPanel.Dock="Left"></Image>
|
||||
<StackPanel Spacing="8" DockPanel.Dock="Right">
|
||||
<DockPanel>
|
||||
<controls:ScrollingTextBlock
|
||||
Width="{Binding $parent.Width}"
|
||||
Text="{Binding Name,Mode=OneWay}"
|
||||
FontSize="16"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource HighlightForegroundBrushKey}"/>
|
||||
|
||||
<Button Background="Transparent" Cursor="Hand" HorizontalAlignment="Right"
|
||||
Command="{ReflectionBinding #u.DataContext.DeleteScriptItemButton}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Delete,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<PathIcon Width="20" Data="{StaticResource DeleteDrawing}" />
|
||||
</Button>
|
||||
<WrapPanel HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
Text="{Binding Author}"
|
||||
FontSize="14"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource HighlightForegroundBrushKey}"/>
|
||||
|
||||
<Button Background="Transparent" IsVisible="{Binding IsUpdate}" Cursor="Hand" HorizontalAlignment="Right"
|
||||
Command="{ReflectionBinding #u.DataContext.DownloadScriptItemButton}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Update,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<WrapPanel Orientation="Horizontal">
|
||||
<PathIcon Width="20" Margin="5 0 5 0" Data="{StaticResource DownloadDrawing}" />
|
||||
<TextBlock
|
||||
Text="{Binding NewVersion}"
|
||||
FontSize="14"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource HighlightForegroundBrushKey}"/>
|
||||
<Ellipse VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center" IsVisible="{Binding IsUpdate}" x:Name="circle" Margin="5 5 5 5" Height="10" Width="10" Fill="#F82805">
|
||||
</Ellipse>
|
||||
</WrapPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsRepeater.ItemTemplate>
|
||||
</ItemsRepeater>
|
||||
</ScrollViewer>
|
||||
</Panel>
|
||||
</DockPanel>
|
||||
<TextBlock Text=" / v" FontSize="14"></TextBlock>
|
||||
<TextBlock
|
||||
Text="{Binding Version}"
|
||||
FontSize="14"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource HighlightForegroundBrushKey}"/>
|
||||
</WrapPanel>
|
||||
</DockPanel>
|
||||
|
||||
<Separator Classes="Separator" Margin="0 0 0 5"></Separator>
|
||||
|
||||
<TextBlock
|
||||
Width="{Binding $parent.Width}"
|
||||
TextWrapping="WrapWithOverflow"
|
||||
Text="{Binding Description}"
|
||||
FontSize="12"
|
||||
Foreground="{DynamicResource HighlightForegroundBrushKey}"/>
|
||||
|
||||
|
||||
<DockPanel VerticalAlignment="Bottom">
|
||||
<StackPanel Orientation="Horizontal" Spacing="10">
|
||||
<ToggleSwitch OnContent="" OffContent="" IsChecked="{Binding Enable,Mode=TwoWay}">
|
||||
</ToggleSwitch>
|
||||
<Button Background="Transparent" Cursor="Hand"
|
||||
Command="{ReflectionBinding #u.DataContext.EditScriptItemButton}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Edit,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<PathIcon Width="20" Data="{StaticResource CodeDrawing}" />
|
||||
</Button>
|
||||
|
||||
<Button Background="Transparent" Cursor="Hand"
|
||||
Command="{ReflectionBinding #u.DataContext.RefreshScriptItemButton}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Refresh,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<PathIcon Width="16" Data="{StaticResource RefreshDrawing}" />
|
||||
</Button>
|
||||
|
||||
<Button Background="Transparent" Cursor="Hand"
|
||||
Command="{ReflectionBinding #u.DataContext.OpenHomeScriptItemButton}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Home,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<PathIcon Width="16" Data="{StaticResource HomeDrawing}" />
|
||||
</Button>
|
||||
|
||||
<Button Background="Transparent" Cursor="Hand" HorizontalAlignment="Right"
|
||||
Command="{ReflectionBinding #u.DataContext.DeleteScriptItemButton}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Delete,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<PathIcon Width="20" Data="{StaticResource DeleteDrawing}" />
|
||||
</Button>
|
||||
|
||||
</StackPanel>
|
||||
|
||||
<WrapPanel
|
||||
DockPanel.Dock="Right"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Update,Mode=OneWay,Source={x:Static resx:R.Current}}"
|
||||
IsVisible="{Binding IsUpdate}">
|
||||
<!--<Button Background="Transparent" IsVisible="{Binding IsUpdate}" Cursor="Hand" HorizontalAlignment="Right"
|
||||
Command="{ReflectionBinding #u.DataContext.DownloadScriptItemButton}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Update,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<PathIcon Width="20" Height="20" Data="{StaticResource DownloadDrawing}" />
|
||||
</Button>-->
|
||||
<Button Classes="Hyperlink"
|
||||
Command="{ReflectionBinding #u.DataContext.DownloadScriptItemButton}"
|
||||
CommandParameter="{Binding}"
|
||||
Content="{Binding NewVersion,StringFormat={}v{0}}"
|
||||
FontSize="{DynamicResource FontSizeH8}"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource HighlightForegroundBrushKey}"/>
|
||||
<Ellipse VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
Height="6" Width="6" Margin="5 0"
|
||||
Fill="{DynamicResource ValidationErrorColorKey}">
|
||||
</Ellipse>
|
||||
</WrapPanel>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsRepeater.ItemTemplate>
|
||||
</ItemsRepeater>
|
||||
</ScrollViewer>
|
||||
</Panel>
|
||||
</DockPanel>
|
||||
</UserControl>
|
||||
@@ -46,7 +46,9 @@
|
||||
CommandParameter="{Binding}" />
|
||||
</ContextMenu>
|
||||
</Panel.ContextMenu>
|
||||
<Border x:Name="card" DockPanel.Dock="Top" Classes="paper" CornerRadius="0" Background="{DynamicResource ThemeBrushKey}">
|
||||
<Border x:Name="card"
|
||||
Classes="paper"
|
||||
Background="{DynamicResource ThemeBrushKey}">
|
||||
<i:Interaction.Behaviors>
|
||||
<ia:EventTriggerBehavior EventName="PointerEnter" SourceObject="{ReflectionBinding #card}">
|
||||
<ia:ChangePropertyAction TargetObject="{ReflectionBinding #delete_btn}" PropertyName="IsVisible" Value="True"/>
|
||||
|
||||
+135
-109
@@ -18,118 +18,144 @@
|
||||
Title="{Binding Title}"
|
||||
x:DataType="vm:ScriptStoreWindowViewModel"
|
||||
x:CompileBindings="True">
|
||||
<Panel HorizontalAlignment="Stretch">
|
||||
<controls:TitleBar></controls:TitleBar>
|
||||
<Panel HorizontalAlignment="Stretch">
|
||||
<controls:TitleBar></controls:TitleBar>
|
||||
|
||||
<DockPanel>
|
||||
<Border DockPanel.Dock="Top" Classes="paper" Background="{DynamicResource ThemeBrushKey}" Padding="10" Margin="20 40 20 10">
|
||||
<DockPanel>
|
||||
<StackPanel Orientation="Horizontal" Spacing="8" HorizontalAlignment="Left">
|
||||
<Button Background="Transparent" Cursor="Hand"
|
||||
Command="{ReflectionBinding RefreshScriptButton}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Refresh,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<PathIcon Width="16" Data="{StaticResource RefreshDrawing}" />
|
||||
</Button>
|
||||
</StackPanel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Spacing="15" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<TextBox Watermark="{ReflectionBinding Path=Res.Search,Mode=OneWay,Source={x:Static resx:R.Current}}" Text="{CompiledBinding SearchText,Mode=TwoWay}" VerticalAlignment="Center" MinWidth="300">
|
||||
<TextBox.InnerLeftContent>
|
||||
<PathIcon Data="{StaticResource SearchDrawing}"
|
||||
Width="20" Height="20"
|
||||
Opacity="0.8"
|
||||
VerticalAlignment="Top" HorizontalAlignment="Left"
|
||||
Margin="15,8,0,0" />
|
||||
</TextBox.InnerLeftContent>
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
<Panel>
|
||||
<TextBlock IsVisible="{Binding IsScriptsEmpty}"
|
||||
Text="{ReflectionBinding Path=Res.ScriptConfig_ScriptEmptyTip,Mode=OneWay,Source={x:Static resx:R.Current}}"
|
||||
TextWrapping="WrapWithOverflow"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" Padding="{StaticResource ScrollMargin}">
|
||||
<ItemsRepeater Items="{Binding Scripts}">
|
||||
<ItemsRepeater.Layout>
|
||||
<StackLayout Orientation="Vertical" Spacing="20"/>
|
||||
</ItemsRepeater.Layout>
|
||||
<ItemsRepeater.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border Classes="paper" Background="{DynamicResource ThemeBrushKey}" Padding="20 10">
|
||||
<DockPanel>
|
||||
<Image Source="{Binding Icon}" DockPanel.Dock="Left"></Image>
|
||||
<StackPanel Spacing="8" DockPanel.Dock="Right">
|
||||
<DockPanel>
|
||||
<controls:ScrollingTextBlock
|
||||
Width="{Binding $parent.Width}"
|
||||
Text="{Binding Name,Mode=OneWay}"
|
||||
FontSize="16"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource HighlightForegroundBrushKey}"/>
|
||||
|
||||
<WrapPanel HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
Text="{Binding Author}"
|
||||
FontSize="14"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource HighlightForegroundBrushKey}"/>
|
||||
<TextBlock Text=" / v" FontSize="14"></TextBlock>
|
||||
<TextBlock
|
||||
Text="{Binding Version}"
|
||||
FontSize="14"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource HighlightForegroundBrushKey}"/>
|
||||
</WrapPanel>
|
||||
</DockPanel>
|
||||
|
||||
<Separator Classes="Separator" Margin="0 0 0 5"></Separator>
|
||||
|
||||
<TextBlock
|
||||
Width="{Binding $parent.Width}"
|
||||
TextWrapping="WrapWithOverflow"
|
||||
Text="{Binding Description}"
|
||||
FontSize="12"
|
||||
Foreground="{DynamicResource HighlightForegroundBrushKey}"/>
|
||||
<StackPanel Orientation="Horizontal" Spacing="10" VerticalAlignment="Bottom">
|
||||
<Border DockPanel.Dock="Top" Classes="paper" Background="{DynamicResource ThemeBrushKey}" Padding="10" Margin="20 40 20 10">
|
||||
<DockPanel>
|
||||
<StackPanel Orientation="Horizontal" Spacing="8" HorizontalAlignment="Left">
|
||||
<Button Background="Transparent" Cursor="Hand"
|
||||
Command="{ReflectionBinding #u.DataContext.OpenHomeScriptItemButton}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Home,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<PathIcon Width="16" Data="{StaticResource HomeDrawing}" />
|
||||
Command="{ReflectionBinding RefreshScriptButton}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Refresh,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<PathIcon Width="16" Data="{StaticResource RefreshDrawing}" />
|
||||
</Button>
|
||||
<Button IsVisible="{Binding !IsExist}" Background="Transparent" Cursor="Hand"
|
||||
Command="{ReflectionBinding #u.DataContext.DownloadScriptItemButton}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Install,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<PathIcon Width="16" Data="{StaticResource DownloadDrawing}" />
|
||||
</Button>
|
||||
<Button IsVisible="{Binding IsUpdate}" Background="Transparent" Cursor="Hand"
|
||||
Command="{ReflectionBinding #u.DataContext.DownloadScriptItemButton}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Update,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<WrapPanel Orientation="Horizontal">
|
||||
<PathIcon Width="20" Margin="5 0 5 0" Data="{StaticResource DownloadDrawing}" />
|
||||
<TextBlock
|
||||
Text="{Binding NewVersion}"
|
||||
FontSize="14"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource HighlightForegroundBrushKey}"/>
|
||||
<Ellipse VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center" IsVisible="{Binding IsUpdate}" x:Name="circle" Margin="5 5 5 5" Height="10" Width="10" Fill="#F82805">
|
||||
</Ellipse>
|
||||
</WrapPanel>
|
||||
</Button>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsRepeater.ItemTemplate>
|
||||
</ItemsRepeater>
|
||||
</ScrollViewer>
|
||||
</Panel>
|
||||
</DockPanel>
|
||||
</Panel>
|
||||
|
||||
<StackPanel Orientation="Horizontal" Spacing="15" HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<TextBox Watermark="{ReflectionBinding Path=Res.Search,Mode=OneWay,Source={x:Static resx:R.Current}}" Text="{CompiledBinding SearchText,Mode=TwoWay}" VerticalAlignment="Center" MinWidth="300">
|
||||
<TextBox.InnerLeftContent>
|
||||
<PathIcon Data="{StaticResource SearchDrawing}"
|
||||
Width="20" Height="20"
|
||||
Opacity="0.8"
|
||||
VerticalAlignment="Top" HorizontalAlignment="Left"
|
||||
Margin="15,8,0,0" />
|
||||
</TextBox.InnerLeftContent>
|
||||
</TextBox>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
<Panel>
|
||||
<TextBlock IsVisible="{Binding IsScriptsEmpty}"
|
||||
Text="{ReflectionBinding Path=Res.ScriptConfig_ScriptEmptyTip,Mode=OneWay,Source={x:Static resx:R.Current}}"
|
||||
TextWrapping="WrapWithOverflow"
|
||||
VerticalAlignment="Center" HorizontalAlignment="Center"></TextBlock>
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Disabled" Padding="{StaticResource ScrollMargin}">
|
||||
<ItemsRepeater Items="{Binding Scripts}">
|
||||
<ItemsRepeater.Layout>
|
||||
<StackLayout Orientation="Vertical" Spacing="20"/>
|
||||
</ItemsRepeater.Layout>
|
||||
<ItemsRepeater.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Border Classes="paper" Background="{DynamicResource ThemeBrushKey}" Padding="20 10">
|
||||
<DockPanel>
|
||||
<Image Source="{Binding Icon}" DockPanel.Dock="Left"></Image>
|
||||
<StackPanel Spacing="8" DockPanel.Dock="Right">
|
||||
<DockPanel>
|
||||
<controls:ScrollingTextBlock
|
||||
Width="{Binding $parent.Width}"
|
||||
Text="{Binding Name,Mode=OneWay}"
|
||||
FontSize="16"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource HighlightForegroundBrushKey}"/>
|
||||
|
||||
<WrapPanel HorizontalAlignment="Right" VerticalAlignment="Center">
|
||||
<TextBlock
|
||||
Text="{Binding Author}"
|
||||
FontSize="14"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource HighlightForegroundBrushKey}"/>
|
||||
<TextBlock Text=" / v" FontSize="14"></TextBlock>
|
||||
<TextBlock
|
||||
Text="{Binding Version}"
|
||||
FontSize="14"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource HighlightForegroundBrushKey}"/>
|
||||
</WrapPanel>
|
||||
</DockPanel>
|
||||
|
||||
<Separator Classes="Separator" Margin="0 0 0 5"></Separator>
|
||||
|
||||
<TextBlock
|
||||
Width="{Binding $parent.Width}"
|
||||
TextWrapping="WrapWithOverflow"
|
||||
Text="{Binding Description}"
|
||||
FontSize="12"
|
||||
Foreground="{DynamicResource HighlightForegroundBrushKey}"/>
|
||||
|
||||
<DockPanel VerticalAlignment="Bottom">
|
||||
<StackPanel Orientation="Horizontal" Spacing="10">
|
||||
<Button Background="Transparent" Cursor="Hand"
|
||||
Command="{ReflectionBinding #u.DataContext.OpenHomeScriptItemButton}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Home,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<PathIcon Width="16" Data="{StaticResource HomeDrawing}" />
|
||||
</Button>
|
||||
<Button IsVisible="{Binding !IsExist}" Background="Transparent" Cursor="Hand"
|
||||
Command="{ReflectionBinding #u.DataContext.DownloadScriptItemButton}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Install,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<PathIcon Width="16" Data="{StaticResource DownloadDrawing}" />
|
||||
</Button>
|
||||
<PathIcon Data="{StaticResource CheckmarkDrawing}"
|
||||
Width="16"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Installed,Mode=OneWay,Source={x:Static resx:R.Current}}"
|
||||
Margin="8 0" IsVisible="{Binding IsExist}"/>
|
||||
<!--<Button IsVisible="{Binding IsUpdate}" Background="Transparent" Cursor="Hand"
|
||||
Command="{ReflectionBinding #u.DataContext.DownloadScriptItemButton}"
|
||||
CommandParameter="{Binding}"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Update,Mode=OneWay,Source={x:Static resx:R.Current}}">
|
||||
<WrapPanel Orientation="Horizontal">
|
||||
<PathIcon Width="20" Margin="5 0 5 0" Data="{StaticResource DownloadDrawing}" />
|
||||
<TextBlock
|
||||
Text="{Binding NewVersion}"
|
||||
FontSize="14"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource HighlightForegroundBrushKey}"/>
|
||||
<Ellipse VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center" IsVisible="{Binding IsUpdate}" x:Name="circle" Margin="5 5 5 5" Height="10" Width="10" Fill="#F82805">
|
||||
</Ellipse>
|
||||
</WrapPanel>
|
||||
</Button>-->
|
||||
</StackPanel>
|
||||
<WrapPanel
|
||||
DockPanel.Dock="Right"
|
||||
HorizontalAlignment="Right"
|
||||
VerticalAlignment="Center"
|
||||
ToolTip.Tip="{ReflectionBinding Path=Res.Script_Update,Mode=OneWay,Source={x:Static resx:R.Current}}"
|
||||
IsVisible="{Binding IsUpdate}">
|
||||
<Button Classes="Hyperlink"
|
||||
Command="{ReflectionBinding #u.DataContext.DownloadScriptItemButton}"
|
||||
CommandParameter="{Binding}"
|
||||
Content="{Binding NewVersion,StringFormat={}v{0}}"
|
||||
FontSize="{DynamicResource FontSizeH7}"
|
||||
VerticalAlignment="Center"
|
||||
Foreground="{DynamicResource HighlightForegroundBrushKey}"/>
|
||||
<Ellipse VerticalAlignment="Center"
|
||||
HorizontalAlignment="Center"
|
||||
Height="6" Width="6" Margin="5 0"
|
||||
Fill="{DynamicResource ValidationErrorColorKey}">
|
||||
</Ellipse>
|
||||
</WrapPanel>
|
||||
</DockPanel>
|
||||
</StackPanel>
|
||||
</DockPanel>
|
||||
</Border>
|
||||
</DataTemplate>
|
||||
</ItemsRepeater.ItemTemplate>
|
||||
</ItemsRepeater>
|
||||
</ScrollViewer>
|
||||
</Panel>
|
||||
</DockPanel>
|
||||
</Panel>
|
||||
</Window>
|
||||
|
||||
+10
-1
@@ -1565,7 +1565,7 @@ namespace System.Application.UI.Resx {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 自动更新 的本地化字符串。
|
||||
/// 查找类似 启用脚本自动检查更新 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string Script_AutoUpdate {
|
||||
get {
|
||||
@@ -1618,6 +1618,15 @@ namespace System.Application.UI.Resx {
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 已安装 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string Script_Installed {
|
||||
get {
|
||||
return ResourceManager.GetString("Script_Installed", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 刷新缓存 的本地化字符串。
|
||||
/// </summary>
|
||||
|
||||
@@ -632,7 +632,7 @@
|
||||
<value>脚本工坊</value>
|
||||
</data>
|
||||
<data name="Script_AutoUpdate" xml:space="preserve">
|
||||
<value>自动更新</value>
|
||||
<value>启用脚本自动检查更新</value>
|
||||
</data>
|
||||
<data name="Script_DeleteItem" xml:space="preserve">
|
||||
<value>确定要删除这个脚本吗?</value>
|
||||
@@ -649,6 +649,9 @@
|
||||
<data name="Script_Install" xml:space="preserve">
|
||||
<value>安装脚本</value>
|
||||
</data>
|
||||
<data name="Script_Installed" xml:space="preserve">
|
||||
<value>已安装</value>
|
||||
</data>
|
||||
<data name="Script_Refresh" xml:space="preserve">
|
||||
<value>刷新缓存</value>
|
||||
</data>
|
||||
|
||||
@@ -15,153 +15,164 @@ using System.Windows;
|
||||
|
||||
namespace System.Application.UI.ViewModels
|
||||
{
|
||||
public class ProxyScriptManagePageViewModel : TabItemViewModel
|
||||
{
|
||||
public override string Name
|
||||
{
|
||||
get => AppResources.ScriptConfig;
|
||||
protected set { throw new NotImplementedException(); }
|
||||
}
|
||||
internal override void ActivationOnFirst()
|
||||
{
|
||||
if (ProxySettings.IsAutoCheckScriptUpdate)
|
||||
ProxyService.Current.CheckUpdate();
|
||||
}
|
||||
private readonly ReadOnlyObservableCollection<ScriptDTO> _ProxyScripts;
|
||||
public ReadOnlyObservableCollection<ScriptDTO> ProxyScripts => _ProxyScripts;
|
||||
public class ProxyScriptManagePageViewModel : TabItemViewModel
|
||||
{
|
||||
public override string Name
|
||||
{
|
||||
get => AppResources.ScriptConfig;
|
||||
protected set { throw new NotImplementedException(); }
|
||||
}
|
||||
internal override void ActivationOnFirst()
|
||||
{
|
||||
if (ProxySettings.IsAutoCheckScriptUpdate)
|
||||
ProxyService.Current.CheckUpdate();
|
||||
}
|
||||
private readonly ReadOnlyObservableCollection<ScriptDTO> _ProxyScripts;
|
||||
public ReadOnlyObservableCollection<ScriptDTO> ProxyScripts => _ProxyScripts;
|
||||
|
||||
private Func<ScriptDTO, bool> ScriptFilter(string? serachText)
|
||||
{
|
||||
return s =>
|
||||
{
|
||||
if (s == null)
|
||||
return false;
|
||||
if (string.IsNullOrEmpty(serachText))
|
||||
return true;
|
||||
if (s.Name.Contains(serachText, StringComparison.OrdinalIgnoreCase) ||
|
||||
s.Author.Contains(serachText, StringComparison.OrdinalIgnoreCase) ||
|
||||
s.Description.Contains(serachText, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
private Func<ScriptDTO, bool> ScriptFilter(string? serachText)
|
||||
{
|
||||
return s =>
|
||||
{
|
||||
if (s == null)
|
||||
return false;
|
||||
if (string.IsNullOrEmpty(serachText))
|
||||
return true;
|
||||
if (s.Name.Contains(serachText, StringComparison.OrdinalIgnoreCase) ||
|
||||
s.Author.Contains(serachText, StringComparison.OrdinalIgnoreCase) ||
|
||||
s.Description.Contains(serachText, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
}
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
public ProxyScriptManagePageViewModel()
|
||||
{
|
||||
IconKey = nameof(ProxyScriptManagePageViewModel).Replace("ViewModel", "Svg");
|
||||
public ReactiveCommand<Unit, Unit> EnableScriptAutoUpdateCommand { get; }
|
||||
|
||||
ScriptStoreCommand = ReactiveCommand.Create(OpenScriptStoreWindow);
|
||||
public MenuItemViewModel? ScriptAutoUpdate { get; }
|
||||
|
||||
MenuItems = new ObservableCollection<MenuItemViewModel>()
|
||||
{
|
||||
new MenuItemViewModel (nameof(AppResources.CommunityFix_EnableScriptService)),
|
||||
new MenuItemViewModel (nameof(AppResources.ScriptStore)){
|
||||
IconKey ="JavaScriptDrawing",Command=ScriptStoreCommand},
|
||||
};
|
||||
public ProxyScriptManagePageViewModel()
|
||||
{
|
||||
IconKey = nameof(ProxyScriptManagePageViewModel).Replace("ViewModel", "Svg");
|
||||
|
||||
var scriptFilter = this.WhenAnyValue(x => x.SearchText).Select(ScriptFilter);
|
||||
ScriptStoreCommand = ReactiveCommand.Create(OpenScriptStoreWindow);
|
||||
EnableScriptAutoUpdateCommand = ReactiveCommand.Create(() =>
|
||||
{
|
||||
ScriptAutoUpdate?.CheckmarkChange(ProxySettings.IsAutoCheckScriptUpdate.Value = !ProxySettings.IsAutoCheckScriptUpdate.Value);
|
||||
});
|
||||
|
||||
ProxyService.Current.ProxyScripts
|
||||
.Connect()
|
||||
.Filter(scriptFilter)
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Sort(SortExpressionComparer<ScriptDTO>.Ascending(x => x.Order).ThenBy(x => x.Name))
|
||||
.Bind(out _ProxyScripts)
|
||||
.Subscribe(_ => this.RaisePropertyChanged(nameof(IsProxyScriptsEmpty)));
|
||||
MenuItems = new ObservableCollection<MenuItemViewModel>()
|
||||
{
|
||||
new MenuItemViewModel (nameof(AppResources.CommunityFix_EnableScriptService)),
|
||||
new MenuItemViewModel (nameof(AppResources.ScriptStore)){
|
||||
IconKey ="JavaScriptDrawing",Command=ScriptStoreCommand},
|
||||
new MenuItemViewModel (),
|
||||
(ScriptAutoUpdate=new MenuItemViewModel (nameof(AppResources.Script_AutoUpdate))
|
||||
{Command=EnableScriptAutoUpdateCommand }),
|
||||
};
|
||||
|
||||
}
|
||||
var scriptFilter = this.WhenAnyValue(x => x.SearchText).Select(ScriptFilter);
|
||||
|
||||
public ReactiveCommand<Unit, Unit> ScriptStoreCommand { get; }
|
||||
ProxyService.Current.ProxyScripts
|
||||
.Connect()
|
||||
.Filter(scriptFilter)
|
||||
.ObserveOn(RxApp.MainThreadScheduler)
|
||||
.Sort(SortExpressionComparer<ScriptDTO>.Ascending(x => x.Order).ThenBy(x => x.Name))
|
||||
.Bind(out _ProxyScripts)
|
||||
.Subscribe(_ => this.RaisePropertyChanged(nameof(IsProxyScriptsEmpty)));
|
||||
|
||||
}
|
||||
|
||||
public ReactiveCommand<Unit, Unit> ScriptStoreCommand { get; }
|
||||
|
||||
|
||||
private string? _SearchText;
|
||||
public string? SearchText
|
||||
{
|
||||
get => _SearchText;
|
||||
set => this.RaiseAndSetIfChanged(ref _SearchText, value);
|
||||
}
|
||||
private string? _SearchText;
|
||||
public string? SearchText
|
||||
{
|
||||
get => _SearchText;
|
||||
set => this.RaiseAndSetIfChanged(ref _SearchText, value);
|
||||
}
|
||||
|
||||
public bool IsProxyScriptsEmpty => !ProxyScripts.Any_Nullable();
|
||||
public bool IsProxyScriptsEmpty => !ProxyScripts.Any_Nullable();
|
||||
|
||||
public void RefreshScriptButton()
|
||||
{
|
||||
ProxyService.Current.RefreshScript();
|
||||
Toast.Show(string.Format(@AppResources.Success_, @AppResources.Refresh));
|
||||
}
|
||||
public void DownloadScriptItemButton(ScriptDTO model)
|
||||
{
|
||||
ProxyService.Current.DownloadScript(model);
|
||||
}
|
||||
public void RefreshScriptButton()
|
||||
{
|
||||
ProxyService.Current.RefreshScript();
|
||||
Toast.Show(string.Format(@AppResources.Success_, @AppResources.Refresh));
|
||||
}
|
||||
public void DownloadScriptItemButton(ScriptDTO model)
|
||||
{
|
||||
ProxyService.Current.DownloadScript(model);
|
||||
}
|
||||
|
||||
public void DeleteScriptItemButton(ScriptDTO script)
|
||||
{
|
||||
var result = MessageBoxCompat.ShowAsync(@AppResources.Script_DeleteItem, ThisAssembly.AssemblyTrademark, MessageBoxButtonCompat.OKCancel).ContinueWith(async (s) =>
|
||||
{
|
||||
if (s.Result == MessageBoxResultCompat.OK)
|
||||
{
|
||||
var item = await DI.Get<IScriptManagerService>().DeleteScriptAsync(script);
|
||||
if (item.state)
|
||||
{
|
||||
if (ProxyService.Current.ProxyScripts != null)
|
||||
ProxyService.Current.ProxyScripts.Remove(script);
|
||||
public void DeleteScriptItemButton(ScriptDTO script)
|
||||
{
|
||||
var result = MessageBoxCompat.ShowAsync(@AppResources.Script_DeleteItem, ThisAssembly.AssemblyTrademark, MessageBoxButtonCompat.OKCancel).ContinueWith(async (s) =>
|
||||
{
|
||||
if (s.Result == MessageBoxResultCompat.OK)
|
||||
{
|
||||
var item = await DI.Get<IScriptManagerService>().DeleteScriptAsync(script);
|
||||
if (item.state)
|
||||
{
|
||||
if (ProxyService.Current.ProxyScripts != null)
|
||||
ProxyService.Current.ProxyScripts.Remove(script);
|
||||
|
||||
}
|
||||
Toast.Show(item.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
Toast.Show(item.msg);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void EditScriptItemButton(ScriptDTO script)
|
||||
{
|
||||
public void EditScriptItemButton(ScriptDTO script)
|
||||
{
|
||||
|
||||
var url = Path.Combine(IOPath.AppDataDirectory, script.FilePath);
|
||||
DI.Get<IDesktopPlatformService>().OpenFileByTextReader(url);
|
||||
var result = MessageBoxCompat.ShowAsync(@AppResources.Script_EditTxt, ThisAssembly.AssemblyTrademark, MessageBoxButtonCompat.OKCancel).ContinueWith(async (s) =>
|
||||
{
|
||||
if (s.Result == MessageBoxResultCompat.OK)
|
||||
{
|
||||
var item = await DI.Get<IScriptManagerService>().AddScriptAsync(url, script);
|
||||
if (item.state)
|
||||
{
|
||||
if (ProxyService.Current.ProxyScripts.Items.Any() && item.model != null)
|
||||
{
|
||||
ProxyService.Current.ProxyScripts.Replace(script, item.model);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
var url = Path.Combine(IOPath.AppDataDirectory, script.FilePath);
|
||||
DI.Get<IDesktopPlatformService>().OpenFileByTextReader(url);
|
||||
var result = MessageBoxCompat.ShowAsync(@AppResources.Script_EditTxt, ThisAssembly.AssemblyTrademark, MessageBoxButtonCompat.OKCancel).ContinueWith(async (s) =>
|
||||
{
|
||||
if (s.Result == MessageBoxResultCompat.OK)
|
||||
{
|
||||
var item = await DI.Get<IScriptManagerService>().AddScriptAsync(url, script);
|
||||
if (item.state)
|
||||
{
|
||||
if (ProxyService.Current.ProxyScripts.Items.Any() && item.model != null)
|
||||
{
|
||||
ProxyService.Current.ProxyScripts.Replace(script, item.model);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void OpenHomeScriptItemButton(ScriptDTO script)
|
||||
{
|
||||
Services.CloudService.Constants.BrowserOpen(script.SourceLink);
|
||||
}
|
||||
public void OpenHomeScriptItemButton(ScriptDTO script)
|
||||
{
|
||||
Services.CloudService.Constants.BrowserOpen(script.SourceLink);
|
||||
}
|
||||
|
||||
public async void RefreshScriptItemButton(ScriptDTO script)
|
||||
{
|
||||
if (script?.FilePath != null)
|
||||
{
|
||||
var item = await DI.Get<IScriptManagerService>().AddScriptAsync(script.FilePath, build: script.IsBuild);
|
||||
if (item.state)
|
||||
if (item.model != null)
|
||||
{
|
||||
script = item.model;
|
||||
Toast.Show(AppResources.RefreshOK);
|
||||
}
|
||||
else
|
||||
{
|
||||
script.Enable = false;
|
||||
Toast.Show(item.msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
public async void RefreshScriptItemButton(ScriptDTO script)
|
||||
{
|
||||
if (script?.FilePath != null)
|
||||
{
|
||||
var item = await DI.Get<IScriptManagerService>().AddScriptAsync(script.FilePath, build: script.IsBuild);
|
||||
if (item.state)
|
||||
if (item.model != null)
|
||||
{
|
||||
script = item.model;
|
||||
Toast.Show(AppResources.RefreshOK);
|
||||
}
|
||||
else
|
||||
{
|
||||
script.Enable = false;
|
||||
Toast.Show(item.msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void OpenScriptStoreWindow()
|
||||
{
|
||||
IShowWindowService.Instance.Show(CustomWindow.ScriptStore, new ScriptStoreWindowViewModel(), string.Empty, ResizeModeCompat.CanResize);
|
||||
}
|
||||
}
|
||||
public void OpenScriptStoreWindow()
|
||||
{
|
||||
IShowWindowService.Instance.Show(CustomWindow.ScriptStore, new ScriptStoreWindowViewModel(), string.Empty, ResizeModeCompat.CanResize);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user