Skip to content

Commit

Permalink
Added Synethia Actions releated code
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo-Peyronnet committed Aug 13, 2022
1 parent 2419774 commit 70aa79c
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 11 deletions.
18 changes: 9 additions & 9 deletions InternetTest/InternetTest/Classes/Global.cs
Expand Up @@ -133,18 +133,18 @@ public static List<ActionInfo> GetMostRelevantActions(SynethiaConfig synethiaCon
AppPages.DownDetector,
AppPages.MyIP,
AppPages.Ping,
AppPages.IPConfig
AppPages.IPConfig
};

public static List<ActionInfo> DefaultRelevantActions => new()
{
new(AppActions.MyIP, 12),
new(AppActions.Test, 10),
new(AppActions.DownDetectorRequest, 7),
new(AppActions.LocateIP, 6),
new(AppActions.GetWiFiPasswords, 5),
new(AppActions.GetIPConfig, 2),
new(AppActions.Ping, 1),
new() { Action = AppActions.MyIP, UsageCount = 0 },
new() { Action = AppActions.Test, UsageCount = 0 },
new() { Action = AppActions.DownDetectorRequest, UsageCount = 0 },
new() { Action = AppActions.Ping, UsageCount = 0 },
new() { Action = AppActions.LocateIP, UsageCount = 0 },
new() { Action = AppActions.GetIPConfig, UsageCount = 0 },
new() { Action = AppActions.GetWiFiPasswords, UsageCount = 0 },
};

public static Dictionary<AppActions, string> ActionsIcons => new()
Expand All @@ -166,7 +166,7 @@ public static List<ActionInfo> GetMostRelevantActions(SynethiaConfig synethiaCon
{ AppActions.LocateIP, "TEXT_HERE" },
{ AppActions.MyIP, "TEXT_HERE" },
{ AppActions.Ping, "TEXT_HERE" },
{ AppActions.Test, "TEXT_HERE" },
{ AppActions.Test, Properties.Resources.TestConnection },
};

public static Color GetColorFromResource(string resourceName) => (Color)ColorConverter.ConvertFromString(Application.Current.Resources[resourceName].ToString());
Expand Down
8 changes: 6 additions & 2 deletions InternetTest/InternetTest/Classes/SynethiaConfig.cs
Expand Up @@ -42,7 +42,7 @@ public SynethiaConfig()
IPConfigPageInfo = new();
WiFiPasswordsPageInfo = new();

ActionInfos = Enumerable.Empty<ActionInfo>().ToList();
ActionInfos = Global.DefaultRelevantActions;
}

public PageInfo StatusPageInfo { get; set; }
Expand Down Expand Up @@ -74,4 +74,8 @@ public PageInfo()
public double Score { get; set; }
}

public record ActionInfo(AppActions Action, int UsageCount);
public class ActionInfo
{
public AppActions Action { get; set; }
public int UsageCount { get; set; }
}
2 changes: 2 additions & 0 deletions InternetTest/InternetTest/Pages/StatusPage.xaml.cs
Expand Up @@ -162,6 +162,8 @@ private async void LaunchTest(string? customSite = null)
private void TestBtn_Click(object sender, RoutedEventArgs e)
{
LaunchTest();
// Increment the interaction count of the ActionInfo in Global.SynethiaConfig
Global.SynethiaConfig.ActionInfos.First(a => a.Action == Enums.AppActions.Test).UsageCount++;
}

private void BrowserBtn_Click(object sender, RoutedEventArgs e)
Expand Down
9 changes: 9 additions & 0 deletions InternetTest/InternetTest/Properties/Resources.Designer.cs

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

3 changes: 3 additions & 0 deletions InternetTest/InternetTest/Properties/Resources.en-US.resx
Expand Up @@ -216,4 +216,7 @@
<data name="LaunchTestToCheckConnection" xml:space="preserve">
<value>Launch a test to check your connection</value>
</data>
<data name="TestConnection" xml:space="preserve">
<value>Test your connection</value>
</data>
</root>
3 changes: 3 additions & 0 deletions InternetTest/InternetTest/Properties/Resources.fr-FR.resx
Expand Up @@ -216,4 +216,7 @@
<data name="LaunchTestToCheckConnection" xml:space="preserve">
<value>Lancez un test pour vérifier votre connexion</value>
</data>
<data name="TestConnection" xml:space="preserve">
<value>Tester votre connection</value>
</data>
</root>
3 changes: 3 additions & 0 deletions InternetTest/InternetTest/Properties/Resources.resx
Expand Up @@ -216,4 +216,7 @@
<data name="LaunchTestToCheckConnection" xml:space="preserve">
<value>Launch a test to check your connection</value>
</data>
<data name="TestConnection" xml:space="preserve">
<value>Test your connection</value>
</data>
</root>
3 changes: 3 additions & 0 deletions InternetTest/InternetTest/Properties/Resources.zh-CN.resx
Expand Up @@ -216,4 +216,7 @@
<data name="LaunchTestToCheckConnection" xml:space="preserve">
<value>启动测试以检查您的连接</value>
</data>
<data name="TestConnection" xml:space="preserve">
<value>Test your connection</value>
</data>
</root>

0 comments on commit 70aa79c

Please sign in to comment.