SetupDialog() private method

private SetupDialog ( IWritingSystem tempWs, IWritingSystem origWs, bool displayRelatedWss ) : void
tempWs IWritingSystem
origWs IWritingSystem
displayRelatedWss bool
return void
		/// <summary>
		/// Shows the new writing system properties dialog.
		/// </summary>
		/// <param name="owner">The owner.</param>
		/// <param name="cache">The cache.</param>
		/// <param name="wsManager">The ws manager.</param>
		/// <param name="wsContainer">The ws container.</param>
		/// <param name="helpTopicProvider">The help topic provider.</param>
		/// <param name="app">The app.</param>
		/// <param name="stylesheet">The stylesheet.</param>
		/// <param name="displayRelatedWss">if set to <c>true</c> related writing systems will be displayed.</param>
		/// <param name="defaultName">The default language name for the new writing system.</param>
		/// <param name="newWritingSystems">The new writing systems.</param>
		/// <returns></returns>
		public static bool ShowNewDialog(Form owner, FdoCache cache, IWritingSystemManager wsManager,
			IWritingSystemContainer wsContainer, IHelpTopicProvider helpTopicProvider, IApp app,
			IVwStylesheet stylesheet, bool displayRelatedWss, string defaultName,
			out IEnumerable<IWritingSystem> newWritingSystems)
		{
			newWritingSystems = null;
			LanguageSubtag languageSubtag;

			using (new WaitCursor(owner))
			using (var dlg = new LanguageSelectionDlg(wsManager, helpTopicProvider))
			{
				dlg.Text = FwCoreDlgs.kstidLanguageSelectionNewWsCaption;
				dlg.DefaultLanguageName = defaultName;

				if (dlg.ShowDialog(owner) != DialogResult.OK)
					return false;

				languageSubtag = dlg.LanguageSubtag;
			}

			using (new WaitCursor(owner))
			using (var wsPropsDlg = new WritingSystemPropertiesDialog(cache, wsManager, wsContainer, helpTopicProvider, app, stylesheet))
			{
				wsPropsDlg.SetupDialog(languageSubtag, displayRelatedWss);

				if (wsPropsDlg.ShowDialog(owner) == DialogResult.OK)
				{
					newWritingSystems = wsPropsDlg.NewWritingSystems;
					return true;
				}
			}
			return false;
		}
		/// <summary>
		/// Shows the modify writing system properties dialog.
		/// </summary>
		/// <param name="owner">The owner.</param>
		/// <param name="selectedWs">The selected writing system.</param>
		/// <param name="addNewForLangOfSelectedWs">if set to <c>true</c> a new writing system with the
		/// same language as the selected writing system will be added.</param>
		/// <param name="cache">The cache.</param>
		/// <param name="wsContainer">The ws container.</param>
		/// <param name="helpTopicProvider">The help topic provider.</param>
		/// <param name="app">The app.</param>
		/// <param name="stylesheet">The stylesheet.</param>
		/// <param name="newWritingSystems">The new writing systems.</param>
		/// <returns></returns>
		public static bool ShowModifyDialog(Form owner, IWritingSystem selectedWs, bool addNewForLangOfSelectedWs, FdoCache cache,
			IWritingSystemContainer wsContainer, IHelpTopicProvider helpTopicProvider, IApp app, IVwStylesheet stylesheet,
			out IEnumerable<IWritingSystem> newWritingSystems)
		{
			newWritingSystems = null;
			string path;
			if (!cache.ServiceLocator.WritingSystemManager.CanSave(selectedWs, out path))
			{
				MessageBox.Show(owner, string.Format(FwCoreDlgs.ksCannotSaveWritingSystem, path), FwCoreDlgs.ksError, MessageBoxButtons.OK, MessageBoxIcon.Warning);
				return false; // nothing changed.
			}
			using (new WaitCursor(owner))
			using (var wsPropsDlg = new WritingSystemPropertiesDialog(cache, cache.ServiceLocator.WritingSystemManager,
				wsContainer, helpTopicProvider, app, stylesheet))
			{
				wsPropsDlg.SetupDialog(selectedWs, true);
				if (addNewForLangOfSelectedWs)
					wsPropsDlg.AddNewWsForLanguage();

				if (!ClientServerServicesHelper.WarnOnOpeningSingleUserDialog(cache))
					return false; // nothing changed.
				if (!SharedBackendServicesHelper.WarnOnOpeningSingleUserDialog(cache))
					return false;

				if (wsPropsDlg.ShowDialog(owner) == DialogResult.OK)
				{
					if (wsPropsDlg.IsChanged)
					{
						newWritingSystems = wsPropsDlg.NewWritingSystems;
						return true;
					}
				}
			}

			return false;
		}