PANZER234425
PANZER234425
CC#
Created by PANZER234425 on 10/6/2024 in #help
Improving performance / caching
public void SetPictureNull()
{
MessageBox.Show("Called");
Dispose();
Hide();
picMostRecent.Image = null;
picRandomAircraft.Image = null;
Thread.Sleep(5000);
}
public void SetPictureNull()
{
MessageBox.Show("Called");
Dispose();
Hide();
picMostRecent.Image = null;
picRandomAircraft.Image = null;
Thread.Sleep(5000);
}
61 replies
CC#
Created by PANZER234425 on 10/6/2024 in #help
Improving performance / caching
private Home home;
public void Application_Exit(object sender, EventArgs e)
{
if (home != null)
{
home.SetPictureNull();
}

MessageBox.Show("Application Exit Called");
MessageBox.Show("Number of paths to delete: " + imagePathsToDelete.Count);

string exePath = AppDomain.CurrentDomain.BaseDirectory;

foreach (var relativePath in imagePathsToDelete)
{
string fullImagePath = Path.Combine(exePath, relativePath);

if (System.IO.File.Exists(fullImagePath))
{
try
{
GC.Collect();
GC.WaitForPendingFinalizers();

MessageBox.Show("Deleting file: " + fullImagePath);
System.IO.File.Delete(fullImagePath);
MessageBox.Show("Deleted: " + fullImagePath);
}
catch (Exception ex)
{
MessageBox.Show("Error deleting file: " + ex.Message);
}
}
else
{
MessageBox.Show("File not found: " + fullImagePath);
}
}

Application.Exit();
}
private Home home;
public void Application_Exit(object sender, EventArgs e)
{
if (home != null)
{
home.SetPictureNull();
}

MessageBox.Show("Application Exit Called");
MessageBox.Show("Number of paths to delete: " + imagePathsToDelete.Count);

string exePath = AppDomain.CurrentDomain.BaseDirectory;

foreach (var relativePath in imagePathsToDelete)
{
string fullImagePath = Path.Combine(exePath, relativePath);

if (System.IO.File.Exists(fullImagePath))
{
try
{
GC.Collect();
GC.WaitForPendingFinalizers();

MessageBox.Show("Deleting file: " + fullImagePath);
System.IO.File.Delete(fullImagePath);
MessageBox.Show("Deleted: " + fullImagePath);
}
catch (Exception ex)
{
MessageBox.Show("Error deleting file: " + ex.Message);
}
}
else
{
MessageBox.Show("File not found: " + fullImagePath);
}
}

Application.Exit();
}
61 replies
CC#
Created by PANZER234425 on 10/6/2024 in #help
Improving performance / caching
No description
61 replies
CC#
Created by PANZER234425 on 10/6/2024 in #help
Improving performance / caching
I already set the pictureBox NULL where the picture is in but it still says that its being used
61 replies
CC#
Created by PANZER234425 on 10/6/2024 in #help
Improving performance / caching
Basically when Im deleting a picture it says that its being used by another thread and so it cant delete the picture
61 replies
CC#
Created by PANZER234425 on 10/6/2024 in #help
Improving performance / caching
Okay, so im pretty much done now, I got one last problem
61 replies
CC#
Created by PANZER234425 on 10/6/2024 in #help
Improving performance / caching
No description
61 replies
CC#
Created by PANZER234425 on 10/6/2024 in #help
Improving performance / caching
So its saving the picture files, but I just cant get it to work so it shows the picture again in the pictureBox, it just shows an empty box without any error
61 replies
CC#
Created by PANZER234425 on 10/6/2024 in #help
Improving performance / caching
Is this correct (Besides the suffix)
61 replies
CC#
Created by PANZER234425 on 10/6/2024 in #help
Improving performance / caching
No description
61 replies
CC#
Created by PANZER234425 on 10/6/2024 in #help
Improving performance / caching
No description
61 replies
CC#
Created by PANZER234425 on 10/6/2024 in #help
Improving performance / caching
Okay, so im now copying the file to a directory in the project folder and the database is looking like this now
61 replies
CC#
Created by PANZER234425 on 10/6/2024 in #help
Improving performance / caching
No description
61 replies
CC#
Created by PANZER234425 on 10/6/2024 in #help
Improving performance / caching
No description
61 replies
CC#
Created by PANZER234425 on 10/6/2024 in #help
Improving performance / caching
Why not use the current table, instead of The Picture use a string
61 replies
CC#
Created by PANZER234425 on 10/6/2024 in #help
Improving performance / caching
So shall i create a table and link it to The main table with a foreign Key, The Table then only Stores a path
61 replies
CC#
Created by PANZER234425 on 10/6/2024 in #help
Improving performance / caching
So, I Change the datatype in The DB to varchar and create The Method above and just call it whenever I need to interact with a Picture?
61 replies
CC#
Created by PANZER234425 on 10/6/2024 in #help
Improving performance / caching
and what if the path changes, eg i buy a new PC
61 replies
CC#
Created by PANZER234425 on 10/6/2024 in #help
Improving performance / caching
Can you help in me in doing this, I literally builded the whole thing around storing the pictures in the db and dont know how to start now over with this again :sadge:
61 replies
CC#
Created by PANZER234425 on 10/6/2024 in #help
Improving performance / caching
Thanks
61 replies