Exemple #1
0
        private void OnAskUserWhatToDoWithDataInWritingSystemToBeDeleted(object sender, WhatToDoWithDataInWritingSystemToBeDeletedEventArgs args)
        {
            //If no one is listening for the help button we won't offer it to the user
            bool showHelpButton = UserWantsHelpWithDeletingWritingSystems != null;

            using (var deleteDialog = new DeleteInputSystemDialog(args.WritingSystemIdToDelete, _model.WritingSystemDefinitions, showHelpButton))
            {
                deleteDialog.HelpWithDeletingWritingSystemsButtonClickedEvent += OnHelpWithDeletingWritingSystemsButtonClicked;
                var dialogResult = deleteDialog.ShowDialog();

                if (dialogResult != DialogResult.OK)
                {
                    args.WhatToDo = WhatToDos.Nothing;
                }
                else
                {
                    switch (deleteDialog.Choice)
                    {
                    case DeleteInputSystemDialog.Choices.Cancel:
                        args.WhatToDo = WhatToDos.Nothing;
                        break;

                    case DeleteInputSystemDialog.Choices.Merge:
                        args.WhatToDo = WhatToDos.Conflate;
                        args.WritingSystemIdToConflateWith = deleteDialog.WritingSystemToConflateWith;
                        break;

                    case DeleteInputSystemDialog.Choices.Delete:
                        args.WhatToDo = WhatToDos.Delete;
                        break;
                    }
                }
            }
        }
		private void OnAskUserWhatToDoWithDataInWritingSystemToBeDeleted(object sender, WhatToDoWithDataInWritingSystemToBeDeletedEventArgs args)
		{
			//If no one is listening for the help button we won't offer it to the user
			bool showHelpButton = UserWantsHelpWithDeletingWritingSystems != null;
			using (var deleteDialog = new DeleteInputSystemDialog(args.WritingSystemIdToDelete, _model.WritingSystemDefinitions, showHelpButton))
			{
				deleteDialog.HelpWithDeletingWritingSystemsButtonClickedEvent += OnHelpWithDeletingWritingSystemsButtonClicked;
				var dialogResult = deleteDialog.ShowDialog();

				if (dialogResult != DialogResult.OK)
				{
					args.WhatToDo = WhatToDos.Nothing;
				}
				else
				{
					switch (deleteDialog.Choice)
					{
						case DeleteInputSystemDialog.Choices.Cancel:
							args.WhatToDo = WhatToDos.Nothing;
							break;
						case DeleteInputSystemDialog.Choices.Merge:
							args.WhatToDo = WhatToDos.Conflate;
							args.WritingSystemIdToConflateWith = deleteDialog.WritingSystemToConflateWith;
							break;
						case DeleteInputSystemDialog.Choices.Delete:
							args.WhatToDo = WhatToDos.Delete;
							break;
					}
				}
			}
		}