Revamped advanced settings dialog to use new control
This commit is contained in:
parent
2243e2a124
commit
f94f66da94
@ -65,19 +65,19 @@ namespace FileManager
|
|||||||
{
|
{
|
||||||
None = 0,
|
None = 0,
|
||||||
|
|
||||||
[Description("In my Users folder")]
|
[Description("My Users folder")]
|
||||||
UserProfile = 1,
|
UserProfile = 1,
|
||||||
|
|
||||||
[Description("In the same folder that Libation is running from")]
|
[Description("The same folder that Libation is running from")]
|
||||||
AppDir = 2,
|
AppDir = 2,
|
||||||
|
|
||||||
[Description("In your Windows temporary folder")]
|
[Description("Windows temporary folder")]
|
||||||
WinTemp = 3,
|
WinTemp = 3,
|
||||||
|
|
||||||
[Description("In My Documents")]
|
[Description("My Documents")]
|
||||||
MyDocs = 4,
|
MyDocs = 4,
|
||||||
|
|
||||||
[Description("In your settings folder (aka: Libation Files)")]
|
[Description("Your settings folder (aka: Libation Files)")]
|
||||||
LibationFiles = 5
|
LibationFiles = 5
|
||||||
}
|
}
|
||||||
// use func calls so we always get the latest value of LibationFiles
|
// use func calls so we always get the latest value of LibationFiles
|
||||||
|
|||||||
@ -13,7 +13,7 @@
|
|||||||
<!-- <PublishSingleFile>true</PublishSingleFile> -->
|
<!-- <PublishSingleFile>true</PublishSingleFile> -->
|
||||||
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
|
||||||
|
|
||||||
<Version>5.1.9.8</Version>
|
<Version>5.1.9.13</Version>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
@ -28,7 +28,7 @@ namespace LibationWinForms.Dialogs
|
|||||||
public void SetDirectoryItems(List<Configuration.KnownDirectories> knownDirectories, Configuration.KnownDirectories? defaultDirectory = Configuration.KnownDirectories.UserProfile)
|
public void SetDirectoryItems(List<Configuration.KnownDirectories> knownDirectories, Configuration.KnownDirectories? defaultDirectory = Configuration.KnownDirectories.UserProfile)
|
||||||
=> this.directorySelectControl.SetDirectoryItems(knownDirectories, defaultDirectory);
|
=> this.directorySelectControl.SetDirectoryItems(knownDirectories, defaultDirectory);
|
||||||
|
|
||||||
/// <summary>select, set default, or rehydrate</summary>
|
/// <summary>set selection</summary>
|
||||||
/// <param name="directory"></param>
|
/// <param name="directory"></param>
|
||||||
public void SelectDirectory(Configuration.KnownDirectories directory)
|
public void SelectDirectory(Configuration.KnownDirectories directory)
|
||||||
{
|
{
|
||||||
@ -37,7 +37,7 @@ namespace LibationWinForms.Dialogs
|
|||||||
selectDir(directory, null);
|
selectDir(directory, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>select, set default, or rehydrate</summary>
|
/// <summary>set selection</summary>
|
||||||
public void SelectDirectory(string directory)
|
public void SelectDirectory(string directory)
|
||||||
{
|
{
|
||||||
directory = directory?.Trim() ?? "";
|
directory = directory?.Trim() ?? "";
|
||||||
@ -46,11 +46,14 @@ namespace LibationWinForms.Dialogs
|
|||||||
|
|
||||||
private void selectDir(Configuration.KnownDirectories knownDir, string customDir)
|
private void selectDir(Configuration.KnownDirectories knownDir, string customDir)
|
||||||
{
|
{
|
||||||
var unknown = knownDir == Configuration.KnownDirectories.None;
|
var isKnown
|
||||||
customDirectoryRb.Checked = unknown;
|
= knownDir != Configuration.KnownDirectories.None
|
||||||
knownDirectoryRb.Checked = !unknown;
|
// this could be a well known dir which isn't an option in this particular dropdown. This will always be true of LibationFiles
|
||||||
this.directorySelectControl.SelectDirectory(knownDir);
|
&& this.directorySelectControl.SelectDirectory(knownDir);
|
||||||
this.customTb.Text = unknown ? customDir : "";
|
|
||||||
|
customDirectoryRb.Checked = !isKnown;
|
||||||
|
knownDirectoryRb.Checked = isKnown;
|
||||||
|
this.customTb.Text = isKnown ? "" : customDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
private string dirSearchTitle;
|
private string dirSearchTitle;
|
||||||
|
|||||||
@ -36,7 +36,7 @@ namespace LibationWinForms.Dialogs
|
|||||||
/// <summary>Set items for combobox</summary>
|
/// <summary>Set items for combobox</summary>
|
||||||
/// <param name="knownDirectories">List rather than IEnumerable so that client can determine display order</param>
|
/// <param name="knownDirectories">List rather than IEnumerable so that client can determine display order</param>
|
||||||
/// <param name="defaultDirectory">Optional default item to select</param>
|
/// <param name="defaultDirectory">Optional default item to select</param>
|
||||||
public void SetDirectoryItems(List<Configuration.KnownDirectories> knownDirectories, Configuration.KnownDirectories? defaultDirectory = Configuration.KnownDirectories.UserProfile)
|
public void SetDirectoryItems(List<Configuration.KnownDirectories> knownDirectories, Configuration.KnownDirectories? defaultDirectory = null)
|
||||||
{
|
{
|
||||||
this.directoryComboBox.Items.Clear();
|
this.directoryComboBox.Items.Clear();
|
||||||
|
|
||||||
@ -46,29 +46,23 @@ namespace LibationWinForms.Dialogs
|
|||||||
SelectDirectory(defaultDirectory);
|
SelectDirectory(defaultDirectory);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>select, set default, or rehydrate</summary>
|
/// <summary>set selection</summary>
|
||||||
/// <param name="directory"></param>
|
/// <param name="directory"></param>
|
||||||
/// <returns>True is there was a matching entry</returns>
|
/// <returns>True is there was a matching entry</returns>
|
||||||
public bool SelectDirectory(string directory) => SelectDirectory(Configuration.GetKnownDirectory(directory));
|
public bool SelectDirectory(string directory) => SelectDirectory(Configuration.GetKnownDirectory(directory));
|
||||||
|
|
||||||
/// <summary>select, set default, or rehydrate</summary>
|
/// <summary>set selection</summary>
|
||||||
/// <param name="directory"></param>
|
/// <param name="directory"></param>
|
||||||
/// <returns>True is there was a matching entry</returns>
|
/// <returns>True is there was a matching entry</returns>
|
||||||
public bool SelectDirectory(Configuration.KnownDirectories? directory)
|
public bool SelectDirectory(Configuration.KnownDirectories? directory)
|
||||||
{
|
{
|
||||||
if (directory is null || directory == Configuration.KnownDirectories.None)
|
if (directory is null || directory == Configuration.KnownDirectories.None)
|
||||||
{
|
|
||||||
this.directoryComboBox.SelectedIndex = 0;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
// set default
|
// set default
|
||||||
var item = this.directoryComboBox.Items.Cast<DirectoryComboBoxItem>().SingleOrDefault(item => item.Value == directory.Value);
|
var item = this.directoryComboBox.Items.Cast<DirectoryComboBoxItem>().SingleOrDefault(item => item.Value == directory.Value);
|
||||||
if (item is null)
|
if (item is null)
|
||||||
{
|
|
||||||
this.directoryComboBox.SelectedIndex = 0;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
this.directoryComboBox.SelectedItem = item;
|
this.directoryComboBox.SelectedItem = item;
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
101
LibationWinForms/Dialogs/LibationFilesDialog.Designer.cs
generated
101
LibationWinForms/Dialogs/LibationFilesDialog.Designer.cs
generated
@ -29,85 +29,29 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.libationFilesDescLbl = new System.Windows.Forms.Label();
|
this.libationFilesDescLbl = new System.Windows.Forms.Label();
|
||||||
this.libationFilesCustomBtn = new System.Windows.Forms.Button();
|
|
||||||
this.libationFilesCustomTb = new System.Windows.Forms.TextBox();
|
|
||||||
this.libationFilesCustomRb = new System.Windows.Forms.RadioButton();
|
|
||||||
this.libationFilesMyDocsRb = new System.Windows.Forms.RadioButton();
|
|
||||||
this.libationFilesRootRb = new System.Windows.Forms.RadioButton();
|
|
||||||
this.cancelBtn = new System.Windows.Forms.Button();
|
this.cancelBtn = new System.Windows.Forms.Button();
|
||||||
this.saveBtn = new System.Windows.Forms.Button();
|
this.saveBtn = new System.Windows.Forms.Button();
|
||||||
|
this.directoryOrCustomSelectControl = new LibationWinForms.Dialogs.DirectoryOrCustomSelectControl();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
// libationFilesDescLbl
|
// libationFilesDescLbl
|
||||||
//
|
//
|
||||||
this.libationFilesDescLbl.AutoSize = true;
|
this.libationFilesDescLbl.AutoSize = true;
|
||||||
this.libationFilesDescLbl.Location = new System.Drawing.Point(12, 9);
|
this.libationFilesDescLbl.Location = new System.Drawing.Point(14, 10);
|
||||||
|
this.libationFilesDescLbl.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
this.libationFilesDescLbl.Name = "libationFilesDescLbl";
|
this.libationFilesDescLbl.Name = "libationFilesDescLbl";
|
||||||
this.libationFilesDescLbl.Size = new System.Drawing.Size(36, 13);
|
this.libationFilesDescLbl.Size = new System.Drawing.Size(39, 15);
|
||||||
this.libationFilesDescLbl.TabIndex = 0;
|
this.libationFilesDescLbl.TabIndex = 0;
|
||||||
this.libationFilesDescLbl.Text = "[desc]";
|
this.libationFilesDescLbl.Text = "[desc]";
|
||||||
//
|
//
|
||||||
// libationFilesCustomBtn
|
|
||||||
//
|
|
||||||
this.libationFilesCustomBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.libationFilesCustomBtn.Location = new System.Drawing.Point(753, 95);
|
|
||||||
this.libationFilesCustomBtn.Name = "libationFilesCustomBtn";
|
|
||||||
this.libationFilesCustomBtn.Size = new System.Drawing.Size(35, 23);
|
|
||||||
this.libationFilesCustomBtn.TabIndex = 5;
|
|
||||||
this.libationFilesCustomBtn.Text = "...";
|
|
||||||
this.libationFilesCustomBtn.UseVisualStyleBackColor = true;
|
|
||||||
this.libationFilesCustomBtn.Click += new System.EventHandler(this.libationFilesCustomBtn_Click);
|
|
||||||
//
|
|
||||||
// libationFilesCustomTb
|
|
||||||
//
|
|
||||||
this.libationFilesCustomTb.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
|
||||||
| System.Windows.Forms.AnchorStyles.Right)));
|
|
||||||
this.libationFilesCustomTb.Location = new System.Drawing.Point(35, 97);
|
|
||||||
this.libationFilesCustomTb.Name = "libationFilesCustomTb";
|
|
||||||
this.libationFilesCustomTb.Size = new System.Drawing.Size(712, 20);
|
|
||||||
this.libationFilesCustomTb.TabIndex = 4;
|
|
||||||
//
|
|
||||||
// libationFilesCustomRb
|
|
||||||
//
|
|
||||||
this.libationFilesCustomRb.AutoSize = true;
|
|
||||||
this.libationFilesCustomRb.Location = new System.Drawing.Point(15, 100);
|
|
||||||
this.libationFilesCustomRb.Name = "libationFilesCustomRb";
|
|
||||||
this.libationFilesCustomRb.Size = new System.Drawing.Size(14, 13);
|
|
||||||
this.libationFilesCustomRb.TabIndex = 3;
|
|
||||||
this.libationFilesCustomRb.TabStop = true;
|
|
||||||
this.libationFilesCustomRb.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// libationFilesMyDocsRb
|
|
||||||
//
|
|
||||||
this.libationFilesMyDocsRb.AutoSize = true;
|
|
||||||
this.libationFilesMyDocsRb.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
|
|
||||||
this.libationFilesMyDocsRb.Location = new System.Drawing.Point(15, 61);
|
|
||||||
this.libationFilesMyDocsRb.Name = "libationFilesMyDocsRb";
|
|
||||||
this.libationFilesMyDocsRb.Size = new System.Drawing.Size(111, 30);
|
|
||||||
this.libationFilesMyDocsRb.TabIndex = 2;
|
|
||||||
this.libationFilesMyDocsRb.TabStop = true;
|
|
||||||
this.libationFilesMyDocsRb.Text = "[desc]\r\n[myDocs\\Libation]";
|
|
||||||
this.libationFilesMyDocsRb.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// libationFilesRootRb
|
|
||||||
//
|
|
||||||
this.libationFilesRootRb.AutoSize = true;
|
|
||||||
this.libationFilesRootRb.CheckAlign = System.Drawing.ContentAlignment.TopLeft;
|
|
||||||
this.libationFilesRootRb.Location = new System.Drawing.Point(15, 25);
|
|
||||||
this.libationFilesRootRb.Name = "libationFilesRootRb";
|
|
||||||
this.libationFilesRootRb.Size = new System.Drawing.Size(113, 30);
|
|
||||||
this.libationFilesRootRb.TabIndex = 1;
|
|
||||||
this.libationFilesRootRb.TabStop = true;
|
|
||||||
this.libationFilesRootRb.Text = "[desc]\r\n[appDir\\Libation]";
|
|
||||||
this.libationFilesRootRb.UseVisualStyleBackColor = true;
|
|
||||||
//
|
|
||||||
// cancelBtn
|
// cancelBtn
|
||||||
//
|
//
|
||||||
this.cancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.cancelBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.cancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
this.cancelBtn.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||||
this.cancelBtn.Location = new System.Drawing.Point(713, 124);
|
this.cancelBtn.Location = new System.Drawing.Point(832, 118);
|
||||||
|
this.cancelBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||||
this.cancelBtn.Name = "cancelBtn";
|
this.cancelBtn.Name = "cancelBtn";
|
||||||
this.cancelBtn.Size = new System.Drawing.Size(75, 23);
|
this.cancelBtn.Size = new System.Drawing.Size(88, 27);
|
||||||
this.cancelBtn.TabIndex = 10;
|
this.cancelBtn.TabIndex = 10;
|
||||||
this.cancelBtn.Text = "Cancel";
|
this.cancelBtn.Text = "Cancel";
|
||||||
this.cancelBtn.UseVisualStyleBackColor = true;
|
this.cancelBtn.UseVisualStyleBackColor = true;
|
||||||
@ -116,28 +60,35 @@
|
|||||||
// saveBtn
|
// saveBtn
|
||||||
//
|
//
|
||||||
this.saveBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
this.saveBtn.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
|
||||||
this.saveBtn.Location = new System.Drawing.Point(612, 124);
|
this.saveBtn.Location = new System.Drawing.Point(714, 118);
|
||||||
|
this.saveBtn.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||||
this.saveBtn.Name = "saveBtn";
|
this.saveBtn.Name = "saveBtn";
|
||||||
this.saveBtn.Size = new System.Drawing.Size(75, 23);
|
this.saveBtn.Size = new System.Drawing.Size(88, 27);
|
||||||
this.saveBtn.TabIndex = 9;
|
this.saveBtn.TabIndex = 9;
|
||||||
this.saveBtn.Text = "Save";
|
this.saveBtn.Text = "Save";
|
||||||
this.saveBtn.UseVisualStyleBackColor = true;
|
this.saveBtn.UseVisualStyleBackColor = true;
|
||||||
this.saveBtn.Click += new System.EventHandler(this.saveBtn_Click);
|
this.saveBtn.Click += new System.EventHandler(this.saveBtn_Click);
|
||||||
//
|
//
|
||||||
|
// directoryOrCustomSelectControl
|
||||||
|
//
|
||||||
|
this.directoryOrCustomSelectControl.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||||
|
| System.Windows.Forms.AnchorStyles.Right)));
|
||||||
|
this.directoryOrCustomSelectControl.Location = new System.Drawing.Point(14, 28);
|
||||||
|
this.directoryOrCustomSelectControl.Name = "directoryOrCustomSelectControl";
|
||||||
|
this.directoryOrCustomSelectControl.Size = new System.Drawing.Size(909, 81);
|
||||||
|
this.directoryOrCustomSelectControl.TabIndex = 11;
|
||||||
|
//
|
||||||
// LibationFilesDialog
|
// LibationFilesDialog
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
this.ClientSize = new System.Drawing.Size(800, 159);
|
this.ClientSize = new System.Drawing.Size(933, 158);
|
||||||
|
this.Controls.Add(this.directoryOrCustomSelectControl);
|
||||||
this.Controls.Add(this.cancelBtn);
|
this.Controls.Add(this.cancelBtn);
|
||||||
this.Controls.Add(this.saveBtn);
|
this.Controls.Add(this.saveBtn);
|
||||||
this.Controls.Add(this.libationFilesDescLbl);
|
this.Controls.Add(this.libationFilesDescLbl);
|
||||||
this.Controls.Add(this.libationFilesCustomBtn);
|
|
||||||
this.Controls.Add(this.libationFilesCustomTb);
|
|
||||||
this.Controls.Add(this.libationFilesRootRb);
|
|
||||||
this.Controls.Add(this.libationFilesCustomRb);
|
|
||||||
this.Controls.Add(this.libationFilesMyDocsRb);
|
|
||||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
|
||||||
|
this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||||
this.Name = "LibationFilesDialog";
|
this.Name = "LibationFilesDialog";
|
||||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
this.Text = "Libation Files location";
|
this.Text = "Libation Files location";
|
||||||
@ -150,12 +101,8 @@
|
|||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
private System.Windows.Forms.Label libationFilesDescLbl;
|
private System.Windows.Forms.Label libationFilesDescLbl;
|
||||||
private System.Windows.Forms.Button libationFilesCustomBtn;
|
|
||||||
private System.Windows.Forms.TextBox libationFilesCustomTb;
|
|
||||||
private System.Windows.Forms.RadioButton libationFilesCustomRb;
|
|
||||||
private System.Windows.Forms.RadioButton libationFilesMyDocsRb;
|
|
||||||
private System.Windows.Forms.RadioButton libationFilesRootRb;
|
|
||||||
private System.Windows.Forms.Button cancelBtn;
|
private System.Windows.Forms.Button cancelBtn;
|
||||||
private System.Windows.Forms.Button saveBtn;
|
private System.Windows.Forms.Button saveBtn;
|
||||||
|
private DirectoryOrCustomSelectControl directoryOrCustomSelectControl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6,19 +6,10 @@ namespace LibationWinForms.Dialogs
|
|||||||
{
|
{
|
||||||
public partial class LibationFilesDialog : Form
|
public partial class LibationFilesDialog : Form
|
||||||
{
|
{
|
||||||
Configuration config { get; } = Configuration.Instance;
|
private Configuration config { get; } = Configuration.Instance;
|
||||||
Func<string, string> desc { get; } = Configuration.GetDescription;
|
private Func<string, string> desc { get; } = Configuration.GetDescription;
|
||||||
|
|
||||||
public LibationFilesDialog()
|
public LibationFilesDialog() => InitializeComponent();
|
||||||
{
|
|
||||||
InitializeComponent();
|
|
||||||
|
|
||||||
this.libationFilesCustomTb.TextChanged += (_, __) =>
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrWhiteSpace(libationFilesCustomTb.Text))
|
|
||||||
this.libationFilesCustomRb.Checked = true;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
private void LibationFilesDialog_Load(object sender, EventArgs e)
|
private void LibationFilesDialog_Load(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
@ -26,35 +17,20 @@ namespace LibationWinForms.Dialogs
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
libationFilesDescLbl.Text = desc(nameof(config.LibationFiles));
|
libationFilesDescLbl.Text = desc(nameof(config.LibationFiles));
|
||||||
this.libationFilesRootRb.Text = "In the same folder that Libation is running from\r\n" + Configuration.AppDir_Relative;
|
|
||||||
this.libationFilesMyDocsRb.Text = "In My Documents\r\n" + Configuration.MyDocs;
|
directoryOrCustomSelectControl.SetSearchTitle("Libation Files");
|
||||||
if (config.LibationFiles == Configuration.AppDir_Relative)
|
directoryOrCustomSelectControl.SetDirectoryItems(new()
|
||||||
libationFilesRootRb.Checked = true;
|
|
||||||
else if (config.LibationFiles == Configuration.MyDocs)
|
|
||||||
libationFilesMyDocsRb.Checked = true;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
libationFilesCustomRb.Checked = true;
|
Configuration.KnownDirectories.UserProfile,
|
||||||
libationFilesCustomTb.Text = config.LibationFiles;
|
Configuration.KnownDirectories.AppDir,
|
||||||
}
|
Configuration.KnownDirectories.MyDocs
|
||||||
}
|
}, Configuration.KnownDirectories.UserProfile);
|
||||||
|
directoryOrCustomSelectControl.SelectDirectory(config.LibationFiles);
|
||||||
private void libationFilesCustomBtn_Click(object sender, EventArgs e) => selectFolder("Search for Libation Files location", this.libationFilesCustomTb);
|
|
||||||
|
|
||||||
private static void selectFolder(string desc, TextBox textbox)
|
|
||||||
{
|
|
||||||
using var dialog = new FolderBrowserDialog { Description = desc, SelectedPath = "" };
|
|
||||||
dialog.ShowDialog();
|
|
||||||
if (!string.IsNullOrWhiteSpace(dialog.SelectedPath))
|
|
||||||
textbox.Text = dialog.SelectedPath;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void saveBtn_Click(object sender, EventArgs e)
|
private void saveBtn_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var libationDir
|
var libationDir = directoryOrCustomSelectControl.SelectedDirectory;
|
||||||
= libationFilesRootRb.Checked ? Configuration.AppDir_Relative
|
|
||||||
: libationFilesMyDocsRb.Checked ? Configuration.MyDocs
|
|
||||||
: libationFilesCustomTb.Text;
|
|
||||||
if (!config.TrySetLibationFiles(libationDir))
|
if (!config.TrySetLibationFiles(libationDir))
|
||||||
{
|
{
|
||||||
MessageBox.Show("Not saving change to Libation Files location. This folder does not exist:\r\n" + libationDir);
|
MessageBox.Show("Not saving change to Libation Files location. This folder does not exist:\r\n" + libationDir);
|
||||||
|
|||||||
@ -1,64 +1,4 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<root>
|
||||||
<root>
|
|
||||||
<!--
|
|
||||||
Microsoft ResX Schema
|
|
||||||
|
|
||||||
Version 2.0
|
|
||||||
|
|
||||||
The primary goals of this format is to allow a simple XML format
|
|
||||||
that is mostly human readable. The generation and parsing of the
|
|
||||||
various data types are done through the TypeConverter classes
|
|
||||||
associated with the data types.
|
|
||||||
|
|
||||||
Example:
|
|
||||||
|
|
||||||
... ado.net/XML headers & schema ...
|
|
||||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
|
||||||
<resheader name="version">2.0</resheader>
|
|
||||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
|
||||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
|
||||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
|
||||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
|
||||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
|
||||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
|
||||||
</data>
|
|
||||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
|
||||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
|
||||||
<comment>This is a comment</comment>
|
|
||||||
</data>
|
|
||||||
|
|
||||||
There are any number of "resheader" rows that contain simple
|
|
||||||
name/value pairs.
|
|
||||||
|
|
||||||
Each data row contains a name, and value. The row also contains a
|
|
||||||
type or mimetype. Type corresponds to a .NET class that support
|
|
||||||
text/value conversion through the TypeConverter architecture.
|
|
||||||
Classes that don't support this are serialized and stored with the
|
|
||||||
mimetype set.
|
|
||||||
|
|
||||||
The mimetype is used for serialized objects, and tells the
|
|
||||||
ResXResourceReader how to depersist the object. This is currently not
|
|
||||||
extensible. For a given mimetype the value must be set accordingly:
|
|
||||||
|
|
||||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
|
||||||
that the ResXResourceWriter will generate, however the reader can
|
|
||||||
read any of the formats listed below.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.binary.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.soap.base64
|
|
||||||
value : The object must be serialized with
|
|
||||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
|
|
||||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
|
||||||
value : The object must be serialized into a byte array
|
|
||||||
: using a System.ComponentModel.TypeConverter
|
|
||||||
: and then encoded with base64 encoding.
|
|
||||||
-->
|
|
||||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||||
<xsd:element name="root" msdata:IsDataSet="true">
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
|||||||
@ -40,23 +40,23 @@ namespace LibationWinForms.Dialogs
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
//{
|
||||||
var dirOrCustCtrl = this.directoryOrCustomSelectControl1;
|
// var dirOrCustCtrl = this.directoryOrCustomSelectControl1;
|
||||||
dirOrCustCtrl.SetSearchTitle("Libation Files");
|
// dirOrCustCtrl.SetSearchTitle("Libation Files");
|
||||||
dirOrCustCtrl.SetDirectoryItems(new()
|
// dirOrCustCtrl.SetDirectoryItems(new()
|
||||||
{
|
// {
|
||||||
FileManager.Configuration.KnownDirectories.AppDir,
|
// FileManager.Configuration.KnownDirectories.AppDir,
|
||||||
FileManager.Configuration.KnownDirectories.MyDocs,
|
// FileManager.Configuration.KnownDirectories.MyDocs,
|
||||||
FileManager.Configuration.KnownDirectories.LibationFiles,
|
// FileManager.Configuration.KnownDirectories.LibationFiles,
|
||||||
FileManager.Configuration.KnownDirectories.MyDocs,
|
// FileManager.Configuration.KnownDirectories.MyDocs,
|
||||||
FileManager.Configuration.KnownDirectories.None,
|
// FileManager.Configuration.KnownDirectories.None,
|
||||||
FileManager.Configuration.KnownDirectories.WinTemp,
|
// FileManager.Configuration.KnownDirectories.WinTemp,
|
||||||
FileManager.Configuration.KnownDirectories.UserProfile
|
// FileManager.Configuration.KnownDirectories.UserProfile
|
||||||
}
|
// }
|
||||||
,
|
// ,
|
||||||
FileManager.Configuration.KnownDirectories.MyDocs
|
// FileManager.Configuration.KnownDirectories.MyDocs
|
||||||
);
|
// );
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -64,13 +64,12 @@ namespace LibationWinForms.Dialogs
|
|||||||
private void button1_Click(object sender, EventArgs e)
|
private void button1_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var dirCtrl = this.directorySelectControl1;
|
var dirCtrl = this.directorySelectControl1;
|
||||||
var dirOrCustCtrl = this.directoryOrCustomSelectControl1;
|
|
||||||
|
|
||||||
var x = dirCtrl.SelectedDirectory;
|
var x = dirCtrl.SelectedDirectory;
|
||||||
var y = dirOrCustCtrl.SelectedDirectory;
|
|
||||||
|
|
||||||
dirCtrl.SelectDirectory(FileManager.Configuration.KnownDirectories.UserProfile);
|
dirCtrl.SelectDirectory(FileManager.Configuration.KnownDirectories.UserProfile);
|
||||||
dirOrCustCtrl.SelectDirectory(FileManager.Configuration.KnownDirectories.UserProfile);
|
|
||||||
|
//var dirOrCustCtrl = this.directoryOrCustomSelectControl1;
|
||||||
|
//var y = dirOrCustCtrl.SelectedDirectory;
|
||||||
|
//dirOrCustCtrl.SelectDirectory(FileManager.Configuration.KnownDirectories.UserProfile);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user