private void buttonPlay_Click(object sender, EventArgs e) { if (listBox1.SelectedIndex >= 0) { MNBookHeader bh = (MNBookHeader)(listBox1.Items[listBox1.SelectedIndex]); if (bh != null) { CurrentBook = bh; pageView1.CurrentBook = bh; pageView1.SetDocument(bh.LoadFull()); MNNotificationCenter.BroadcastMessage(this, "StartDocumentReview", pageView1.CurrentDocument, bh.FilePath); // this is default loading of language file if (bh.Languages != null && bh.Languages.Count > 0) { MNLocalisation file = new MNLocalisation(); file.Load(bh.Languages[0].FilePath, true); pageView1.CurrentDocument.CurrentLanguage = file; } // this is presenting book to the user SetShowPanel("book"); pageView1.Start(); } } }
public MNLocalisation LoadLanguage(MNBookLanguage bl) { MNLocalisation file = new MNLocalisation(); file.Load(bl.FilePath, true); return(file); }
void panelDownload_OnDownloadComplete(object sender, EventArgs e) { MNLocalisation file = new MNLocalisation(); file.Load(Library.GetLocalFile(p_fileDown), true); pageView1.CurrentDocument.CurrentLanguage = file; pageView1.ReloadPage(false); SetShowPanel("book"); }
public void PreviewLanguage(MNBookLanguage bl, string fileName) { MNLocalisation file = new MNLocalisation(); bl.FilePath = fileName; file.Load(bl.FilePath, false); bl.BookCode = file.GetProperty("BookCode"); bl.LastTimeSave = file.GetProperty("LastTime"); bl.LanguageName = file.GetProperty("LanguageName"); }
private void buttonOK_Click(object sender, EventArgs e) { ListBox lb = listBox1; if (lb.SelectedIndex >= 0 && lb.SelectedIndex < lb.Items.Count) { object obj = lb.Items[lb.SelectedIndex]; if (obj is MNBookLanguage) { mainForm.OnSave(); MNLocalisation data = new MNLocalisation(); data.Load((obj as MNBookLanguage).FilePath, true); mainForm.SetLocalisationData(data); mainForm.SetFileName((obj as MNBookLanguage).FilePath); } } }
public void dialogDidSelectLanguage(RemoteFileRef book, RemoteFileRef lang) { if (book == null) { SetShowPanel("book"); return; } MNBookHeader bh = Library.FindBookHeader(book.Text); if (bh != null && lang != null) { if (lang.Local) { if (lang.Text.Equals("Default")) { pageView1.CurrentDocument.CurrentLanguage = null; pageView1.ReloadPage(false); } else { MNLocalisation file = new MNLocalisation(); file.Load(Library.GetLocalFile(lang.FileName), true); pageView1.CurrentDocument.CurrentLanguage = file; pageView1.ReloadPage(false); } SetShowPanel("book"); } else { p_fileDown = lang.FileName; panelDownload.FilesToDownload.Clear(); panelDownload.FilesToDownload.Add(lang.FileName); panelDownload.Start(Library); SetShowPanel("downloader"); } } else { SetShowPanel("book"); } }
/// <summary> /// Load /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void toolStripButton2_ClickLoad(object sender, EventArgs e) { OnSave(); // load file OpenFileDialog d = new OpenFileDialog(); d.RestoreDirectory = true; d.Filter = "Language Pack Files (*" + fileExtensions + ")|*" + fileExtensions + "||"; if (Properties.Settings.Default.LastDirectory.Length > 0) { d.InitialDirectory = Properties.Settings.Default.LastDirectory; } if (d.ShowDialog() == System.Windows.Forms.DialogResult.OK) { data = new MNLocalisation(); fileName = d.FileName; data.Load(d.FileName, true); UpdateUIWithData(); PresentData(data, ""); } }