Skip to content

Commit

Permalink
Add LIFF Manager (WPF Application)
Browse files Browse the repository at this point in the history
  • Loading branch information
pierre3 committed Jun 19, 2018
1 parent 8fb2c89 commit 5b5c308
Show file tree
Hide file tree
Showing 14 changed files with 686 additions and 0 deletions.
6 changes: 6 additions & 0 deletions LiffManager/App.config
Original file line number Diff line number Diff line change
@@ -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>
9 changes: 9 additions & 0 deletions LiffManager/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Application x:Class="LiffManager.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:LiffManager"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
17 changes: 17 additions & 0 deletions LiffManager/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace LiffManager
{
/// <summary>
/// App.xaml の相互作用ロジック
/// </summary>
public partial class App : Application
{
}
}
120 changes: 120 additions & 0 deletions LiffManager/LiffManager.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<?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>{48EC0A76-C311-4A20-9AC2-14CF655485C8}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>LiffManager</RootNamespace>
<AssemblyName>LiffManager</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>
</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>
</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="Microsoft.Practices.ServiceLocation, Version=1.3.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="Prism, Version=6.3.0.0, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
<HintPath>..\packages\Prism.Core.6.3.0\lib\net45\Prism.dll</HintPath>
</Reference>
<Reference Include="Prism.Wpf, Version=6.3.0.0, Culture=neutral, PublicKeyToken=40ee6c3a2184dc59, processorArchitecture=MSIL">
<HintPath>..\packages\Prism.Wpf.6.3.0\lib\net45\Prism.Wpf.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Windows.Interactivity, Version=4.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\packages\Prism.Wpf.6.3.0\lib\net45\System.Windows.Interactivity.dll</HintPath>
</Reference>
<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="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<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="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</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>
<ProjectReference Include="..\Line.Messaging\Line.Messaging.csproj">
<Project>{05d6b392-9e4f-4f35-b1f9-72f907d9c3d0}</Project>
<Name>Line.Messaging</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
87 changes: 87 additions & 0 deletions LiffManager/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
<Window x:Class="LiffManager.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:local="clr-namespace:LiffManager"
xmlns:line="clr-namespace:Line.Messaging.Liff;assembly=Line.Messaging"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="610.76">

<Window.Resources>
<ObjectDataProvider x:Key="ViewTypeKey" MethodName="GetValues"
ObjectType="{x:Type sys:Enum}">
<ObjectDataProvider.MethodParameters>
<x:Type TypeName="line:ViewType"/>
</ObjectDataProvider.MethodParameters>
</ObjectDataProvider>
</Window.Resources>
<Window.DataContext>
<local:MainWindowViewModel/>
</Window.DataContext>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="Auto"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>

<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>

<TextBlock Grid.Row="0" Grid.Column="0" Margin="4,2"
Text="Channel Access Token: "/>
<TextBox Grid.Row="0" Grid.Column="1" HorizontalAlignment="Left" Margin="4,2"
Text="{Binding ChannelAccessToken, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="400"/>

<TextBlock Grid.Row="1" Grid.Column="0" Margin="4,2"
Text="View Type: "/>
<ComboBox Grid.Row="1" Grid.Column="1" Width="200"
HorizontalAlignment="Left" Margin="4,2"
SelectedItem="{Binding SelectedViewType}"
ItemsSource="{Binding Source={StaticResource ViewTypeKey}}"/>

<TextBlock Grid.Row="2" Grid.Column="0" Text="Site URL:" Margin="4,2"/>
<TextBox Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" Margin="4,2"
Text="{Binding SiteUrl, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" Width="400"/>

<Button Grid.Row="3" Grid.ColumnSpan="2" HorizontalAlignment="Center" Padding="4,2" Margin="4,2"
Command="{Binding AddLiffAppCommand}">
Add LIFF App
</Button>

<Separator Grid.Row="4" Grid.ColumnSpan="2" Height="16"/>
<StackPanel Grid.Row="5" Grid.ColumnSpan="2" Orientation="Horizontal" >
<Button Margin="4,2" Padding="4,2" Command="{Binding ListLiffAppsCommand}">List LIFF Apps</Button>
<Button Margin="4,2" Padding="4,2" Command="{Binding DeleteLiffAppCommand}">Delete LIFF App</Button>
<TextBlock Margin="12,2,4,2" Padding="4,2" Text="User ID"/>
<TextBox Text="{Binding UserId}" Width="200"></TextBox>
<Button Margin="4,2" Padding="4,2" Command="{Binding PushLinkMessageCommand}">Push to User</Button>
</StackPanel>

<ListView Grid.Row="6" Grid.ColumnSpan="2" Margin="4,8" ItemsSource="{Binding LiffApps}" SelectedItem="{Binding SelectedLiffApp}">
<ListView.ItemTemplate>
<DataTemplate DataType="{x:Type line:LiffApp}">
<StackPanel Orientation="Vertical">
<TextBlock >
<Run Text="ID: "/><Run Text="{Binding LiffId, Mode=OneWay}" FontSize="16" FontWeight="Bold"/><LineBreak/>
<Run Text="View Type: "/><Run Text="{Binding View.Type, Mode=OneWay}"/><LineBreak/>
<Run Text="URL: "/>
<Hyperlink NavigateUri="{Binding View.Url}">
<Run Text="{Binding View.Url, Mode=OneWay}"/>
</Hyperlink>
</TextBlock>
</StackPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>

</Grid>
</Window>
29 changes: 29 additions & 0 deletions LiffManager/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
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 LiffManager
{
/// <summary>
/// MainWindow.xaml の相互作用ロジック
/// </summary>
public partial class MainWindow : Window
{
private MainWindowViewModel VM { get => DataContext as MainWindowViewModel; }
public MainWindow()
{
InitializeComponent();
}
}
}
Loading

0 comments on commit 5b5c308

Please sign in to comment.