diff --git a/src/GitHubExtension/Widgets/GitHubAssignedWidget.cs b/src/GitHubExtension/Widgets/GitHubAssignedWidget.cs index ce1c6336..794b47bd 100644 --- a/src/GitHubExtension/Widgets/GitHubAssignedWidget.cs +++ b/src/GitHubExtension/Widgets/GitHubAssignedWidget.cs @@ -139,7 +139,7 @@ public override void OnActionInvoked(WidgetActionInvokedArgs actionInvokedArgs) } } - public new void UpdateActivityState() + public override void UpdateActivityState() { // State logic for the Widget: // Signed in -> Configure -> Active / Inactive per widget host. @@ -235,7 +235,7 @@ public override void LoadContentData() public void LoadContentData(IEnumerable items) { - Log.Logger()?.ReportDebug(Name, ShortId, "Getting Data for Assigned in Widget"); + Log.Logger()?.ReportDebug(Name, ShortId, "Getting Data for Assigned to Widget"); try { @@ -328,7 +328,6 @@ public string GetConfigurationData() { { "showCategory", EnumHelper.SearchCategoryToString(ShowCategory == SearchCategory.Unknown ? SearchCategory.IssuesAndPullRequests : ShowCategory) }, { "savedShowCategory", savedShowCategory != null ? "savedShowCategory" : string.Empty }, - { "configuring", true }, }; return configurationData.ToJsonString(); } diff --git a/src/GitHubExtension/Widgets/GitHubIssuesWidget.cs b/src/GitHubExtension/Widgets/GitHubIssuesWidget.cs index 8df74fdb..66ff5bc7 100644 --- a/src/GitHubExtension/Widgets/GitHubIssuesWidget.cs +++ b/src/GitHubExtension/Widgets/GitHubIssuesWidget.cs @@ -199,7 +199,7 @@ public override string GetData(WidgetPageState page) WidgetPageState.SignIn => GetSignIn(), WidgetPageState.Configure => GetConfiguration(RepositoryUrl), WidgetPageState.Content => ContentData, - WidgetPageState.Loading => new JsonObject { { "configuring", true } }.ToJsonString(), + WidgetPageState.Loading => EmptyJson, _ => throw new NotImplementedException(Page.GetType().Name), }; } diff --git a/src/GitHubExtension/Widgets/GitHubMentionedInWidget.cs b/src/GitHubExtension/Widgets/GitHubMentionedInWidget.cs index 0667fac8..c3836538 100644 --- a/src/GitHubExtension/Widgets/GitHubMentionedInWidget.cs +++ b/src/GitHubExtension/Widgets/GitHubMentionedInWidget.cs @@ -105,7 +105,7 @@ public override void OnWidgetContextChanged(WidgetContextChangedArgs contextChan UpdateActivityState(); } - public new void UpdateActivityState() + public override void UpdateActivityState() { // State logic for the Widget: // Signed in -> Configure -> Active / Inactive per widget host. @@ -304,7 +304,6 @@ public string GetConfigurationData() { { "showCategory", EnumHelper.SearchCategoryToString(ShowCategory == SearchCategory.Unknown ? SearchCategory.IssuesAndPullRequests : ShowCategory) }, { "savedShowCategory", savedShowCategory != null ? "savedShowCategory" : string.Empty }, - { "configuring", true }, }; return configurationData.ToJsonString(); } diff --git a/src/GitHubExtension/Widgets/GitHubPullsWidget.cs b/src/GitHubExtension/Widgets/GitHubPullsWidget.cs index 4624cdd7..e0488ac0 100644 --- a/src/GitHubExtension/Widgets/GitHubPullsWidget.cs +++ b/src/GitHubExtension/Widgets/GitHubPullsWidget.cs @@ -172,7 +172,7 @@ public override string GetData(WidgetPageState page) WidgetPageState.SignIn => GetSignIn(), WidgetPageState.Configure => GetConfiguration(RepositoryUrl), WidgetPageState.Content => ContentData, - WidgetPageState.Loading => new JsonObject { { "configuring", true } }.ToJsonString(), + WidgetPageState.Loading => EmptyJson, _ => throw new NotImplementedException(Page.GetType().Name), }; } diff --git a/src/GitHubExtension/Widgets/GitHubReviewWidget.cs b/src/GitHubExtension/Widgets/GitHubReviewWidget.cs index f52f42e3..6f313249 100644 --- a/src/GitHubExtension/Widgets/GitHubReviewWidget.cs +++ b/src/GitHubExtension/Widgets/GitHubReviewWidget.cs @@ -1,12 +1,10 @@ // Copyright (c) Microsoft Corporation and Contributors // Licensed under the MIT license. -using System.Text.Json; using System.Text.Json.Nodes; -using System.Text.Json.Serialization; using GitHubExtension.DataManager; using GitHubExtension.Helpers; -using GitHubExtension.Widgets.Enums; +using GitHubExtension.Widgets.Enums; using Microsoft.Windows.Widgets.Providers; using Octokit; @@ -73,7 +71,7 @@ public override void OnWidgetContextChanged(WidgetContextChangedArgs contextChan UpdateActivityState(); } - public new void UpdateActivityState() + public override void UpdateActivityState() { // State logic for the Widget: (no configuration is needed) // Signed in -> Active / Inactive per widget host. @@ -156,7 +154,7 @@ public override void LoadContentData() public void LoadContentData(IEnumerable items) { - Log.Logger()?.ReportDebug(Name, ShortId, "Getting Data for Mentioned in Widget"); + Log.Logger()?.ReportDebug(Name, ShortId, "Getting Data for Review requested Widget"); try { @@ -232,7 +230,7 @@ public override string GetData(WidgetPageState page) return page switch { WidgetPageState.SignIn => new JsonObject { { "message", Resources.GetResource(@"Widget_Template/SignInRequired", Log.Logger()) } }.ToJsonString(), - WidgetPageState.Configure => EmptyJson, + WidgetPageState.Configure => throw new NotImplementedException(Page.GetType().Name), WidgetPageState.Content => ContentData, WidgetPageState.Loading => EmptyJson, _ => throw new NotImplementedException(Page.GetType().Name), diff --git a/src/GitHubExtension/Widgets/GitHubWidget.cs b/src/GitHubExtension/Widgets/GitHubWidget.cs index 90865037..9ceb25c3 100644 --- a/src/GitHubExtension/Widgets/GitHubWidget.cs +++ b/src/GitHubExtension/Widgets/GitHubWidget.cs @@ -228,7 +228,6 @@ public string GetConfiguration(string data) if (data == string.Empty) { configurationData.Add("hasConfiguration", false); - configurationData.Add("configuring", true); var repositoryData = new JsonObject { { "url", string.Empty }, @@ -279,7 +278,6 @@ public string GetConfiguration(string data) { Log.Logger()?.ReportError(Name, ShortId, $"Failed getting configuration information for input url: {data}", ex); configurationData.Add("hasConfiguration", false); - configurationData.Add("configuring", true); var repositoryData = new JsonObject { @@ -302,7 +300,6 @@ public string GetSignIn() var signInData = new JsonObject { { "message", Resources.GetResource(@"Widget_Template/SignInRequired", Log.Logger()) }, - { "configuring", true }, }; return signInData.ToString(); @@ -314,7 +311,7 @@ public bool IsUserLoggedIn() return authProvider.GetLoggedInDeveloperIds().DeveloperIds.Any(); } - public void UpdateActivityState() + public override void UpdateActivityState() { // State logic for the Widget: // Signed in -> Valid Repository Url -> Active / Inactive per widget host. diff --git a/src/GitHubExtension/Widgets/Templates/GitHubIssuesConfigurationTemplate.json b/src/GitHubExtension/Widgets/Templates/GitHubIssuesConfigurationTemplate.json index 4130d34b..47f5e5e7 100644 --- a/src/GitHubExtension/Widgets/Templates/GitHubIssuesConfigurationTemplate.json +++ b/src/GitHubExtension/Widgets/Templates/GitHubIssuesConfigurationTemplate.json @@ -66,19 +66,6 @@ "weight": "bolder", "spacing": "None" }, - { - "type": "TextBlock", - "text": "%Widget_Template/Label%", - "wrap": true, - "size": "Small" - }, - { - "type": "TextBlock", - "text": "${label}", - "wrap": true, - "weight": "bolder", - "spacing": "None" - }, { "type": "TextBlock", "text": "%Widget_Template/Author%", @@ -91,19 +78,6 @@ "wrap": true, "weight": "bolder", "spacing": "None" - }, - { - "type": "TextBlock", - "text": "%Widget_Template/Project%", - "wrap": true, - "size": "Small" - }, - { - "type": "TextBlock", - "text": "${Project}", - "wrap": true, - "weight": "bolder", - "spacing": "None" } ], "spacing": "Medium", @@ -115,7 +89,6 @@ { "type": "ColumnSet", "spacing": "Medium", - "$when": "${$root.savedRepositoryUrl != \"\"}", "columns": [ { "type": "Column", @@ -142,7 +115,8 @@ "type": "Action.Execute", "title": "%Widget_Template_Button/Cancel%", "verb": "Cancel", - "tooltip": "%Widget_Template_Tooltip/Cancel%" + "tooltip": "%Widget_Template_Tooltip/Cancel%", + "isEnabled": "${$root.savedRepositoryUrl != \"\"}" } ] } diff --git a/src/GitHubExtension/Widgets/Templates/GitHubPullsConfigurationTemplate.json b/src/GitHubExtension/Widgets/Templates/GitHubPullsConfigurationTemplate.json index 81ffa7ea..49754ee5 100644 --- a/src/GitHubExtension/Widgets/Templates/GitHubPullsConfigurationTemplate.json +++ b/src/GitHubExtension/Widgets/Templates/GitHubPullsConfigurationTemplate.json @@ -51,19 +51,6 @@ "weight": "bolder", "spacing": "None" }, - { - "type": "TextBlock", - "text": "%Widget_Template/Label%", - "wrap": true, - "size": "Small" - }, - { - "type": "TextBlock", - "text": "${label}", - "wrap": true, - "weight": "bolder", - "spacing": "None" - }, { "type": "TextBlock", "text": "%Widget_Template/Author%", @@ -76,19 +63,6 @@ "wrap": true, "weight": "bolder", "spacing": "None" - }, - { - "type": "TextBlock", - "text": "%Widget_Template/Project%", - "wrap": true, - "size": "Small" - }, - { - "type": "TextBlock", - "text": "${Project}", - "wrap": true, - "weight": "bolder", - "spacing": "None" } ], "spacing": "Medium", @@ -100,7 +74,6 @@ { "type": "ColumnSet", "spacing": "Medium", - "$when": "${$root.savedRepositoryUrl != \"\"}", "columns": [ { "type": "Column", @@ -127,7 +100,8 @@ "type": "Action.Execute", "title": "%Widget_Template_Button/Cancel%", "verb": "Cancel", - "tooltip": "%Widget_Template_Tooltip/Cancel%" + "tooltip": "%Widget_Template_Tooltip/Cancel%", + "isEnabled": "${$root.savedRepositoryUrl != \"\"}" } ] } diff --git a/src/GitHubExtension/Widgets/WidgetImpl.cs b/src/GitHubExtension/Widgets/WidgetImpl.cs index f25454ce..3ba7d4d4 100644 --- a/src/GitHubExtension/Widgets/WidgetImpl.cs +++ b/src/GitHubExtension/Widgets/WidgetImpl.cs @@ -49,4 +49,6 @@ public void SetState(string state) public abstract void OnCustomizationRequested(WidgetCustomizationRequestedArgs customizationRequestedArgs); public abstract void OnWidgetContextChanged(WidgetContextChangedArgs contextChangedArgs); + + public abstract void UpdateActivityState(); }