Skip to content

Commit

Permalink
Prototipo 3
Browse files Browse the repository at this point in the history
  • Loading branch information
gpicchiarelli committed Oct 29, 2023
1 parent cfe5f11 commit c569fb4
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 21 deletions.
2 changes: 1 addition & 1 deletion AccordaGUItar/AccordaGUItar.xaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Window x:Class="Accorda.AccordaGUI"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Accordatore per Chitarra" Height="400" Width="600">
Title="Accordatore per Chitarra" Height="349" Width="600">
<Grid Background="#F5F5F5">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
Expand Down
30 changes: 12 additions & 18 deletions AccordaGUItar/AccordaGUItar.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,26 +102,20 @@ private double CalcolaSogliaAccordatura(string cordaInfo)
}
private void AvviaAccordatura(double soglia)
{
// Ottieni la frequenza corrente
double currentFrequency = double.Parse(FrequenzaAttuale.Text);
if (FrequenzaAttuale.Text.Trim() != String.Empty)
{
double targetFrequency = GetTargetFrequency();// Ottieni la frequenza target in base alla corda selezionata dal ComboBox
double currentFrequency = double.Parse(FrequenzaAttuale.Text);

// Calcola la differenza tra la frequenza corrente e la frequenza target
double frequencyDifference = Math.Abs(currentFrequency - GetTargetFrequency());
double frequencyDifference = Math.Abs(currentFrequency - targetFrequency);
double differencePercentage = (frequencyDifference / targetFrequency) * 100.0;

// Verifica se la frequenza corrente è all'interno della soglia specificata
if (frequencyDifference <= soglia)
{
// La frequenza è nell'intervallo di accordatura
// Puoi eseguire le azioni desiderate, ad esempio, cambiare il colore della barra di progresso a verde
AccordaturaProgressBar.Value = 100; // Barra di progresso completa
AccordaturaProgressBar.Foreground = Brushes.Green; // Imposta il colore a verde
}
else
{
// La frequenza è al di fuori dell'intervallo di accordatura
// Puoi eseguire le azioni desiderate, ad esempio, cambiare il colore della barra di progresso a rosso
AccordaturaProgressBar.Value = 0; // Barra di progresso vuota
AccordaturaProgressBar.Foreground = Brushes.Red; // Imposta il colore a rosso
const int MaxValue = 100;
int progressValue = MaxValue - (int)differencePercentage;
progressValue = Math.Max(0, Math.Min(MaxValue, progressValue));

AccordaturaProgressBar.Value = progressValue;
AccordaturaProgressBar.Foreground = progressValue == MaxValue ? new SolidColorBrush(Colors.Green) : new SolidColorBrush(Colors.Red);
}
}

Expand Down
Binary file modified AccordaGUItar/bin/Debug/net7.0-windows/AccordaGUItar.dll
Binary file not shown.
Binary file modified AccordaGUItar/bin/Debug/net7.0-windows/AccordaGUItar.pdb
Binary file not shown.
Binary file modified AccordaGUItar/obj/Debug/net7.0-windows/AccordaGUItar.baml
Binary file not shown.
Binary file modified AccordaGUItar/obj/Debug/net7.0-windows/AccordaGUItar.dll
Binary file not shown.
2 changes: 1 addition & 1 deletion AccordaGUItar/obj/Debug/net7.0-windows/AccordaGUItar.g.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma checksum "..\..\..\AccordaGUItar.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "FA0C246CDB9C69D9D3D32D073EF2E3E5EFF89718"
#pragma checksum "..\..\..\AccordaGUItar.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "DE67D0311AF0D3FFD620287E7F926FB419BE4DC4"
//------------------------------------------------------------------------------
// <auto-generated>
// Il codice è stato generato da uno strumento.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#pragma checksum "..\..\..\AccordaGUItar.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "FA0C246CDB9C69D9D3D32D073EF2E3E5EFF89718"
#pragma checksum "..\..\..\AccordaGUItar.xaml" "{ff1816ec-aa5e-4d10-87f7-6f4963833460}" "DE67D0311AF0D3FFD620287E7F926FB419BE4DC4"
//------------------------------------------------------------------------------
// <auto-generated>
// Il codice è stato generato da uno strumento.
Expand Down
Binary file modified AccordaGUItar/obj/Debug/net7.0-windows/AccordaGUItar.g.resources
Binary file not shown.
Binary file modified AccordaGUItar/obj/Debug/net7.0-windows/AccordaGUItar.pdb
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified accorda.net/.vs/Accorda/v17/.suo
Binary file not shown.

0 comments on commit c569fb4

Please sign in to comment.