public bool OnRestoreDefaultLayouts(object commandObject) { CheckDisposed(); Form formActive = ActiveForm; FwXWindow wndActive = formActive as FwXWindow; if (wndActive != null) { bool fRestore; using (RestoreDefaultsDlg dlg = new RestoreDefaultsDlg(this)) fRestore = (dlg.ShowDialog(formActive) == DialogResult.Yes); if (fRestore) { InitializePartInventories(null, false); ReplaceMainWindow(wndActive); } } return(true); }
/* * public bool OnImportSFMLexicon(object sender) * { * CheckDisposed(); * * FdoCache cache = null; * Form formActive = ActiveForm; * foreach (FwXWindow wnd in m_rgMainWindows) * { * if ((object)wnd == (object)formActive) * { * cache = wnd.Cache; * break; * } * } * * if (cache != null) * { * FwXWindow wndActive = formActive as FwXWindow; * //SIL.FieldWorks.LexText.Controls.ImportLexiconDlg dlg = * // new SIL.FieldWorks.LexText.Controls.ImportLexiconDlg(cache, "", ""); * SIL.FieldWorks.LexText.Controls.LexImportWizard dlg = * new SIL.FieldWorks.LexText.Controls.LexImportWizard(cache, wndActive.Mediator ); * if(dlg.ShowDialog(ActiveForm) == DialogResult.OK) * * { * // Make everything we've imported visible. Note that this needs to happen regardless of what the return value of ShowDialog is. * // An exception during processing may cause the result to not be OK, but entries will still have been added. * wndActive.Mediator.BroadcastMessage("MasterRefresh", null); * } * } * return true; * } * * /// <summary> * /// Launch a dialog that will allow the user to import LinguaLinks data. * /// </summary> * /// <param name="sender"></param> * /// <returns>true, to indicate it was handled here.</returns> * public bool OnImportLinguaLinksData(object sender) * { * FdoCache cache = null; * Form formActive = ActiveForm; * foreach (FwXWindow wnd in m_rgMainWindows) * { * if ((object)wnd == (object)formActive) * { * cache = wnd.Cache; * break; * } * } * if (cache != null) * { * FwXWindow wndActive = formActive as FwXWindow; * using (LinguaLinksImportDlg dlg = * new LinguaLinksImportDlg(cache, wndActive.Mediator)) * { * if (dlg.ShowDialog(ActiveForm) == DialogResult.OK) * { * // Make everything we've imported visible. * wndActive.Mediator.SendMessage("MasterRefresh", wndActive); * } * * } * } * return true; * } */ public bool OnRestoreDefaultLayouts(object commandObject) { CheckDisposed(); Form formActive = ActiveForm; FdoCache cache = GetActiveCache(formActive); FwXWindow wndActive = formActive as FwXWindow; if (cache != null && wndActive != null) { bool fRestore = false; using (RestoreDefaultsDlg dlg = new RestoreDefaultsDlg()) { fRestore = (dlg.ShowDialog(formActive) == DialogResult.Yes); } if (fRestore) { InitializePartInventories(cache, false); wndActive.Mediator.BroadcastMessage("MasterRefresh", wndActive); } } return(true); }
/* public bool OnImportSFMLexicon(object sender) { CheckDisposed(); FdoCache cache = null; Form formActive = ActiveForm; foreach (FwXWindow wnd in m_rgMainWindows) { if ((object)wnd == (object)formActive) { cache = wnd.Cache; break; } } if (cache != null) { FwXWindow wndActive = formActive as FwXWindow; //SIL.FieldWorks.LexText.Controls.ImportLexiconDlg dlg = // new SIL.FieldWorks.LexText.Controls.ImportLexiconDlg(cache, "", ""); SIL.FieldWorks.LexText.Controls.LexImportWizard dlg = new SIL.FieldWorks.LexText.Controls.LexImportWizard(cache, wndActive.Mediator ); if(dlg.ShowDialog(ActiveForm) == DialogResult.OK) { // Make everything we've imported visible. Note that this needs to happen regardless of what the return value of ShowDialog is. // An exception during processing may cause the result to not be OK, but entries will still have been added. wndActive.Mediator.BroadcastMessage("MasterRefresh", null); } } return true; } /// <summary> /// Launch a dialog that will allow the user to import LinguaLinks data. /// </summary> /// <param name="sender"></param> /// <returns>true, to indicate it was handled here.</returns> public bool OnImportLinguaLinksData(object sender) { FdoCache cache = null; Form formActive = ActiveForm; foreach (FwXWindow wnd in m_rgMainWindows) { if ((object)wnd == (object)formActive) { cache = wnd.Cache; break; } } if (cache != null) { FwXWindow wndActive = formActive as FwXWindow; using (LinguaLinksImportDlg dlg = new LinguaLinksImportDlg(cache, wndActive.Mediator)) { if (dlg.ShowDialog(ActiveForm) == DialogResult.OK) { // Make everything we've imported visible. wndActive.Mediator.SendMessage("MasterRefresh", wndActive); } } } return true; } */ public bool OnRestoreDefaultLayouts(object commandObject) { CheckDisposed(); Form formActive = ActiveForm; FdoCache cache = GetActiveCache(formActive); FwXWindow wndActive = formActive as FwXWindow; if (cache != null && wndActive != null) { bool fRestore = false; using (RestoreDefaultsDlg dlg = new RestoreDefaultsDlg()) { fRestore = (dlg.ShowDialog(formActive) == DialogResult.Yes); } if (fRestore) { InitializePartInventories(cache, false); wndActive.Mediator.BroadcastMessage("MasterRefresh", wndActive); } } return true; }