Add saving the ColumnWidths, Window Sizes/Position
This commit is contained in:
41
MainForm.cs
41
MainForm.cs
@@ -218,6 +218,17 @@ namespace AndroidSideloader
|
||||
}
|
||||
}
|
||||
|
||||
private void LoadListViewColumnWidths(System.Windows.Forms.ListView listView, string listViewName)
|
||||
{
|
||||
if (settings.ListViewColumnWidths.TryGetValue(listViewName, out var columnWidths))
|
||||
{
|
||||
for (int i = 0; i < columnWidths.Length && i < listView.Columns.Count; i++)
|
||||
{
|
||||
listView.Columns[i].Width = columnWidths[i]; // Apply saved width
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static string donorApps = String.Empty;
|
||||
private string oldTitle = String.Empty;
|
||||
public static bool updatesNotified = false;
|
||||
@@ -274,6 +285,18 @@ namespace AndroidSideloader
|
||||
speedLabel.Text = String.Empty;
|
||||
diskLabel.Text = String.Empty;
|
||||
verLabel.Text = Updater.LocalVersion;
|
||||
LoadListViewColumnWidths(gamesListView, "gamesListView");
|
||||
if (settings.MainWindowLocationX == 0 && settings.MainWindowLocationY == 0)
|
||||
{
|
||||
this.StartPosition = FormStartPosition.CenterScreen;
|
||||
} else
|
||||
{
|
||||
this.StartPosition = FormStartPosition.Manual;
|
||||
this.Left = settings.MainWindowLocationX;
|
||||
this.Top = settings.MainWindowLocationY;
|
||||
}
|
||||
this.Width = settings.MainWindowSizeWidth;
|
||||
this.Height = settings.MainWindowSizeHeight;
|
||||
if (File.Exists("crashlog.txt"))
|
||||
{
|
||||
if (File.Exists(settings.CurrentCrashPath))
|
||||
@@ -3359,6 +3382,17 @@ Please visit our Telegram (https://t.me/VRPirates) or Discord (https://discord.g
|
||||
}
|
||||
}
|
||||
|
||||
private void SaveListViewColumnWidths(System.Windows.Forms.ListView listView, string listViewName)
|
||||
{
|
||||
var columnWidths = new int[listView.Columns.Count];
|
||||
for (int i = 0; i < listView.Columns.Count; i++)
|
||||
{
|
||||
columnWidths[i] = listView.Columns[i].Width; // Get current width
|
||||
}
|
||||
|
||||
settings.ListViewColumnWidths[listViewName] = columnWidths;
|
||||
settings.Save(); // Save to settings file
|
||||
}
|
||||
|
||||
private async void Form1_FormClosing(object sender, FormClosingEventArgs e)
|
||||
{
|
||||
@@ -3399,7 +3433,12 @@ Please visit our Telegram (https://t.me/VRPirates) or Discord (https://discord.g
|
||||
RCLONE.killRclone();
|
||||
_ = ADB.RunAdbCommandToString("kill-server");
|
||||
}
|
||||
|
||||
SaveListViewColumnWidths(gamesListView, "gamesListView");
|
||||
settings.MainWindowLocationX = this.Left;
|
||||
settings.MainWindowLocationY = this.Top;
|
||||
settings.MainWindowSizeHeight = this.Height;
|
||||
settings.MainWindowSizeWidth = this.Width;
|
||||
settings.Save();
|
||||
}
|
||||
|
||||
private async void ADBWirelessDisable_Click(object sender, EventArgs e)
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AndroidSideloader.Utilities
|
||||
{
|
||||
@@ -132,6 +134,11 @@ namespace AndroidSideloader.Utilities
|
||||
public bool UseDownloadedFiles { get; set; } = false;
|
||||
public float BandwidthLimit { get; set; } = 0f;
|
||||
public bool HideAdultContent { get; set; } = false;
|
||||
public Dictionary<string, int[]> ListViewColumnWidths { get; set; } = new Dictionary<string, int[]>();
|
||||
public int MainWindowLocationX { get; set; } = 0;
|
||||
public int MainWindowLocationY { get; set; } = 0;
|
||||
public int MainWindowSizeWidth { get; set; } = 0;
|
||||
public int MainWindowSizeHeight { get; set; } = 0;
|
||||
|
||||
private SettingsManager()
|
||||
{
|
||||
@@ -253,6 +260,14 @@ namespace AndroidSideloader.Utilities
|
||||
UseDownloadedFiles = false;
|
||||
BandwidthLimit = 0f;
|
||||
HideAdultContent = false;
|
||||
ListViewColumnWidths = new Dictionary<string, int[]>
|
||||
{
|
||||
{ "gamesListView", new[] { 158, 244, 87, 75, 145, 66, 80 } }
|
||||
};
|
||||
MainWindowLocationX = 0;
|
||||
MainWindowLocationY = 0;
|
||||
MainWindowSizeWidth = 1120;
|
||||
MainWindowSizeHeight = 786;
|
||||
|
||||
Save();
|
||||
Debug.WriteLine("Default settings created.");
|
||||
|
||||
Reference in New Issue
Block a user