diff --git a/fileFinder/App.config b/fileFinder/App.config index 8e15646..95f27c9 100644 --- a/fileFinder/App.config +++ b/fileFinder/App.config @@ -1,6 +1,24 @@  + + +
+ + + + + + C:\nextcloud\ + + + * + + + sh + + + \ No newline at end of file diff --git a/fileFinder/HintModel.cs b/fileFinder/HintModel.cs new file mode 100644 index 0000000..8374935 --- /dev/null +++ b/fileFinder/HintModel.cs @@ -0,0 +1,22 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace fileFinder +{ + class HintModel + { + public HintModel () + { + isDirectoryHintActive = true; + isNameQueryHintActive = true; + isInnerQueryHintActive = true; + } + + public bool isDirectoryHintActive { get; set; } + public bool isNameQueryHintActive { get; set; } + public bool isInnerQueryHintActive { get; set; } + } +} diff --git a/fileFinder/MainForm.Designer.cs b/fileFinder/MainForm.Designer.cs index 50d30cd..fbef4f7 100644 --- a/fileFinder/MainForm.Designer.cs +++ b/fileFinder/MainForm.Designer.cs @@ -168,6 +168,7 @@ this.MaximizeBox = false; this.Name = "MainForm"; this.Text = "fileFinder"; + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainForm_FormClosing); this.splitContainer.Panel1.ResumeLayout(false); this.splitContainer.Panel1.PerformLayout(); this.splitContainer.Panel2.ResumeLayout(false); diff --git a/fileFinder/MainForm.cs b/fileFinder/MainForm.cs index eaaca56..bb61d53 100644 --- a/fileFinder/MainForm.cs +++ b/fileFinder/MainForm.cs @@ -15,7 +15,7 @@ namespace fileFinder { public partial class MainForm : Form { - bool hintHided = false; + HintModel hints = new HintModel(); TaskController mainController; System.Timers.Timer updateInfoTimer = new System.Timers.Timer(1000); @@ -37,7 +37,6 @@ namespace fileFinder resultViewer.ImageIndex = 3; resultViewer.SelectedImageIndex = 3; } catch { } - } private void dirSelectBtn_Click(object sender, EventArgs e) @@ -48,28 +47,28 @@ namespace fileFinder if (result == DialogResult.OK && !String.IsNullOrWhiteSpace(dialog.SelectedPath)) { curDirTextBox.Text = dialog.SelectedPath; - hintHided = true; + hints.isDirectoryHintActive = false; } } } private void curDirTextBox_Enter(object sender, EventArgs e) { - if (!hintHided) - { - hintHided = true; - curDirTextBox.Text = ""; - } + //if (hints.isDirectoryHintActive) + //{ + // hints.isDirectoryHintActive = false; + // curDirTextBox.Text = ""; + //} } private async Task buildResultTree(TaskController controller, IProgress report) { TreeNode itemsNode = new TreeNode(); ProgressReportModel _report = new ProgressReportModel(); - List foundFiles = getFileList(curDirTextBox.Text, queryTextBox.Text); + List foundFiles = getFileList(curDirTextBox.Text, queryTextBox.Text); int counter = 0; - foreach (String item in foundFiles) + foreach (string item in foundFiles) { while (controller.isPaused) { @@ -228,5 +227,13 @@ namespace fileFinder }; try { this.Invoke(refresh); } catch { } } + + private void MainForm_FormClosing(object sender, FormClosingEventArgs e) + { + MainSettings.Default.urlDirectory = curDirTextBox.Text; + MainSettings.Default.fileNameQuery = queryTextBox.Text; + MainSettings.Default.fileInnerQuery = innerQueryTextBox.Text; + MainSettings.Default.Save(); + } } } diff --git a/fileFinder/MainSettings.Designer.cs b/fileFinder/MainSettings.Designer.cs new file mode 100644 index 0000000..8e05277 --- /dev/null +++ b/fileFinder/MainSettings.Designer.cs @@ -0,0 +1,62 @@ +//------------------------------------------------------------------------------ +// +// Этот код создан программой. +// Исполняемая версия:4.0.30319.42000 +// +// Изменения в этом файле могут привести к неправильной работе и будут потеряны в случае +// повторной генерации кода. +// +//------------------------------------------------------------------------------ + +namespace fileFinder { + + + [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0")] + internal sealed partial class MainSettings : global::System.Configuration.ApplicationSettingsBase { + + private static MainSettings defaultInstance = ((MainSettings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new MainSettings()))); + + public static MainSettings Default { + get { + return defaultInstance; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("C:\\nextcloud\\")] + public string urlDirectory { + get { + return ((string)(this["urlDirectory"])); + } + set { + this["urlDirectory"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("*")] + public string fileNameQuery { + get { + return ((string)(this["fileNameQuery"])); + } + set { + this["fileNameQuery"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("sh")] + public string fileInnerQuery { + get { + return ((string)(this["fileInnerQuery"])); + } + set { + this["fileInnerQuery"] = value; + } + } + } +} diff --git a/fileFinder/MainSettings.cs b/fileFinder/MainSettings.cs new file mode 100644 index 0000000..88d1e7c --- /dev/null +++ b/fileFinder/MainSettings.cs @@ -0,0 +1,28 @@ +namespace fileFinder { + + + // Этот класс позволяет обрабатывать определенные события в классе параметров: + // Событие SettingChanging возникает перед изменением значения параметра. + // Событие PropertyChanged возникает после изменения значения параметра. + // Событие SettingsLoaded возникает после загрузки значений параметров. + // Событие SettingsSaving возникает перед сохранением значений параметров. + internal sealed partial class MainSettings { + + public MainSettings() { + // // Для добавления обработчиков событий для сохранения и изменения параметров раскомментируйте приведенные ниже строки: + // + // this.SettingChanging += this.SettingChangingEventHandler; + // + // this.SettingsSaving += this.SettingsSavingEventHandler; + // + } + + private void SettingChangingEventHandler(object sender, System.Configuration.SettingChangingEventArgs e) { + // Добавьте здесь код для обработки события SettingChangingEvent. + } + + private void SettingsSavingEventHandler(object sender, System.ComponentModel.CancelEventArgs e) { + // Добавьте здесь код для обработки события SettingsSaving. + } + } +} diff --git a/fileFinder/MainSettings.settings b/fileFinder/MainSettings.settings new file mode 100644 index 0000000..dffed02 --- /dev/null +++ b/fileFinder/MainSettings.settings @@ -0,0 +1,15 @@ + + + + + + C:\nextcloud\ + + + * + + + sh + + + \ No newline at end of file diff --git a/fileFinder/fileFinder.csproj b/fileFinder/fileFinder.csproj index 5919035..7e52ad3 100644 --- a/fileFinder/fileFinder.csproj +++ b/fileFinder/fileFinder.csproj @@ -45,12 +45,19 @@ + Form MainForm.cs + + + True + True + MainSettings.settings + @@ -67,6 +74,10 @@ True Resources.resx + + SettingsSingleFileGenerator + MainSettings.Designer.cs + SettingsSingleFileGenerator Settings.Designer.cs