Skip to content

Commit

Permalink
Merge branch 'test'
Browse files Browse the repository at this point in the history
  • Loading branch information
aiqinxuancai committed Nov 18, 2021
2 parents 3fd4959 + bff45ca commit c1826e1
Show file tree
Hide file tree
Showing 18 changed files with 1,664 additions and 49 deletions.
9 changes: 9 additions & 0 deletions ChromeTest/App.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Application x:Class="ChromeTest.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:ChromeTest"
StartupUri="MainWindow.xaml">
<Application.Resources>

</Application.Resources>
</Application>
17 changes: 17 additions & 0 deletions ChromeTest/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 ChromeTest
{
/// <summary>
/// Interaction logic for App.xaml
/// </summary>
public partial class App : Application
{
}
}
10 changes: 10 additions & 0 deletions ChromeTest/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
using System.Windows;

[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
13 changes: 13 additions & 0 deletions ChromeTest/ChromeTest.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net5.0-windows</TargetFramework>
<UseWPF>true</UseWPF>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CefSharp.Wpf.NETCore" Version="94.4.110" />
</ItemGroup>

</Project>
12 changes: 12 additions & 0 deletions ChromeTest/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<Window x:Class="ChromeTest.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:ChromeTest"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>

</Grid>
</Window>
28 changes: 28 additions & 0 deletions ChromeTest/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -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 ChromeTest
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
}
}
6 changes: 6 additions & 0 deletions EvernoteToNotionChrome.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EvernoteToNotionChrome", "E
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EvernoteToNotion", "EvernoteToNotion\EvernoteToNotion.csproj", "{B31F147A-02D1-4300-A67F-65C0DB7EC1F2}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ChromeTest", "ChromeTest\ChromeTest.csproj", "{376D4A9F-6AA8-4A6E-B038-5DC33F7AC6A9}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -21,6 +23,10 @@ Global
{B31F147A-02D1-4300-A67F-65C0DB7EC1F2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B31F147A-02D1-4300-A67F-65C0DB7EC1F2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B31F147A-02D1-4300-A67F-65C0DB7EC1F2}.Release|Any CPU.Build.0 = Release|Any CPU
{376D4A9F-6AA8-4A6E-B038-5DC33F7AC6A9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{376D4A9F-6AA8-4A6E-B038-5DC33F7AC6A9}.Debug|Any CPU.Build.0 = Debug|Any CPU
{376D4A9F-6AA8-4A6E-B038-5DC33F7AC6A9}.Release|Any CPU.ActiveCfg = Release|Any CPU
{376D4A9F-6AA8-4A6E-B038-5DC33F7AC6A9}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
6 changes: 3 additions & 3 deletions EvernoteToNotionChrome/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@ private static void InitializeCefSharp()


// Set BrowserSubProcessPath based on app bitness at runtime
setting.BrowserSubprocessPath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
Environment.Is64BitProcess ? "x64" : "x86",
"CefSharp.BrowserSubprocess.exe");
//setting.BrowserSubprocessPath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase,
// Environment.Is64BitProcess ? "x64" : "x86",
// "CefSharp.BrowserSubprocess.exe");

if (!Cef.Initialize(setting, performDependencyCheck: false, browserProcessHandler: null))
{
Expand Down
5 changes: 2 additions & 3 deletions EvernoteToNotionChrome/EvernoteToNotionChrome.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CefSharp.Wpf">
<Version>86.0.241</Version>
</PackageReference>
<PackageReference Include="CefSharp.Wpf.NETCore" Version="94.4.110" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.36" />
<PackageReference Include="MahApps.Metro" Version="2.4.7" />
<PackageReference Include="Newtonsoft.Json">
<Version>12.0.3</Version>
</PackageReference>
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.4" />
<PackageReference Include="System.Drawing.Common" Version="5.0.1" />
</ItemGroup>
</Project>
57 changes: 44 additions & 13 deletions EvernoteToNotionChrome/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,61 @@
xmlns:local="clr-namespace:EvernoteToNotionChrome" xmlns:wpf="clr-namespace:CefSharp.Wpf;assembly=CefSharp.Wpf"
xmlns:mah="clr-namespace:MahApps.Metro.Controls;assembly=MahApps.Metro"
mc:Ignorable="d"
Title="EvernoteToNotionChrome" Height="720" Width="1080" Loaded="Window_Loaded" AllowDrop="True">
Title="EvernoteToNotionChrome" Height="720" Width="1080" Loaded="Window_Loaded" AllowDrop="True"
x:Name="Self">

<mah:MetroWindow.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/Style/AQButton.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</mah:MetroWindow.Resources>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="941*"/>
<ColumnDefinition Width="139*"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="*"/>
<RowDefinition Height="90"/>
<RowDefinition Height="50"/>
<RowDefinition Height="24"/>
</Grid.RowDefinitions>
<Grid Grid.Row="1" Margin="10,10,10,10">
<Grid Grid.Row="1" Margin="10,10,10,10" Grid.ColumnSpan="2">
<Grid >
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*"/>
<ColumnDefinition Width="140"/>
</Grid.ColumnDefinitions>


<Button Grid.Column="1" x:Name="ButtonStart" Content="Start" Click="ButtonStart_Click" Margin="10,0,0,0" Height="40" Width="100"></Button>

<StackPanel>
<TextBlock Text="请粘贴Everonte导出的HTML所在目录"></TextBlock>
<TextBox x:Name="TextBoxPath" Text="" Margin="0,5,0,0" Height="26"/>
<TextBlock x:Name="TextBlockStatus" Text="等待开始..." Margin="0,5,0,0" ></TextBlock>
</StackPanel>
</Grid>
</Grid>
<Grid Grid.Row="1" Height="1" Grid.ColumnSpan="2" VerticalAlignment="Top" Background="#0C000000">

</Grid>
<Grid Grid.Row="1">
<Border CornerRadius="4" Background="#0C000000" Grid.RowSpan="1" Grid.Row="1" Margin="10,10,0,10" >
<Grid>
<TextBox Text="" Grid.Row="1" x:Name="TextBoxPath"
mah:ControlsHelper.FocusBorderThickness="0"
mah:ControlsHelper.FocusBorderBrush="Transparent"
mah:ControlsHelper.MouseOverBorderBrush="Transparent"
Background="Transparent"
AllowDrop="True"
BorderBrush="#00CCCCCC" mah:TextBoxHelper.Watermark="请粘贴Everonte导出的HTML所在目录" HorizontalAlignment="Stretch" Margin="0,0,100,0" VerticalAlignment="Center" />

<wpf:ChromiumWebBrowser Grid.Row="0" x:Name="Browser" AllowDrop="True" Grid.RowSpan="1" Loaded="Browser_Loaded" />
<CheckBox x:Name="OverwriteCheckBox" IsChecked="{Binding Path=Overwrite, Mode=TwoWay}" HorizontalAlignment="Right" VerticalAlignment="Center" Content="覆盖文件" Margin="0,0,5,0" Foreground="#E5000000" ></CheckBox>
</Grid>

</Border>
</Grid>
<Grid Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Background="#0C000000">
<TextBlock x:Name="TextBlockStatus" Text="等待开始..." Margin="10,0,10,0" VerticalAlignment="Center" Foreground="#CC000000" ></TextBlock>
</Grid>

<Grid Grid.Row="1" Grid.Column="1">
<Button Grid.Column="1" x:Name="ButtonStart" Style="{StaticResource AQButtonBlue}" Content="Start" Click="ButtonStart_Click" Margin="10,0,0,0" Height="40" Width="120"></Button>
<!--<Button Grid.Column="1" x:Name="ButtonTest" Content="Test" Click="ButtonTest_Click" Margin="10,0,0,0" Height="40" Width="100"></Button>-->
</Grid>
<wpf:ChromiumWebBrowser Grid.Row="0" x:Name="Browser" AllowDrop="True" Grid.RowSpan="2" Loaded="Browser_Loaded" Grid.ColumnSpan="2" Margin="0,0,0,90" />
</Grid>
</mah:MetroWindow>
25 changes: 23 additions & 2 deletions EvernoteToNotionChrome/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using CefSharp;
using CefSharp.Internals;
using EvernoteToNotionChrome.Service;
using EvernoteToNotionChrome.Utils;
using MahApps.Metro.Controls;
Expand All @@ -22,26 +23,37 @@
using System.Windows.Navigation;
using System.Windows.Shapes;




namespace EvernoteToNotionChrome
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : MetroWindow
{
public static MainWindow SingleInstance { set; get; }
public static MainWindow Instance { set; get; }

public bool Overwrite { set; get; } = false;

public MainWindow()
{
SingleInstance = this;
Instance = this;



InitializeComponent();
OverwriteCheckBox.DataContext = this;


BrowserSettings browserSettings = new BrowserSettings();
browserSettings.Javascript = CefSharp.CefState.Enabled;
browserSettings.JavascriptAccessClipboard = CefSharp.CefState.Enabled;
browserSettings.JavascriptDomPaste = CefSharp.CefState.Enabled;
Browser.BrowserSettings = browserSettings;


}

private void Window_Loaded(object sender, RoutedEventArgs e)
Expand All @@ -52,6 +64,8 @@ private void Window_Loaded(object sender, RoutedEventArgs e)

Browser.RequestHandler = new OxoRequestHandler();
Browser.Address = "https://notion.so/";

var screenInfo = ((IRenderWebBrowser)Browser).GetScreenInfo();

GlobalNotification.Default.Register(GlobalNotification.NotificationOutputLogInfo, this, (msg) => {
Debug.WriteLine(msg.Source);
Expand All @@ -74,6 +88,13 @@ await Task.Run(() => {
ButtonStart.IsEnabled = true;
}

private async void ButtonTest_Click(object sender, RoutedEventArgs e)
{
await UploadManager.UploadFile(@"C:\Users\aiqin\Documents\Tencent Files\76835052\FileRecv\tinified (5).zip");
}



private void Browser_Loaded(object sender, RoutedEventArgs e)
{

Expand Down
Loading

0 comments on commit c1826e1

Please sign in to comment.