Skip to content

Commit

Permalink
ui adjustment - remember position of the main window
Browse files Browse the repository at this point in the history
  • Loading branch information
NeVeSpl committed Oct 19, 2024
1 parent 89d8fc0 commit a2576d3
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 10 deletions.
5 changes: 5 additions & 0 deletions sources/RevitDBExplorer/Command.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Windows;
using Autodesk.Revit.Attributes;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;
using RevitDBExplorer.Domain.Selectors;
using RevitDBExplorer.Properties;

namespace RevitDBExplorer
{
Expand All @@ -20,6 +22,9 @@ public Result Execute(ExternalCommandData commandData, ref string message, Eleme
var source = SelectorFactory.Create(Selector.CurrentSelection);
source.ReadFromTheSource(commandData.Application);
var window = new MainWindow(source, commandData.Application.MainWindowHandle);
window.WindowStartupLocation = WindowStartupLocation.Manual;
window.Top = AppSettings.Default.MainWindowTop;
window.Left = AppSettings.Default.MainWindowLeft;
window.Show();

windows.Add(new WeakReference(window));
Expand Down
2 changes: 1 addition & 1 deletion sources/RevitDBExplorer/MainWindow.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@
<ContextMenu>
<MenuItem Header="Snoop Groups" InputGestureText="ParameterUtils.GetAllBuiltInGroups()" Click="SelectorButton_Click" Tag="ForgeParameterUtilsGetAllBuiltInGroups"/>
<MenuItem Header="Snoop Parameters" InputGestureText="ParameterUtils.GetAllBuiltInParameters()" Click="SelectorButton_Click" Tag="ForgeParameterUtilsGetAllBuiltInParameters"/>
<MenuItem Header="Snoop measurable Specs" InputGestureText="UnitUtils.GetAllMeasurableSpecs()" Click="SelectorButton_Click" Tag="ForgeUnitUtilsGetAllMeasurableSpecs"/>
<MenuItem Header="Snoop Measurable Specs" InputGestureText="UnitUtils.GetAllMeasurableSpecs()" Click="SelectorButton_Click" Tag="ForgeUnitUtilsGetAllMeasurableSpecs"/>
<MenuItem Header="Snoop Units" InputGestureText="UnitUtils.GetAllUnits()" Click="SelectorButton_Click" Tag="ForgeUnitUtilsGetAllUnits"/>
<MenuItem Header="Snoop Disciplines" InputGestureText="UnitUtils.GetAllDisciplines()" Click="SelectorButton_Click" Tag="ForgeUnitUtilsGetAllDisciplines"/>
<MenuItem Header="Snoop Specs" InputGestureText="SpecUtils.GetAllSpecs()" Click="SelectorButton_Click" Tag="ForgeSpecUtilsGetAllSpecs"/>
Expand Down
2 changes: 2 additions & 0 deletions sources/RevitDBExplorer/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -392,6 +392,8 @@ private void SaveUserSettings()
{
AppSettings.Default.MainWindowHeight = Height;
AppSettings.Default.MainWindowWidth = Width;
AppSettings.Default.MainWindowTop = Top;
AppSettings.Default.MainWindowLeft = Left;
AppSettings.Default.FirstColumnWidth = Workspaces.GetFirstColumnWidth();
AppSettings.Default.Save();
}
Expand Down
26 changes: 25 additions & 1 deletion sources/RevitDBExplorer/Properties/AppSettings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions sources/RevitDBExplorer/Properties/AppSettings.settings
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,11 @@
<Setting Name="OpenLinksInNewWindow" Type="System.Boolean" Scope="User">
<Value Profile="(Default)">False</Value>
</Setting>
<Setting Name="MainWindowTop" Type="System.Double" Scope="User">
<Value Profile="(Default)">200</Value>
</Setting>
<Setting Name="MainWindowLeft" Type="System.Double" Scope="User">
<Value Profile="(Default)">200</Value>
</Setting>
</Settings>
</SettingsFile>
17 changes: 9 additions & 8 deletions sources/RevitDBExplorer/UIComponents/List/ListView.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,15 @@

<Path Style="{Binding Icon, Converter={StaticResource ToResourceWithKeyConverter}}" Margin="0 1 4 0" />
<TextBlock Text="{Binding Name, Mode=OneWay}" Foreground="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}" Grid.Column="1" />
<TextBlock Text="{Binding RevitVersion, Mode=OneWay}" Foreground="white" Background="#0C3D91"
FontWeight="Bold"
TextAlignment="Center"
Padding="2 1"
Margin="0 -1"
Grid.Column="2"
Visibility="{Binding RevitVersion, Converter={StaticResource StringToVisibilityConverter}}"
ToolTip="First appeared in Revit"/>
<Border BorderThickness="1" BorderBrush="#0C3D91" Background="#0C3D91" Grid.Column="2" Padding="1 0" Visibility="{Binding RevitVersion, Converter={StaticResource StringToVisibilityConverter}}" >
<TextBlock Text="{Binding RevitVersion, Mode=OneWay}" Foreground="white" Background="#0C3D91"
FontWeight="Bold"
TextAlignment="Center"
Margin="0 -1"
Padding="0"
Visibility="{Binding RevitVersion, Converter={StaticResource StringToVisibilityConverter}}"
ToolTip="First appeared in Revit"/>
</Border>
</Grid>
</Grid>
<DataTemplate.Resources>
Expand Down
6 changes: 6 additions & 0 deletions sources/RevitDBExplorer/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@
<setting name="OpenLinksInNewWindow" serializeAs="String">
<value>False</value>
</setting>
<setting name="MainWindowTop" serializeAs="String">
<value>200</value>
</setting>
<setting name="MainWindowLeft" serializeAs="String">
<value>200</value>
</setting>
</RevitDBExplorer.Properties.AppSettings>
</userSettings>
</configuration>

0 comments on commit a2576d3

Please sign in to comment.