Skip to content

Tweak api#3

Merged
kpreisser merged 3 commits intokpreisser:taskdialogfrom
RussKie:Tweak_API
Dec 30, 2019
Merged

Tweak api#3
kpreisser merged 3 commits intokpreisser:taskdialogfrom
RussKie:Tweak_API

Conversation

@RussKie
Copy link

@RussKie RussKie commented Dec 10, 2019

  • Rename CanBeMinimized -> AllowMinimize

  • Rename ShouldCloseDialog -> AllowCloseDialog

  • Add overloads for defaultButton, enabled, allowCloseDialog
    This way we can reduce a boilerplate code:

     TaskDialogStandardButton button1 = page.StandardButtons.Add(TaskDialogResult.No);
     button1.Enabled = false;
     button1.AllowCloseDialog = false;
     button1.DefaultButton = true;
    
     TaskDialogCustomButton button2 = page.CustomButtons.Add("&Save", "Save the document");
     button2.Enabled = false;
     button2.AllowCloseDialog = false;
     button2.DefaultButton = true;
    

    to

     TaskDialogStandardButton button1 = page.StandardButtons.Add(TaskDialogResult.No, enabled: false, defaultButton: true, allowCloseDialog: false);
     TaskDialogStandardButton button2 = page.CustomButtons.Add("&Save", "Save the document", enabled: false, defaultButton: true, allowCloseDialog: false);
    

@kpreisser
Copy link
Owner

  • Rename CanBeMinimized -> AllowMinimize

Note that Form has a property MinimizeBox.

@RussKie
Copy link
Author

RussKie commented Dec 11, 2019

Note that Form has a property MinimizeBox.

Yes, I know. AllowMinimize kind of went with the flow.
But we can call it MinimizeBox.

@dotnet/dotnet-winforms any preference?

This way we can reduce a boilerplate code:
```
TaskDialogStandardButton button1 = page.StandardButtons.Add(TaskDialogResult.No);
button1.Enabled = false;
button1.AllowCloseDialog = false;
button1.DefaultButton = true;

TaskDialogCustomButton button2 = page.CustomButtons.Add("&Save", "Save the document");
button2.Enabled = false;
button2.AllowCloseDialog = false;
button2.DefaultButton = true;
```

to

```
TaskDialogStandardButton button1 = page.StandardButtons.Add(TaskDialogResult.No, enabled: false, defaultButton: true, allowCloseDialog: false);
TaskDialogStandardButton button2 = page.CustomButtons.Add("&Save", "Save the document", enabled: false, defaultButton: true, allowCloseDialog: false);
```
@kpreisser
Copy link
Owner

Yes, I know. AllowMinimize kind of went with the flow.
But we can call it MinimizeBox.

I'm OK with calling it AllowMinimize.

@kpreisser kpreisser merged commit 4985159 into kpreisser:taskdialog Dec 30, 2019
@RussKie RussKie deleted the Tweak_API branch January 2, 2020 07:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants