Skip to content

Commit

Permalink
Merge pull request #73 from OpenIPC/layout-reorg
Browse files Browse the repository at this point in the history
Layout reorg
  • Loading branch information
mikecarr authored Jan 22, 2025
2 parents b7e08f3 + 669ddb4 commit f4371de
Show file tree
Hide file tree
Showing 24 changed files with 591 additions and 308 deletions.
79 changes: 40 additions & 39 deletions OpenIPC_Config/App.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Net.Http;
using System.Reflection;
Expand Down Expand Up @@ -76,14 +77,14 @@ private IConfigurationRoot LoadConfiguration()
return configuration;
}

private void InitializeBasicLogger()
{
Log.Logger = new LoggerConfiguration()
.WriteTo.Console()
.CreateLogger();

Log.Information("Basic logger initialized for early startup.");
}
// private void InitializeBasicLogger()
// {
// Log.Logger = new LoggerConfiguration()
// .WriteTo.Console()
// .CreateLogger();
//
// Log.Information("Basic logger initialized for early startup.");
// }

private void ReconfigureLogger(IConfiguration configuration)
{
Expand Down Expand Up @@ -172,37 +173,37 @@ private string GetConfigPath()
return configPath;
}

private void CreateAppSettings()
{
var configPath = GetConfigPath();

// Create default settings if not present
if (!File.Exists(configPath))
{
var defaultSettings = createDefaultAppSettings();
File.WriteAllText(configPath, defaultSettings.ToString());
Log.Information($"Default appsettings.json created at {configPath}");
}

var configuration = new ConfigurationBuilder()
.AddJsonFile(configPath, false, true)
.AddJsonFile("appsettings.json", true, true)
// .AddJsonFile("appsettings.Development.json", Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == "Development")
// .AddJsonFile(
// $"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production"}.json",
// true)
.Build();

Log.Logger = new LoggerConfiguration()
.ReadFrom.Configuration(configuration)
.WriteTo.Sink(new EventAggregatorSink(ServiceProvider.GetRequiredService<IEventAggregator>()))
.CreateLogger();

Log.Information(
"**********************************************************************************************");
Log.Information($"Starting up log for OpenIPC Configurator v{VersionHelper.GetAppVersion()}");
Log.Information($"Using appsettings.json from {configPath}");
}
// private void CreateAppSettings()
// {
// var configPath = GetConfigPath();
//
// // Create default settings if not present
// if (!File.Exists(configPath))
// {
// var defaultSettings = createDefaultAppSettings();
// File.WriteAllText(configPath, defaultSettings.ToString());
// Log.Information($"Default appsettings.json created at {configPath}");
// }
//
// var configuration = new ConfigurationBuilder()
// .AddJsonFile(configPath, false, true)
// .AddJsonFile("appsettings.json", true, true)
// // .AddJsonFile("appsettings.Development.json", Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") == "Development")
// // .AddJsonFile(
// // $"appsettings.{Environment.GetEnvironmentVariable("ASPNETCORE_ENVIRONMENT") ?? "Production"}.json",
// // true)
// .Build();
//
// Log.Logger = new LoggerConfiguration()
// .ReadFrom.Configuration(configuration)
// .WriteTo.Sink(new EventAggregatorSink(ServiceProvider.GetRequiredService<IEventAggregator>()))
// .CreateLogger();
//
// Log.Information(
// "**********************************************************************************************");
// Log.Information($"Starting up log for OpenIPC Configurator v{VersionHelper.GetAppVersion()}");
// Log.Information($"Using appsettings.json from {configPath}");
// }

public virtual async Task ShowUpdateDialogAsync(string releaseNotes, string downloadUrl, string newVersion)
{
Expand Down
15 changes: 15 additions & 0 deletions OpenIPC_Config/Assets/Resources.Designer.cs

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

60 changes: 60 additions & 0 deletions OpenIPC_Config/Assets/Resources.es.Designer.cs

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

31 changes: 31 additions & 0 deletions OpenIPC_Config/Assets/Resources.es.resx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<?xml version="1.0" encoding="utf-8"?>

<root>
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">

</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="AddMavlinkExtraToolTip" xml:space="preserve">
<value>1) Agregar la temperatura del SOC al OSD
2) Configurar baja latencia para los interruptores de channels.sh</value>
</data>
<data name="PingStatusToolTip" xml:space="preserve">
<value>Muestra el estado del resultado de Ping cuando se ingresa una IP válida:

• Verde: El resultado del ping es válido.
• Rojo: El resultado del ping no es válido.</value>
</data>
</root>
13 changes: 13 additions & 0 deletions OpenIPC_Config/Assets/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -251,4 +251,17 @@ Adjust the transmission power for the 2.4GHz frequency. Lower power conserves en
<data name="LocalIpToolTip" xml:space="preserve">
<value>IP of the device running the App</value>
</data>

<data name="DroneKeyActionsToolTip" xml:space="preserve">
<value>Send or receive encrypted key to/from connected device</value>
</data>
<data name="DeviceChkSumToolTip" xml:space="preserve">
<value>• Green: matches default key (drone.key or gs.key)
• Red: does not match default key</value>
</data>
<data name="PingStatusToolTip" xml:space="preserve">
<value>Displays state of Ping Result when valid IP is entered
• Green : Ping result is valid
• Red : Ping result is not valid</value>
</data>
</root>
11 changes: 11 additions & 0 deletions OpenIPC_Config/OpenIPC_Config.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,17 @@
<DependentUpon>Resources.resx</DependentUpon>
</Compile>

<EmbeddedResource Update="Assets\Resources.es.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.es.Designer.cs</LastGenOutput>
</EmbeddedResource>

<Compile Update="Assets\Resources.es.Designer.cs">
<DesignTime>True</DesignTime>
<AutoGen>True</AutoGen>
<DependentUpon>Resources.es.resx</DependentUpon>
</Compile>

<!-- <Compile Update="Views\PreferencesTabView.axaml.cs">-->
<!-- <DependentUpon>PreferencesTabView.axaml</DependentUpon>-->
<!-- </Compile>-->
Expand Down
6 changes: 3 additions & 3 deletions OpenIPC_Config/Services/SshClientService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -506,14 +506,14 @@ public async Task ExecuteCommandWithProgressAsync(DeviceConfig deviceConfig, str
}


await Task.Delay(100); // Non-blocking pause
Log.Debug("Waiting for command to complete...");
await Task.Delay(2); // Non-blocking pause
//Log.Debug("Waiting for command to complete...");

}
}

// Wait a bit before checking again to avoid a tight loop
await Task.Delay(100, cancellationToken);
await Task.Delay(1, cancellationToken);
}

if (!commandCompleted)
Expand Down
23 changes: 18 additions & 5 deletions OpenIPC_Config/Styles/Styles.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<!-- Default Window Style -->
<Style Selector="Window">
<Setter Property="Width" Value="850" />
<Setter Property="Height" Value="800" />
<Setter Property="Height" Value="815" />
</Style>


Expand Down Expand Up @@ -44,8 +44,21 @@
</Style>


<!-- TextBox Style -->
<Style Selector="TextBlock">
<Setter Property="VerticalAlignment" Value="Center" />
</Style>

<!-- RadioButton Style -->
<Style Selector="RadioButton">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
</Style>

<!-- TextBox Style -->
<Style Selector="TextBox">
<Setter Property="VerticalAlignment" Value="Center" />
<Setter Property="MinHeight" Value="10" />
<!-- Default Font Size -->
<Setter Property="FontSize" Value="14" />
Expand All @@ -56,17 +69,17 @@

<!-- Button Style -->
<Style Selector="Button">
<Setter Property="Padding" Value="5,3" />
<Setter Property="BorderThickness" Value="1" />
<Setter Property="BorderBrush" Value="Black" />
<Setter Property="Background" Value="Orange" />
<Setter Property="Margin" Value="2" />
<Setter Property="MinHeight" Value="30" />
<Setter Property="MinWidth" Value="80" />
<!-- <Setter Property="Margin" Value="2" /> -->
<!-- <Setter Property="MinHeight" Value="30" /> -->
<!-- <Setter Property="MinWidth" Value="80" /> -->
<Setter Property="CornerRadius" Value="5" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="HorizontalContentAlignment" Value="Center" />
<Setter Property="VerticalContentAlignment" Value="Center" />

</Style>

<Style Selector="ComboBox">
Expand Down
2 changes: 1 addition & 1 deletion OpenIPC_Config/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v0.2.2
v0.3.2
Loading

0 comments on commit f4371de

Please sign in to comment.