diff --git a/Time Tracker/ApplicationInitializer.cs b/Time Tracker/ApplicationInitializer.cs new file mode 100644 index 0000000000..b1b470be89 --- /dev/null +++ b/Time Tracker/ApplicationInitializer.cs @@ -0,0 +1,28 @@ +using Sdl.Community.Studio.Time.Tracker.Panels.Main; +using Sdl.Desktop.IntegrationApi; +using Sdl.Desktop.IntegrationApi.Extensions; +using Sdl.Desktop.IntegrationApi.Interfaces; +using Sdl.Desktop.IntegrationApi.Notifications.Events; +using Sdl.TranslationStudioAutomation.IntegrationApi; +using Sdl.TranslationStudioAutomation.IntegrationApi.Internal; +using System; + +namespace Sdl.Community.Studio.Time.Tracker +{ + [ApplicationInitializer] + public class ApplicationInitializer : IApplicationInitializer + { + private static StudioTimeTrackerViewController _studioTimeTrackerViewController; + + private SdlTradosStudioApplication SdlTradosStudioApplication => SdlTradosStudio.Application; + + private StudioTimeTrackerViewController StudioTimeTrackerViewController => _studioTimeTrackerViewController ??= + SdlTradosStudioApplication.GetController(); + + public void Execute() => + SdlTradosStudioApplication.GetService() + .GetEvent().Subscribe(OnStudioWindowCreated); + + private void OnStudioWindowCreated(StudioWindowCreatedNotificationEvent @event) => StudioTimeTrackerViewController.Initialize(); + } +} \ No newline at end of file diff --git a/Time Tracker/Panels/Main/StudioTimeTrackerViewController.cs b/Time Tracker/Panels/Main/StudioTimeTrackerViewController.cs index c1a4a362d3..28f400504b 100644 --- a/Time Tracker/Panels/Main/StudioTimeTrackerViewController.cs +++ b/Time Tracker/Panels/Main/StudioTimeTrackerViewController.cs @@ -200,6 +200,9 @@ public void Initialize() protected override void Initialize(IViewContext context) { + if (Initialized) return; + Initialized = true; + ActivationChanged += StudioTimeTrackerViewController_ActivationChanged; IsLoading = true; @@ -279,6 +282,8 @@ protected override void Initialize(IViewContext context) IsLoading = false; } + public bool Initialized { get; set; } + private void StudioTimeTrackerViewController_ActivationChanged(object sender, ActivationChangedEventArgs e) { IsActive = e.Active; diff --git a/Time Tracker/Properties/AssemblyInfo.cs b/Time Tracker/Properties/AssemblyInfo.cs index 20ab1fc5e2..6ad0b8e1dd 100644 --- a/Time Tracker/Properties/AssemblyInfo.cs +++ b/Time Tracker/Properties/AssemblyInfo.cs @@ -32,4 +32,4 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] [assembly: AssemblyVersion("5.0.0.0")] -[assembly: AssemblyFileVersion("5.0.1.1")] +[assembly: AssemblyFileVersion("5.0.2.0")] diff --git a/Time Tracker/Sdl.Community.Studio.Time.Tracker.csproj b/Time Tracker/Sdl.Community.Studio.Time.Tracker.csproj index 9814e99abf..9ca3aeb52e 100644 --- a/Time Tracker/Sdl.Community.Studio.Time.Tracker.csproj +++ b/Time Tracker/Sdl.Community.Studio.Time.Tracker.csproj @@ -1,26 +1,11 @@ - - + - Debug - AnyCPU - 11.0.3344.0 - 2.0 - {AC39EA6C-DDDE-4C47-8E9C-10796087CE32} + net48 Library - Properties - Sdl.Community.Studio.Time.Tracker - Sdl.Community.Studio.Time.Tracker - v4.8 - - - - - 2.0 - false publish\ true @@ -36,32 +21,19 @@ 1.0.0.%2a false true - - $(AppData)\Trados\Trados Studio\18\Plugins $(MSBuildProgramFiles32)\Trados\Trados Studio\Studio18 + false + true + true - true - full - false bin\Debug - DEBUG;TRACE - prompt - 4 AllRules.ruleset - AnyCPU - false - pdbonly - true bin\Release - TRACE - prompt - 4 AllRules.ruleset - false @@ -91,150 +63,27 @@ $(TradosFolder)\Sdl.TellMe.ProviderApi.dll - - - - - - - 4.0 + + $(TradosFolder)\System.Reactive.dll - - - - - - - - - - - - - - - - - - Form - - - ExportActivitesToExcel.cs - - - Form - - - Message.cs - - - - - - - - - - + UserControl - - StudioTimeTrackerViewTimerControl.cs - - - Form - - - ActivityType.cs - - - Form - - - AddressDetails.cs - - - Form - - - ClientProfile.cs - - - Form - - - ClientActivityRate.cs - - - Form - - - TrackProjectActivity.cs - - - Form - - - TimeTrackerProject.cs - - - Form - - - Settings.cs - - - - True - True - PluginResources.resx - - - - - - - - - - - + UserControl - - StudioTimeTrackerViewPropertiesControl.cs - - + UserControl - - StudioTimeTrackerNavigationControl.cs - - - - - + UserControl - - StudioTimeTrackerViewControl.cs - - - - - - - + UserControl - - StudioTimeTrackerEditorControl.cs - - - @@ -280,62 +129,9 @@ - - ExportActivitesToExcel.cs - - - Message.cs - - - StudioTimeTrackerViewTimerControl.cs - Designer - - - ActivityType.cs - - - AddressDetails.cs - - - ClientProfile.cs - - - ClientActivityRate.cs - - - TrackProjectActivity.cs - - - TimeTrackerProject.cs - - - Settings.cs - - - StudioTimeTrackerViewPropertiesControl.cs - Designer - - - StudioTimeTrackerNavigationControl.cs - Designer - - - Designer - PublicResXFileCodeGenerator - PluginResources.Designer.cs - Designer - - StudioTimeTrackerEditorControl.cs - - - - - StudioTimeTrackerViewControl.cs - Designer - @@ -375,6 +171,9 @@ 18.0.1 + + + true @@ -389,6 +188,6 @@ Studio.Time.Tracker.ico + latest - \ No newline at end of file diff --git a/Time Tracker/pluginpackage.manifest.xml b/Time Tracker/pluginpackage.manifest.xml index 8450128578..1eb245c944 100644 --- a/Time Tracker/pluginpackage.manifest.xml +++ b/Time Tracker/pluginpackage.manifest.xml @@ -1,7 +1,7 @@ Studio Time Tracker - 5.0.1.1 + 5.0.2.0 Studio Time Tracker Trados AppStore Team