static public bool Edit(IWin32Window owner, Theme theme) { ThemeDialog dialog = new ThemeDialog(); dialog.FillControlValues(theme); return(ShowDialog(owner, dialog, theme) != null); }
static Theme ShowDialog(IWin32Window owner, ThemeDialog dialog, Theme theme) { if (dialog.ShowDialog(owner) == DialogResult.OK) { dialog.FillThemeProperties(theme); using (ISession session = DataHelper.OpenSession()) { using (ITransaction transaction = session.BeginTransaction()) { try { dialog.CreateLanguageProperties(session, theme, dialog.Culture1); dialog.CreateLanguageProperties(session, theme, dialog.Culture2); session.SaveOrUpdate(theme); transaction.Commit(); return(theme); } catch (ADOException e) { transaction.Rollback(); Trace.TraceError(ErrorHelper.Message(e)); ErrorHelper.ShowDbError(dialog, e); } } } } return(null); }
bool IHost.Create() { currentTheme = ThemeDialog.Create(this); if (currentTheme != null) { user = SelectUserDialog.Get(this); if (user != null) { Text = $"{Strings.VocabularyTest} - {currentTheme.Name}"; LoadWindowLayout(); addons.Run(); return(true); } } return(false); }