Skip to content

Commit

Permalink
修改进行换肤操作时会导致记录丢失的情况
Browse files Browse the repository at this point in the history
  • Loading branch information
silentmoooon committed Oct 13, 2017
1 parent ff37363 commit f1c98f6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion ClipOne/ClipOne.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="html\index.html">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="html\js\jquery-3.2.1.min.js">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down
1 change: 1 addition & 0 deletions ClipOne/html/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,7 @@ function hidePreview() {
function getAllClip() {
return encodeURIComponent(JSON.stringify(clipObj));
}

function saveData() {
window.localStorage.setItem("data", JSON.stringify(clipObj));

Expand Down
8 changes: 5 additions & 3 deletions ClipOne/view/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,6 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
{
Directory.CreateDirectory(storeDir);
}



//初始化浏览器
InitWebView();

Expand All @@ -187,6 +184,9 @@ private void Window_Loaded(object sender, RoutedEventArgs e)
{
InitConfig();
}



//设置保存最大数量到前端
new Thread(SetRecords).Start();
//初始化托盘图标
Expand Down Expand Up @@ -490,6 +490,7 @@ private void SkinItem_Click(object sender, EventArgs e)
item.Checked = true;
settingsMap["skin"] = item.Text;
SaveSettings();
webView?.GetBrowser()?.MainFrame.EvaluateScriptAsync("saveData()").Wait();
string css = item.Tag.ToString();
ChangeSkin(css);

Expand Down Expand Up @@ -639,6 +640,7 @@ private void Clear_Click(object sender, EventArgs e)
/// <param name="e"></param>
private void Reload(object sender, EventArgs e)
{
webView?.GetBrowser()?.MainFrame.EvaluateScriptAsync("saveData()").Wait();
webView.GetBrowser().Reload(true);
}

Expand Down

0 comments on commit f1c98f6

Please sign in to comment.