diff --git a/AddInManager/App.config b/AddInManager/App.config index 26e0202..3224a05 100644 --- a/AddInManager/App.config +++ b/AddInManager/App.config @@ -1,7 +1,7 @@ - + - +
@@ -16,6 +16,12 @@ Default + + 0 + + + 0 + \ No newline at end of file diff --git a/AddInManager/Model/ProcessManager.cs b/AddInManager/Model/ProcessManager.cs index 2b5dad3..6f8d9ef 100644 --- a/AddInManager/Model/ProcessManager.cs +++ b/AddInManager/Model/ProcessManager.cs @@ -17,7 +17,7 @@ public static class ProcessManager public static void SetRevitAsWindowOwner(this Window window) { if (null == window) { return; } - window.WindowStartupLocation = WindowStartupLocation.CenterScreen; + window.WindowStartupLocation = WindowStartupLocation.Manual; WindowInteropHelper helper = new WindowInteropHelper(window); helper.Owner = GetActivateWindow(); window.Loaded += delegate { FrmControl.IsOpened = true; }; diff --git a/AddInManager/Properties/App.Designer.cs b/AddInManager/Properties/App.Designer.cs index 07dee16..9ba9c1b 100644 --- a/AddInManager/Properties/App.Designer.cs +++ b/AddInManager/Properties/App.Designer.cs @@ -1,7 +1,6 @@ //------------------------------------------------------------------------------ // // This code was generated by a tool. -// Runtime Version:4.0.30319.42000 // // Changes to this file may cause incorrect behavior and will be lost if // the code is regenerated. @@ -12,7 +11,7 @@ namespace RevitAddinManager.Properties { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.4.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.9.0.0")] internal sealed partial class App : global::System.Configuration.ApplicationSettingsBase { private static App defaultInstance = ((App)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new App()))); @@ -58,5 +57,29 @@ public string ThemName { this["ThemName"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public double AppLeft { + get { + return ((double)(this["AppLeft"])); + } + set { + this["AppLeft"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("0")] + public double AppTop { + get { + return ((double)(this["AppTop"])); + } + set { + this["AppTop"] = value; + } + } } } diff --git a/AddInManager/Properties/App.settings b/AddInManager/Properties/App.settings index 3e8293f..e28bc87 100644 --- a/AddInManager/Properties/App.settings +++ b/AddInManager/Properties/App.settings @@ -1,4 +1,4 @@ - + @@ -11,5 +11,12 @@ Default + + 0 + + + 0 + - \ No newline at end of file + + diff --git a/AddInManager/View/FrmAddInManager.xaml b/AddInManager/View/FrmAddInManager.xaml index 2b68cbb..398c73b 100644 --- a/AddInManager/View/FrmAddInManager.xaml +++ b/AddInManager/View/FrmAddInManager.xaml @@ -16,10 +16,13 @@ d:DataContext="{d:DesignInstance viewModel:AddInManagerViewModel}" d:DesignHeight="600" d:DesignWidth="400" + Closed="OnCloseApp" FocusManager.FocusedElement="{Binding ElementName=tbxSearch}" Icon="../Resources/dev.ico" + Left="{model:SettingBinding AppLeft}" PreviewKeyDown="CloseFormEvent" SizeChanged="FrmSizeChanged" + Top="{model:SettingBinding AppTop}" mc:Ignorable="d"> diff --git a/AddInManager/View/FrmAddInManager.xaml.cs b/AddInManager/View/FrmAddInManager.xaml.cs index 25fb386..b9ff6e7 100644 --- a/AddInManager/View/FrmAddInManager.xaml.cs +++ b/AddInManager/View/FrmAddInManager.xaml.cs @@ -22,7 +22,6 @@ public FrmAddInManager(AddInManagerViewModel vm) ThemManager.ChangeThem(true); Title += DefaultSetting.Version; } - private void TbxDescription_OnLostKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e) { if (viewModel.MAddinManagerBase.ActiveCmdItem != null && TabControl.SelectedIndex == 0) @@ -158,4 +157,11 @@ private DispatcherTimer Debounce(DispatcherTimer dispatcher, TimeSpan interval, return dispatcher; } + + private void OnCloseApp(object sender, EventArgs e) + { + Properties.App.Default.AppLeft = Left; + Properties.App.Default.AppTop = Top; + Properties.App.Default.Save(); + } } \ No newline at end of file diff --git a/AddInManager/ViewModel/AddInManagerViewModel.cs b/AddInManager/ViewModel/AddInManagerViewModel.cs index c95224c..6142c0a 100644 --- a/AddInManager/ViewModel/AddInManagerViewModel.cs +++ b/AddInManager/ViewModel/AddInManagerViewModel.cs @@ -24,6 +24,8 @@ public class AddInManagerViewModel : ViewModelBase public AssemLoader AssemLoader { get; set; } public int AppWidth { get; set; } = 400; public int AppHeight { get; set; } = 600; + public int AppLeft { get; set; } = 0; + public int AppTop { get; set; } = 0; public AddinManagerBase MAddinManagerBase { get; set; } private ObservableCollection commandItems;