mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 09:47:22 +13:00
#774: Saving all config when main window minimize to tray
This commit is contained in:
parent
5dba6f96c6
commit
87790e404e
4 changed files with 23 additions and 13 deletions
|
@ -79,7 +79,7 @@ public bool Save(string filePath)
|
|||
return SettingsHelper.Save(this, FilePath, SerializationType);
|
||||
}
|
||||
|
||||
private void Save()
|
||||
public void Save()
|
||||
{
|
||||
Save(FilePath);
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public void SaveAsync(string filePath)
|
|||
TaskEx.Run(() => Save(filePath));
|
||||
}
|
||||
|
||||
private void SaveAsync()
|
||||
public void SaveAsync()
|
||||
{
|
||||
SaveAsync(FilePath);
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ private string GetMetadata(string title, string parentID)
|
|||
|
||||
private void SetPermissions(string fileID, GoogleDrivePermissionRole role, GoogleDrivePermissionType type, string value, bool withLink)
|
||||
{
|
||||
if (!CheckAuthorization()) return null;
|
||||
if (!CheckAuthorization()) return;
|
||||
|
||||
string url = string.Format("https://www.googleapis.com/drive/v2/files/{0}/permissions", fileID);
|
||||
|
||||
|
|
|
@ -847,7 +847,7 @@ private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
|
|||
{
|
||||
e.Cancel = true;
|
||||
Hide();
|
||||
Program.Settings.SaveAsync(Program.ApplicationConfigFilePath);
|
||||
Program.SaveSettingsAsync();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -431,6 +431,13 @@ public static void SaveSettings()
|
|||
if (HotkeysConfig != null) HotkeysConfig.Save(HotkeysConfigFilePath);
|
||||
}
|
||||
|
||||
public static void SaveSettingsAsync()
|
||||
{
|
||||
if (Settings != null) Settings.SaveAsync(ApplicationConfigFilePath);
|
||||
UploadersConfigSaveAsync();
|
||||
if (HotkeysConfig != null) HotkeysConfig.SaveAsync(HotkeysConfigFilePath);
|
||||
}
|
||||
|
||||
public static void BackupSettings()
|
||||
{
|
||||
Helpers.BackupFileWeekly(ApplicationConfigFilePath, BackupFolder);
|
||||
|
@ -548,16 +555,19 @@ private static void ReloadUploadersConfig(string filePath)
|
|||
|
||||
public static void UploadersConfigSaveAsync()
|
||||
{
|
||||
if (uploaderConfigWatcher != null) uploaderConfigWatcher.EnableRaisingEvents = false;
|
||||
if (UploadersConfig != null)
|
||||
{
|
||||
if (uploaderConfigWatcher != null) uploaderConfigWatcher.EnableRaisingEvents = false;
|
||||
|
||||
TaskEx.Run(() =>
|
||||
{
|
||||
UploadersConfig.Save(UploadersConfigFilePath);
|
||||
},
|
||||
() =>
|
||||
{
|
||||
if (uploaderConfigWatcher != null) uploaderConfigWatcher.EnableRaisingEvents = true;
|
||||
});
|
||||
TaskEx.Run(() =>
|
||||
{
|
||||
UploadersConfig.Save(UploadersConfigFilePath);
|
||||
},
|
||||
() =>
|
||||
{
|
||||
if (uploaderConfigWatcher != null) uploaderConfigWatcher.EnableRaisingEvents = true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public static string GetGitHash()
|
||||
|
|
Loading…
Reference in a new issue