Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ClusterM/hakchi2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'Manager/BookManager.cs')
-rw-r--r--Manager/BookManager.cs34
1 files changed, 29 insertions, 5 deletions
diff --git a/Manager/BookManager.cs b/Manager/BookManager.cs
index ba4c3212..5a686809 100644
--- a/Manager/BookManager.cs
+++ b/Manager/BookManager.cs
@@ -90,25 +90,49 @@ namespace com.clusterrr.hakchi_gui.Manager
}
return currentHigh + 1;
}
- public void AddPage(string name)
+ public Page GetPageById(int pageId)
{
+ Page ret = null;
+ foreach(Page p in Pages)
+ {
+ if(p.Id == pageId)
+ {
+ ret = p;
+ break;
+ }
+ }
+ return ret;
+ }
+ public Page AddPage(string name, bool forceNew)
+ {
+ Page ret = null;
bool found = false;
- foreach(Page p in Pages)
+ if (!forceNew)
{
- if(p.FriendlyName ==name)
+ foreach (Page p in Pages)
{
- found = true;
+ if (p.FriendlyName == name)
+ {
+ found = true;
+ ret = p;
+ }
}
}
- if(!found)
+ if (!found)
{
Page p = new Page();
p.FriendlyName = name;
p.Id = GetNextPageId();
Pages.Add(p);
+ ret = p;
BookManager.getInstance().SaveSettings();
}
+ return ret;
+ }
+ public Page AddPage(string name)
+ {
+ return AddPage(name, true);
}
}
public class Page