revit-wpf-template icon indicating copy to clipboard operation
revit-wpf-template copied to clipboard

Enhancement: External Method Buttons

Open max-sun-hongyi opened this issue 3 years ago • 0 comments

This enhancement allows user to click on different buttons to post different external methods. In my personal opinion buttons are more intuitive to use than checkbox + single button. I totally understand the current setup is for demo purpose and it's useful. This enhancement is to provide users with an additional way to post external methods.

image

I've added 3 buttons in the "Export" tab

                <Button x:Name="BExternalMethodProject" BorderBrush="#FFABADB3" Background="{x:Null}" Padding="5,0,5,0"
                        Click="BExternalMethodProject_Click" HorizontalAlignment="Left" Width="183" Height="26"
                        VerticalAlignment="Top" Margin="11,40,0,0" Grid.ColumnSpan="2" Grid.Row="1">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Project" Margin="5,0,0,0" />
                    </StackPanel>
                </Button>
                
                <Button x:Name="BExternalMethodWalls" BorderBrush="#FFABADB3" Background="{x:Null}" Padding="5,0,5,0"
                        Click="BExternalMethodWalls_Click" HorizontalAlignment="Left" Width="183" Height="26"
                        VerticalAlignment="Center" Margin="11,40,0,0" Grid.ColumnSpan="2" Grid.Row="1">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Walls" Margin="5,0,0,0" />
                    </StackPanel>
                </Button>
                <Button x:Name="BExternalMethodSheet" BorderBrush="#FFABADB3" Background="{x:Null}" Padding="5,0,5,0"
                        Click="BExternalMethodSheet_Click" HorizontalAlignment="Left" Width="183" Height="26"
                        VerticalAlignment="Bottom" Margin="11,40,0,0" Grid.ColumnSpan="2" Grid.Row="1">
                    <StackPanel Orientation="Horizontal">
                        <TextBlock Text="Sheet" Margin="5,0,0,0" />
                    </StackPanel>
                </Button>

Then I've utilized the "IsMouseOver" property in the MethodsWrapper class to identify which button is clicked. (Open for suggestions and better ideas)

        if (ui.BExternalMethodProject.IsMouseOver)
        {
            Methods.DocumentInfo(ui, doc);
        }

        if (ui.BExternalMethodWalls.IsMouseOver)
        {
            Methods.WallInfo(ui, doc);
        }

        if (ui.BExternalMethodSheet.IsMouseOver)
        {
            Methods.SheetRename(ui, doc);
        }

Happy to create a pull request if you find this enhancement useful.

Thanks very much for sharing your template and make it open source!

max-sun-hongyi avatar Aug 05 '20 01:08 max-sun-hongyi