Browse Source

add test tool for client

arthur.wu 2 years ago
parent
commit
90aafa2fad
24 changed files with 1189 additions and 0 deletions
  1. 11 0
      Tools/Flyinsono.Client.Test/.vs/Flyinsono.Client.Test/project-colors.json
  2. 6 0
      Tools/Flyinsono.Client.Test/App.config
  3. 73 0
      Tools/Flyinsono.Client.Test/App.xaml
  4. 23 0
      Tools/Flyinsono.Client.Test/App.xaml.cs
  5. 159 0
      Tools/Flyinsono.Client.Test/Extensions/BoolToVisibilityConverterExtension.cs
  6. 50 0
      Tools/Flyinsono.Client.Test/Extensions/LogLevelToColorConvertExtension.cs
  7. 131 0
      Tools/Flyinsono.Client.Test/Flyinsono.Client.Test.csproj
  8. BIN
      Tools/Flyinsono.Client.Test/Flyinsono.Client.Test.sln
  9. 62 0
      Tools/Flyinsono.Client.Test/LogEngineImplement.cs
  10. 24 0
      Tools/Flyinsono.Client.Test/MainDispatcher.cs
  11. 59 0
      Tools/Flyinsono.Client.Test/MainWindow.xaml
  12. 57 0
      Tools/Flyinsono.Client.Test/MainWindow.xaml.cs
  13. 140 0
      Tools/Flyinsono.Client.Test/MainWindowViewModel.cs
  14. 55 0
      Tools/Flyinsono.Client.Test/Properties/AssemblyInfo.cs
  15. 63 0
      Tools/Flyinsono.Client.Test/Properties/Resources.Designer.cs
  16. 117 0
      Tools/Flyinsono.Client.Test/Properties/Resources.resx
  17. 26 0
      Tools/Flyinsono.Client.Test/Properties/Settings.Designer.cs
  18. 7 0
      Tools/Flyinsono.Client.Test/Properties/Settings.settings
  19. 62 0
      Tools/Flyinsono.Client.Test/ViewModels/TestViewModel.cs
  20. 23 0
      Tools/Flyinsono.Client.Test/Views/TestView.xaml
  21. 28 0
      Tools/Flyinsono.Client.Test/Views/TestView.xaml.cs
  22. BIN
      Tools/Flyinsono.Client.Test/libs/Vinno.IUS.Common.Client.dll
  23. BIN
      Tools/Flyinsono.Client.Test/libs/Vinno.IUS.Common.dll
  24. 13 0
      Tools/Flyinsono.Client.Test/packages.config

+ 11 - 0
Tools/Flyinsono.Client.Test/.vs/Flyinsono.Client.Test/project-colors.json

@@ -0,0 +1,11 @@
+{
+  "Version": 1,
+  "ProjectMap": {
+    "c5890948-1042-43c1-8de8-9280bc001d90": {
+      "ProjectGuid": "c5890948-1042-43c1-8de8-9280bc001d90",
+      "DisplayName": "Flyinsono.Client.Test",
+      "ColorIndex": 0
+    }
+  },
+  "NextColorIndex": 1
+}

+ 6 - 0
Tools/Flyinsono.Client.Test/App.config

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8" ?>
+<configuration>
+    <startup> 
+        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
+    </startup>
+</configuration>

+ 73 - 0
Tools/Flyinsono.Client.Test/App.xaml

@@ -0,0 +1,73 @@
+<Application x:Class="Flyinsono.Client.Test.App"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:local="clr-namespace:Flyinsono.Client.Test"
+             StartupUri="MainWindow.xaml">
+    <Application.Resources>
+        <Style TargetType="Button">
+            <Setter Property="Margin" Value="7"/>
+            <Setter Property="Width" Value="80"/>
+        </Style>
+
+        <Style TargetType="TextBox">
+            <Setter Property="Margin" Value="7"/>
+            <Setter Property="MinWidth" Value="120"/>
+        </Style>
+
+        <Style x:Key="CommonButtonStyle" TargetType="Button" >
+            <Setter Property="Margin" Value="7"/>
+            <Setter Property="Width" Value="80"/>
+            <Setter Property="Command" Value="{Binding}"/>
+            <Setter Property="BorderBrush" Value="#4cae4c"/>
+            <Setter Property="Background" Value="#5cb85c"/>
+            <Setter Property="Foreground" Value="#fff"/>
+            <Setter Property="Template">
+                <Setter.Value>
+                    <ControlTemplate TargetType="Button">
+                        <Border CornerRadius="4" Name="container" Cursor="Hand" Padding="{TemplateBinding Padding}" 
+                            BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}"
+                            Background="{TemplateBinding Background}">
+                            <ContentPresenter ContentSource="{TemplateBinding Content}" 
+                            ContentTemplate="{TemplateBinding ContentTemplate}"
+                            VerticalAlignment="{TemplateBinding VerticalContentAlignment}"
+                            HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}"/>
+                            <VisualStateManager.VisualStateGroups>
+                                <VisualStateGroup Name="CommonStates">
+                                    <VisualState Name="Normal">
+
+                                    </VisualState>
+                                    <VisualState Name="MouseOver">
+                                        <Storyboard>
+                                            <ColorAnimation Storyboard.TargetName="container" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" 
+                                                        Duration="0:0:0.02" To="#449d44"></ColorAnimation>
+                                            <ColorAnimation Storyboard.TargetName="container" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" 
+                                                        Duration="0:0:0.02" To="#398439"></ColorAnimation>
+                                        </Storyboard>
+                                    </VisualState>
+                                    <VisualState Name="Pressed">
+                                        <Storyboard>
+                                            <ColorAnimation Storyboard.TargetName="container" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" 
+                                                        Duration="0:0:0.02" To="#398439"></ColorAnimation>
+                                            <ColorAnimation Storyboard.TargetName="container" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" 
+                                                        Duration="0:0:0.02" To="#255625"></ColorAnimation>
+                                        </Storyboard>
+                                    </VisualState>
+                                    <VisualState Name="Disabled">
+                                        <Storyboard>
+                                            <ColorAnimation Storyboard.TargetName="container" Storyboard.TargetProperty="(Border.Background).(SolidColorBrush.Color)" 
+                                                        Duration="0:0:0.02" To="#5cb85c"></ColorAnimation>
+                                            <ColorAnimation Storyboard.TargetName="container" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" 
+                                                        Duration="0:0:0.02" To="#4cae4c"></ColorAnimation>
+                                            <DoubleAnimation Storyboard.TargetName="container" Storyboard.TargetProperty="Opacity"
+                                                         Duration="0:0:0.02" To="0.7"></DoubleAnimation>
+                                        </Storyboard>
+                                    </VisualState>
+                                </VisualStateGroup>
+                            </VisualStateManager.VisualStateGroups>
+                        </Border>
+                    </ControlTemplate>
+                </Setter.Value>
+            </Setter>
+        </Style>
+    </Application.Resources>
+</Application>

+ 23 - 0
Tools/Flyinsono.Client.Test/App.xaml.cs

@@ -0,0 +1,23 @@
+using System.Windows;
+
+namespace Flyinsono.Client.Test
+{
+    /// <summary>
+    /// App.xaml 的交互逻辑
+    /// </summary>
+    public partial class App : Application
+    {
+        protected override void OnStartup(StartupEventArgs e)
+        {
+          
+
+            MainDispatcher.Register(Current.Dispatcher);
+
+          
+
+            
+
+            base.OnStartup(e);
+        }             
+    }
+}

+ 159 - 0
Tools/Flyinsono.Client.Test/Extensions/BoolToVisibilityConverterExtension.cs

@@ -0,0 +1,159 @@
+using System;
+using System.Collections.Generic;
+using System.Globalization;
+using System.Text;
+using System.Windows;
+using System.Windows.Data;
+using System.Windows.Markup;
+
+namespace Flyinsono.Client.Test.Extensions
+{
+    [Flags]
+    public enum BoolToVisibilityEnums
+    {
+        /// <summary>
+        /// True=Visible,False=Collapsed
+        /// </summary>
+        None = 0x0,
+        /// <summary>
+        /// True=invisible,False=visible
+        /// </summary>
+        Revert = 0x2,
+        /// <summary>
+        /// invisible=Visibility.Hidden
+        /// </summary>
+        InvisibleHidden = 0x4,
+
+        RevertHidden = Revert | InvisibleHidden
+    }
+
+    [MarkupExtensionReturnType(typeof(IValueConverter))]
+    public class BoolToVisibilityConverterExtension : MarkupExtension, IValueConverter, IMultiValueConverter
+    {
+        #region Properties 
+
+        [ThreadStatic]
+        private static BoolToVisibilityConverterExtension _converter;
+
+        public static BoolToVisibilityConverterExtension Converter
+        {
+            get { return _converter ?? (_converter = new BoolToVisibilityConverterExtension()); }
+        }
+
+        #endregion Properties 
+
+        #region Methods 
+
+        // Constructors 
+
+        public BoolToVisibilityConverterExtension()
+        {
+
+        }
+        // Methods 
+
+        public override object ProvideValue(IServiceProvider serviceProvider)
+        {
+            return Converter;
+        }
+
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            var boolValue = ToBool(value);
+            bool isRevert;
+            Visibility invisible;
+
+            TryParseParameter(parameter, out invisible, out isRevert);
+
+            if (isRevert)
+            {
+                boolValue = !boolValue;
+            }
+            return boolValue ? Visibility.Visible : invisible;
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            var visibility = (Visibility)value;
+            return visibility == Visibility.Visible;
+        }
+
+
+        public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+        {
+            bool boolValue = false;
+            if (values != null && values.Length > 0)
+            {
+                bool hasInvisible = false;
+                foreach (var value in values)
+                {
+                    if (!ToBool(value))
+                    {
+                        hasInvisible = true;
+                        break;
+                    }
+                }
+                boolValue = !hasInvisible;
+            }
+            bool isRevert;
+            Visibility invisible;
+
+            TryParseParameter(parameter, out invisible, out isRevert);
+
+            if (isRevert)
+            {
+                boolValue = !boolValue;
+            }
+            return boolValue ? Visibility.Visible : invisible;
+        }
+
+        public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+        {
+            throw new NotImplementedException();
+        }
+
+        private bool ToBool(object value)
+        {
+            var boolValue = false;
+            if (value != null)
+            {
+                if (value is Visibility)
+                {
+                    boolValue = (Visibility)value == Visibility.Visible;
+                }
+                else
+                {
+                    string valueInString = value.ToString();
+
+                    if (string.IsNullOrEmpty(valueInString) || !bool.TryParse(valueInString, out boolValue))
+                    {
+                        boolValue = false;
+                    }
+                }
+            }
+            return boolValue;
+        }
+
+        private void TryParseParameter(object parameter, out Visibility invisible, out bool isRevert)
+        {
+            isRevert = false;
+            invisible = Visibility.Collapsed;
+            if (parameter is BoolToVisibilityEnums)
+            {
+                BoolToVisibilityEnums options = (BoolToVisibilityEnums)parameter;
+                if ((options & BoolToVisibilityEnums.Revert) != 0)
+                {
+                    isRevert = true;
+                }
+                if ((options & BoolToVisibilityEnums.InvisibleHidden) != 0)
+                {
+                    invisible = Visibility.Hidden;
+                }
+            }
+        }
+
+        #endregion Methods 
+
+
+    }
+}

+ 50 - 0
Tools/Flyinsono.Client.Test/Extensions/LogLevelToColorConvertExtension.cs

@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Drawing;
+using System.Globalization;
+using System.Text;
+using System.Windows.Data;
+using System.Windows.Markup;
+using System.Windows.Media;
+using Vinno.IUS.Common.Log;
+using Brushes = System.Windows.Media.Brushes;
+
+namespace Flyinsono.Client.Test.Extensions
+{
+    public class LogLevelToColorConvertExtension : MarkupExtension, IValueConverter
+    {
+        [ThreadStatic]
+        private static LogLevelToColorConvertExtension _converter;
+
+        public override object ProvideValue(IServiceProvider serviceProvider)
+        {
+            return _converter ?? (_converter = new LogLevelToColorConvertExtension());
+        }
+
+        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            if (value != null)
+            {
+                if (Enum.TryParse(value.ToString(), out LogLevel level))
+                {
+                    switch (level)
+                    {
+                        case LogLevel.Info:
+                            return Brushes.Blue;
+                        case LogLevel.Warn:
+                            return Brushes.Goldenrod;
+                        case LogLevel.Error:
+                            return Brushes.Red;
+                    }
+                }
+            }
+
+            return Brushes.Black;
+        }
+
+        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
+        {
+            throw new NotImplementedException();
+        }
+    }
+}

+ 131 - 0
Tools/Flyinsono.Client.Test/Flyinsono.Client.Test.csproj

@@ -0,0 +1,131 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProjectGuid>{C5890948-1042-43C1-8DE8-9280BC001D90}</ProjectGuid>
+    <OutputType>WinExe</OutputType>
+    <RootNamespace>Flyinsono.Client.Test</RootNamespace>
+    <AssemblyName>Flyinsono.Client.Test</AssemblyName>
+    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+    <FileAlignment>512</FileAlignment>
+    <ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+    <WarningLevel>4</WarningLevel>
+    <AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
+    <Deterministic>true</Deterministic>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+    <Prefer32Bit>false</Prefer32Bit>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <PlatformTarget>AnyCPU</PlatformTarget>
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+    <Reference Include="System.Data" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Web" />
+    <Reference Include="System.Xml" />
+    <Reference Include="Microsoft.CSharp" />
+    <Reference Include="System.Core" />
+    <Reference Include="System.Xml.Linq" />
+    <Reference Include="System.Data.DataSetExtensions" />
+    <Reference Include="System.Net.Http" />
+    <Reference Include="System.Xaml">
+      <RequiredTargetFramework>4.0</RequiredTargetFramework>
+    </Reference>
+    <Reference Include="Vinno.IUS.Common, Version=1.7.57.26562, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>libs\Vinno.IUS.Common.dll</HintPath>
+    </Reference>
+    <Reference Include="Vinno.IUS.Common.Client, Version=1.7.57.26562, Culture=neutral, processorArchitecture=MSIL">
+      <SpecificVersion>False</SpecificVersion>
+      <HintPath>libs\Vinno.IUS.Common.Client.dll</HintPath>
+    </Reference>
+    <Reference Include="WindowsBase" />
+    <Reference Include="PresentationCore" />
+    <Reference Include="PresentationFramework" />
+    <Reference Include="WindowsFormsIntegration" />
+  </ItemGroup>
+  <ItemGroup>
+    <ApplicationDefinition Include="App.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </ApplicationDefinition>
+    <Compile Include="Extensions\LogLevelToColorConvertExtension.cs" />
+    <Compile Include="MainDispatcher.cs" />
+    <Compile Include="ViewModels\TestViewModel.cs" />
+    <Compile Include="Views\TestView.xaml.cs">
+      <DependentUpon>TestView.xaml</DependentUpon>
+    </Compile>
+    <Page Include="MainWindow.xaml">
+      <Generator>MSBuild:Compile</Generator>
+      <SubType>Designer</SubType>
+    </Page>
+    <Compile Include="App.xaml.cs">
+      <DependentUpon>App.xaml</DependentUpon>
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Extensions\BoolToVisibilityConverterExtension.cs" />
+    <Compile Include="LogEngineImplement.cs" />
+    <Compile Include="MainWindow.xaml.cs">
+      <DependentUpon>MainWindow.xaml</DependentUpon>
+      <SubType>Code</SubType>
+    </Compile>
+    <Page Include="Views\TestView.xaml">
+      <SubType>Designer</SubType>
+      <Generator>MSBuild:Compile</Generator>
+    </Page>
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="MainWindowViewModel.cs" />
+    <Compile Include="Properties\AssemblyInfo.cs">
+      <SubType>Code</SubType>
+    </Compile>
+    <Compile Include="Properties\Resources.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DesignTime>True</DesignTime>
+      <DependentUpon>Resources.resx</DependentUpon>
+    </Compile>
+    <Compile Include="Properties\Settings.Designer.cs">
+      <AutoGen>True</AutoGen>
+      <DependentUpon>Settings.settings</DependentUpon>
+      <DesignTimeSharedInput>True</DesignTimeSharedInput>
+    </Compile>
+    <EmbeddedResource Include="Properties\Resources.resx">
+      <Generator>ResXFileCodeGenerator</Generator>
+      <LastGenOutput>Resources.Designer.cs</LastGenOutput>
+    </EmbeddedResource>
+    <None Include="packages.config" />
+    <None Include="Properties\Settings.settings">
+      <Generator>SettingsSingleFileGenerator</Generator>
+      <LastGenOutput>Settings.Designer.cs</LastGenOutput>
+    </None>
+  </ItemGroup>
+  <ItemGroup>
+    <None Include="App.config" />
+  </ItemGroup>
+  <ItemGroup>
+    <Resource Include="NOTICE.TXT" />
+  </ItemGroup>
+  <ItemGroup>
+    <Content Include="libs\Vinno.IUS.Common.Client.dll" />
+    <Content Include="libs\Vinno.IUS.Common.dll" />
+  </ItemGroup>
+  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+</Project>

BIN
Tools/Flyinsono.Client.Test/Flyinsono.Client.Test.sln


+ 62 - 0
Tools/Flyinsono.Client.Test/LogEngineImplement.cs

@@ -0,0 +1,62 @@
+using System;
+using Vinno.IUS.Common.Log;
+using Vinno.IUS.Common.Utilities.Executors;
+
+namespace Flyinsono.Client.Test
+{
+    public class LogItem
+    {
+        /// <summary>
+        /// Log level
+        /// </summary>
+        public LogLevel LogLevel { get; set; }
+
+        /// <summary>
+        /// Log content
+        /// </summary>
+        public string Content { get; set; }
+    }
+
+    public class LogEngineImplement : DefaultLogEngine
+    {
+        private SequenceExecutor<string> _logSequenceExecutor = new SequenceExecutor<string>("LogSequenceExecutor");
+        private DateTime _today;
+        
+        Action<LogItem> _actionShowLogger;
+        public LogEngineImplement(Action<LogItem> action)
+        {
+            _actionShowLogger = action;
+        }
+
+        public override void Write(LogLevel level, string msg)
+        {
+            var message = RecombinateMessage(level, msg);
+            _logSequenceExecutor.Add(ExecuteWrite, message);
+            _actionShowLogger?.Invoke(new LogItem() { LogLevel = level, Content = message });
+        }
+
+        private bool ExecuteWrite(string message)
+        {
+            try
+            {
+                if (DateTime.Today != _today)
+                {
+                    InitializeLogger();
+                    _today = DateTime.Today;
+                }
+                WriteMessage(message);             
+            }
+            catch
+            {
+            }
+
+            return true;
+        }
+
+        public override void Dispose()
+        {
+            _logSequenceExecutor.Dispose();
+            base.Dispose();
+        }
+    }
+}

+ 24 - 0
Tools/Flyinsono.Client.Test/MainDispatcher.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Threading;
+
+namespace Flyinsono.Client.Test
+{
+    public class MainDispatcher
+    {
+        private static Dispatcher _dispatcher;
+
+        public static void Register(Dispatcher dispatcher)
+        {
+            _dispatcher = dispatcher;
+        }
+
+        public static void Invoke(Action action)
+        {
+            _dispatcher?.Invoke(action);
+        }
+    }
+}

+ 59 - 0
Tools/Flyinsono.Client.Test/MainWindow.xaml

@@ -0,0 +1,59 @@
+<Window x:Class="Flyinsono.Client.Test.MainWindow"
+        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:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
+        xmlns:extensions="clr-namespace:Flyinsono.Client.Test.Extensions" xmlns:views="clr-namespace:Flyinsono.Client.Test.Views"
+        mc:Ignorable="d"
+        Title="MainWindow"
+        WindowState="Maximized"
+        Height="768" Width="1366">
+    <Window.CommandBindings>
+        <CommandBinding
+    	Command="ApplicationCommands.Copy"
+    	Executed="CopyCommandHandler"
+    	CanExecute="CanCopyExecuteHandler" />
+    </Window.CommandBindings>
+    <Window.Resources>
+        <ContextMenu x:Key="SharedInstanceContextMenu">
+            <MenuItem Header="Copy" Command="ApplicationCommands.Copy"/>
+        </ContextMenu>
+        <Style  TargetType="{x:Type ListBoxItem}"
+        BasedOn="{StaticResource {x:Type ListBoxItem}}">
+            <Setter Property="ContextMenu" Value="{StaticResource SharedInstanceContextMenu}"/>
+            <Setter Property="BorderThickness" Value="1"/>
+            <Setter Property="Margin" Value="0"/>
+            <Setter Property="Padding" Value="0"/>
+            <Setter Property="VerticalContentAlignment" Value="Stretch"/>
+        </Style>
+    </Window.Resources>
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="*"/>
+            <RowDefinition Height="*"/>
+        </Grid.RowDefinitions>
+        <GroupBox Header="Log Info"  Margin="7">
+            <Grid>
+                <Grid.RowDefinitions>
+                    <RowDefinition Height="Auto"/>
+                    <RowDefinition/>
+                </Grid.RowDefinitions>
+                <Button HorizontalAlignment="Right" Margin="0,7" Content="清理日志" Command="{Binding ClearLogCommand}" Style="{StaticResource CommonButtonStyle}"/>
+                <ListBox Grid.Row="1" Margin="7" x:Name="logList" ItemsSource="{Binding LogItems}"  ScrollViewer.HorizontalScrollBarVisibility="Disabled">
+                    <ListBox.ItemTemplate>
+                        <DataTemplate >
+                            <TextBlock Text="{Binding Content}" TextWrapping="Wrap" Foreground="{Binding LogLevel, Converter={extensions:LogLevelToColorConvertExtension}}" />
+                        </DataTemplate>
+                    </ListBox.ItemTemplate>
+                </ListBox>
+            </Grid>
+        </GroupBox>
+        <TabControl Grid.Row="1">
+            <TabItem Header="Test">
+                <views:TestView DataContext="{Binding AccountLoginTest}"/>
+            </TabItem>
+           
+        </TabControl>
+        
+    </Grid>
+</Window>

+ 57 - 0
Tools/Flyinsono.Client.Test/MainWindow.xaml.cs

@@ -0,0 +1,57 @@
+using System;
+using System.Windows;
+using System.Windows.Input;
+using Vinno.IUS.Common;
+using Vinno.IUS.Common.Log;
+
+namespace Flyinsono.Client.Test
+{
+    /// <summary>
+    /// MainWindow.xaml 的交互逻辑
+    /// </summary>
+    public partial class MainWindow : Window
+    {
+        public MainWindow()
+        {
+            _mainWindowViewModel = new MainWindowViewModel();
+            CommonParameters.DataFolder = AppDomain.CurrentDomain.BaseDirectory;
+            var logEngine = new LogEngineImplement((s) =>
+            {
+                AddLog(s);
+            });
+            Logger.RegisterEngine(logEngine);
+            InitializeComponent();
+
+            DataContext = _mainWindowViewModel;
+        }
+        
+        private MainWindowViewModel _mainWindowViewModel;
+
+       
+
+        private void AddLog(LogItem s)
+        {
+            Dispatcher.BeginInvoke(System.Windows.Threading.DispatcherPriority.Normal, new Action(()=> {
+                if (_mainWindowViewModel != null)
+                {
+                    _mainWindowViewModel.LogItems.Add(s);
+
+                }
+            }));
+        }
+
+        private void CopyCommandHandler(object sender, ExecutedRoutedEventArgs e)
+        {
+            var sel = logList.SelectedItem as LogItem;
+            if (sel != null)
+            {
+                Clipboard.SetText(sel.Content.ToString());
+            }
+        }
+
+        private void CanCopyExecuteHandler(object sender, CanExecuteRoutedEventArgs e)
+        {
+            e.CanExecute = true;
+        }
+    }
+}

+ 140 - 0
Tools/Flyinsono.Client.Test/MainWindowViewModel.cs

@@ -0,0 +1,140 @@
+using Flyinsono.Client.Test.ViewModels;
+using System;
+using System.Collections.ObjectModel;
+using Vinno.IUS.Common.Client.ViewModels;
+using Vinno.IUS.Common.Log;
+
+namespace Flyinsono.Client.Test
+{
+    class MainWindowViewModel : ViewModel
+    {
+        //private List<SequenceExecutor<int>> _sequenceExecutors = new List<SequenceExecutor<int>>();
+        /// <summary>
+        /// Request window close
+        /// </summary>
+        public event EventHandler RequestClosed;
+
+        /// <summary>
+        /// Cancel Command
+        /// </summary>
+        public Command CancelCommand { get; }
+
+        /// <summary>
+        /// Finish command
+        /// </summary>
+        public Command CloseCommand { get; }
+
+
+        
+
+        /// <summary>
+        /// Open Output Dir Command
+        /// </summary>
+        public Command OpenOutputDirCommand { get; }
+
+       
+
+
+        /// <summary>
+        /// Log infoes
+        /// </summary>
+        public ObservableCollection<LogItem> LogItems { get; }
+
+       
+       
+
+        public Command ClearLogCommand { get; }
+
+        public TestViewModel AccountLoginTest { get; }
+
+      
+
+        
+
+       
+
+        public MainWindowViewModel()
+        {          
+            LogItems = new ObservableCollection<LogItem>();
+            Description = "AppName";
+            CancelCommand = new ButtonCommand(OnCancelCommand, "Cancel");
+            CloseCommand = new ButtonCommand(OnCloseCommand, "Finish");
+                                
+            ClearLogCommand = new ButtonCommand(OnClearLogCommand, "ClearLog");
+           
+            AccountLoginTest = new TestViewModel();
+          
+            
+          
+        }
+        
+
+        private void OnClearLogCommand(object obj)
+        {
+            LogItems.Clear();
+        }
+        
+        
+
+        private void OnCancelCommand(object obj)
+        {
+            OnRequestClosed();
+        }
+
+
+        private void OnCloseCommand(object obj)
+        {
+           
+
+            OnRequestClosed();
+        }
+
+
+        void OnRequestClosed()
+        {
+            RequestClosed?.Invoke(this, EventArgs.Empty);
+        }        
+    }
+
+    public class LogEntity
+    {
+        /// <summary>
+        /// Gets or sets the default Id for the log.
+        /// </summary>
+        public string _id { get; set; }
+
+        /// <summary>
+        /// Gets or sets the time of this log.
+        /// </summary>
+        public DateTime Time { get; set; }
+
+        /// <summary>
+        /// Who is log
+        /// </summary>
+        public string Owner { get; set; }
+
+        /// <summary>
+        /// Gets or sets the <see cref="LogLevel"/> of this log.
+        /// </summary>
+        public LogLevel Level { get; set; }
+
+        /// <summary>
+        /// Gets or sets the content of this log.
+        /// </summary>
+        public string Message { get; set; }
+
+
+        public LogEntity()
+        {
+
+        }
+
+        public LogEntity(DateTime time, LogLevel level, string message)
+        {
+            _id = Guid.NewGuid().ToString();
+            Time = time;
+            Level = level;
+            Message = message;
+        }
+    }
+}

+ 55 - 0
Tools/Flyinsono.Client.Test/Properties/AssemblyInfo.cs

@@ -0,0 +1,55 @@
+using System.Reflection;
+using System.Resources;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using System.Windows;
+
+// 有关程序集的一般信息由以下
+// 控制。更改这些特性值可修改
+// 与程序集关联的信息。
+[assembly: AssemblyTitle("Flyinsono.Client.Test")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("Flyinsono.Client.Test")]
+[assembly: AssemblyCopyright("Copyright ©  2020")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// 将 ComVisible 设置为 false 会使此程序集中的类型
+//对 COM 组件不可见。如果需要从 COM 访问此程序集中的类型
+//请将此类型的 ComVisible 特性设置为 true。
+[assembly: ComVisible(false)]
+
+//若要开始生成可本地化的应用程序,请设置
+//.csproj 文件中的 <UICulture>CultureYouAreCodingWith</UICulture>
+//例如,如果您在源文件中使用的是美国英语,
+//使用的是美国英语,请将 <UICulture> 设置为 en-US。  然后取消
+//对以下 NeutralResourceLanguage 特性的注释。  更新
+//以下行中的“en-US”以匹配项目文件中的 UICulture 设置。
+
+//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
+
+
+[assembly: ThemeInfo(
+    ResourceDictionaryLocation.None, //主题特定资源词典所处位置
+                                     //(未在页面中找到资源时使用,
+                                     //或应用程序资源字典中找到时使用)
+    ResourceDictionaryLocation.SourceAssembly //常规资源词典所处位置
+                                              //(未在页面中找到资源时使用,
+                                              //、应用程序或任何主题专用资源字典中找到时使用)
+)]
+
+
+// 程序集的版本信息由下列四个值组成: 
+//
+//      主版本
+//      次版本
+//      生成号
+//      修订号
+//
+//可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
+//通过使用 "*",如下所示:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]

+ 63 - 0
Tools/Flyinsono.Client.Test/Properties/Resources.Designer.cs

@@ -0,0 +1,63 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码由工具生成。
+//     运行时版本:4.0.30319.42000
+//
+//     对此文件的更改可能会导致不正确的行为,并且如果
+//     重新生成代码,这些更改将会丢失。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Flyinsono.Client.Test.Properties {
+    using System;
+    
+    
+    /// <summary>
+    ///   一个强类型的资源类,用于查找本地化的字符串等。
+    /// </summary>
+    // 此类是由 StronglyTypedResourceBuilder
+    // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+    // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+    // (以 /str 作为命令选项),或重新生成 VS 项目。
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
+    [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    internal class Resources {
+        
+        private static global::System.Resources.ResourceManager resourceMan;
+        
+        private static global::System.Globalization.CultureInfo resourceCulture;
+        
+        [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+        internal Resources() {
+        }
+        
+        /// <summary>
+        ///   返回此类使用的缓存的 ResourceManager 实例。
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Resources.ResourceManager ResourceManager {
+            get {
+                if (object.ReferenceEquals(resourceMan, null)) {
+                    global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Flyinsono.Client.Test.Properties.Resources", typeof(Resources).Assembly);
+                    resourceMan = temp;
+                }
+                return resourceMan;
+            }
+        }
+        
+        /// <summary>
+        ///   重写当前线程的 CurrentUICulture 属性,对
+        ///   使用此强类型资源类的所有资源查找执行重写。
+        /// </summary>
+        [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+        internal static global::System.Globalization.CultureInfo Culture {
+            get {
+                return resourceCulture;
+            }
+            set {
+                resourceCulture = value;
+            }
+        }
+    }
+}

+ 117 - 0
Tools/Flyinsono.Client.Test/Properties/Resources.resx

@@ -0,0 +1,117 @@
+<?xml version="1.0" encoding="utf-8"?>
+<root>
+  <!-- 
+    Microsoft ResX Schema 
+    
+    Version 2.0
+    
+    The primary goals of this format is to allow a simple XML format 
+    that is mostly human readable. The generation and parsing of the 
+    various data types are done through the TypeConverter classes 
+    associated with the data types.
+    
+    Example:
+    
+    ... ado.net/XML headers & schema ...
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
+    <resheader name="version">2.0</resheader>
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
+    </data>
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
+        <comment>This is a comment</comment>
+    </data>
+                
+    There are any number of "resheader" rows that contain simple 
+    name/value pairs.
+    
+    Each data row contains a name, and value. The row also contains a 
+    type or mimetype. Type corresponds to a .NET class that support 
+    text/value conversion through the TypeConverter architecture. 
+    Classes that don't support this are serialized and stored with the 
+    mimetype set.
+    
+    The mimetype is used for serialized objects, and tells the 
+    ResXResourceReader how to depersist the object. This is currently not 
+    extensible. For a given mimetype the value must be set accordingly:
+    
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
+    that the ResXResourceWriter will generate, however the reader can 
+    read any of the formats listed below.
+    
+    mimetype: application/x-microsoft.net.object.binary.base64
+    value   : The object must be serialized with 
+            : System.Serialization.Formatters.Binary.BinaryFormatter
+            : and then encoded with base64 encoding.
+    
+    mimetype: application/x-microsoft.net.object.soap.base64
+    value   : The object must be serialized with 
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
+            : and then encoded with base64 encoding.
+
+    mimetype: application/x-microsoft.net.object.bytearray.base64
+    value   : The object must be serialized into a byte array 
+            : using a System.ComponentModel.TypeConverter
+            : and then encoded with base64 encoding.
+    -->
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
+    <xsd:element name="root" msdata:IsDataSet="true">
+      <xsd:complexType>
+        <xsd:choice maxOccurs="unbounded">
+          <xsd:element name="metadata">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" />
+              <xsd:attribute name="type" type="xsd:string" />
+              <xsd:attribute name="mimetype" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="assembly">
+            <xsd:complexType>
+              <xsd:attribute name="alias" type="xsd:string" />
+              <xsd:attribute name="name" type="xsd:string" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="data">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
+            </xsd:complexType>
+          </xsd:element>
+          <xsd:element name="resheader">
+            <xsd:complexType>
+              <xsd:sequence>
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
+              </xsd:sequence>
+              <xsd:attribute name="name" type="xsd:string" use="required" />
+            </xsd:complexType>
+          </xsd:element>
+        </xsd:choice>
+      </xsd:complexType>
+    </xsd:element>
+  </xsd:schema>
+  <resheader name="resmimetype">
+    <value>text/microsoft-resx</value>
+  </resheader>
+  <resheader name="version">
+    <value>2.0</value>
+  </resheader>
+  <resheader name="reader">
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+  <resheader name="writer">
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
+  </resheader>
+</root>

+ 26 - 0
Tools/Flyinsono.Client.Test/Properties/Settings.Designer.cs

@@ -0,0 +1,26 @@
+//------------------------------------------------------------------------------
+// <auto-generated>
+//     此代码由工具生成。
+//     运行时版本:4.0.30319.42000
+//
+//     对此文件的更改可能会导致不正确的行为,并且如果
+//     重新生成代码,这些更改将会丢失。
+// </auto-generated>
+//------------------------------------------------------------------------------
+
+namespace Flyinsono.Client.Test.Properties {
+    
+    
+    [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+    [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "16.8.1.0")]
+    internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
+        
+        private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
+        
+        public static Settings Default {
+            get {
+                return defaultInstance;
+            }
+        }
+    }
+}

+ 7 - 0
Tools/Flyinsono.Client.Test/Properties/Settings.settings

@@ -0,0 +1,7 @@
+<?xml version='1.0' encoding='utf-8'?>
+<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
+  <Profiles>
+    <Profile Name="(Default)" />
+  </Profiles>
+  <Settings />
+</SettingsFile>

+ 62 - 0
Tools/Flyinsono.Client.Test/ViewModels/TestViewModel.cs

@@ -0,0 +1,62 @@
+using System.Collections.Generic;
+using Vinno.IUS.Common.Client.ViewModels;
+
+namespace Flyinsono.Client.Test.ViewModels
+{
+    public class TestViewModel : ViewModel
+    {
+       
+        private string _uploadFilePath;
+                    
+        public Command BrowseCommand { get; }
+        public string UploadFilePath
+        {
+            get { return _uploadFilePath; }
+            set
+            {
+                if (_uploadFilePath != value)
+                {
+                    _uploadFilePath = value;
+                    OnPropertyChanged(() => UploadFilePath);
+                }
+            }
+        }
+       
+        public TestViewModel()
+        {
+
+            BrowseCommand = new ButtonCommand(OnBrowse);
+           
+            
+            
+        }
+
+       
+
+        
+
+       
+
+
+        private void OnBrowse(object obj)
+        {
+           
+        }  
+    }
+    public class ImportBugsRequest
+    {
+        public string Version { get; set; }
+        public IList<BugInfo> Bugs { get; set; }
+
+        public ImportBugsRequest()
+        {
+            Bugs = new List<BugInfo>();
+        }
+    }
+
+    public class BugInfo
+    {
+        public int BugNo { get; set; }
+        public string Title { get; set; }
+    }
+}

+ 23 - 0
Tools/Flyinsono.Client.Test/Views/TestView.xaml

@@ -0,0 +1,23 @@
+<UserControl x:Class="Flyinsono.Client.Test.Views.TestView"
+             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
+             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
+             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
+             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
+             xmlns:local="clr-namespace:Flyinsono.Client.Test.Views"
+             mc:Ignorable="d" 
+             d:DesignHeight="450" d:DesignWidth="800">
+    <Grid>
+        <Grid.RowDefinitions>
+            <RowDefinition Height="Auto"/>
+            <RowDefinition/>
+            <RowDefinition/>
+        </Grid.RowDefinitions>
+        <GroupBox>
+            <StackPanel Orientation="Horizontal">
+                <TextBox Width="580" Text="{Binding UploadFilePath}"/>
+                <Button Content="Browse" Command="{Binding BrowseCommand}"/>
+            </StackPanel>
+        </GroupBox>
+        
+    </Grid>
+</UserControl>

+ 28 - 0
Tools/Flyinsono.Client.Test/Views/TestView.xaml.cs

@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+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.Media;
+using System.Windows.Media.Imaging;
+using System.Windows.Navigation;
+using System.Windows.Shapes;
+
+namespace Flyinsono.Client.Test.Views
+{
+    /// <summary>
+    /// AccountTestView.xaml 的交互逻辑
+    /// </summary>
+    public partial class TestView : UserControl
+    {
+        public TestView()
+        {
+            InitializeComponent();
+        }
+    }
+}

BIN
Tools/Flyinsono.Client.Test/libs/Vinno.IUS.Common.Client.dll


BIN
Tools/Flyinsono.Client.Test/libs/Vinno.IUS.Common.dll


+ 13 - 0
Tools/Flyinsono.Client.Test/packages.config

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="DotNetCore.NPOI" version="1.2.3" targetFramework="net461" />
+  <package id="DotNetCore.NPOI.Core" version="1.2.3" targetFramework="net461" />
+  <package id="DotNetCore.NPOI.OpenXml4Net" version="1.2.3" targetFramework="net461" />
+  <package id="DotNetCore.NPOI.OpenXmlFormats" version="1.2.3" targetFramework="net461" />
+  <package id="Microsoft.Office.Interop.Excel" version="15.0.4795.1001" targetFramework="net461" />
+  <package id="Newtonsoft.Json" version="12.0.3" targetFramework="net461" />
+  <package id="SharpZipLib" version="1.2.0" targetFramework="net461" />
+  <package id="System.Drawing.Common" version="4.5.0" targetFramework="net461" />
+  <package id="System.Runtime.CompilerServices.Unsafe" version="4.5.0" targetFramework="net461" />
+  <package id="System.Text.Encoding.CodePages" version="4.5.0" targetFramework="net461" />
+</packages>