Skip to content

Commit

Permalink
Added minimize button, updated UI color scheme, and changed app icon.
Browse files Browse the repository at this point in the history
- Implemented a minimize button for the UI.
- Adjusted the UI color scheme to better align with the app's design.
- Updated the application icon to a new design.
  • Loading branch information
ArataAI committed Aug 14, 2024
1 parent 2d64896 commit 9234962
Show file tree
Hide file tree
Showing 8 changed files with 184 additions and 52 deletions.
39 changes: 18 additions & 21 deletions MagicA1/MagicA1.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,22 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<UseWPF>true</UseWPF>
<ApplicationIcon>MagicA1.ico</ApplicationIcon>
<ApplicationIcon>assets\logo.ico</ApplicationIcon>
<EnableCompressionInSingleFile>true</EnableCompressionInSingleFile>
<Title>MagicA1</Title>
<Copyright>SAHO Inc.</Copyright>
<PackageIcon>MagicA1.png</PackageIcon>
<PackageIcon>logo.png</PackageIcon>
<PackageReadmeFile>readme.md</PackageReadmeFile>
<NeutralLanguage>en-US</NeutralLanguage>
<PackageProjectUrl>https://saho.jp</PackageProjectUrl>
<PackageProjectUrl>https://github.com/ArataAI/MagicA1</PackageProjectUrl>
<Description>In the realm of the divine, A1 is a number imbued with magical power.</Description>
<RepositoryUrl>https://github.com/ArataAI/MagicA1</RepositoryUrl>
<AssemblyVersion>1.1.0</AssemblyVersion>
<FileVersion>1.1.0</FileVersion>
</PropertyGroup>

<ItemGroup>
<None Remove="MagicA1.ico" />
</ItemGroup>

<ItemGroup>
<Content Include="MagicA1.ico" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="ClosedXML" Version="0.104.0-preview2" />
<PackageReference Include="MaterialDesignThemes" Version="5.1.0" />
</ItemGroup>

<ItemGroup>
<Resource Include="MagicA1.ico" />
</ItemGroup>

<ItemGroup>
<None Update="MagicA1.png">
<None Update="assets\logo.png">
<Pack>True</Pack>
<PackagePath>\</PackagePath>
</None>
Expand All @@ -45,4 +31,15 @@
</None>
</ItemGroup>

<ItemGroup>
<Resource Include="assets\logo.ico" />
<Resource Include="assets\logo.png" />
<Resource Include="assets\logo.svg" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="ClosedXML" Version="0.102.3" />
<PackageReference Include="MaterialDesignThemes" Version="5.1.0" />
</ItemGroup>

</Project>
Binary file removed MagicA1/MagicA1.ico
Binary file not shown.
Binary file removed MagicA1/MagicA1.png
Binary file not shown.
90 changes: 71 additions & 19 deletions MagicA1/MainWindow.xaml

Large diffs are not rendered by default.

32 changes: 20 additions & 12 deletions MagicA1/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,24 +23,30 @@ private void Grid_MouseLeftButtonDown(object sender, System.Windows.Input.MouseB
this.DragMove();
}
}

private void MinimizeButton_Click(object sender, RoutedEventArgs e)
{
this.WindowState = WindowState.Minimized;
}

private void CloseButton_Click(object sender, RoutedEventArgs e)
{
this.Close(); // Closes the window when the button is clicked
}


private void Border_DragOver(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop, true))
{
string[] fileNames = (string[])e.Data.GetData(DataFormats.FileDrop, true);

// Check if all dropped items are either directories or Excel files
// Check if all dropped items are either directories or Excel files (.xlsx, .xlsm)
bool allItemsValid = true;

foreach (var fileName in fileNames)
{
if (!Directory.Exists(fileName) && !Path.GetExtension(fileName).Equals(".xlsx", StringComparison.OrdinalIgnoreCase))
if (!Directory.Exists(fileName) &&
!IsExcelFile(fileName))
{
allItemsValid = false;
break;
Expand All @@ -64,7 +70,6 @@ private void Border_DragOver(object sender, DragEventArgs e)
e.Handled = true;
}


private async void Border_Drop(object sender, DragEventArgs e)
{
try
Expand All @@ -82,7 +87,7 @@ private async void Border_Drop(object sender, DragEventArgs e)
// Process all Excel files in the directory (including subdirectories)
tasks.Add(ProcessAllExcelFilesInFolder(fileName));
}
else if (Path.GetExtension(fileName).Equals(".xlsx", StringComparison.OrdinalIgnoreCase))
else if (IsExcelFile(fileName))
{
// Process a single Excel file
tasks.Add(ProcessSingleExcelFile(fileName));
Expand All @@ -97,10 +102,8 @@ private async void Border_Drop(object sender, DragEventArgs e)
{
MessageBox.Show($"{ex.Message}");
}

}


private async Task ProcessSingleExcelFile(string filePath)
{
try
Expand Down Expand Up @@ -146,8 +149,6 @@ private async void SelectFolder_Click(object sender, RoutedEventArgs e)
if (folderDialog.ShowDialog() == true)
{
string selectedFolder = folderDialog.FolderName;
// Update status in UI
//AddStatus(selectedFolder, "...");
await ProcessAllExcelFilesInFolder(selectedFolder);
}
}
Expand All @@ -156,7 +157,8 @@ private async Task ProcessAllExcelFilesInFolder(string folderPath)
{
try
{
var excelFiles = Directory.GetFiles(folderPath, "*.xlsx", SearchOption.AllDirectories);
var excelFiles = Directory.GetFiles(folderPath, "*.*", SearchOption.AllDirectories)
.Where(f => IsExcelFile(f));

foreach (var filePath in excelFiles)
{
Expand All @@ -174,7 +176,6 @@ await Task.Run(() =>
// Set the top-left cell of the visible view to A1
worksheet.SheetView.TopLeftCellAddress = worksheet.Cell("A1").Address;


// Save the changes to the file
workbook.Save();
}
Expand All @@ -192,9 +193,15 @@ await Task.Run(() =>
}
}

private bool IsExcelFile(string fileName)
{
var extension = Path.GetExtension(fileName).ToLower();
return extension == ".xlsx" || extension == ".xlsm";
}

#pragma warning disable CA1416 // Suppress platform-specific API warning
private void AddStatus(string itemName, string status)
{
// Add status to the ListBox
Dispatcher.Invoke(() =>
{
var duration = 3;
Expand All @@ -208,5 +215,6 @@ private void AddStatus(string itemName, string status)
TimeSpan.FromSeconds(duration));
});
}
#pragma warning restore CA1416
}
}
Binary file added MagicA1/assets/logo.ico
Binary file not shown.
Binary file added MagicA1/assets/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
75 changes: 75 additions & 0 deletions MagicA1/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 9234962

Please sign in to comment.