/// <summary> /// Checks and shows the trial version form if necessary. /// </summary> public static void CheckShow() { if (!ConvertHelper.ToBoolean( ConfigurationManager.AppSettings[@"disableExitAdvertisementFormNew"]) /*&& !ZetaResourceEditorCommandLineInfo.Current.IsNonblockingGui*/) { if (HostSettings.Current.License.LicenseType == ZreLicenseType.Freeware) { var lastExitAdvertisementShownAt = ConvertHelper.ToDateTime( PersistanceHelper.RestoreValue(@"ExitAdvertisement.LastShown")); if (lastExitAdvertisementShownAt <= DateTime.Now.AddDays(-1) || ConvertHelper.ToBoolean( ConfigurationManager.AppSettings[@"forceExitAdvertisementFormNew"])) { PersistanceHelper.SaveValue(@"ExitAdvertisement.LastShown", DateTime.Now); using (var form = new ExitAdvertisementFormNew()) { var af = ActiveForm; if (af != null) { af.Visible = false; } form.ShowDialog(af); } } } } }
private void mainForm_FormClosing( object sender, FormClosingEventArgs e) { if (!checkAskSaveEverything()) { e.Cancel = true; } else { projectFilesUserControl.CloseProject(); if (!_skipAdvertising) { ExitAdvertisementFormNew.CheckShow(); } FormBase.SaveState(ribbon); FormBase.SaveState(mainFormMainSplitContainer); WinFormsPersistanceHelper.SaveState(this); ((PersistentXmlFilePairStorage)PersistanceHelper.Storage).Flush(); } }