-
Notifications
You must be signed in to change notification settings - Fork 278
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix #13 remember window size, fix crash on closing app while scanning
- Loading branch information
Showing
8 changed files
with
170 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
using System; | ||
using System.IO; | ||
using System.Text; | ||
using System.Windows.Forms; | ||
|
||
namespace nspector.Common.Helper | ||
{ | ||
public class UserSettings | ||
{ | ||
public int WindowTop { get; set; } | ||
|
||
public int WindowLeft { get; set; } | ||
|
||
public int WindowWidth { get; set; } | ||
|
||
public int WindowHeight { get; set; } | ||
|
||
public FormWindowState WindowState { get; set; } | ||
|
||
private static string GetSettingsFilename() | ||
{ | ||
var path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), Application.ProductName); | ||
if (!Directory.Exists(path)) Directory.CreateDirectory(path); | ||
return Path.Combine(path, "settings.xml"); ; | ||
} | ||
|
||
public void SaveSettings() | ||
{ | ||
XMLHelper<UserSettings>.SerializeToXmlFile(this, GetSettingsFilename(), Encoding.Unicode, true); | ||
} | ||
|
||
public static UserSettings LoadSettings() | ||
{ | ||
var filename = GetSettingsFilename(); | ||
if (!File.Exists(filename)) return new UserSettings(); | ||
|
||
return XMLHelper<UserSettings>.DeserializeFromXMLFile(GetSettingsFilename()); | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters