Skip to content

Commit

Permalink
Merge pull request #977 from ywmoyue/dev
Browse files Browse the repository at this point in the history
4.7.11
  • Loading branch information
ywmoyue authored Jan 8, 2025
2 parents 8ca8325 + b938594 commit 0a812c2
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/BiliLite.UWP/Controls/Settings/UISettingsControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@
<controls:SettingsCard Header="启动应用时打开上次浏览的标签页"
Description="仅支持标签页模式">
<controls:SettingsCard.HeaderIcon>
<font:FontAwesome Icon="Brands_Page4"></font:FontAwesome>
<font:FontAwesome Icon="Solid_History"></font:FontAwesome>
</controls:SettingsCard.HeaderIcon>
<ToggleSwitch x:Name="SwitchOpenLastPage" ></ToggleSwitch>
</controls:SettingsCard>
Expand Down
67 changes: 45 additions & 22 deletions src/BiliLite.UWP/Services/PageSaveService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -65,40 +65,63 @@ public void HandleStartApp()

public string AddPage(string title, Type type, object parameters, Symbol icon)
{
var page = new PageSavedDTO()
try
{
var page = new PageSavedDTO()
{
Parameters = JsonConvert.SerializeObject(parameters),
Type = JsonConvert.SerializeObject(type),
Title = title,
Icon = JsonConvert.SerializeObject(icon),
};
m_biliLiteDbContext.PageSavedItems.Add(page);
m_biliLiteDbContext.SaveChanges();
return page.Id;
}
catch (Exception ex)
{
Parameters = JsonConvert.SerializeObject(parameters),
Type = JsonConvert.SerializeObject(type),
Title = title,
Icon = JsonConvert.SerializeObject(icon),
};
m_biliLiteDbContext.PageSavedItems.Add(page);
m_biliLiteDbContext.SaveChanges();
return page.Id;
_logger.Error(ex.Message, ex);
}

return "";
}

public void UpdatePage(string id,string title, Type type, object parameters, Symbol icon)
public void UpdatePage(string id, string title, Type type, object parameters, Symbol icon)
{
var page = m_biliLiteDbContext.PageSavedItems.Find(id);
if (page == null) return;
page.Title = title;
page.Type = JsonConvert.SerializeObject(type);
page.Parameters = JsonConvert.SerializeObject(parameters);
page.Icon = JsonConvert.SerializeObject(icon);
m_biliLiteDbContext.SaveChanges();
try
{
var page = m_biliLiteDbContext.PageSavedItems.Find(id);
if (page == null) return;
page.Title = title;
page.Type = JsonConvert.SerializeObject(type);
page.Parameters = JsonConvert.SerializeObject(parameters);
page.Icon = JsonConvert.SerializeObject(icon);
m_biliLiteDbContext.SaveChanges();
}
catch (Exception ex)
{
_logger.Error(ex.Message, ex);
}
}

public void RemovePage(string id)
{
var page = m_biliLiteDbContext.PageSavedItems.Find(id);
if(page == null) return;
m_biliLiteDbContext.PageSavedItems.Remove(page);
m_biliLiteDbContext.SaveChanges();
try
{
var page = m_biliLiteDbContext.PageSavedItems.Find(id);
if (page == null) return;
m_biliLiteDbContext.PageSavedItems.Remove(page);
m_biliLiteDbContext.SaveChanges();
}
catch (Exception ex)
{
_logger.Error(ex.Message, ex);
}
}

public void SaveMainPageTabIndex(int index)
{

}
}
}
}
2 changes: 1 addition & 1 deletion src/BiliLite.UWP/Services/SqlMigrateService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public async Task MigrateDatabase()
var currentAppVersion = GetCurrentAppVersion();
var currentDbVersion = GetCurrentDatabaseVersion();
if (currentDbVersion == currentAppVersion) return;
var migrationScripts = await GetMigrationScriptsToRun(currentDbVersion);
var migrationScripts = await GetMigrationScriptsToRun(0);
foreach (var script in migrationScripts)
{
await ExecuteMigrationScript(script);
Expand Down

0 comments on commit 0a812c2

Please sign in to comment.